Launchpad for a toddler

Rezo

Well-known member
Hi all!

Been playing around with the Teensy for a few years and I also have a consumer product based off of a Teensy MM. But I've never played with any of the Audio stuff

I have a 16 month old toddler that loves toys that make sounds. He likes to play a bunch of sounds simultaneously and dance to it.

I thought it would be nice to create a little launch pad for him with 12-16 big push buttons - each playing a different sound or song, and perhaps reserve 3-4 buttons for recording new sounds via a mic and playing them back.

I would be using a T4.1 for this project, but would like to hear suggestions on what might be the best way to kick off such a project:
-Suggestions for buttons and how to wire 12/16 of them to the Teensy (Use the GPIOs or use a GPIO expander?)
-I2C led arrays to make it light up?
-Use an SD card or onboard Flash memory to store the WAV files?
-Can I play multiple files at once?

And anything else you can think of or suggest - Im very much open to ideas!
 
Sound like a fun project! Depending on how much you want to do from scratch the actual Novation LaunchPad (mini) is a great control surface for this. Combine it with a Teensy in a rugged case and I can see how it could be both toddler-friendly and do all you want on your feature list. Check out my silly sequencer project here for inspiration: https://www.youtube.com/watch?v=mbtgXcqlupM

If you want to go more DIY on the controls maybe Adafruit Trellis/Neotrellis.
 
I was actually thinking of using some arcade pushbuttons and some neopixel LEDs to create the launchpad look, but on the other hand be easy for the little guy to push/punch :)

I want this to be fully contained in a case with a little speaker and a battery pack.
 
So been doing some research and I think I know what I want:

1. I'll be using 4*4 (16) 30mm arcade buttons (should I use some multiplexers or just use up 16 digital inputs on the T4.1?)
2. 16 WS8212B RGB NeoPixel LEDs seated either inside or beside the arcade buttons (do I need an 74HCT245 or some type of level shifter for these?)
3. A Rev D audio board
4. A simple microphone
5. 2*3W mini amp + 1.5" full range speakers.
6. Perhaps a rotary switch to change modes

I'll load a series of audio files onto the SD card (using SDIO interface on the T4.1), and each button trigger will call for a different file.
I'll reserve 2-4 buttons to be able to record audio via the microphone and then play them back.
Then the rotary switch might come in handy to load different sets of sounds eg (animals, numbers, machines, instruments etc)

Does this sound achievable on the T4.1?
With 7 pins taken by the audio shield, 16 pins for the buttons, one pin for the NeoPixels and perhaps 1-3 more pins for other features seems more than adequate.

If anyone has other suggestions I would be happy to hear!
 
I would suggest thinking about using a combined keypad/LED setup, such as this 4x4 keypad from Adafruit that includes neopixels. Note when I wrote this, Adafruit was sold out, but digikey had 29 available:


I don't own this, but it would greatly simply your wiring to just the 2 I2C pins plus ground, 3.3v.

There is a mono version available, that you would need to add your individual 3mm LEDs and a keypad:

Even if you don't use these boards, I would suggest using an I2C multiplexer just to reduce the wiring to the Teensy.

In terms of level shifter, it depends. You do need it in some cases, but often with just 16 leds (assuming you are using the modern neopixels that Adafruit ships, and not blasting the LEDs at full power), you can get buy by just using 3.3v power. Similarly if you use a battery, you might not need the level shifter, even powering the pixels via VIN instead of 3.3v.
 
Last edited:
While the Adafruit buttons/leds matrix will save me a lot of wiring, I feel it’s too small for what I’m looking for.

I’m aiming for something like this: https://learn.adafruit.com/neopixel-arcade-button

Im sourcing most parts from AliExpress, so the BOM so far is quite low.
Regarding the WS2812B, from what I understand they need 5v supply volt but I can feed the digital input with 3.3v logic, right?
I’ll be powering the unit with a USB battery supply
 
More than you wanted to know about WS2812 leds

While the Adafruit buttons/leds matrix will save me a lot of wiring, I feel it’s too small for what I’m looking for.

