# Controlling LEDs with MOSFETs

I am working on a hobby project in which I am controlling two rows of LEDs. Each row has 5 LEDs in series. I want to achieve the logic drawn in this table:

Can anyone suggest any MOSFET logic to achieve this goal? For example, GPIOs are connected with MOSFETs and MOSFETs are controlling the logic mentioned in the table.

Any relevant information or diagram will be appreciated.

Here is my schematic of the power section of both rows. Am I doing that portion correctly? Probably a voltage divider will be needed for row1, because the input voltage is more than the required voltage.

• What supply voltage are you powering the LEDs with? How much current do the LEDs draw? Feb 22, 2023 at 21:36
• Each row has its own constant current IC. Row1 leds are 1.7Vf and row2 leds are 2Vf. both rows have 50mA forward current. Powering and controlling current of the LED ROWs is not issue. Issue is to control their logics based on the table Feb 22, 2023 at 21:39
• Please add the circuit diagram to your question (use the edit button at the bottom) and show what constant current ICs you're using, the supply voltages, etc. You'll probably run into problems if you just try to put a low-side MOSFET switch in series with the LEDs, so if the CC drivers have enable pins I'd use those instead. The ideal solution depends on the specifics of your circuit. I presume from your description that you're just switching the LEDs on and off at a fairly slow pace, and not trying to PWM them or anything? Feb 22, 2023 at 21:46
• Does it really have to be this logic? It would be so easy, if you could just connect each row to a separate pin, and put the logic in the software instead. Feb 22, 2023 at 23:07

If your GPIOs are running at the same voltage as your LEDs, this should work:

simulate this circuit – Schematic created using CircuitLab

Of course, you'll want to use FETs that fit your requirements (voltage, current, etc.)

The logic you're implementing is:

D1 = 4 * 5

D2 = !4 * 5

The "* 5" part is provided by M3 in series with both strings. M3 must be a logic level device.

R1 and R2 should be chosen based on your supply voltage and the MOSFETs you procure; R1 may not be strictly necessary. M1 must be logic level but M2 does not necessarily have to be. This circuit will work if V1 is not the same as your logic levels.

simulate this circuit – Schematic created using CircuitLab

• can you check the edited post? Feb 23, 2023 at 18:09
• @cristobol can you check the edited post? Feb 23, 2023 at 18:09
• is there anyone who can help me with this? Also i will have issue to turn off mosfet properly because my logic level is 3.3v and mosfet drain is at 20V. Does anyone has solution for this? Feb 24, 2023 at 19:31
• What about the edited post? Both of the circuits provided should work with the LED strings in place of D1 and D2.
– vir
Feb 24, 2023 at 19:58
• the issue is how can I turnoff the NMOS and turn-on the PMOS in these circuits? My power input voltage for both strings is 40V and logic level signal is 3.3v. Feb 26, 2023 at 18:47