Maker Pro
Maker Pro

Building a Current logger - quick question.

Tarsjan

May 1, 2017
2
Joined
May 1, 2017
Messages
2
Hello all, first post here on this forum. Thought i'd try getting included in some online forum where i could help for my projects but also help others where i can.

So was trying to build this current logger that i found in a blog post. Im trying to measure the current used by my raspberry pi and log the results to a file.

opamp.jpg


Now i have the programming part down and ive gotten the circuit to work , however i dont like using stuff i dont fully understand. What i dont completety understand about this circuit is why the Vref on pin 5 from the AD623 needs to connect to Arduino GND and 0V.

I just dont understand why i have to connect 0V from the load and its power supply to GND on the Arduino. I thought just connecting the .01 ohm resistor (Shunt) in series with the load and then using the voltage drop measured over it to calculate the current flowing would be enough ? What is it i dont understand ? Do i even understand anything ?
 

garublador

Oct 14, 2014
111
Joined
Oct 14, 2014
Messages
111
The output of the AD623AN is an analog voltage relative to pin 5 of the AD623AN. If there were no other reference then the Arduino wouldn't know what the actual voltage was and the output of the AD623 would be useless. That's why they gave that Vref pin, so you could potentially not connect up the grounds from the two systems and use that pin as the reference. However, according to the datasheet:

Because the AD623 output voltage is developed with respect to the potential on the reference terminal, many grounding problems can be solved by simply tying the REF pin to the appropriate local ground. The REF pin must, however, be tied to a low impedance point for optimal CMR.

Grounding problems tend to manifest in weird ways and can be difficult to debug, so connecting the grounds together would be preferred. Is there a reason you don't want to connect the Arduino ground to the Rasberry Pi ground?
 

Tarsjan

May 1, 2017
2
Joined
May 1, 2017
Messages
2
Hey thanks for you reply !

So what i have now is the depicted circuit in my previous post and an Arduino with a program i've written that calculates the current from the analog input value. I have tested it with a simple battery and lamp circuit and have gotten accurate and good readings. I am powering the arduino through USB becuase i am actively logging the current using serial communication.

To my PI i have a standard 5.1v / 2A DC power supply. What happens when i connect the power supply through my current logger circuit is that there is too much current beeing drawn (i have an amperemeter in series as well just for double checking). I quickly suspected this was some kind of ungodly GND short through the USB connection to my PC, and sure enough when i removed it and powered my Arduino with a battery, the power drain of the pi was back to normal. The problem of course now is that i would have to log the data to a SD card since im afraid to connect the USB.

Which is why i asked the initial question. Through feeling which wires was warm after i disconnected, it seemed that alot of current had gone through one of the thinner measuring wires, more specifically the one connected to pin 2 on the AD623 which is also connected to GND.

Maybe there is something obvious here that im not seeing ? maybe im an idiot for introducing a USB powered arduino board into this circuit ?
 

garublador

Oct 14, 2014
111
Joined
Oct 14, 2014
Messages
111
You may have to post pictures and schematics of the actual circuit you have made.

It could be some strange ground loop with the CPU USB and the power supply for the load. It could also be some error in the wiring.
 
Top