I’m aiming for something like this: https://learn.adafruit.com/neopixel-arcade-button

Im sourcing most parts from AliExpress, so the BOM so far is quite low.
Regarding the WS2812B, from what I understand they need 5v supply volt but I can feed the digital input with 3.3v logic, right?
I’ll be powering the unit with a USB battery supply

Basically in terms of WS2812B's, it is complicated. And as somebody who has used neopixels/ws2812b's for awhile, I've seen some of the issues (often called 'grumpy' neopixels back then).

Over history there have been two major versions (the original WS2812B version, plus modifications made by that designer over time, and the newer SK6812 versions). Note, what you get, may depend on the whim of the people packing up the LEDs, whatever supply chain issues currently exist, maybe the phase of the moon, etc.

Note, I'm a software guy, not an EE, and follows is how I understand the various ramblings about WS2812B compatible LED strings.

The original WS2812B's were very strict in terms of voltage. IIRC, you had to have the voltage between 4.5 volts and 6 volts (maybe 5.5 volts). The data signal had to be of the same voltage as the power signal. For the original Arduino Uno (using the AVR 328p) which ran at 5 volts, this was great. You didn't need any voltage shifting.

As 3.3 volt microprocessors (like Teensy LC/3.x/4.x) have pushed 5 volt microprocessors out of the limelight, and with the increased use of single cell lithium-ion batteries (nominal voltage 3.6-3.8 volts, maximum voltage when freshly charged around 4.2-4.4 volts) some ws2812b LEDs would not run reliably.

Because the original WS2812 compatible LEDs really wanted 5 volts, often microprocessors being fed off of USB would feed the USB power to the LEDs to give them the 5 volts that were called for. But they would feed the data pins at 3.3 volts. In general, circuits if a data pin is about 70% the voltage of the power level, it will be read as HIGH, and under 70% will be read as LOW. But in cases like this, the world isn't digital. Some devices may read 60% as being HIGH, while others would want 70% (or maybe more). And if you do the math, 5 volts * 0.70 is 3.5 volts. And note, USB sources do vary, with voltages going from around 4.8 volts to 5.2 volts. If the power is 4.8 volts, 0.70 times that is just around 3.3 volts, while if the power is really 5.2 volts, it would be 3.6 volts.

Back in the day, on one of my first WS2812 projects on a 3.3v processor, I found with the microprocessor I was using and the particular 16 LED ring I had, when I was doing the programming, the LED ring would not run off of USB power, but if I unplugged the microprocessor from USB and plugged in a lithium-ion battery, it would work fine. So I had to program the pattern, switch to battery power, do the action, and then switch back to USB to do more programming.

So people started adding level shifters to convert the 3.3 volt data pin to be the same as the power voltage. Here the problem is speed. The WS2812 protocol is a single wire protocol, and the producer has a very tight window to produce the next set of bits for the LED. The garden variety of level shifter that is typically made for slower I2C, SPI, and UART buses is often too slow for WS2812. There are faster level shifters that are single direction that are recommended if you are driving WS2812 LEDS.

Then WS2812 LEDs got a competitor (SK6812) that uses the same protocol. But the SK6812 strips changed some features. They made the minimum voltage lower, so that you could often drive the LEDs directly off of a 3.3 volt bus (though I suspect that at 3.3 volts, the blue/green colors might not be the same as if you used 5 volts). But more importantly for cosplay projects, you could use a lithium-ion battery instead of USB. The sk6812 designers also made the voltage where the chip decides if the data is high/low to be somewhat lower. Finally, while it doesn't affect timing, I believe the PWM rate used by the SK6812's is much faster than WS2812's which is friendlier to people that are sensitive to blinking lights, such as people with epilepsy, migraines, etc.).

This means that often times, you can drive a few SK6812's using the 3.3 volt power bus instead of 5 volt VIN. You have to be careful not to overload the power that the Teensy VIN to 3.3v power regulator can supply. And you don't need the level shifter.

