Arduino with Neopixel and MOSFET

Hello everyone,

This is my first Forum Post my appoloygies if this post is in the wrong place or category.

I am thinking of making a 4x4x4 LED Cube using Neopixel WS2812D-F5 a throughole version of the WS2812B.

I have already done a standard single color Cube that worked well, and now it to move to multi-color Neo Cube. :slightly_smiling_face:

The cube will have 64 LED in total. I am thinking of using a LM7805 5V Regulator with a 9V 1.5 amp Wall Adapter, but then I realized each LED consumes 60mA at full brightness. It's very rear to have all 64 LEDs (R,G,B) at full brightness but it give idea of the MAX current draw of 3.8 Amps which is more than the LM7805 can handle. The LM7805 can handle upto 1A but only for short time, and obversely not enough to drive 64 Neopixel LEDs.

I also hear that some LEDs may switch to full white if you do not supply any data when powering up, with devastating effects when a huge current is drawed causing the MCU to crash during a powerup procedure.

A way round this would be to use a larger power supply or insert a MOSFET between
the power supply and LED display, with the MOSFET gate connected to an output on the Atmega328P the LEDs are swithed off during MCU Powerup as mentioned
in the following video link [#246 12 Tips and Tricks for Neopixels Projects (Arduino, ESP8266/ ESP32) - YouTube]

My question is would inserting a MOSFET also serve as a "current booster" for driving these LEDs as well as a switch, and still use the LM7805 and 9V 1.5A Wall Adapter as before ?
or would I have to stack the LM7805 with a TIP2955 and upgrade the 9V Wall Adapter ?

The Mosfet I'm thinking of using is a P-Channel IRF9Z34N rated at 19A, it's the only thing I have lying around.

I hope I have explained things properly, thank you and Merry Christmas.


No such thing.

First, an LM78xx regulator is last-century. Use a buck voltage regulator- it can handle more current and runs cooler than the older linear regulators. You need a bigger supply. In my measurements, I never saw 60mA per LED. Mostly in the mid 40's

Programmable LEDs using the WS28xx chip should turn on to the last programmed state, but not always. The best thing to do is set all LEDs black in setup().

Add proper heatsinks to the 7805 and they deliver 1 Amp for ever.
Without heatsink maximum power dissipation is like 1 Watt for a TO220 body.

Just use a proper 5v power supply. Yes they can all come on at full brightness, though they rarely will, but you must always make sure that you can deliver the power required to have them all at full brightness. The datasheet will tell you how much current that is. To cut he initial brightness by using a mosfet is pointless, because the leds will not receive the signal unless they are powered.
Just calculate how much current you need, add a 10% margin. The leds you are using are actually WS2811 chips, i have some as well (both 12v and 5v) 3.8A sounds like a lot, and you can probably get away with a little less, but i would just go for a 20 Watt 5 v adapter, and know that nothing much can go wrong.

Seriously? How could they do that? :astonished:

To the extent that is a problem, then the properly rated power supply is the answer.

That would be of no benefit. If the pixels actually start up with the wrong colour data, it makes no difference whether the MCU is initialised or not when you turn on the power (except as below :grin:). They will hold that data until you actually write the data you want to them.

In actual fact, I believe they generally show black when turned on, however you should include a 10k pull-down from the data output of the Arduino to ground to prevent any random noise affecting the pixels before the data output pin is defined as an OUTPUT.

I know 3.8A seems alot, I believe each RGB Component of an LED consumes at least 20mA at full brightness (20mA - Red, 20mA - Green, 20mA - Blue) = 60mA per LED x 64 LEDs. So a total would be 3.8A if all LED color brightness were set to full. There never be case when you want "all" full white, so I calculated 3.8A as my maximum current requirements.

If I went for a 5v 20 watt wall adaptor, would there be any voltage drop between the wall adaptor and the LED Cube ifself ? because some adaptors come with a fair bit of cable length would that cause a drop in voltage, the MCU and LEDs need a steady clean 5V supply.

There may be. That is one reason why you put a 470 µF or 1 mF capacitor across the 5 V and ground at the input to the LED strip.

you can use several regulators, it is a cube, you can power each layer from own LM

But it still makes more sense to power with the correct voltage - which is 5 V - directly from a 5 V power supply.

These are readily available in the form of "Phone chargers" of a variety of ratings.

I did think about powering each layer with a seperate regulator, but was'nt sure how to go about doing this or how the schematics would look like. I might haved to upgrade my 9V 1.5A wall adaptor to handle the extra current draw.

Cube, cube, cube. Why always a "cube"?
How many times has that been done?
How about a pyramid or an obelisk or something?

Why would you want a 9 V power supply when the electronics requires 5 V? :grimacing:

Som there is always. If the adapter comes with a length of cable, normally voltage at the end of that is still easily within a useable range. The thickness of that cable is relevant of course. All cable has 'voltage drop' , and the thicker the cable, the less that will be. The main issue with voltage drop, is that it is 'absolute', not 'relative' . A cable can have, for instance, a voltage drop of 0.2v per meter, that may result in 0.6v for a 3 meter length. In a 12v system that would result in a drop from 12v to 11.4v , which in 12v ledstrip is not a problem, but in a 5v system this would result in 4.4v , which is clearly out of the range required. Most cable don't have nearly that much voltage drop, and the 5v adapters that i use, actually put out something like 5.1v at the plug (i have some IP65 30watt adapters) Open housed switching adapters many times have a small adjustment trim-pot. You shouldn't have to worry about it to much, in my experience the voltage drop has not been an issue with cable lengths up to 3 meters. A multimeter will provide you with some detailed information when you have everything hooked up. Just measure the voltage to confirm how much there is left at the cube. And while you are at it, switch the cube to full bright white and measure the current.

I understand your calculation. Normally vendors provide you with power consumption specs, and many times these are higher than the actual use. I would measure my Christmas lights, but i haven't put them up yet.

To be honest, i never do this and it hasn't resulted in issues, but it is the specification. If you do have issues this may fix them, and it for sure won't hurt. Sorry, just put one, it is the spec and it should be there.

Is better yes, most MCU's (all 16MHz AVR's ) run fine on anything above 4.5v and even WS2811's do OK on a little less. WS2811's can be used with a variety of supply voltages, and use a current limiting resistor through which they are powered, (different values for different supply voltages 100R at 5v) driving the LED's with a PWM signal through Open-collectors, also here there may be a current limiting resistor ( in a 12v strip with 5050 SMD leds, there is, but only on the red channel, and all channels have 3 leds in series )

Of 4.5 V and above.

Thanks, you guys have given me alot of useful information to get me started with. I wanted to clarify a few things before hand, which you have done :+1:

I thought by adding a Mosfet would provide the extra current need to drive 64 RGB's and still be able to keep the LM7805 and 1.5A Wall adapter as before. Where a Mosfet like a 'Transistor' is basically a switch and "amplifier", but I was'nt clear on weather it "ampilifies" AC or DC Current? This does'nt look so promising so that's is out the window.

I have ordered a 5V 25 Watt power supply, I could'nt find a 20 Watt one so this should do fine, keep things simple and hopefully not much can go wrong.

I would add a 10K pull down on the data line to reduce any noise and 1000uF Cap across the LED power line.

Yes, I know it's yet another Cube !!! :grinning: I just wanted something to keep myself occupied with, during this ever increasing world in isolation... A pyramid sounds good for my next project.

Thanks to Deva_Rishi, for clairify the voltage drop over a length of cable that is also depend on the cable thinkness.

Thank you all again...

A four legged pyramid is basically half a cube., so you can make it look like that already, nice bit of programming coming.

A "four legged" pyramid is the traditional sort. A
"three legged" one would be a tetrahedron. :grin:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.