Level shifting NeoPixels for Particle Photon
14 September 2018 at 9:08 pm
I just miscounted how many GPIO pins I had for a project, so I had to find a way to save some pins. In this project we have a status LED that is either red, green or both (producing a somewhat orange color). I need 4 of these per Photon, so that’s 8 pins. What about using programmable ws2812, sw2812b or SK6812 LED’s?
They only need a single pin to drive many LEDs (NeoPixels is just the marketing name that Adafruit apply for all of these), so I can potentially save up to 7 pins, but also make other colors than red/green possible. Surely enough, I had some of these floating around from a former project.
For my Bitmart marquee sign I used maybe 90 of these, but I kept having bugs causing random flashes if I pulled too much power. Back then I used a 74HCT125 for level shifting, but I couldn’t find either that or the 74AHCT125 variant in my component shelves. I did however find some 74HCT245 deep down in a drawer and surely enough - these are what is perferred for driving these programmable LED’s in the Teensy community. Both will do the job!
I plugged it up and it worked perfectly! No glitches, just perfect timing. From the datasheets, the 74HCT125 and 74HCT245 looks to have very similar characteristics, but the first shifts 4 lines and the other shifts up to eight lines. The one I used in the Bitmart-sign was just one I found in a shelf at Bitraf. Maybe that one was damaged? Hmmm. I’ll have to revisit that project to fix the glitches, but for now I’ve solved my problem.
I had a hard time locating pinouts / connection schematics for these IC’s so here they are for use with Particle Photon.
Connecting Particle Photon to NeoPixels using 74HCT125
Connecting Particle Photon to NeoPixels using 74HCT245
Yellow wire is data out from the Photon. Purple is the level shifted data signal. Red is 5V. Black is GND. Do not omit the fat Capacitor that feeds the fast PWM LEDs.