Blairvoyach
Posts: 5
Joined: Sun Jun 24, 2012 11:00 am

remote monitoring of 12v battery

Sun Sep 24, 2017 12:39 pm

Hi,

Because of our very rural location, our broadband is delivered via 5ghz radio link. Unfortunately, the radio link is not line of sight and we had to install a repeater to shoot the signal around a forest and down to the house. The repeater is 500m away and is powered by a 200ah 12 v battery. I am looking for solutions to monitor the voltage of the battery. Also the load on the system would be nice but not vital. The repeater has it's own WiFi so I could connect the Pi to that. I envisage the Pi having a webpage I could log onto to read the voltage from. At the moment we are relying on an automatic shutdown switch which turns off power at 11v to protect both battery and equipment.

Is there a plug-in module I can buy that will do this simple task? All the commercial remote monitors are way out of my price range.

Regards,
Jeff.

pcmanbob
Posts: 2176
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: remote monitoring of 12v battery

Sun Sep 24, 2017 1:05 pm

Hi.

You need to add an analogue to digital converter and a simple potential divider circuit to your pi to measure 12v using your pi.

here's one example I found for you https://www.enigma14.eu/wiki/AD_Convert ... spberry_Pi
Please only ask questions in the forum I will not answer questions sent to me directly via PM
Remember we want information.......................no information no help

User avatar
Gavinmc42
Posts: 1549
Joined: Wed Aug 28, 2013 3:31 am

Re: remote monitoring of 12v battery

Mon Sep 25, 2017 5:48 am

I use i2c chips for this sort of stuff, LTC2945 etc.
Ti have some battery gauge chips too.
Solar powered?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

bkelly212
Posts: 17
Joined: Fri Feb 17, 2017 8:26 pm

Re: remote monitoring of 12v battery

Wed Sep 27, 2017 6:44 pm

Hello guys, don't mean to "hijack" this thread, but I am looking to do something very similar and have found lots of info for people who are looking to have high levels of precision, and I am not. I would like to know the easiest (somewhat affordable, but cost isn't a big deal) way to monitor battery voltage. I am looking to know when it goes below 12.3v and/or above 14.3v. It would need to be displayed on my Pi, but that is a problem for another day. I am just looking for info on hardware and a diagram if possible. I would need to sample about 1 time each second, more than that wouldn't really be necessary.

Thanks for any help/info

Moe
Posts: 195
Joined: Sun Jan 25, 2015 2:44 pm

Re: remote monitoring of 12v battery

Wed Sep 27, 2017 6:57 pm

I use one of these to monitor several voltages, incuding a 24V battery bank:

https://www.abelectronics.co.uk/p/69/AD ... -converter

pcmanbobs link would do the same and be cheaper. You need a resistor divider to bring the battery range within range of the ADC, and then calibrate using an accurate meter.
Submarine communication systems engineer and amateur robot enthusiast.

pcmanbob
Posts: 2176
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: remote monitoring of 12v battery

Thu Sep 28, 2017 12:30 pm

bkelly212 wrote:
Wed Sep 27, 2017 6:44 pm
Hello guys, don't mean to "hijack" this thread, but I am looking to do something very similar and have found lots of info for people who are looking to have high levels of precision, and I am not. I would like to know the easiest (somewhat affordable, but cost isn't a big deal) way to monitor battery voltage. I am looking to know when it goes below 12.3v and/or above 14.3v. It would need to be displayed on my Pi, but that is a problem for another day. I am just looking for info on hardware and a diagram if possible. I would need to sample about 1 time each second, more than that wouldn't really be necessary.

Thanks for any help/info
Hi.

if you just want to know when the voltage falls or rises above a set point, you can do that with a simple lm741 opamp circuit.
you will of course need 2 circuits one for high volts and one for low volts each connected to its own gpio pin.

low volts circuit

Image

now before you connect this to the pi gpio you need to do some setup. ( failure to do this will damage your pi )

first you need to set the 10k variable resistor so that the LED lights at the correct voltage you will need to supply the circuit with your required voltage.
then once the led is on you need to adjust the 50K variable resistor so that the output that will be connected to the gpio is between 2.8 and 3v.

for the high volts circuit you need to swap the inputs on pin 2 and 3 of the LM741 and again go through the set up procedure.

once you have you 2 working circuits you can connect them to the pi gpio and then you just need some simple python code to check the gpio of a high signal on each input to check for high or low volts.
Please only ask questions in the forum I will not answer questions sent to me directly via PM
Remember we want information.......................no information no help