There are two other issues that are often mentioned:
  • Some power supplies are not clean, and it is recommended to put large capacitors near the power source to the first WS2812/SK6812 led. These capacitors act as a battery, and will smooth out minor power distrubances. Adafruit recommends a 500–1000 µF at 6.3V or higher capacitor.
  • There is a problem of 'ringing' that it is recommended to put a resistor inline between the data pin and the first WS2812/SK6812. Adafruit recommends a 300 - 500 ohm resistor, while other things that have the resistor (like the octows2811 shield) seem to use a 100 ohm resistor.

I've actually built up a test jig that I can feed several different power sources, I have two different level shifters, with/without capacitors, and outputs with/without the resistor. Using jumper wires, I could test the results of different solutions But when I tried it, I couldn't get things to start failing. ;)

And as I said, LEDs with SK6812's seem to work better than the original WS2812's (but I believe WS2812's are being improved, and perhaps newer generations fix the original problems). Since I buy the majority of my LEDs from Adafruit, and they have switched over to SK6812, I see the issues less often. But note, I generally only run a few leds (up to 32 or so). If you were to do 100 or 1,000's of leds, you likely have to pay more attention to getting the details right.

But these days with supply chain issues, perhaps one set of leds uses modern SK6812's and another uses some old WS2812's that have been sitting in a warehouse for 10 years.

In general, if you want to be bullet proof, you would want:
  • Add the capacitor near the first LED in the string;
  • Add a resistor between your circuit and the first LED data input;
  • Feed the leds 5 volts;
  • Use a known good level shifter like the 74AHCT125 (I believe the 'T' in the 74 series means it is fast enough).

But if you don't want to do all that, test the stuff you get, and see if it will work. Maybe you will get lucky. On the other hand, if you let out the magic smoke in the leds, and you have to replace it, perhaps the next strand won't be as tolerant.

Oh and have fun!
 
Last edited:
Hi all!

Been playing around with the Teensy for a few years and I also have a consumer product based off of a Teensy MM. But I've never played with any of the Audio stuff

I have a 16 month old toddler that loves toys that make sounds. He likes to play a bunch of sounds simultaneously and dance to it.

I thought it would be nice to create a little launch pad for him with 12-16 big push buttons - each playing a different sound or song, and perhaps reserve 3-4 buttons for recording new sounds via a mic and playing them back.

I would be using a T4.1 for this project, but would like to hear suggestions on what might be the best way to kick off such a project:
-Suggestions for buttons and how to wire 12/16 of them to the Teensy (Use the GPIOs or use a GPIO expander?)
-I2C led arrays to make it light up?
-Use an SD card or onboard Flash memory to store the WAV files?
-Can I play multiple files at once?

And anything else you can think of or suggest - Im very much open to ideas!
Sounds like a fun project! For playing multiple WAV files simultaneously from an SD card, you can try the basic Audio library, or you could give my improved player / recorder objects a spin. Description / discussion can be found at https://forum.pjrc.com/threads/70963-Yet-Another-File-Player-(and-recorder), and the code at https://github.com/h4yn0nnym0u5e/Audio/tree/feature/buffered-SD. For the latter, there are some new sketches in examples/Buffered to demonstrate features, and the GUI designer has been updated with the new objects and instructions. If you have questions or issues probably best to post on that thread rather than this one; I'm keen for people to give it a try, report problems and make suggestions, so if it's genuinely useful it can be rolled into Teensyduino at some point.
 
@MichaelMeissner thank you very much for the detailed response on the LEDs
I'll get the level shifter and cap anyways just to be on the safe side.

@h4yn0nnym0u5e I believe I came across your improved library and thats where the recording idea come from - I'll defiantly give it a try!
On another note - what DAC/ADC do you recommend other than the audio shield? If needed I will place an order on PJRC, just the shipping is a little heavy to my country, so if there is another chip/breakout board I can use that will give me audio out and audio in/mic in that would be awesome.
 
I've tended to use the audio adaptor for almost all my playing, as it's so convenient. I have got a PT8211 DAC, which is certainly a lot cheaper and smaller, and seems to get good reviews (I got it for debugging purposes rather than audio quality, so it was only briefly tested); I guess you could pair that with a PDM microphone for your use case.

If you're ordering anyway, you might want to get some PSRAM too. My player / recorder code can use it for buffering, and I'm sure it has other uses you can think of.
 
Perhaps you could order from other distributors, for Example PiHut in the UK. They have delivery charges for most of the world.
I believe a T4.1 delivered from them without vat would be $40. You don't say where in the World you are, so it is difficult to be precise.
I have put in a link to their delivery charges page.
 
Perhaps you could order from other distributors, for Example PiHut in the UK. They have delivery charges for most of the world.
I believe a T4.1 delivered from them without vat would be $40. You don't say where in the World you are, so it is difficult to be precise.
I have put in a link to their delivery charges page.

Thanks for the link!
I’m from Israel for what it’s worth :)
 
