United Kingdom
Asked — Edited

Battery Voltage Monitor

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


ARC Pro

Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.

Canada
#17  

@winstn60 You answered quickly, no complaints here:)

Thanks for checking it out... I need to purchase the resistors and, yes, breadboard them before committing to the EZ-B... must keep the magic smoke in:P I think the lower voltages are due to something called Loading Effect. The simulator shows differing voltages as I add or remove a "rung". There is aperently math involved eek but I want to keep it fun, so I just ignore that and test away:P

@pittom It is a handy little app isn't it... so easy to use and visual... I love visual, soaks into the grey matter easier:)

Canada
#18  

Science prevails again...

I rigged up a test curcut using the highest value resistors I had on hand, 510 Ohm, And matched the real world results with the simulated ones.

User-inserted image

Then I tied the curcut into the EZ-B on ADC7 and fiddled with the Unit Multiplier untill the resulting value matched my multimeter. I am sure DJ has a formula that is to be used, but I ended up with 0.09693

User-inserted image

Now I can monitor my battery level within ARC.

User-inserted image

Such a simple thing... but makes me happy to have worked it out:)

United Kingdom
#19  

Well done you

I didnt know there was a unit multiplier on the ADC control thats handy

Interesting to know if the measurement tracks correctly your battery voltage? I guess it must do and you should be ok to safely measure voltages up to 20 volts

Canada
#20  

So far it has matched my multimeter with anything I have used for power, 12v, AA battery pack and regulated bench supply (the voltage shown in previous pic).

Here it is all soldered up and shrink wrapped.

User-inserted image

Canada
#21  

Ah, but when I think I have it all figured out... It seems to display the voltage source correctly at a standstill, but when I run the H-Bridge the voltage counter goes UP while the multimeter goes DOWN ?

BIG EDIT blush I had set the port number to ADC7 when it should be ADC1... now it reads properly all around. But it is interesting that other ports should have such "quasi correct" but fluctuating readings when they aren't even hooked up to anything confused