LM7805 in reverse - will it backfeed?

Thread Starter

ischonfeld

Joined Jun 22, 2019
27
I have a project that uses a 12V regulated power supply.

It needs 5V for the MCU, so I have an LM7805 to drop the voltage down to 5V. The MCU is normally fed this way, but when programming it, the 12V supply is removed and the MCU is connected to a USB computer port to flash the program update. The USB power connection is tied to the LM7805 Output. I am careful that USB power and 12V power are never connected at the same time.

The 12V input is also used to run some small motors, with 5V relays controlling which motor(s) operate via MCU control. The motor connections are tapped off the input side of the LM7805.

This all operates just fine.

Today when I was flashing a program update (12V power supply physically disconnected, MCU power supplied by USB), I noticed that the motors would still run under program control. Slower, yes, but still running. The only way they could have received power is if the LM7805 supplied current from the 5V Output connection (USB Supplied) back to it's Input connection.

Does this make any sense? It's the only explanation I can come up with.
 

Papabravo

Joined Feb 24, 2006
21,159
If the USB and 7805 outputs are connected together, with the input to the 7805 at zero volts then there is no back-feeding going on as I understand that term. It is just that the 7805 now represents a load to the USB connection which may according to the specifications be current limited to 100 mA. This might cause the voltage from the USB port to drop, which is consistent with slower motor operation. Where does the concept of back-feeding come from? Is there some theory of back-feeding that you can point to? I'm really confused about what you think it is or means.
 

narkeleptk

Joined Mar 11, 2019
558
I recently was doing a similar circuit. I planned to do both like you are contemplating but I ended up just ditching the power from USB altogether and powered it from my mcu vcc supply instead since it would always be plugged into to 12V anyway when using it. In my case I was more worried about the 12V finding its way to my pc's usb port.
 

Thread Starter

ischonfeld

Joined Jun 22, 2019
27
Here is the simplified circuit. There is more circuitry on the 5V side (other relays, MCU connections, etc.) but the 12V circuitry is shown here completely. There is no other connection between 5V and 12V other than the LM7805.

LM7805 Simplified.png

The motor is only connected to the 12V side of the LM7805. I'm 100% sure this is how things are connected, and it works just fine off 12V.

The way the MCU is designed, it can be fed 5V through VIN, or it can be fed from the USB and the USB's 5V is output on VIN. There is a spec for how much current can be supply by VIN while using USB.

Under normal circumstances when only connected to 12V, the MCU and it boots up, it goes through it's normal programming, closes a motor relay, and a motor runs (normal speed).

What surprises me is that when just connected to USB power (during firmware updates), the motor still runs (although slowly). The only explanation I can come up with is that 5V power is flowing from the LM7805 OUT connection back to the LM7805 IN connection. When I flash updates, not only is the switch off, but the plug supplying 12V from the PS is removed. As mentioned above, I don't want to take the chance of back-feeding 5V into the computer's USB port.

I'm asking more of our curiosity than anything else, since the project has been working just fine for a long time. It's just the strange behavior I just noticed that's weird.

Thanks.
 

Papabravo

Joined Feb 24, 2006
21,159
Here is the simplified circuit. There is more circuitry on the 5V side (other relays, MCU connections, etc.) but the 12V circuitry is shown here completely. There is no other connection between 5V and 12V other than the LM7805.

View attachment 233936

The motor is only connected to the 12V side of the LM7805. I'm 100% sure this is how things are connected, and it works just fine off 12V.

The way the MCU is designed, it can be fed 5V through VIN, or it can be fed from the USB and the USB's 5V is output on VIN. There is a spec for how much current can be supply by VIN while using USB.

Under normal circumstances when only connected to 12V, the MCU and it boots up, it goes through it's normal programming, closes a motor relay, and a motor runs (normal speed).

What surprises me is that when just connected to USB power (during firmware updates), the motor still runs (although slowly). The only explanation I can come up with is that 5V power is flowing from the LM7805 OUT connection back to the LM7805 IN connection. When I flash updates, not only is the switch off, but the plug supplying 12V from the PS is removed. As mentioned above, I don't want to take the chance of back-feeding 5V into the computer's USB port.