Ok, it might be worth putting through a dummy order, just to see what the charges are likely to be.
Just out of interest let me know how you get on.

PS: I don't have any connection with the PiHut other than using them to buy goods, and I have always found them to be very helpful and professional.
 
Looks like they are sold out on the Audio Shield �� so I’ll just place an order through Paul. But I appreciate the efforts to help find a good deal :)
 
Ok, it might be worth putting through a dummy order, just to see what the charges are likely to be.
Just out of interest let me know how you get on.

PS: I don't have any connection with the PiHut other than using them to buy goods, and I have always found them to be very helpful and professional.

There are other options than the audio shield. The audio shield is nice because it is designed to be directly attached to the Teensy, it has volume control that can be controlled by the Teensy, it supports a simple PCM microphone, and it has a headphone jack for direct usage or line out pins if you want to hook it up to an amplifier and speakers.

But you can get other I2S boards that you can attach via jumper wires (or soldered into a prototype board with fixed wires attached). Now, if you are adapting a sketch that uses the audio adapter board, you typically have to eliminate lines that control the SGTL5000 on the audio board, either by commenting them out, or possibly doing something to deal with the board you have. The lines you would have to delete typically look like:

Code:
  sgtl5000.enable ();
  sgtl5000.volume (0.5f);

The pins you would need to connect to these I2S boards are:

Code:
    Pins:         Teensy 4.x      Teensy 3.x

    LRCLK:     Pin 20/A6       Pin 23/A9
    BCLK:       Pin 21/A7       Pin 9
    OUT:         Pin 7              Pin 22/A8    (OUT is the Teensy name, on the board it would typically be IN)
    Ground:    Ground           Ground
    VIN:          VIN or 3.3v     VIN or 3.3v

Other I2S pins not typically not used by these devices are:

    MCLK:      Pin 23            Pin 11
    IN:             Pin 8             Pin 13

On the Teensy 4.x you could also use the second I2S bus instead of the first I2S bus. The pins used would be:

Code:
    Pins:        Teensy 4.0

    LRCLK2:  Pin 3
    BCLK2:    Pin 4
    OUT2:      Pin 2
    Ground:   Ground
    VIN:         5v

Other I2S2 pins typically not used:

    MCLK2:   Pin 33 
    OUT2:      Pin 6

When I've looked around, I found the I2S boards came in two varieties.

The first class of board supports a mono speaker. It takes the stereo I2S input stream and under control via pins either average the L/R streams, or use just the left or right channels. These mono boards usually include an amplifier, so all you have to attach is the speaker itself.


Other boards provides stereo output, but you typically need to provide an amplifier to your speakers:


Beyond I2S, there are other ways to produce sound on Teensy 4.x:

  • Using pins 14/A0 and 15/A1 you can create S/PDIF output and input
  • Using pins 10 and 12, you can provide MQSL/MQSR output (lower quality than I2S)
  • Using any PWM pin attached to a capacitor and amplifier under Teensydunio 1.57 or later (probably lower quality than MQS or I2S)
 
I ended up ordering an extra T4.1 and a Rev D audio shield from PJRC.com and called it a day - as mentioned it's an easy fit for the Teensy footprint and has all the hardware I need (mic input and audio output)
Once it all arrives I'll be sure to be back here with more questions ;)
 
Back
Top