Teensy 3.6, audio adapter and apa102: sound reactive LEDs

Status
Not open for further replies.

yagoy

New member
Hi all,
I would like to make sound reactive lights with teensy 3.6 and APA102.
-- I have managed to read and play an audio file from SD card with audio adapter board and teensy 3.6.
-- With FastLed and APA library, I tested the APA102 with teensy and it works good.
I need guidance for combining these two tasks. I need the lights to dance according to the music. :).
 
In Arduino, looks at File > Examples > OctoWS2811 > SpectrumAnalyzer

This uses WS2812 LEDs, but the code ought to be adaptable to APA102 with FastLED. Ultimately all it's doing is reading the audio analysis and using setPixel() to update all 1920 LEDs, and then show() to display them.
 
Thanks Paul!.. I have few questions regarding the SPI pins.. The setup goes this way,
Code:
#define SDCARD_CS_PIN    10
#define SDCARD_MOSI_PIN  7
#define SDCARD_SCK_PIN   14

AudioPlaySdWav           playSdWav1;
AudioOutputI2S           i2s1;
AudioConnection          patchCord1(playSdWav1, 0, i2s1, 0);
AudioConnection          patchCord2(playSdWav1, 1, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;

1. Which pin can be used for clock and data of APA102?
2. To set the pixel values of the audio frequecy, which pin do I get the frequency outputs from audio adaptor board?
3. I also have OctoWS2811 Adaptor, Should I also use this? If so..how and why?

Sorry for the basic questions.. I am little confused.
Thank you in advance
 
Using APA102 and SD card on the audio shield together is usually problematic. If you must use both, usually the best way is with the slower bitbang option in FastLED. Then you can put the APA102 on two completely different pins.

Since you have a Teensy 3.6, you can use the SD socket on 3.6, which is faster and does not conflict. Then you can use the SPI pins only for the LEDs. Just make sure to NOT put your SD card into the audio shield’s socket.

FastLED has its own way to specify which pins, with addLeds. You can choose 11/13 or 7/14.

The audio shield gives you streaming audio data with a protocol called I2S. You use the audio library to receive and analyze i. The frequency data does not come from the audio shield. It comes from the FFT code in the audio lib. Check out the audio library tutorial to learn how this works.

Normally the octo board is used for WS2812, not APA102. It is really just 8 buffers. If you want to use it, you can choose to use 2 of those 8 pins for your APA102 signals. The other 6 can just be unused. They place very little load on those pins, so usually having the buffer inputs connected to a pin you’re using for some other purpose is harmless.

Most LED strips these days can work with 3.3V signals, so you might try first with just connecting the APA102 clock and data directly. Of course 5V signals are best, but too much complexity all at once before you get anything working can be the death of a project, so maybe try to keep things simple at first and try to test each thing as you go.
 
Status
Not open for further replies.
Back
Top