Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Controlling a LED from lower voltage signal

StudentSA

Member
Good Day,

I am struggling with what I thought was a simple enough circuit. Would like to know what the correct way would be to handle this situation. I have two voltage rails, 5V supply (V_BUS) and 3v3 (from a LDL1117S33R buck). I am trying to get a LED to turn on when the 5V supply is available i.e. by default when 5V DC supply is plugged in the LED should be on indicating that there is power.

We have a 3v3 microcontroller that I would like to use a gpio to control the power led as well so we can use PWM etc to manage brightness etc.
My initial circuit attempt is as follows:

Circuit1.png


This works for the most part, however I am noticing some weird behaviour on the microcontroller side which I think is linked to the fact that I am pulling the GPIO (PWR_LED line) to 5V in this circuit which is probably not the best thing to do given it is running off 3v3.

Im guessing I need to run two mosfets one to isolate the 3v3 and one to drive the 5V.

I evaluated the following circuit (in LTSpice) using a P and N channel enhancement mode mosfets. however on simulation I see I have the logic inverted. i.e. LED is off by default and only comes on when 3v3 is applied:

Circuit2.png


Would really appreciate assistance in correctly designing a circuit where the LED that is ON when no signal is present (floating or 0) from microcontroller GPIO and is controllable i.e able to switch off when GPIO is at 3v3.

Thanks.
 
One solution is run LED of 3.3V, just a thought. If you can find one that works
down to 2.5V.

1704719275091.png


When processor running off 3.3 and you add a pullup to 5V current is injected
into output pin that can affect operation, in the extreme latchup and destroy
processor. Although most processors, with a 10K, would generally not experience
enough current into pin because of 10K. Consult datasheet.

You could add a Schottky diode from pin to 5V such that it clamps output at
3.3V + Vschottky. Ignore the "Input" label on the 3.3V diagram below, that can
also be "output".

1704719568140.png




Regards, Dana.
 
Thanks for the response, Due to some physical limitations on the design i.e. the microcontroller and power indicator led being located on different PCB's linked via connector, we do not have 3v3 bus on the board with the power indicator led. So we need to power it from the 5V rail. Its also meant to be a indication that 5V rail is operational so it made sense to have it run from the 5V rail.

The diode might help but im hoping there is a better way using two MOSFETs as I've read that the P channel can be used as "high side switch" while the N channel can be used to trigger the P.

I was wondering if its just a case of selecting a P channel depletion mode based MOSFET as opposed to the enhancement mode used.
 
On further investigation it seems my suggestion to use depletion mode P channel MOSFETs in not practical as they seem to be not readily available and are considered speciality devices. :(
We can scratch that idea
 
This approach is fine :

1704727156242.png


Although I would replace the 6244 with a general purpose NPN, save $$$$.
You would add a R from micro to NPN base to limit current. Or just this :

2N3904 fine as well. Below should add a 10K - 20K base to ground to absorb leakage
and keep LED off when micro starts up and pins are tristated, until code takes over.

1704727384316.png





Regards, Dana.
 
Thanks for the response, Due to some physical limitations on the design i.e. the microcontroller and power indicator led being located on different PCB's linked via connector, we do not have 3v3 bus on the board with the power indicator led. So we need to power it from the 5V rail. Its also meant to be a indication that 5V rail is operational so it made sense to have it run from the 5V rail.

The diode might help but im hoping there is a better way using two MOSFETs as I've read that the P channel can be used as "high side switch" while the N channel can be used to trigger the P.

I was wondering if its just a case of selecting a P channel depletion mode based MOSFET as opposed to the enhancement mode used.

Replace the M2 PMOS with an NMOS and move the LED to the NMOS drain. The pullup resistor will keep it on and light the LED.
Also check that M1 NMOS vgs(th) is within acceptable range (it has to be much less than 3.3v)
(2N7000 wouldn't be a good choice)
 
Thanks eTech , The N MOSFET I have easy access to is the IRLML6244 which has vgs(th) of 0.9V, this should suffice.

I have simulated the following circuit, which seems to be working and will test later today:

DualNFet.png
 
Can you just attach the pullup (R3) to 3.3V?

If your concerned about placement then place the pullup with the ESP as both the output and 3.3V should both be available.

Mike.
 
The red LED (typical 2V vf) will only turn on when 5v is present. If you only want one LED of a different color, add some 0.6v diodes in series with the LED until it easily exceeds your 3.3v rail.
 

Attachments

  • IMG_5258.jpeg
    IMG_5258.jpeg
    72.6 KB · Views: 61
Good Day,

I am struggling with what I thought was a simple enough circuit. Would like to know what the correct way would be to handle this situation. I have two voltage rails, 5V supply (V_BUS) and 3v3 (from a LDL1117S33R buck). I am trying to get a LED to turn on when the 5V supply is available i.e. by default when 5V DC supply is plugged in the LED should be on indicating that there is power.

We have a 3v3 microcontroller that I would like to use a gpio to control the power led as well so we can use PWM etc to manage brightness etc.
My initial circuit attempt is as follows:

View attachment 144051

This works for the most part, however I am noticing some weird behaviour on the microcontroller side which I think is linked to the fact that I am pulling the GPIO (PWR_LED line) to 5V in this circuit which is probably not the best thing to do given it is running off 3v3.

Im guessing I need to run two mosfets one to isolate the 3v3 and one to drive the 5V.

I evaluated the following circuit (in LTSpice) using a P and N channel enhancement mode mosfets. however on simulation I see I have the logic inverted menu maxi best of prix. i.e. LED is off by default and only comes on when 3v3 is applied:

View attachment 144052

Would really appreciate assistance in correctly designing a circuit where the LED that is ON when no signal is present (floating or 0) from microcontroller GPIO and is controllable i.e able to switch off when GPIO is at 3v3.

Thanks.
I have a friend that wants me to convert 1 over to white LED's. The issue is that the red LED's are spec'd at 2 volts, and white is 3 to 3.3 volts. So a 5 LED segment would be 15-16.5 volts. Would this be safe? What value resistor should be used, if any?
 
Confused, you want to series connect 5 white LEDs ? Or parallel them off the 5V
supply ? Obviously only the latter configuration is doable. And each of the
5 LEDs should have a series R to insure current is ~ same in each LED, hence
its brightness uniform.


Regards, Dana.
 
I have a friend that wants me to convert 1 over to white LED's. The issue is that the red LED's are spec'd at 2 volts, and white is 3 to 3.3 volts. So a 5 LED segment would be 15-16.5 volts. Would this be safe? What value resistor should be used, if any?
What supply voltages do you have and is the ground signal switched and by what? Safest is as danadak suggested parallel them with individual resistors - assuming the circuitry can handle 5 times the current.

Mike
 

Latest threads

New Articles From Microcontroller Tips

Back
Top