How to measure amps

geoff57

10 kW
Joined
Apr 25, 2007
Messages
752
Location
England
Hi
I know that to measure the amps coming from a battery you put a shunt on the negative wire and take measurements from both sides of the shunt, calibrate it using a meter you know to be accurate and there you have it, I have used a cycle analyst before.
My problem is what measurements do you take and how can that be fed into a micro computer like the Arduino.
It may seam like reinventing the wheel as we have the cycle analyst but I have some projects in mind that require this information in a form that can be further processed by the Arduino, the cycle analyst only gives information out visually and the box is too big for my project.
Geoff
 
well, as you know, you need to measure the voltage drop across the shunt to calculate amps.
so what you need to do is measure this voltage. since the arduino measures 0 to Vcc (about 5v) it wont tell you much directly about the milivolts you're trying to measure. you need an op amp.

I started to type more, but realized there are probably better articles, like this: http://www.vwlowen.co.uk/arduino/current/current.htm

search google for "current" instead of amps... it will give more results.
 
Most setups I've reverse engineered use an op amp to amplify the voltage across the shunt to get it into the right range for a microprocessor input. It's a pretty simple circuit. Normally the voltage across a shunt is too low to get an accurate reading going directly to a A/D input.
 
geoff57 said:
the cycle analyst only gives information out visually
Not true of all versions. The newer ones also output a serial data stream of the values chosen in CA's setup, as comma-delimited text, which can include the amps reading. See the http://ebikes.ca CA pages for what they'll output and how.
 
Hi
Thanks for the info, did some searching on you tube this morning and found a YouTube video on how to mesure current with the results going into an Arduino which is my final aim, I have several turnigy 130 power meters that have stopped working I’ll rip one apart and take out the shunt circuit, I’ll put at least 10a current across the shunt and see what the result is.
As for resolution Arduino a/d limit is 5v with a resoloution of 1024 use 1000 for easy calculations if i want to mesure a maximum of 100a with an Arduino each digit on the scale (if 1000used)would be 5/1000=0.005amp per unit if my calculations are correct weather the shunt I have will give me those results is a different matter if my math are correct then this resoloution is good enough for meas my controller is rated at 40a and so far has had a maximum draw of 2.5kw 72v, the bms is rated at 80a. I could probably get away with a measurement coverage of 0 to 50a this would give me greater resolution. A problem i could foresee is what if the voltage dose go over 5 v could a zenner diode rated at 4.9v be used to protect the Arduino and how would it affect the voltage coming out of the shunt.
Geoff
 
Yes, you can clamp the input with a zener (but I think there are diodes to the Vcc inside the chip too) and use a resistor in series with the input to limit the current. Not sure what the input resistance of those A/D inputs is, but it's pretty high. Something like a 4.7k in series should keep the diode from blowing up. You can also put a capacitor across the input to make a RC filter at the same time. The signal on the shunt will be pretty noisy. If you use an op-amp, you can do the same thing on the input to protect against over voltage.
 
The shunt resistor I’ve got to play about with is 0.5mR ohm 5% is there a way to work out what voltage output I would get with 60 amp going through it at a voltage of 72v.
Geoff
 
V=IR
60A through a 0.5 ohm resistor will drop 30V across it and dissipate 1800W. This will result in instant smoke.

You need something more like 0.005 ohms.
 
Hi I did not read the markings close enough I did edit the previous post the shunt has a value of 0.5mR 5% tolerance it is used on a power meter that can handle 180a at 60v.
Geoff
 
geoff57 said:
use 1000 for easy calculations if i want to mesure a maximum of 100a with an Arduino each digit on the scale (if 1000used)would be 5/1000=0.005amp per unit if my calculations are correct weather the shunt I have will give me those results is a different matter if my math are correct then this resoloution is good enough for meas my controller is rated at 40a and so far has had a maximum draw of 2.5kw 72v, the bms is rated at 80a. I could probably get away with a measurement coverage of 0 to 50a this would give me greater resolution. A problem i could foresee is what if the voltage dose go over 5 v could a zenner diode rated at 4.9v be used to protect the Arduino and how would it affect the voltage coming out of the shunt.
Geoff

I think you're calculating the wrong thing there. If you want to measure 100A and you have a resolution of 1000, you would get 100A / 1000 = 0.1A per unit. This is assuming that your shunt measurement gets scaled nicely so that the shunt reading goes from 0-5V.

You could use a zener diode for protection, but they have a soft turn-on, so a 4.9V zener would start conducting at less than 4.9V and the voltage could rise to 5.5V or more before the zener can really clamp it. It would be more effective if you used a lower voltage zener, like 4.1V, but then you wouldn't be able to use the full range of the ADC.
 
Hi
I’ve been hard at work with the soldering iron.
I made a simple circuit with a 36v(10s lipo) battery as a source and a bank of 50w car head lamps as a load, I put a reference power meter in there to mesure amps and volts a second shunt with wires coming off it that can be eventunatly used with an Arduino,for now I just but a volt meter on the wires.
The results were as follows from the power meter amps = 13.08a at 39.25volts
The volt meter on the test shunt was giving a result of 0.0073v across the shunt.
Looks like I will need a multiplier of some form.
Given I want a range up to 80A with the option to alter to improve range or resoloution it looks like an opamp will be needed can anyone suggest one.

Been watching more videos on YouTube looks like the best way is to use an external dedicated a to d converter the range of the input can be altered to better suite the input from the shunt, Arduino code is included in the video have put a few on order.


geoff
 
I misread your post about the shunt resistor. 0.5 milliohms would be more like it.

At 100A, this would be a drop of 50mV. To make full use of the A/D resolution, you'd want to amplify this by x100 to get 5V full scale.

There are a bunch of chips out there made specifically for this, but with a few resistors, pretty much any op amp with RR inputs will work. LM358 seems to be popular for this application and is dirt cheap.

There are several circuits you could use, but the simplest one is a single ended inverting amplifier. Looks like this:

sense amplifier.gif

If the amplifier is powered by the same 5v supply as the microprocessor, then there is no danger of the input to the processor going over the limit.
 
Hi Since your previous post I started looking through YouTube for relevant videos. A guy has done a whol load of videos for measuring current using a shunt and an Arduino, he discussed the problems between the voltage across the shunt and the 5v limit of the Arduino.
First he came up with a opamp on a chip then he decided the best solution was a separate ADC with variable limits the board has an a to d converter with 2K resoloution if I can get the voltage range down to about 0to 0.6 volts I will get excellent results I’ve put on on order should be with me in a few days then I will find out just what it can do.
Geoff
 
Hi
The shunt I had was a one off taken out of a turnigy 130a watts up type meter that had stopped working.
I’ve found some sad resistors that I think will do the job they are 0.5mohm 3w about 5mm x10mm.
Maximum load would be 80a at 10v typical would be 40a at 72v approx 2.5kw.

Kendrick
 
geoff57 said:
Hi
The shunt I had was a one off taken out of a turnigy 130a watts up type meter that had stopped working.
I’ve found some sad resistors that I think will do the job they are 0.5mohm 3w about 5mm x10mm.
Maximum load would be 80a at 10v typical would be 40a at 72v approx 2.5kw.

Kendrick

At 50A, the dissipation would be 1.25W, so a 3W rated one will be good.
 
Back
Top