
pacomms
United Kingdom
Asked
— Edited
This is really a question aimed at DJ but if anyone else knows the answer please chip in, i want to know how i can use an ADC port to monitor the battery voltage on my 6v battery, my idea is to write a script that will for now just say that the battery voltage is low, by speaking through my laptop, my eventual aim is so that when the roborealm module is done he will sense the battery is low and head for a home base by using the navigation module in roborealm.
Thanks Kurt
Kurt don't connect an ADC port directly to your 6v battery it will blow up the port. You just need a couple of resistors say 10k in series to ground from the + of the battery and connect the ADC port to the centre of the resistors. Then you can read the ADC port and calibrate at what voltage you need to start a go and get charged script. Thats the way I would do it any others?
Hmm not to sure i get that, you got a wiring diagram i can see ;-)
Thanks Kurt
Here's a thrown together pic if you want I will wire it up tomorrow and see if the impedances are about right
Ok tested it works fine. You will get 1/2 the 6v battery voltage applied to an ADC port. You would need to adjust the resistor values if using a higher battery voltage than 10 volts or say 7 dry cells.
Then run a script like this
IF (ADC(ADC0) < 3)
The EZ-B will excute the next line if the battery voltage falls below 3 (ie 6volts). Adjust this value to see what works best. The total current drawn off the battery with this arrangement using ohms law would be only 0.0003 amps or 0.3 ma
Winstn60 --
Please pardon my ignorance as I'm totally new to circuitry. It looks like the ADC port utilizes a 3 wire connection. Your diagram only shows one wire. Which one is it and what did you do to the other two? And just to be clear, this setup is place between the battery and the EZ-B, right?
I'd like to utilize this along with a simple script for an LCD screen which could display a low battery warning.
Thanks in advance!
Hi Choyster
You are correct the EZ-B has 3 wires to any port +5 volts, ground and the signal wire. Yes and it does go between the battery and the EZ-B
In this case we aren't powering anything like a servo so we don't need the +5v and GND wires, just the input lead sensing the voltage level on the main battery I have called it PSU in my diagram before it gets regulated by the EZ-B board. On the V3 board its the outer pin of any input port A0 to A7 that gets connected to the resistors if you use a servo lead just snip the other 2 off
So forgive my stupidity but i am connecting the + and - together with the two resistors inline correct ? then comming from the middle of the two resistors to the input signal wire of the ADC ? Just checking dont wanna blow my ezb up lol
Thanks Kurt
The two resistors are wired inline (series) across your battery + and - terminals and then as you say the middle of the 2 resistors go to the EZ-B ADC signal pin.
Hence the high value of the resistors they won't drain your battery are they are in effect shorting it out
OK now?