bkelly212
Posts: 17
Joined: Fri Feb 17, 2017 8:26 pm

Re: remote monitoring of 12v battery

Thu Sep 28, 2017 2:31 pm

Moe wrote:
Wed Sep 27, 2017 6:57 pm
I use one of these to monitor several voltages, incuding a 24V battery bank:

https://www.abelectronics.co.uk/p/69/AD ... -converter

pcmanbobs link would do the same and be cheaper. You need a resistor divider to bring the battery range within range of the ADC, and then calibrate using an accurate meter.
I ordered an ADC yesterday, hopefully arrives today but I need to order the required resistors yet. My problem is I am not sure which ones I should use, I am going to use 5v as my reference and my range wil be 11.5-14.5v (to be safe) but do I just calculate using 12v or 14.5 since that would technically be 100%?

bkelly212
Posts: 17
Joined: Fri Feb 17, 2017 8:26 pm

Re: remote monitoring of 12v battery

Thu Sep 28, 2017 2:32 pm

pcmanbob wrote:
Thu Sep 28, 2017 12:30 pm
bkelly212 wrote:
Wed Sep 27, 2017 6:44 pm
Hello guys, don't mean to "hijack" this thread, but I am looking to do something very similar and have found lots of info for people who are looking to have high levels of precision, and I am not. I would like to know the easiest (somewhat affordable, but cost isn't a big deal) way to monitor battery voltage. I am looking to know when it goes below 12.3v and/or above 14.3v. It would need to be displayed on my Pi, but that is a problem for another day. I am just looking for info on hardware and a diagram if possible. I would need to sample about 1 time each second, more than that wouldn't really be necessary.

Thanks for any help/info
Hi.

if you just want to know when the voltage falls or rises above a set point, you can do that with a simple lm741 opamp circuit.
you will of course need 2 circuits one for high volts and one for low volts each connected to its own gpio pin.

low volts circuit

Image

now before you connect this to the pi gpio you need to do some setup. ( failure to do this will damage your pi )

first you need to set the 10k variable resistor so that the LED lights at the correct voltage you will need to supply the circuit with your required voltage.
then once the led is on you need to adjust the 50K variable resistor so that the output that will be connected to the gpio is between 2.8 and 3v.

for the high volts circuit you need to swap the inputs on pin 2 and 3 of the LM741 and again go through the set up procedure.

once you have you 2 working circuits you can connect them to the pi gpio and then you just need some simple python code to check the gpio of a high signal on each input to check for high or low volts.
At this point I do want to be able to see the exact voltage on the screen, if that becomes harder than necessary this is definitely an option. Basically I want the program to be self-aware of the voltage and pause what its doing if it drops below 12.2, so this would definitely work.
Thank you!

User avatar
Burngate
Posts: 5044
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
Contact: Website

Re: remote monitoring of 12v battery

Thu Sep 28, 2017 3:55 pm

bkelly212 wrote:
Thu Sep 28, 2017 2:32 pm
Hello guys, don't mean to "hijack" this thread, but I am looking to do something very similar and have found lots of info for people who are looking to have high levels of precision, and I am not. I would like to know the easiest (somewhat affordable, but cost isn't a big deal) way to monitor battery voltage. I am looking to know when it goes below 12.3v and/or above 14.3v. It would need to be displayed on my Pi, but that is a problem for another day. I am just looking for info on hardware and a diagram if possible. I would need to sample about 1 time each second, more than that wouldn't really be necessary.

Thanks for any help/info
bkelly212 wrote:
Wed Sep 27, 2017 6:44 pm
At this point I do want to be able to see the exact voltage on the screen, if that becomes harder than necessary this is definitely an option. Basically I want the program to be self-aware of the voltage and pause what its doing if it drops below 12.2, so this would definitely work.
Thank you!
If you want to be able to see the "exact" voltage, you need an ADC.

If all you want is to be notified when the voltage goes out-of-range, then pcmanbob's solution would work (though I wouldn't do it that way - I'd use an LM393 or equivalent. It's a dual comparator, rather than op-amp, but more to the point it's got open-collector outputs, so there's no worries about it driving the gpios to high.)

baetis
Posts: 10
Joined: Tue Dec 22, 2015 6:19 pm

Re: remote monitoring of 12v battery

Thu Sep 28, 2017 10:48 pm

