Running 5V NeoPixels from 3.3V Microcontroller
2020-Jul-29, Wednesday 11:59 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
As I do more with electronics I get more complicated ideas, which necessitate learning more. At the moment I want to run 5V NeoPixels from a 3.3V microcontroller (i.e. Arduino Lilypad) which doesn't have a handy MOSFET pin (like the Adafruit Flora). I studied the NeoPixel best practices guide repeatedly. The new requirements boiled down to;
- 300 to 500 Ohm resistor on the Data In line of NeoPixel strip (which will be added to the NeoPixel end),
- capacitor (1000 µF, 6.3V or higher) across the battery terminals,
- logic shifter to up the 3.3V Data Out from the microcontroller to the 5V Data In for the NeoPixels.
Okay, great. Now where am I going to get the 5Vs from? 4AA rechargeable batteries would give me 4 x 1.2V = 4.8Vs, great. But, what if I accidentally grab alkaline batteries by mistake? That would result in 4 x 1.5V = 6Vs. Which is enough to damage the NeoPixels. To protect against thoughtlessness I would need a 5V voltage regulator. But, hang on, why don't I also add a 3.3V voltage regulator and remove the need to power the microcontroller with a separate power source? Just have to make sure everything has a common Ground.
Great, okay, so that's two voltage regulators. And the recommended bypass capacitors; 1µF on input and 0.1µF on output. This is a lot. Let's sketch it out. A few times by hand, then in Fritzing.
Now to breadboard the circuit and test it out. Mega props to Ben Artin's post 'Avoiding NeoPixel glitches' for helping me realise that the logic shifter has two ground pins that need to be connected to stop the flashing/glitching.
Then it's time to commit it to solder. It all fits on a half-size breadboard, and you can use any, but the ElectroCookie board has a continuous ground line if you bridge the break, which saves me work. Also, bonus cuteness.
Fingers crossed while testing everything together to make sure it's functional.
And then, with a bunch more NeoPixels like in my LED Grid. When it works, without fire or smoke, celebrate. (If there is fire and/or smoke, disconnect the power, put out fire if applicable, and debug.)
- 300 to 500 Ohm resistor on the Data In line of NeoPixel strip (which will be added to the NeoPixel end),
- capacitor (1000 µF, 6.3V or higher) across the battery terminals,
- logic shifter to up the 3.3V Data Out from the microcontroller to the 5V Data In for the NeoPixels.
Okay, great. Now where am I going to get the 5Vs from? 4AA rechargeable batteries would give me 4 x 1.2V = 4.8Vs, great. But, what if I accidentally grab alkaline batteries by mistake? That would result in 4 x 1.5V = 6Vs. Which is enough to damage the NeoPixels. To protect against thoughtlessness I would need a 5V voltage regulator. But, hang on, why don't I also add a 3.3V voltage regulator and remove the need to power the microcontroller with a separate power source? Just have to make sure everything has a common Ground.
Great, okay, so that's two voltage regulators. And the recommended bypass capacitors; 1µF on input and 0.1µF on output. This is a lot. Let's sketch it out. A few times by hand, then in Fritzing.
Fritzing diagram
Photo by chebe
Now to breadboard the circuit and test it out. Mega props to Ben Artin's post 'Avoiding NeoPixel glitches' for helping me realise that the logic shifter has two ground pins that need to be connected to stop the flashing/glitching.
Breadboarding is messy work
Photo by chebe
Then it's time to commit it to solder. It all fits on a half-size breadboard, and you can use any, but the ElectroCookie board has a continuous ground line if you bridge the break, which saves me work. Also, bonus cuteness.
Finished circuit soldered
Photo by chebe
Fingers crossed while testing everything together to make sure it's functional.
Testing circuit with Arduino Lilypad and NeoPixel ring
Photo by chebe
And then, with a bunch more NeoPixels like in my LED Grid. When it works, without fire or smoke, celebrate. (If there is fire and/or smoke, disconnect the power, put out fire if applicable, and debug.)
Circuit with Arduino Lilypad and 81 NeoPixels
Photo by chebe