I'm asking more of our curiosity than anything else, since the project has been working just fine for a long time. It's just the strange behavior I just noticed that's weird.

Thanks.
I'm pretty sure that a linear voltage regulator does not work that way. My evidence for this is that charged capacitors without a path to ground don't normally discharge through the voltage regulator unless there is a diode bypass from output back to input. This is an easy test. Just measure the voltage on the input pin with a multimeter after turning off the +12V input.
 

wayneh

Joined Sep 9, 2010
17,496
What surprises me is that when just connected to USB power (during firmware updates), the motor still runs (although slowly). The only explanation I can come up with is that 5V power is flowing from the LM7805 OUT connection back to the LM7805 IN connection.
Did you read the datasheet?
8.1.1 Shorting the Regulator Input
When using large capacitors at the output of these regulators, a protection diode connected input to output (Figure 15) may be required if the input is shorted to ground. Without the protection diode, an input short causes the input to rapidly approach ground potential, while the output remains near the initial VOUT because of the stored charge in the large output capacitor. The capacitor will then discharge through a large internal input to output diode and parasitic transistors. If the energy released by the capacitor is large enough, this diode, low current metal, and the regulator are destroyed. The fast diode in Figure 15 shunts most of the capacitors discharge current around the regulator. Generally no protection diode is required for values of output capacitance ≤ 10 μF.
8.1.2 Raising the Output Voltage Above the Input Voltage
Because the output of the device does not sink current, forcing the output high can cause damage to internal low current paths in a manner similar to that just described in Shorting the Regulator Input.
 

wayneh

Joined Sep 9, 2010
17,496
I'm pretty sure that a linear voltage regulator does not work that way. My evidence for this is that charged capacitors without a path to ground don't normally discharge through the voltage regulator unless there is a diode bypass from output back to input.
The diode is used to direct the current around the 7805. You wouldn't need the diode if the current couldn't pass thru (and damage) the 7805.
 

Papabravo

Joined Feb 24, 2006
21,159
The diode is used to direct the current around the 7805. You wouldn't need the diode if the current couldn't pass thru (and damage) the 7805.
I don't see that conclusion. It seemed that discharging big capacitors soon after shutdown was a bigger safety concern for ham-handed techs with screwdrivers. So if you have a linear regulator with a higher potential on the output than on the input, where does the current go? If it goes somewhere how fast does it go there, and what happens to it in the process? Adjustable regulators have a DC path to ground through external resistors. Does a fixed regulator also have that property? EDIT: I see the answer in the previous post -- never mind.
 
Last edited:

Thread Starter

ischonfeld

Joined Jun 22, 2019
27
8.1.2 Raising the Output Voltage Above the Input Voltage
Because the output of the device does not sink current, forcing the output high can cause damage to internal low current paths in a manner similar to that just described in Shorting the Regulator Input.
So it sounds like the safest thing to do is install a diode right at the IN pin of the LM7805. With that in place, current cannot flow in reverse back into the motor or even back into the 12V supply in the case where 12V and USB might both be connected at the same time, and the motor won't look like a short in the case that's described in the datasheet. Seems like good protection either way. Thank you.
 

Papabravo

Joined Feb 24, 2006
21,159
So it sounds like the safest thing to do is install a diode right at the IN pin of the LM7805. With that in place, current cannot flow in reverse back into the motor or even back into the 12V supply in the case where 12V and USB might both be connected at the same time, and the motor won't look like a short in the case that's described in the datasheet. Seems like good protection either way. Thank you.
Just to be clear. The anode of the diode goes to the lower voltage (+5V in this case) and the cathode of the diode goes to the higher voltage (+12V in this case). Do not allow the +5V connection from the USB cable to to come anywhere near the +5 from the regulator. the diode will drop the USB supply like a brick in the rain.
 

Thread Starter

ischonfeld

Joined Jun 22, 2019
27
This is the addition of the diode I will make the next time I open it up. It protects the computer USB port in case the 12V supply is left connected, and the LM7805. As a slight side benefit, it also reduces the voltage drop (and thus power dissipation) across the LM7805 by about 0.6V.

LM7805 Simplified Updated.png
 
Top