Need help with analog input for AttoPilot voltage & current sensor

I'm using this AttoPilot current & voltage sensor:

The sensor has three pins - one is ground, one is voltage, and one is current. I have the voltage & current pins each going into the arduino on analog ports 0 and 1. I am setting AnalogReference to internal, so I am sensing @ 1.1v. The voltage value is coming in -perfectly-. I am running off a 13.8v AC-DC converter, and it gives me the same results as my multimeter - about 14v. I have used an automotive fuse tester to test current running through the circuit, and it is saying there is 1.4A running through the sensor. The sensor should scale 89.4A to 3.3v, so the sensor's current line should be ~52mv. My multimeter is reading 55mV when I test right from the sensor, but when I test it after about 8 inches of wire it reads about 52mv. The arduino is sensing a value of about 30, or about 32mv.

Any ideas how I can get the arduino to match up with the readings of my multimeter at the source? I need to be able to run this sensor about 10 feet away from the arduino, so I picked up a shielded stereo audio cable - will that work or am I going to need something else?

Thanks for any info you can provide!!

-Bill

You can use that cable.

I wonder how your current is going.
The wires come from the AC-DC converter, and go to the sensor breakout board. From there on they go to the circuit ?

If you use the same AC-DC converter for your Arduino, there could be a ground current through the GND lines to the sensor. That current would influence the reading.
It is even possible that if you connect an computer, there is a current from the +5V to the computer, stealing current from the Arduino.

It would work if everything is seperated. If the load is for example a motor, and the Arduino has its own power supply.

I guess I didn't give much background on the overall setup of what I'm doing... so let me explain :slight_smile:

I am making a CarPC - it will eventually be running off of batteries in my car, and goes through a DC-DC power supply (called an M4-ATX, it's an automotive PC power supply). On the bench right now I am using a 15 amp AC-DC power supply plugged into the AttoPilot voltage & current sensor, which is then plugged into the M4-ATX power supply, which powers the computer. The computer is an Intel Core i5 box, and the arduino is plugged into one of its USB ports. The 3 pins from the AttoPilot are run directly into the arduino A0, A1, and GND pins.

I suspect that near the PC it is quite a noisy (electrically) environment, and that may be causing some of the issue. I'm also using regular male-male jumpers and not a shielded cable.

Originally I was having just a hell of a time getting anything useful from the setup, but the issue was that I was using the arduino plugged into my main PC to read the sensors, and the grounds were different (as you said), and it was causing the readings to be all over the place.

If you have doubts about electric noise, you could use the average of a few analogRead(). For example 3 to 20 samples.

If you use USB power, the Arduino gets something between 4.5 and 4.9V. So you should better use the internal voltage reference of the Arduino of 1.1V. I think you use that already, am I right ?

I still think that a ground wire problem could exist.
The current might influence the measurement.
The ground current can also flow via the USB bus, via the Arduino, over the ground wire to the AttoPilot.

So there is still a ground wire problem.
You could make a single ground point, or remove the ground wire from the sensor to the Arduino, or use a electrical seperated current sensing.
That's why those hall-sensors are so easy, they are isolated from the current.

But in a car, there is so much magnetic noise, they would not be reliable.

Yes, I'm already using the 1.1v internal reference. The current and voltages I am dealing with are significantly less than the 50 volts and 90 amps that the sensor puts out at 3.3v, so scaling down to 1.1v lets me get much finer resolution.

I'll definitely check to see if there is any voltage difference between the ground pin on the sensor and the ground pin on the arduino. If there is, that definitely means something bad will happen. :slight_smile:

If that is indeed the case, I'll see if I can just not plug in the ground wire and see what happens, or I will try and narrow down where the ground fault is. I would expect the incoming ground, M4-ATX ground, PC ground and USB ground to all be connected, but maybe not.

OK - I had some time to test tonight.

I checked the voltage between the AttoPilot ground and the actual ground wire that plugs into the power supply - its around 2mV.
Then I checked the voltage between the power supply ground wire and the USB shield wire - about 7mv. This is with the arduino disconnected from the AttoPilot sensor (because it could mask the ground loop).

THEN... I checked the voltage between the power supply ground wire and the arduino ground - and its 32mv. YIKES! And this makes no sense - I thought the USB shield and the ground should be exactly the same, but I guess not!

I took a wire with alligator clip ends, clipped one to the main ground wire, and another to the arduino ground pin, it drops the voltage difference down to 2mV. When I do this the accuracy of the reading gets better, though. Actually power supply usage is around 1.2A (I removed some stuff from the PC to make sure they weren't causing issues) and when I connect the ground wire the sensor reading goes from 0.4-0.5A up to .7-.75A.

Actual sensed voltage on the arduino is now 0.03v, my multimeter on it says 0.033v. The expected reading should be more like 0.045mv, so it definitely now seems like the ground issue is resolved, but I think my AttoPilot sensor is bad. :frowning:

With such small voltages, the AttoPilot could be less accurate. It is probably okay.

Even the Arduino's 1.1V is not exactly 1.1V. If I use an Arduino only at room temperature, I still have to change my calculations, to adjust for a slightly different internal reference.

Do you have a very good quality multimeter ?
The very cheap multimeters could be off by 10% or 20%, and even the average quality multimeters are not accurate to the last digit.

At least you found the problem. How will you solve it ?

Hello guys,

I just received my Arduino Uno and I wanted to make a curent monitor (i also have the LCD16x2) using the AttoPilor 90 Amp sensor which I had from another project.

I wanted to calibrate the code I'm using as the values don't match with the ones I measured with my multimeter, but I noticed something weird, if I power the board using the USB there are some values and the LCD looks ok, if I power the board from a 6v UBEC the screen leters look very dim and the shown voltages are higher ?

Why the values are changing when the power source is changing ?

Thank you .

PS. This is my first arduino project.