SaikoLED

1.5M ratings
277k ratings

See, that’s what the app is perfect for.

Sounds perfect Wahhhh, I don’t wanna

New Direct Audio Analysis Algorithm using TeensyLED Board

This algorithm demonstrates a new beat detection algorithm and DMX functionality for the TeensyLED control board to do computer-free sound responsive light shows

A circuithub design is available under the CERN open hardware license, allowing you to copy, modify and distribute the design (and products manufactured therefrom), licensed under identical terms & maintaining all copyrights.

https://circuithub.com/projects/neltnerb/TeensyLED

Video Example Demonstrating Algorithm

Code:

Code is available at https://github.com/saikoLED/TeensyLED/tree/master/Examples/TeensyLED_Audio_DMX_Master

Description:

This program is designed for use with the SaikoLED TeensyLED Driver system, using the ADM2582E from Analog Devices to provide a fully isolated RS485/DMX-512 interface which has been demonstrated as both a DMX master and DMX slave device.

TeensyLED Board Design Files (EagleCAD) and some other libraries can be found at:

https://github.com/saikoLED/TeensyLED

A jumper is available on the TeensyLED board to allow switching between the formal DMX-512a spec for DMX over RJ45/CAT5 cabling and the Color Kinetics version of the standard, which switches DATA- and DATA+ and the shield/ground connections.

Reference:

https://en.wikipedia.org/wiki/DMX512#RJ-45_pinout

