I have built an Arduino UNO powered Weather Station, Powered by a 12 vdc Battery, the voltage is then reduced by a step down unit to 9 vdc, the battery is recharged by a PV solar panel. I was going to fit a Manual switch, to switch to a mains powered 9vdc transformer if the Battery is not being recharged, ie no Sunlight and it drains down. But this relies on me being present when this happens.
My question is this, is it possible to install a piece of hardware to automatically switch to a mains powered 9vdc transformer when it detects that the the battery voltage drops to say 11 volt ?
The Arduino can measure the voltage on the 12v battery (with a suitable voltage divider) and can then trigger a relay to turn on the mains for the 9v transformer if the battery voltage falls too low.
However it might be a better idea to use the mains to re-charge the 12v battery. The logic etc would be pretty much the same.
Be careful to keep the wiring for the mains electricity safely separate from the Arduino and the low voltage wiring.
What power saving steps have you added to your setup.
Even simple stuff like having the unit sleep for 5 seconds between loops can reduce the overall drain down to less than 1/3 of always on.
@Robin2. Yes, a good strategy. Charge when it is possible. @gresleyman: Why not use mains whenever it is available and let the 12 volt battory be the power sorce when mains is off or disconnected?
No, i wish to stick to Solar Power to recharge the battery, it has a Tracking device installed so i should get the maximum Sun Hours. (Her indoors does not like electrical cables in her garden)
I am reducing the voltage from the 12 volt charge controller to 9 volt, by installing an LM317 voltage reducer before the load. I like the idea of a voltage divider & relay being monitored by the Arduino, can you advise me on how to do this and with what components.
gresleyman:
I am reducing the voltage from the 12 volt charge controller to 9 volt, by installing an LM317 voltage reducer before the load.
if the only thing being powered at lower voltage is the Arduino why not step down to 5v and feed the power into the 5v pin?
I like the idea of a voltage divider & relay being monitored by the Arduino, can you advise me on how to do this and with what components.
The Arduino will not be monitoring the relay, it will be controlling it.
Google should give you all you need to know about a voltage divider. It is just a pair of resistors to reduce the charge voltage below 5v (at max) so that the Arduino can measure it. This is quite separate from the 5v for powering the Arduino.
Relays also consume Power, probably not so much for a small relay, but.... What if the solar panels charges the battory all the time and the Arduino is permanently connected to the battory? Measuring status of charging and battory will be the same easy.
The Arduino NO already has a switchover. Connect it to a plug-in USB charger. If the V(in) pin drops below 6.6V the UNO will switch over to using the USB power.
To waste less power, use a buck converter instead of an LM317 linear regulator. And set the buck converter for 7V instead of 9V to reduce the power dissipated in the Arduino's linear regulator.
this works for me, momitor and beep on undervoltage. i have my voltage set on 12v
/*
0 - ~17volt voltmeter
works with 3.3volt and 5volt Arduinos
uses the stable internal 1.1volt reference
10k resistor from A0 to ground, and 150k resistor from A0 to +batt
(1k8:27k or 2k2:33k are also valid 1:15 ratios)
100n capacitor from A0 to ground for stable readings
*/
int buzzer = 11;
unsigned int total; // holds readings
float voltage; // converted to volt
void setup() {
pinMode(11, OUTPUT);
analogReference(INTERNAL); // use the internal ~1.1volt reference | change (INTERNAL) to (INTERNAL1V1) for a Mega
Serial.begin(9600); // ---set serial monitor to this value---
}
void loop() {
total = 0; // reset
analogRead(A0); // one unused reading to clear any ghost charge
for (int x = 0; x < 64; x++) { // 64 analogue readings for averaging
total = total + analogRead(A0); // add each value
}
voltage = total * 0.0002505; // convert readings to volt | ---calibrate by changing the last three digits---
Serial.print("The battery is ");
Serial.print(voltage, 2); // change to (voltage, 3) for three decimal places
Serial.println(" volt");
if(voltage<=12 )
{
digitalWrite (buzzer, HIGH);
}
else
{
digitalWrite (buzzer, LOW);
}
delay(1000); // readout delay
}
instead of buzzer you can use a simple relay module