Tinket m0 with neopixel logic

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mtsamperi
 
Posts: 20
Joined: Wed Apr 13, 2022 11:42 am

Tinket m0 with neopixel logic

Post by mtsamperi »

I'm looking to make the trinket m0 control 8 1515 neopixels. But I need to convert 3.3v logic to 5v logic. I know there are a few logic level shifters available on adafruit, but I was hoping I could get recommendations on the smallest one that would do the job?

Additionally, I'd like to have a super tiny speaker for an audio output of a sound loop of about 10 seconds. Any recommendations on speakers and other components needed for that with the trinket m0 would be super appreciated!

Thanks!

User avatar
michaelmeissner
 
Posts: 1822
Joined: Wed Aug 29, 2012 12:40 am

Re: Tinket m0 with neopixel logic

Post by michaelmeissner »

Typically for neopixels, the 74AHCT125 (https://www.adafruit.com/product/1787) is the level shifter that is recommended. It is one of the few level shifters available in through hole format (i.e. suitable for breadboard and prototype boards). It can shift 4 pins in parallel, but for the Trinket M0 you would probably would only use 1 pin. If you can handle surface mount soldering, you can get a smaller form factor that only shifts 1 pin. For example, in the past, I have used something similar to (note, the part I used is currently out of stock, but this is listed as a direct replacement): In terms of setup, I answered a similar question here: Note, I didn't know whether you meant controlling 8 streams of 1,515 pixels each, or just one stream of 1,1515 pixels. In either case, the Trinket M0 is likely not the microprocessor you should be using. The Trinket M0 does not have enough SRAM for 8 streams of 1,515 pixels. While it does have enough SRAM for 1,515 neopixels, when you get to that many neopixels, you likely have to engineer powering the pixels. In addition, if you control that many neopixels in a single stream, you will not be able to get a 30HZ refresh rate. You want to move to updating the pixels to 8 streams in parallel. Such as: If you need even more pixels in parallel, I've seen references to using a Teensy 4.1 and 2 of the PJRC Octows2811 boards in parallel can drive 16 streams in parallel, but I tend to only do a few rings or strands, and that is way above what I need to control.

User avatar
mtsamperi
 
Posts: 20
Joined: Wed Apr 13, 2022 11:42 am

Re: Tinket m0 with neopixel logic

Post by mtsamperi »

Thanks so much for the detailed response!

I'm comfortable with Surface mount soldering so I'd likely go with the parts you listed. Any chance you'd be able to help me figure out the wiring diagram (I'm unsure of which pins to solder to what to get it working properly)?

Also, I'm only planning on powering 8 individual neopixels.

since I'm trying to output a short audio clip loop, I'm actually guessing the Trinket is not the board to go with for this. Now I'm looking at the QT Py haxpress. Any insight on running a short audio loop on that board using an Surface mounted speaker?

for the neopixels I think I could use the same single pin shifter you linked.

Thanks!

User avatar
michaelmeissner
 
Posts: 1822
Joined: Wed Aug 29, 2012 12:40 am

Re: Tinket m0 with neopixel logic

Post by michaelmeissner »

I forgot to mention the audio part. I really like the Stemma Speaker if you don't need really large volume. It includes both a speaker and amplifier, so all you have to do is connect the ground wire to GND, the USB (or 3.3v) power to POWER, and A0 (on the Trinket M0) to the SIGNAL pin. I believe the Trinket M0 has enough horse power to drive the speaker to play sounds, but I haven't used it myself. Before the Stemma Speaker came out, I tended to use the breadboard board speaker soldered into a prototype board: I would use an amplifier like: But for a surface mounted speaker and amplifier, you will need to look elsewhere. My SMT skills are fairly limited. I've only soldered the level shifter and PSram to the Teensy 4.1.

In terms of other microprocessors, to do audio without using a separate audio shield or featherwing, make sure the microprocessor has a pin that can do direct digital to audio (DAC). Some of the ESP32 processors and the Teensy 4.x processors don't have a DAC pin. There are some of the combination boards that include an amplifier in the board, and you would have to just attach a speaker.

I haven't wired up the level shifter in perhaps 2 years now. But going from the data sheet, there are 3 connections (OE, A, GND) on one side, and 2 connections (VCC and Y) on the other side:
  • You connect ground to GND and OE and to the ground pin on the neopixel;
  • You connect the data signal to A;
  • You connect your 5v power to VCC and to the power pin on the neopixel; (and)
  • You connect the Y pin to the data input pin on the neopixel.
You likely should add a capacitor between ground and VCC near to the neopixel. I don't know if you need to connect a resistor in series if you are using the level shifter.

On the Trinket M0, you would likely want to use pin 4 (A4) which would allow you to use the Adafruit Neopixel ZeroDMA library. This library is friendlier when you are using sound and such that needs to use interrupts. For only 8 neopixels and a small sound, you may not need to use the ZeroDMA library, but it may make sense to plan for using it.

An alternative to playing sound in the microprocessor is to off load it, such as with Adafruit Audio FX board.

For a smaller footprint, I might look at the DFRobot boards:
  • Dfplayer mini-MP3 player using a micro-SD card;
  • Gravity: UART MP3 Voice Module with 8MB Flash Memory; (or)
  • Fermion: DFPlayer Pro - A mini MP3 Player with On-board 128MB Storage
Or of course, use the chips in those products and roll your own.

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”