This program assumes that line level audio (~1V peak-to-peak) is available, and wired to analog input 0 on the Teensy 3.1 (on the TeensyLED, this is available on JP1. In this example, A0 is connected to 3.3V and GND via 100k resistors to provide a mid-scale DC offset and then a capacitor is used to connect the audio input to AO.

As such, you end up with a capacitively coupled audio signal centered at mid-scale. There are other ways to accomplish this with higher fidelity, but for this purpose the audio quality is not particularly important as it is never output to speakers and is only used for controlling the lighting.

The basic algorithm below utilizes the SaikoLED HSI to RGB system to convert a hue-saturation-intensity color to RGB which is then output to standard RGB lighting. RGBW lighting could be used by switching to the SaikoLED HSI->RGBW code, or using the new full CIE color correction algorithm specifically designed to allow the TeensyLED to control many-wavelength devices such as the LEDEngin LZ7 series LED that provides RAGCBVW LEDs.

LEDEngin LZ7 LED and CIE Color Correction.

http://blog.saikoled.com/post/133625978643/full-cie-color-correction-with-the-teensy-31

For this audio analysis effect, the hue of the LED light is constantly rotating, with beat detection utilized to cause pulses in the lighting. Volume normalization is accomplished by saving the maximum audio signal seen when the signal exceeds the prior maximum, but then gradually letting the max signal level decay back to a low value over time so that it can both immediately respond to volume increases, and recognize when the audio has gotten quieter.

This effect also accomplishes automatic thresholding for the derivitive of the audio signal for beat detection – you select a target estimate for the number of beats per second you’d like to see, and it gradually tunes the threshold to the actual audio received to achieve roughly that number of detection events. This works effectively to allow the user to switch between very different music genres without needing to reprogram a pile of magic constants to get it to look good.

Upon beat detection, the intensity of the lights immediately increases to the normalized volume seen during that beat. As such, a loud beat in a soft section of music will cause the light to flash brightly while a soft beat in a loud section will appear more as a subtle flash. This results in a very nice effect wherein a loud beat followed by several soft accent beats (very common in music of all kinds) shows the complexities of the beat pattern very intuitively.

After a beat detection, the light brightness gradually decays – the light turning on is immediate but the decay takes ~100ms which gives a nice shape that matches most drum signals very naturally. This decay time also varies automatically based on the number of beats in the song. If a song has many many beats the decay time is short so that the beats appear visually cleaner to match the feeling of the music.

In this example code, I demonstrate controlling 8 DMX lights which are arranged in a color wheel so that the entire array rotates around while pulsing synchronously.

This rough algorithm was first demonstrated in 2013:

http://blog.saikoled.com/post/44823088119/myki-prototype-with-direct-audio-analysis

and the improved algorithm below was first demonstrated in 2016 at the Firefly Arts Festival.

This software requires the DmxSimple library which uses bit-banging of DMX outputs and does not support RDM or other advanced DMX features. However, the ADM2582E and Teensy 3.1 should be perfectly capable of using these features if a better library becomes available.

Filtering is used throughout this code, using explonential smoothing as a very fast and simple way to accomplish a low-pass filter.

Reference:

https://en.wikipedia.org/wiki/Exponential_smoothing

An example is:

audioZero = 0.999999*audioZero + 0.000001*audioSignal;

which takes the prior zero and mixes it with the instantaneous audio value to get a low-pass filtered zero. The two constants must always add to one, but the larger the 0.000001 value is the more quickly the filtered version will adjust to changes.

I am not good at C flags, but there are commented out serial communication lines that can be uncommented for debug information (for instance, printing the audio RMS values and beat detection values for tuning and debugging audio signal issues). Some of this should probably be better encapsulated in a C++ style class to reduce the unabstracted complexity of the effects.

audio light show LED saikoled

Full CIE color correction with the Teensy 3.1

I put together a general purpose firmware that lets you define specific LED sources as CIE-LUV coordinates, and then abstracts it away so that you can use hue, saturation, and intensity with optimal selection and mixing of the available sources to get the desired CIE-LCH value (hue based instead of coordinate based).

You define a LED source like this:

  CIELED white(0.202531646, 0.469936709, (float)180/180, 9);
  CIELED red(0.5137017676, 0.5229440531, (float)78/78, 6);
  CIELED amber(0.3135687079, 0.5529418124, (float)60/60, 5);
  CIELED green(0.0595846867, 0.574988823, (float)125/125, 22);
  CIELED cyan(0.0306675939, 0.5170937486, (float)95/95, 3);
  CIELED blue(0.1747943747, 0.1117834986, (float)30/30, 23);
  CIELED violet(0.35, 0.15, (float)30/30, 4);

and then you add them to the colorspace like this:

  // Create a colorspace object that will be put into the abstract lamp.
  std::shared_ptr colorspace (new Colorspace(white));
  
  // Add the CIE LED definitions to the colorspace.
  colorspace->addLED(red);
  colorspace->addLED(amber);
  colorspace->addLED(green);
  colorspace->addLED(cyan);
  colorspace->addLED(blue);

Then all you need to do is ask the colorspace to return the proper values and output them to the PWM pins defined in the CIELED object.

Code example showing this alongside USB control, and several types of LED effects you can use is here:

TeensyLED_CIE_USB_Multimode

with an overall project description here:

TeensyLED

New LEDEngin LZ7 LED with Artwork

This demonstration uses a prototype seven color LEDEngin LZ7 LED with red, amber, green, cyan, blue, violet, and white LED dies for illuminating artwork, along with a Fraen FXCM-7-H specialty color mixing optic. I am considering it for replacement of my old Ultraluminous Illuminator, a specialty LED light intended for use with artwork.

image

In this demo, violet is disabled, so blacklight effects are not present, but you can see excellent amber reproduction, and good overall color uniformity from the optic. No visible fringes from LED spacing, and although there is a small hot spot in the video, it is not noticeable to the eye.

Overall, the brightness of this single LED solution is slightly less than my existing system, but instead of consuming about 4.4W with blue active, the new design uses only 2W to achieve nearly the same brightness level. The use of a single LED also vastly simplifies color uniformity and lamp construction, which will make this a much less expensive system as compared to the old light.

For testing, I simply placed the LED roughly where the old LED array is mounted pointing downwards. This system is using my newly implemented CIE LUV based full color correction and gamma correction algorithm to do a color wheel, while the old system randomly shifts between different LEDs to show the full range of interesting transitions between different wavelength combinations.

New 7-Channel LZ7 LED with full CIE LUV Color and Gamma Correction

This was a fun project. I got a sample of the new LEDEngin LZ7 LED, which has on a single chip red, amber, green, cyan, blue, violet, and white. While I already have a great algorithm for converting HSI to RGBW, this is a much more complex challenge – converting from HSI to RAGCBVW.

image

The constraint I used is that the color must use only 2 individual LED wavelengths, plus white for saturation control.

To do this, I used the CIE LUV colorspace, shown below. This provides uniform perceptual color changes in hue and linear perceptual brightness as hue changes.

image

(“CIE 1976 UCS” by Adoniscik - Own work. Licensed under Public Domain via Wikimedia Commons - https://commons.wikimedia.org/wiki/File:CIE_1976_UCS.png#/media/File:CIE_1976_UCS.png)

The results are very nice, you can check them out in this video. Unfortunately the CCD (and your monitor) can’t actually represent the violet, amber, and cyan colors accurately, but so it goes.

New LED Driver Board based on Teensy 3.1

Just got finished with a new prototype! Looking pretty good so far.

image

Verified that this baby can respond to just 100ns pulse widths, and works well with the new ARM processor using the Teensy 3.1 as a module!

Need still to test the isolated DMX interface, but the isolated voltages look good, so here’s hoping!

Board Design and some Code:

https://github.com/saikoLED/TeensyLED

Video of the new driver!