I am trying to measure the voltage across the battery in a motorcycle. I have used a voltage divider driving a unity gain Op Amp and plugged the output of the op amp into an analogue port on a Mega 2560. I then calibrated it and it works fine. Until I put a load (bulb) across the battery. I am assuming the effect of the resistance of the bulb (being effectively in parallel with the voltage divider) is affecting the voltage out from the divider.
Is there a better way for me to measure the voltage across the battery.
The Op Amp was suggested by a colleague at work who said it would remove any impact of the Arduino's analogue port impedance so I thought I would give it a try. But the problem I am having is the same whether the Op Amp is in circuit or not.
When there is no load on the battery and my meter says 6v the Arduino agrees. If I substitute a 4.5v battery the Arduino still agrees as it does when I use a 9v battery. So I am happy with my calibration.
But if I use the 6v battery and then stick a bulb across the battery terminals I gets 5.6v on the meter but 4.9 on the ?Arduino. With my limited understanding of electronics I am assuming this is because the resistance of the bulb is effectively in parallel with the voltage divider resistance and therefore changing the characteristics of the voltage divider.
The problem is if I put a bulb across the battery then the relationship of Vo to Vin changes.
How? Where are you connecting the bulb? If the bulb goes between Ve and Gnd, the relationship between Vo and Vin (presumably ve in the diagram) doe not change. The actual value of Vo will change, as ve drops while supplying the load demanded by the bulb, but, presumably that is what you are trying to measure.
I am assuming this is because the resistance of the bulb is effectively in parallel with the voltage divider resistance and therefore changing the characteristics of the voltage divider.
This is a wrong assumption.
What is happening is that the bulb is taking more current than the battery can supply and so the battery voltage is actually dropping. Try a lower wattage bulb and see or measure the current through the bulb. Also try a fully charged battery.
I understand what you are saying but the battery is fully charged and the bulb in question is a bulb of the type used on the bike.
I have calibrated the circuit and the Arduino using a 4.5v battery and a 9v battery.
The problem is if I put the 6v battery in circuit and measure the voltage with my DMM then I get 6.2v. The display on the Arduino agrees. If I put the bulb across the battery (with it still in circuit) the voltage drops to 5.4v on the DMM but to 4.9v on the Arduino display,
This is why I think the resistance of the bulb being in parallel with the voltage divider is influencing it somehow.
I have calibrated the circuit and the Arduino using a 4.5v battery and a 9v battery.
The problem is if I put the 6v battery in circuit and measure the voltage with my DMM then I get 6.2v. The display on the Arduino agrees. If I put the bulb across the battery (with it still in circuit) the voltage drops to 5.4v on the DMM but to 4.9v on the Arduino display,
You really need to show your "calibrated" code. How does what the arduino is reporting compare to Vo/gnd as measured by the multimeter?
Why not start with checking your calculations (how you convert from an analog value to a voltage)? If your circuit is ok there really isn't much else that can be wrong.
A bit more research has shown me that the voltage I am getting from the divider is about .5v less than I am calculating. This is without connection to the Arduino. So I will remake the voltage divider on stripboard and not breadboard as I am currently doing.
It is fast becoming obvuous that the problem lies with the voltage divider itself.
A bit more research has shown me that the voltage I am getting from the divider is about .5v less than I am calculating.
Well yes, calculations get one in the ball park, but measuring the actual values is the only way to see what the actual output is when using parts that probably have a +-10% accuraccy.
The strange thing is I am getting 0.5v difference when calculating using actual measured resistance. There is obviously some "hidden" resistance in there somewhere!
Well, in electronics things generally "work the way they are wired". I suspect you have bad wiring, or more probably bad code since no code has been provided.
BenF - No the resistors are in the Mega Ohm range, At this point I am trying to figure out why I am getting voltage readings which are not what I calculate they should be so the Arduino is not connected.