Battery Voltage with mpc3208 and Prop
s2jesse
Posts: 62
Ive seen a couple other people asking about battery voltage monitors and im messing myself... So here is what i have.
Im getting the basics but a ot of the·details escape me. Ive got it·"working" but im guessing it needs·some diode protection or some caps i dont know really.
Im using a voltage divider and measuring battery voltages up to around 15 volts...
Im using an extra pin i have free on my mcp3208 ADC.. my ref voltage is 3.3 volts on it....
my R1 Value is 10K
my R2 Value is 2700
Ignoring the %error in resistors this gives me a Vout of 3.3v when the Vin is 15.5222·and the amps are .0012
Question #1: Are those values ok... mainly is the amperage ok. Im just guessing you want it as low as the adc can take which i couldnt make out on the spec sheet for the mcp3208 a lot of it is still greek to me.
Now ive got it all working on the prop using some simple math. I can hook differnet batteries up and·I display the voltage pretty accurately when no load is on. It matches my multimeter etc.
Question #2: When i hook up a motor to the batter i drop from about 12.6 volts to 12.4 what exactly is happening here. Do i need caps to buffer or something? Ive got 0.1uf caps on the other side of the adc but dont know how to pick which caps if any to use on other.
Question #3: Im guessing·I need some sort of diode for protection because a couple times when connecting·the load and disconnecting my program glitched out. which im guessing im lucky didnt fry anything.·FYI this is for an rc applcation and will be used to monitor battery voltages for rc cars/ planes /heli etc
Thanks guys once i figure it all out hopeuflly with your help ill post a complete rundown on how to do this from a newbs perspective to save you pros from some of these basic questions in the future·[noparse]:)[/noparse]
Jesse
Im getting the basics but a ot of the·details escape me. Ive got it·"working" but im guessing it needs·some diode protection or some caps i dont know really.
Im using a voltage divider and measuring battery voltages up to around 15 volts...
Im using an extra pin i have free on my mcp3208 ADC.. my ref voltage is 3.3 volts on it....
my R1 Value is 10K
my R2 Value is 2700
Ignoring the %error in resistors this gives me a Vout of 3.3v when the Vin is 15.5222·and the amps are .0012
Question #1: Are those values ok... mainly is the amperage ok. Im just guessing you want it as low as the adc can take which i couldnt make out on the spec sheet for the mcp3208 a lot of it is still greek to me.
Now ive got it all working on the prop using some simple math. I can hook differnet batteries up and·I display the voltage pretty accurately when no load is on. It matches my multimeter etc.
Question #2: When i hook up a motor to the batter i drop from about 12.6 volts to 12.4 what exactly is happening here. Do i need caps to buffer or something? Ive got 0.1uf caps on the other side of the adc but dont know how to pick which caps if any to use on other.
Question #3: Im guessing·I need some sort of diode for protection because a couple times when connecting·the load and disconnecting my program glitched out. which im guessing im lucky didnt fry anything.·FYI this is for an rc applcation and will be used to monitor battery voltages for rc cars/ planes /heli etc
Thanks guys once i figure it all out hopeuflly with your help ill post a complete rundown on how to do this from a newbs perspective to save you pros from some of these basic questions in the future·[noparse]:)[/noparse]
Jesse
Comments
with this math the voltage results seem right on the money...
batt:= fMath2.FDiv((fMath2.FMul(fMath2.FFloat(vout), 15.5222·)), 4096.0)··
my biggest concern is just...if and what proection it needs as well as caps... also why they are needed etc [noparse]:)[/noparse] I still just dont grasp that end of it yet and i would LOVE to [noparse]:)[/noparse]
thanks jesse
·
When voltages change rapidly there can be high voltage spikes. You need a diode to funnel these spikes to the power rail. If you look up google "clamping diode" I think you may find sufficient info to implement it.
If you are using floating point I guess it doesn't matter. I just find floating point so cumbersome in spin that it seems easier to me to avoid it if possible. Setting the max to 20.48 volts means all you have to do is divide by 2 and you have the voltage in hundredths. It is a simple matter to display a virtual decimal point.
Post Edited (Erik Friesen) : 1/18/2009 3:19:53 AM GMT
I know this is an extremely general follow up question but what type of voltage etc are we talking about with emf with motors etc.
You can also use a zener or a tvs to clamp these voltages. In the case of emf I am not sure what steps are needed. I believe there is another thread with quite a bit of detail on emf started by phildaphil.
Q3 -- Probably when you connected the load you created a transient that got into the power supply to your measuring setup.· A capacitor, say 100 microfarads, on the Vdd might prevent that.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net
with additional allegro acs756 current monitoring chip.....
Im assuming that it will out put 0v at -100 amps and 3.3v at 100amps i couldnt really tell from the spec sheet for sure but thats what i gathered...
Is the 100uf cap in the right spot there?
any other glaring mistakes?
fyi this is for monitoring rc batter voltages and current.. the batt goesin the top plug and speed control on the lower plug.
thanks a ton
There was another recent thread with some discussion of battery voltage/current monitoring: http://forums.parallax.com/forums/default.aspx?f=25&m=319268
I have always used a shunt with an opamp for current, and a divider for higher voltages. Any reason you prefer the halleffect approach? When I've looked in the past, the hall efect sensors were a little pricey. This recent board from sparkfun closely approximates the setup I have used (except I used different an cheaper components): http://www.sparkfun.com/commerce/product_info.php?products_id=9028
the circuit for the board can be viewed on the linked datasheet Max(51.8V, 89.4A) and it is scaled for a 3.3V output - it is advertised for monitoring RC batteries
Not sure if this is helpful since I wasn't sure if you had a reason to use a halleffect sensor...