# input voltage higher than supply voltage

Dear all,

I'm working on a scematic to build a barebone arduino with a supercapacitor on the powersupply. This cap is used to give arduino some time to save some values to eeprom just after power is diconnected.

The idea is this; 12v -> LM7805 -> 5v -> supercap -> atmega328

On the 12v side of the LM7805 i've placed a voltage divider which outputs 4.7V. This divider is connected to a pin on the atmega, so the atmega can detect when the power source is diconnected and the atmega will then start it's shutdown routine.

At the moment the power is connected, the voltage on the divider is 4.7V instantly. But the source voltage on the atmega is rising because the capacitor is charging up to 5V. At these few (3) seconds the voltage on the inputpin is higher then the supply voltage. Is this allowed or will I destroy my inputpin?

Your drawing can't be correct as it shows the cap in series with the other components.

Normally with these caps you charge the cap through a resistor and discharge (ie power the uC) through a diode. Connecting a super cap directly to a regulator can cause problems as that's a dead short to GND if the cap is discharged.

Rob

Hi Rob,

The analog inputs on Arduino are very high impedance, so your voltage divider could have high values of resistance, say 100,000 ohms.

The chip has diodes internally connected to Vcc and Gnd. One of those will conduct when the chip is not powered.

The current would be very low due to your high resistances.

I don’t think it will be a problem…

true, after you reply I checked out and found that the should be in parrallel(stupid mistake).
But why the diode?

@terryking228;
Thanks, good to know it should not be a problem.

When putting the cap parrallel the problem went away. The cap charges, but the voltage line is a steady 5v now. So it’s higher than the divider voltage.
Thank you very much!
Rob.

But why the diode?

Because you want to control the current flow into the cap but usually not out of it. So the resistor stops the cap charging too fast and the diode allows it to discharge at any rate. The diode will cause a voltage drop but at least it's always the same, if you power the uC and other circuitry through the charge resistor the voltage on VCC will vary according to the load.

That may or may not matter, it depends on the circuit, but it just seems dodgy to me.

Have a look here for a standard circuit

http://ruggedcircuits.com/html/circuit__13.html

BTW, if you drop your divider down to about 3v5 you'll have more time to tidy up.

Rob

Rob,

Thank you very much. I'll consider putting the diode in. I understand what it does thanks to your link and explanation. The loss of 0,3V seems to me as a negative point, but I'll test whether it works.

dropping the divider down a bit is also a good idea.

Thanks! Rob.

I would consider driving the arduino's pin with a transistor, so that the input voltage is not an issue. A potential divider on the input to the transistor (base) can set the trigger voltage. Better yet would be to use a voltage comparator, then you can adjust the trip voltage with a pot.

Also make the pin one of the ones that can generate an interrupt so that the interrupt service routine can handle the shut down and you don't have to continuously pole it in the software.

I'd use 12v -> diode -> capacitor -> 5v LDO regulator -> Arduino instead. That way, the capacitor can discharge by several volts before the 5v supply drops too low for the Arduino, allowing you to use a much lower value (but higher voltage) capacitor.

You can connect the voltage divider to either the incoming 12v supply or across the capacitor, depending on whether you want to detect short power glitches or not. I would use resistor values of e.g. 100K and 47k for the voltage divider to keep the current possibly flowing into the analog input to a safe level.