You cab build a real simple ADC that is about 5% accurate with one RPi pin and a few resistors and a capacitor, you charge or discharge the cap with the RPi output active and then set a timer to count how ling it takes the capacitor to dis/charge to the bidirectional RPi pins threshold. This has been discussed on this site several times. A little CGI server should get you a web page without much problem (also discussed on this forum).

bkelly212
Posts: 17
Joined: Fri Feb 17, 2017 8:26 pm

Re: remote monitoring of 12v battery

Tue Oct 03, 2017 7:00 pm

Burngate wrote:
Thu Sep 28, 2017 3:55 pm
bkelly212 wrote:
Thu Sep 28, 2017 2:32 pm
Hello guys, don't mean to "hijack" this thread, but I am looking to do something very similar and have found lots of info for people who are looking to have high levels of precision, and I am not. I would like to know the easiest (somewhat affordable, but cost isn't a big deal) way to monitor battery voltage. I am looking to know when it goes below 12.3v and/or above 14.3v. It would need to be displayed on my Pi, but that is a problem for another day. I am just looking for info on hardware and a diagram if possible. I would need to sample about 1 time each second, more than that wouldn't really be necessary.

Thanks for any help/info
bkelly212 wrote:
Wed Sep 27, 2017 6:44 pm
At this point I do want to be able to see the exact voltage on the screen, if that becomes harder than necessary this is definitely an option. Basically I want the program to be self-aware of the voltage and pause what its doing if it drops below 12.2, so this would definitely work.
Thank you!
If you want to be able to see the "exact" voltage, you need an ADC.

If all you want is to be notified when the voltage goes out-of-range, then pcmanbob's solution would work (though I wouldn't do it that way - I'd use an LM393 or equivalent. It's a dual comparator, rather than op-amp, but more to the point it's got open-collector outputs, so there's no worries about it driving the gpios to high.)

Ok - my ADC and resistors have showed up. I have seen the calculators that are supposed to tell you which resistors to use, but they don't make sense to me because they want you to enter 1 of the resistor values but how do I decide what one to use...

pcmanbob
Posts: 2176
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: remote monitoring of 12v battery

Wed Oct 04, 2017 10:22 am

When selecting resistors for a potential divider circuit I always like to start with R2 being 10K then if you find you can get the desired voltage or the resistor values for R1 do not fall on common values you can always try varying R2 a bit.
Another reason for starting with 10K for R2 is that it will limit the current draw to a few milliamp's.
Please only ask questions in the forum I will not answer questions sent to me directly via PM
Remember we want information.......................no information no help

bkelly212
Posts: 17
Joined: Fri Feb 17, 2017 8:26 pm

Re: remote monitoring of 12v battery

Wed Oct 04, 2017 4:10 pm

pcmanbob wrote:
Wed Oct 04, 2017 10:22 am
When selecting resistors for a potential divider circuit I always like to start with R2 being 10K then if you find you can get the desired voltage or the resistor values for R1 do not fall on common values you can always try varying R2 a bit.
Another reason for starting with 10K for R2 is that it will limit the current draw to a few milliamp's.
OK, that makes sense, as 10k is a pretty common size. So, if you wouldn't mind, please tell me what you think of these values below. my voltage will typically be around 13.2 but may be a little higher (13.9-14) but will definitely drop to a little below 12 when motors turn on (pulling 30+amps) but should maintain around 12.5 (at battery) while they are running. The other part I'm confused about is which voltage do I use for Vin (highest possible or average?) I want to use 5v for reference as I already have a separate 5v converter so I don't have to supply that power from the GPIO pins.

Again, thank you!
V.PNG
V.PNG (12.74 KiB) Viewed 1045 times
14.PNG
14.PNG (12.72 KiB) Viewed 1045 times

User avatar
Burngate
Posts: 5044
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
Contact: Website

Re: remote monitoring of 12v battery

Wed Oct 04, 2017 5:26 pm

bkelly212 wrote:
Wed Oct 04, 2017 4:10 pm
my voltage will typically be around 13.2 but may be a little higher (13.9-14) but will definitely drop to a little below 12 when motors turn on (pulling 30+amps) but should maintain around 12.5 (at battery) while they are running. The other part I'm confused about is which voltage do I use for Vin (highest possible or average?) I want to use 5v for reference as I already have a separate 5v converter so I don't have to supply that power from the GPIO pins.
When you choose your resistors, you're deciding what voltage will be the maximum that the ADC can measure.
If you go for the values in V.PNG, so 10k and 14k, it means that 12v out of the battery equals 5v into the ADC, which the ADC will read as maximum (given that the reference for it is 5v)

