Current measurement - How would you do this?

eddydde

Member
As part of a much larger project using a 18X device I am wanting to measure voltage from a 50 Amp shunt.
Shunt is 0-50mV for 0-50 Amps. Shunt is isolated from PICAXE device.
I am not after detailed information just some pointers.
I will use an AXE033B to display the results. Not after high degree of precision.
eddydde - from the land downunder!
 

inglewoodpete

Senior Member
The limitations when measuring just 50mV with a 5v PIC or PICAXE is that, even when using the high-res ReadADC10, you read 5v/1024steps or about 5mV per step. That gives you 9 or 10 values 0-8 or 0-9. Is that level of precision OK?

Your other option is to use a 5v rail-to-rail op-amp (I use MCP6021) to amplify the 0-50mV to something bigger and better.

(Also down under - on the left-hand side:))
 

eggdweather

Senior Member
The shunt voltage is too low, you’d need to amplify/multiply it by x80 through x100 to get the best range from the Picaxe ADC 0-1023 input range. Noise may be a problem too, so some filtering necessary.
 

hippy

Technical Support
Staff member
The value read from "READADC10 pin, Nadc" is as follows -

Nadc = Vin * 1023 / Vpsu

That can be rearranged to determine what the Vin was from Nadc -

Vin = Nadc * Vpsu / 1023

Which is approximately -

Vin = Nadc * Vpsu * 64 / 65536

Vin = Nadc ** (Vpsu*64)

So, if you have used an op-amp to change your 0 to 50mV signal to be a 0 to Vpsu signal, you will get a Nadc value between 0 and 1023 which gives a calculated Vin of 0 to 5. If you use -

Vin = Nadc ** (Vpsu*6400)

That will give a calculated Vin of 0 to 500 which represents the original current of 0.0A to 50.0A in 0.1A steps.

You could go to 0.05A steps using (Vpsu*12800). Wanting greater resolution and the maths will be quite a bit harder.
 

AllyCat

Senior Member
Hi,

