Measuring current with arduino uno

Hey

I try to measure current with hall-sensor amploc 25A, it sense magnetic-fields, offset voltage is 2.5V and I use arduino uno.

I get 519 value from analog pin and 37mV/A is hall sensor sensitivity.

My formula is outputValue = ((((sensorValue*5000.0)/1023.0)-2500)/37

multimeter shows 0.112amps when I put load but I dont gett correct value on LCD

Is my formula OK?

The formula should work in general, but the values in it don’t. That is probably because you are assuming the offset voltage is exactly 2.5 volt, and the sensitivity is 37mV/A. In reality it might be slightly different from what the datasheet may tell you. Aside from that, the analog reference of the arduino depends on the voltage regulator. And that likely outputs something different from exactly 5 volt.

Instead, measure the reference voltage at pin Aref with a multimeter and replace the 5000.0 value. Then I would measure the value for when there is no current (disconnected load), and calculate the offset value by re-arranging the formula. The the sensitivity of 37mV/A falls out of significance as the output value should be 0 amps. offsetVoltage=sensorValueNoCurrent*RefVoltage/1023

Then after the offset and reference value is set you can calibrate the sensitivity by applying the load and measure the output value for a known current. And calculate by re-arranging the formula with known values. BUT!,your measured current is far too low to do this. It’s at 0.5% of the sensor’s full scale. That’s about the measurement inaccuracy of the Arduino’s ADC. I don’t know what your current meter can handle, but I would expect more reliable values of the sensor when you apply 10 Amp through it. You may want to consider buying a sensor that has a smaller amp range. BEWARE though, applying this much current into a cheap meter might kill it and cause fire risks. Even it it says it is rated for it.