Just as a matter of interest, which ADC have you got?
If, for example, it's an eight-bit one, then 5v into the ADC will be read by the Pi as 0xFF, and the PI will have to translate that into a real number of volts on the battery

But if the battery actually gives out 13.5v, the ADC won't be able to read it correctly, so it will still say 12v.

If you go for the second lot, 10k and 18k, then the ADC will read 14v as a maximum of 0xFF, and that gets translated to 14v
12v on the battery would then go into the ADC as (12 x 5 / 14) = 4.28v, the ADC would read it as 0xDA and the Pi will translate that to 12v

bkelly212
Posts: 17
Joined: Fri Feb 17, 2017 8:26 pm

Re: remote monitoring of 12v battery

Wed Oct 04, 2017 8:50 pm

[/quote]
When you choose your resistors, you're deciding what voltage will be the maximum that the ADC can measure.
If you go for the values in V.PNG, so 10k and 14k, it means that 12v out of the battery equals 5v into the ADC, which the ADC will read as maximum (given that the reference for it is 5v)

Just as a matter of interest, which ADC have you got?
If, for example, it's an eight-bit one, then 5v into the ADC will be read by the Pi as 0xFF, and the PI will have to translate that into a real number of volts on the battery

But if the battery actually gives out 13.5v, the ADC won't be able to read it correctly, so it will still say 12v.

If you go for the second lot, 10k and 18k, then the ADC will read 14v as a maximum of 0xFF, and that gets translated to 14v
12v on the battery would then go into the ADC as (12 x 5 / 14) = 4.28v, the ADC would read it as 0xDA and the Pi will translate that to 12v
[/quote]

That's what I thought. The one article I read he was using 12v to calculate, but using a battery to read from. If the battery is at 12v it is dead, so this wouldn't help. I have this one (https://www.amazon.com/HiLetgo-Converte ... ds=ads1115) I am going to wire it up for 14v and work on getting the Pi to read it, not a very savvy programmer either lol

bkelly212
Posts: 17
Joined: Fri Feb 17, 2017 8:26 pm

Re: remote monitoring of 12v battery

Thu Oct 12, 2017 8:18 pm

Burngate wrote:
Wed Oct 04, 2017 5:26 pm
bkelly212 wrote:
Wed Oct 04, 2017 4:10 pm
my voltage will typically be around 13.2 but may be a little higher (13.9-14) but will definitely drop to a little below 12 when motors turn on (pulling 30+amps) but should maintain around 12.5 (at battery) while they are running. The other part I'm confused about is which voltage do I use for Vin (highest possible or average?) I want to use 5v for reference as I already have a separate 5v converter so I don't have to supply that power from the GPIO pins.
When you choose your resistors, you're deciding what voltage will be the maximum that the ADC can measure.
If you go for the values in V.PNG, so 10k and 14k, it means that 12v out of the battery equals 5v into the ADC, which the ADC will read as maximum (given that the reference for it is 5v)

Just as a matter of interest, which ADC have you got?
If, for example, it's an eight-bit one, then 5v into the ADC will be read by the Pi as 0xFF, and the PI will have to translate that into a real number of volts on the battery

But if the battery actually gives out 13.5v, the ADC won't be able to read it correctly, so it will still say 12v.

If you go for the second lot, 10k and 18k, then the ADC will read 14v as a maximum of 0xFF, and that gets translated to 14v
12v on the battery would then go into the ADC as (12 x 5 / 14) = 4.28v, the ADC would read it as 0xDA and the Pi will translate that to 12v
Hello again! A few days on vacation, but back at it today, and finally got resistors wired up. Having a strange result though, I am using an18k and a 10k and tested voltage on a battery that reads 12.81v. The reading after the divider is 8.26v. This doesn't seem right...I know this isn't my normal cup of tea, but am I missing something stupid? Thanks...

d_older
Posts: 63
Joined: Mon Jun 25, 2012 5:04 pm
Location: East Yorkshire, UK

Re: remote monitoring of 12v battery

Thu Oct 12, 2017 11:41 pm

bkelly212,

it looks like you're measuring the voltage over the 18k resistor and not the 10k 18/28 = 0.642 , x 12.81V = 8.235V.

If you're sharing a ground you need to invert the two resistors.

Hope this helps

Dave

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: Davies and 22 guests