Hello,
This is my first post here.
I’m a newbie both in Arduino programming and in electronic in general. Maybe my question will be obvious for you…but it is not for me, and I’m looking for a solution that would prevent me from doing my whole PCB again if possible ! (if I can just solve my issue through programming diffrently my arduino, that would be perfect…If I need to change the PCB…well, it’s a pain…)
I’ve designed a project, gathering information everywhere on Internet, and here especially, in which my Arduino UNO is powered with a 220V AC / 9V DC transformer, and is monitoring a relay. Each time I loose the 220V power, the relay is turning down, and then the Arduino is powered thanks to a 9V battery (the relay has 2 functions : switching the power source between the battery and the transformer, and telling the arduino which is the source. At restart, I know thanks to the relay position what is the power source).
Depending on the power source, I launch some actions (closing or opening safety water valves).
I’ve built as well in my circuit a part that is monitoring the battery level, through a tension divider.
When I’ve tested my system, it worked perfectly…problem is that I’ve tested it over a few minutes…
Plugging in my final system definitively, after having engraved my PCB which communicate with the UNO, I realised that the battery was emptying itself in 3 days…although it was supposed not to be used by anything in the circuit when 220V power is present (which is the case 99.9% of time).
=> a transistor is blocking the battery monitoring (no current is supposed to go through the tension divider until the transistor is activated
In my sketch, I activate the transistor before reading the tension at the tension divider, and then close it again.
According the scheme, and knowing from now on that the battery is emptying, I’ve guessed that I have a leakage current through A0 pin…(I probably should have put the transistor between P6 and R4, see below…but unfortunately, too late >:( )
(If it’s not the cause, then I don’t understand why the battery, which was new, has emptied itself so fast)
Is there any solution to avoid this ‘leakage’ ?
Here is attached my scheme !
on the top left-hand side : P4 is the Arduino’s ground
P5 is the battery negative pole
P6 is the battery positive pole
on the right-hand side, R4 and R5 are the tension divider. Resistor values are designed to monitor a +5V on A0 with a 30mA current (to make sure that battery is loaded enough before reading its tension).
P24 is connected to A0 arduino’s pin
P25 is the pin I put at HIGH value before reading A0, and then back to LOW when it’s done.
=> it’s opening/closing Q1 transistor
Any idea would be highly appreciated !
Thanks,
larbalette