1
\$\begingroup\$

I want to make a simple controller of WS2812B addressable LED strip. I will consist of a MCU (most likely Atmega328P), a couple of buttons (RESET and mode selection) and 7-segment indicator, which will show current illumination mode. Power to the strip will be delivered by a N-channel MOSFET, which gate is also driven by MCU. Max length of the strip is 4 meters, I plan to use 30 leds per meter strip, so maximum current consumption is 6A (1.5A per meter). Since this current is only required if all LEDs are white at full brightness (which I don't plan), i'll use a Mean Well 5V@5A PSU. I think even 5A will never be reached in any application.

Main question is, is it OK? Or do I need to use secondary small PSU for microcontroller? This I'd like to avoid, of course. MCU together with indicator would draw no more than 150 mA.

Another question is, is it OK to use only two large value capacitors (470 uF), one at the input of power, another at strip output? Do I need a separate small ceramic capacitor close to Atmega pins? It's no problem to add, but I'm not sure if it's required: the board is really small, and distance between input 470 uF capacitor and 5V input pin is just 6-8 mm.

Third question is, do I need a fuse on the board? If yes, how to choose it's value properly? Below is my simplified schematic (7-segment indicator and buttons are omitted):

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Are the 470uF meant to be decoupling caps or bulk caps? electronics.stackexchange.com/questions/170957/… \$\endgroup\$
    – Lundin
    Commented Jan 7, 2020 at 8:32
  • \$\begingroup\$ @Lundin I guess those are bulk capacitors, according to the definition in the post you've linked. \$\endgroup\$
    – Zhenek
    Commented Jan 7, 2020 at 8:41
  • 1
    \$\begingroup\$ But what's your intention with them? You don't need multiple bulk caps, just put a single one after the 5V regulator. Then put 100nF decoupling caps on all IC supply pins. MCUs in particular usually have recommendations for decoupling cap layouts etc. \$\endgroup\$
    – Lundin
    Commented Jan 7, 2020 at 10:28

3 Answers 3

1
\$\begingroup\$

Yes same powersupply can be used. Yes you need separate 100nF ceramic at AVR supply pins, it is a local bypass for high frequency current pulses the AVR takes every clock cycle. The electrolytics are quite bad at high frequencies. Also, I am slightly worried about using FET to cut ground from the LEDs, as the data pin must then be set high so that it does not pull current when it is low. Turning the power on with FET will charge the output capacitor with a high current pulse so it might break. Think carefully if you even need to cut power from LEDs, and whether high side switching would be better.

\$\endgroup\$
1
  • \$\begingroup\$ I'm not sure that I 100% need to cut power, frankly speaking. I've chosen N-channel because they're cheaper and mostly have lower Rdson. Din pin has a series resistor of 680 Ohm, so by no means current through it can exceed safe value. I thought of gate resistor, but I've driven MOSFETs directly by MCU pin before without any problems. \$\endgroup\$
    – Zhenek
    Commented Jan 6, 2020 at 22:05
1
\$\begingroup\$

Yes, you can do that, however bear in mind that if you make some programming error, and all LEDs are on the adapter might be ruined, so you might want to add some protection (fuse?), if not already protected. If the PSU does not have a fuse already, I would use a 5A fuse (same as the adapter itself). I also would advise not to use 5A continuosly by LEDs (and MCU), stay at e.g. 4A for have some margin.

\$\endgroup\$
2
  • \$\begingroup\$ Adapter have over-current protection built in. In case current exceeds 5 amps, it switches off and retries to power up again within a couple of seconds. \$\endgroup\$
    – Zhenek
    Commented Jan 6, 2020 at 22:07
  • \$\begingroup\$ @Zhenek Ok, I just added it to be sure (maybe not all adapters have). \$\endgroup\$ Commented Jan 6, 2020 at 22:18
1
\$\begingroup\$

maximum current consumption is 6A (1.5A per meter). Since this current is only required if all LEDs are white at full brightness (which I don't plan), i'll use a Mean Well 5V@5A PSU. I think even 5A will never be reached in any application.

Check the power supply datasheet. MeanWell usually has proper current limiting so if the LEDs draw too much current it will just shut down. You don't need a fuse. You would need a fuse for fire protection if you used a power supply with a huge current that can actually melt your wires, but that is not the case.

Or do I need to use secondary small PSU for microcontroller?

No, but the 5V that powers the LEDs is going to be very noisy due to the large PWM currents. If this is some kind of huge vu-meter or anything that uses the micro's ADC then a bit of filtering could be necessary, for example a ferrite bead on the supply line, and the 470µf capacitor you want to put near the micro, that'll work.

is it OK to use only two large value capacitors (470 uF), one at the input of power, another at strip output?

I think it's recommended with WS2812B but you need to use capacitors that can actually do something useful like decouple the power supply. This means a low-ish ESR like 0.1 ohms and a ripple current rating of an amp or more. Since all the LED PWM won't be synchronized, ripple current shouldn't be the full 5 amps. A general purpose 470µF cap should be rated for about half an amp ripple current with an ESR around 0.7 ohm which is inadequate. Capacitors designed for switching power supplies are a better choice, like Panasonic FC/FM/FR series. These are not expensive.

Do I need a separate small ceramic capacitor close to Atmega pins?

Usually yes.

distance between input 470 uF capacitor and 5V input pin is just 6-8 mm.

Are you trying to save a 0805 SMD ceramic cap? That's like 0.1 cent...

\$\endgroup\$
8
  • \$\begingroup\$ Thanks! No, I'm trying to get out with no SMD parts at all, through-hole are more easily soldered) Guess I'll have to add at least one) \$\endgroup\$
    – Zhenek
    Commented Jan 6, 2020 at 22:23
  • \$\begingroup\$ Oh-oh. The way he has his bulk cap, if it has an ESR of 0.1 Ohms and is switched on current= 5V/0.1Ohms = 50 Amps, may cause the CPU to reset or other EMI problems. I would suggest radial (star) power connections from PSU with 22uF max low ESR before the FET That means no current sharing of 5V, 0V power , return on wires to supply. And probably ferrite beads before 1uF cap across CPU. \$\endgroup\$ Commented Jan 6, 2020 at 22:39
  • 1
    \$\begingroup\$ Using the FET to save power by turning off all the WS2812B when not in use is a good idea... However using it to reset the chips is not so great, if you put some capacitors on the WS218B supply you'll have to wait until they discharge for them to reset, and that will be very slow... \$\endgroup\$
    – bobflux
    Commented Jan 6, 2020 at 23:12
  • 1
    \$\begingroup\$ It'll still be slower than sending them the commands... And if the micro's output is low the LEDs' input will still be grounded through R2 while its GND pin is disconnected by the FET, that is not recommended. \$\endgroup\$
    – bobflux
    Commented Jan 7, 2020 at 11:15
  • 1
    \$\begingroup\$ @peufeu, OK, I see your point. I'll order test PCBs with place for FET, and run some tests. Will report here then. \$\endgroup\$
    – Zhenek
    Commented Jan 7, 2020 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.