1
\$\begingroup\$

I want to design a PCB, include a GPIO of a MCU detecting the on and off of a LED driver. The LED driver input is 220V 60Hz, the output varies between different LED within 28 to 60V DC. My intuition tells me to lower down the DC voltage to 3.3V to the GPIO, but I dont exactly know how to do it. Someone tells me to use an MOSFET or BJT. Using the 28 to 60V as an input to turn on the BJT or MOSFET as a switch, to connect GPIO and an 3.3V. It sounds like an good idea, but I cannot find a MOSFET or BJT with that hign input voltage. Most MOSFET Vgs is 20 at most, and BJT even smaller. and, even if I can find a proper MOSFET, I am not sure if it generates lots of heat or expensive because of the high volgate of DC input. I prefer not. Finally, I don't even know what is the common method to convert a verying high DC voltage to a fixed low DC voltage. Maybe the BJT and MOSFET is not the best way. I don't know. If someone can share experience about this, I will appreciate. Thank you very much.

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

Using a resistor potential divider R1 and R2, obtain close to 3V (a digital high) when LED voltage is 28V. Clamp the MCU input to 3.3V maximum with zener diode D1:

schematic

simulate this circuit – Schematic created using CircuitLab

This arrangement ensures that voltages below about 12V (corresponding to about 1.5V or less at the MCU input) will not be recognised as "high" by the MCU. This might be useful because there may still be a small potential difference across the LEDs even though they are not lit.

To obtain 3V at the MCU input, LED voltage will have to be at least 28V, but as that continues to increase, zener diode D1 prevents the MCU input from rising with it, beyond 3.3V.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you very much! This is the exact answer to the problem. I thought about dividing voltage with resistor, and I thought about zener, but I dont exactly know how to use zener. It has been decades after I learn electronics at university. Thank you for your answer and example. It helps a lot. \$\endgroup\$
    – Superuser
    Jun 27, 2023 at 5:54
3
\$\begingroup\$

You can use a voltage divider:

schematic

simulate this circuit – Schematic created using CircuitLab

This configuration divides the voltage 11:1, so the GPIO pin will see 2.54 to 5.54V depending on the LED voltages while the very high (100k) series resistance will limit current to about 500uA maximum. Assuming your MCU has any protection diodes, this should be safe even though you're going above 3.3V. If it doesn't, you could add an external diode in parallel with R2 to clamp voltage at 3.3V.

\$\endgroup\$
2
  • \$\begingroup\$ Thank you very much! This is the exact answer to the problem. Just one question, would you please elaborate that adding an external diode in parallel with R2 to clamp voltage at 3.3V? I am not sure how it works. Thank you very much. \$\endgroup\$
    – Superuser
    Jun 27, 2023 at 2:59
  • 1
    \$\begingroup\$ @Superuser You could pick a diode that switches on at around 3.3v for a current of a few hundred microamps. Then if the voltage goes above 3.3v, the diode takes the current. The trick is that you'd have to pick the diode carefully since the current is so low or it might not turn on. Probably better to check the datasheet and see if the vendor has handled this for you. Often GPIO pins are rated for some over voltage current. \$\endgroup\$ Jun 27, 2023 at 3:49

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.