You can increase the sensitivity by reducing the ADC Reference voltage (which is the full supply voltage by default) by using the ADCCONFIG 2 command and the internal "Fixed Voltage Reference". Then setting the FVR to 2 volts (with FVRSETUP FVR2048 will increase the READADC10 sensitivity to 2 mV per digit. It's not "recommended" by Microchip, but in practice you can use the 1 volt FVR1024 which will give 1mV (or one Amp) per digit input, which might be "good enough".

Beyond that, it depends if you want to measure smaller changes in current or more accurate values near to "zero". A "rail to rail" Op Amp with a gain set between +10 and +50 will certainly give a better resolution of changes in current, but getting the display to read zero when there is no current flowing is much more difficult. You need to look at the specification of the (maximum) "Input Offset Voltage" of the Op-Amp, because that gets multiplied by the "gain" of the amplifier and upsets the values measured around zero output.

Of course you can "fake" the zero reading by the software displaying any measurement of under perhaps half an Amp (or mV) as zero. This seems to be a trick used by the manufacturers of some of the cheap digital panel meters, but of course means that you still won't get any useful measurement of low currents.

Cheers, Alan.
 

techElder

Well-known member
Astounding as it seems, :D there's been no mention or question of whether the OP is measuring DC or AC with the shunt. :D

With that low resistance shunt, then you will have to be very careful with shielding and lead length.

If AC, you get into converting to DC while also amplifying the shunt's output.

Another solution is using one of the integrated solid-state solutions available such as this one from Infineon.

Here's a list of current measurement devices from the Ocotopart library.
 

tmfkam

Senior Member
One item that I've mentioned before but is worth mentioning again is the FHS 40-P from LEM. This is a hall effect current measuring device, with an output that swings above and below the centre of the supply rail meaning it can measure AC (up to around 10kHz) or DC in either direction. With a 5V supply and no current flowing, it sits at 2.5V, when current flow is detected the output voltage increases or decreases depending on the direction of the current flow. The current is detected from the magnetic field generated in a conductor (this could be a thick PCB track or a wire placed in close proximity to the device) which means that large currents can be detected without a need for a shunt resistor and provides absolute isolation from the supply that is being monitored.

I used this in a Watt Meter using a PicAxe that measured up to 25A. The device was so sensitive that I considered using it as a compass, I could see from the offset on the output whether the device was orientated North/South or East/West. As I was measuring the Voltage (to calculate power) I had a self calibration routine that zeroed the output if the incoming Voltage was nil. No Volts should mean we have no current.

They are fabulous devices, very easy to use, lower currents can be measured with greater accuracy simply by incorporating a few turns of wire around the device to create a larger magnetic field.

View attachment fhs 40-p sp600.pdf

I have deleted a few pages from the datasheet to make it small enough to upload. DigiKey have stock and the full datasheet.
 
Last edited:

premelec

Senior Member
From the LEM URL: [up to 100 amps mentioned]

Miniature
IC SO8 packaging for SMD automatic assembly
Non-contact AC&DC current measurement of up to 70 A and higher
Attractive low price
Isolated measurement
Unlimited possible application designs
High performance gain and offset thermal drifts
5 years warranty
Operating temperature range: -40°C to +115°C (125°C with derating)
 

tmfkam

Senior Member
The OP did mention 0 to 50 amps.
The sensitivity can be changed to suit any given current flow in either direction (more or less sensitive) either by increasing the magnetic field which will allow lower currents to be detected or decreasing the magnetic field to prevent large currents from saturating the sensor.

This can be done with an increased number of turns of conductor around the sensor which will increase the sensitivity to lower current flows, or reducing the magnetic field by increasing the distance from the monitored conductor to the sensor making it less sensitive.

The full datasheet provides several examples of this. I arranged for three loops of 1mm solid core copper to be inserted into my PCB which wound around the sensor as I only needed to detect up to 25A.
 

AllyCat

Senior Member
Hi,

If you get an 050U or 100U reference (Unidirectional) , ..... If 050B, (wich is Bidirectional) .....
I didn't know that, but then I would probably have used a 0.001 ohm resistance. ;)

I wonder what the OP is using, since he hasn't posted anything since #1 ?

Cheers, Alan.
 

newplumber

Senior Member
Hi

If 050B, (wich is Bidirectional) 0A will be at Vcc/2. So you will have to accomodate for that.
okay so if I do buy cjmcu-758-050B I can use it for AC and DC? or just AC? Also I don't understand (as usual!) 0A will be at Vcc/2?
also would you use pin OUT1 or pin OUT2 on the cjmcu
 

inglewoodpete

Senior Member
okay so if I do buy cjmcu-758-050B I can use it for AC and DC? or just AC? Also I don't understand (as usual!) 0A will be at Vcc/2?
also would you use pin OUT1 or pin OUT2 on the cjmcu
0A giving Vcc/2 suggests that the device will handle current in either direction.

An example: assume that Vcc is +5v. With no current being measured by the device (Ie 0A), the output will show Vcc/2 or 2.5v.
  • A positive current (current flowing in one direction) will cause the output voltage to rise from 2.5v towards Vcc (5v).
  • Similarly, a negative current (flowing in the opposite direction) will cause the output voltage to fall from 2.5v towards 0v.
The bidirectional device is more suited to measuring current flowing in either direction (Eg charge and discharge of a battery). However, it should be possible to measure an AC current by rectifying the output of the device, referenced to Vcc/2 (2.5v). An op-amp + rectifier in the feedback loop would make this possible.
 

eddydde

Member
Hi,



I didn't know that, but then I would probably have used a 0.001 ohm resistance. ;)

I wonder what the OP is using, since he hasn't posted anything since #1 ?

Cheers, Alan.
I have not made a decision yet. At age 75 the brain is not as good as it use to be!
Still trying to come to terms with some of the code posted. Certainly leaning to a current measurement device.
Eddydde
 

BESQUEUT

Senior Member
Shunt is 0-50mV for 0-50 Amps. Shunt is isolated from PICAXE device.
How is that possible ? Can you publish schematic please ?
okay so if I do buy cjmcu-758-050B I can use it for AC and DC?
YES, Till 100 kHz, but Picaxe can do far less than that... IHMO, 50 Hz is possible with a Picaxe, more : I do not know...
or just AC?
B version will also work for DC, but there will be 512 steps for 50A, so 0,1A per step. With a U version, 1024 step, so each step is 0,05A
Also I don't understand (as usual!) 0A will be at Vcc/2?
Explained by inglewoodpete at #19. We can also say that READADC10 will be 512 for 0A, 513 for 0,1 A, 514 for 0,2A...
If reverse direction :
511 for -0,1A 510 for -0,2A, ...
also would you use pin OUT1 or pin OUT2 on the cjmcu
Excellent question ! Did not saw that because I directly used the CJMCU-758 and there is only one output !
But here you can see an OP-AMP on the back... So I guess that one output is direct from the CJMCU, the other from the OP-AMP. IHMO, you'll have to try both, but should be the same thing.
 
Last edited:

newplumber

Senior Member
Thanks Besqueut, inglewoodpete...when I have them in hand I will try them out and hopefully get good results
 

PieM

Senior Member
Sensitivity of ACS758LCB-050B is 40mV/A - (0.125A by step @ Vcc 5V) ,
ACS758LCB-050U-PFF-T : 60mv/A - (0.083A by step)
pin OUT2 is the AOP follower output.
For AC measurement see tutorial
[h=2][/h]
 

newplumber

Senior Member
Thanks PieM I'm slowly studying how it works


So if a person would use two ACS758LCB-050U-PFF-T ....one for no load just read rms
and one for a load ...even if the voltage isn't so stable say 118 to 121Vac then maybe the
read out of current would be more precise ? or maybe it wouldn't work.
 

premelec

Senior Member
While you are looking up stuff try "power factor" - when peak current and peak voltage of an AC waveform do not coincide... [on resistive loads no problem... ;-0]
 

BESQUEUT

Senior Member
Not after high degree of precision.
And we do not know if it's DC or AC current...
....one for no load just read rms
If no load, current will be zero (RMS or not...) :)
even if the voltage isn't so stable say 118 to 121Vac then maybe the
read out of current would be more precise ? or maybe it wouldn't work.
If the voltage is sinusoidal but variing, there a great chance that current will vary accordingly.
But RMS current may also vary if stable voltage, but differents wave forms (if load is not only resistive of course).
 
Last edited:

newplumber

Senior Member
If the voltage is sinusoidal but variing, there a great chance that current will vary accordingly
its a good thing you guys are smart ...when I get them in hand I will test them out (the wrong way)
and be back rereading the small print stuff but thanks

@premelec "power factor" is a big word for me ...so yes I will keep learning what it means
 
Top