Close

How the circuit works

A project log for WSController

A kind of universal driver for WS2812B LED strips automatically determining the number of LEDs on the strip.

mabe42MaBe42 11/27/2019 at 19:450 Comments

There are two switches in the circuit - one as a latching switch (SW 2) to switch it on and the other as a mode switch (SW 1).

The latching switch circuit : that's Q2, Q3 and SW2. Pushing SW2 puts the gate of Q3 high. This connects the overall ground GND to PWRGND which is the battery ground. Thus the mcu gets a supply voltage and will pull the base of Q2 low. This will keep the gate of Q3 high. SW2 can be released and is not used anymore.

At the beginning the gate of Q1 will be low. So all current for the LED strip will flow through R2. The mcu now lights LEDs from the start to a defined maximum number (for the moment 200) - one at a time and measures the voltage drop at R2. From this it's easy to find out the number of connected LEDs. Afterwards the gate of Q1 is set high and R2 is shorted by Q2.

The MOSFETs Q1 and Q3 are obviously over-dimensioned. However, the IRLU024N/IRLR024N is the standard MOSFET which I use in my projects : first it's a logic level MOSFET and second it's reasonably priced. So as long I do not need hundreds of them I see no point in flipping through data sheets for hours just to save a few cents.

Discussions