MCP3208 and Battery voltage measure.
jtilghman
Posts: 67
I am trying to use a MCP3208 to measure the battery voltage for a project I am building using a propeller USB board.
My problem comes in this, as best as I understand it the MCP3208 will give a reading 0 to a max 4096 based on a given voltage VS its reference voltage.
How do I measure a battery voltage, using the battery as a reference voltage all the while powering said circuit and while the battery voltage is falling from being used ?
Would i use something like a voltage booster to maintain a steady max reference voltage ?
Thanks,
jt
My problem comes in this, as best as I understand it the MCP3208 will give a reading 0 to a max 4096 based on a given voltage VS its reference voltage.
How do I measure a battery voltage, using the battery as a reference voltage all the while powering said circuit and while the battery voltage is falling from being used ?
Would i use something like a voltage booster to maintain a steady max reference voltage ?
Thanks,
jt
Comments
With some more information, like what your expected range of input voltage is, what your reference voltage is, and what the output (format/precision/etc) you want is, we can help you more with a circuit and some math.
I would love to show you a circuit or two, but i haven't really drawn anything up yet.
What I can tell you is that I am using this battery: http://www.batteryplex.com/powersonic.cfm/m/PS-640-F1?gclid=CPGIh_-fvrYCFQfqnAodazMA4Q with this prop board: http://www.parallax.com/Store/Microcontrollers/PropellerDevelopmentBoards/tabid/514/CategoryID/73/List/0/SortField/0/catpageindex/2/Level/a/ProductID/878/Default.aspx
I am not sure the voltage divider, I know I need to get the battery voltage down in a range for MCP3208. But I am not to sure why i couldn't just run a tap from the battery to the MCP3208 Vref and use 6 volts as the ref. then 4096 would be battery full and 0 would be flat dead. Also not sure where the usable voltage level would be, the prop only needs 3.3 to run but my motors (Stingray Chassis and Motors) can use up to 7.2.
My 1st time with these types of questions so that's why i am asking here.
That battery is rated at 6V, but that is just its nominal voltage, they can go higher (probably ~7.2V is "full").
You can operate the ADC at 3.3V (same as the Propeller), and if you got a 2.5V precision reference, then ran this voltage divider: BAT-R1-R2-GND. Where the ADC channel is connected between R1 and R2, and R1 is 22K-ohm and R2 is 10K-ohm, You would put a load on the battery of only 0.2mA, and could measure the battery voltage from 0V to 8V, and have a precision of 2mV.
Once you get the ADC channel's value, you divide by 512 to get the actual voltage of the battery. The actual math will be a little different because you will be working with integer math on the Propeller.
An example would be if the channel's value is 2100, the battery's voltage is 4.10V.
To get the best possible result with this circuit you could measure the battery voltage (fully charged) with a multimeter and use that along with the measured voltage from the ADC to obtain the most accurate calibration factor.
Do you really need perfect resolution looking at the battery voltage?
And, if you use a voltage divider, you'd have to use really good resistors to make it accurate and not sensitive to temperature...
I think I'd start with just use the Prop's 3.3 V Vdd as reference and two regular 10k resistors for the divider..
I agree that for battery charging circuits using the 3.3V regulated supply is more than adequate, and 12 bits is overkill. Even an 8 bit ADC would do the job. On the other hand a 12 bitter is not much more than an 8 bitter so for low volume or one of projects it may be better to stock fewer parts even if they are over spec for some projects.
For the divider two 10K resistors will give a range of 0 to 6.6V which may not be quite enough if the purpose is to control the battery charging.
My goal here is only to know and alarm the robot that the battery is low, not to recharge it. This is a lead acid gel cell and I don't feel like it's a good idea for me to try and build a charger at this stage.
I have a store bought charger to recharge the battery with for now.
The reason for using the 12 bit ADC is simple, its what I have on hand and I will be using the other inputs for other sensors at some point.
I was thinking of getting fancy and having a LED bar graph display the running voltage like a gas gauge.
But I will take just being able to tell when the battery needs a recharge, at some point when I understand better I would like to current readings for the motors and other senors for kind of robot health check dashboard.
Hope this puts things into scope.
Thanks,
JT
Thanks, i will let you all know how it goes.
JT
Good luck with the project.
BTW, if you only want to use the ADC and a led bar graph as a fuel gauge there is no need to convert the reading to a voltage. Store a table with one value for each led in the bar graph and light that led when the reading is equal to or greater than that value, and less than the next value if you want only one led lit at a time.
If you're looking at 12 V, maybe 15 V is the biggest you could expect...
If you use a 2k and a 10k resistor, that should bring it down low enough...