HELP! Measuring potential difference(V) for AC with Arduino

Hi guys!

I’m trying to build a device measuring the electrical resistivity of a paste (cementitious materials) using Arduino Uno. Four steel probes are put inside the paste (jumper wires attached to them). Two outer probes apply AC signals (Square signals- Frequency 1 kHz- Voltage(peak to peak)= 14 V) and two inner probes should measure the potential difference. Then the resistivity could be calculated by a formula (I cannot change this test setup). Please see the photos attached.

I managed to apply the desired AC signals, but the issue is with reading the potential difference (two inner probes) by Arduino. When I use a multimeter (set to AC mode) I read some values (voltage) which should be correct, but using Arduino as the same time I read different values! I cannot see why!

I use Arduino analogue pin (A0) to read values (other inner steel probe connected to the Arduino ground), convert it to voltage ( float voltage = sensorValue * (5.0 / 1023.0); ) and print it to serial monitor. I programmed Arduino to read values 10 times during a second and report the maximum value only. There is not even a relationship between values of Arduino and multimeter (Examples: (Multimeter: 0.712 V, Arduino: 1.15 V)-(Multimeter: 0.68V, Arduino: 1.10V)-(Multimeter: 0.67V, Arduino: 1.03V)). Can anyone tell me what modification to do to get correct value from Arduino?

I would really appreciate any help !

UPDATE:

To clarify what is happening I got an oscilloscope and repeated the test this time with sin waves (instead of square wave) with Vp-p = 10V… I modified the Arduino code to sample 2500 times during a second and report the maximum value… Now Oscope, MM, and Arduino give me three different numbers: Oscope(Vp-p): 2.5V, Multimeter: 0.7V, Arduino: 1.55V

The circuit is simple and I have attached the scheme. I will be grateful if you can comment on this and how these values are related. Thanks.

Arduino Code:

/*

ReadAnalogVoltage

Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.

Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

*/

// the setup routine runs once when you press reset:

void setup() {

// initialize serial communication at 9600 bits per second:

Serial.begin(9600);

}

void loop() {

// read the input on analog pin 0:

int sensorValue = analogRead(A0);

// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):

float voltage = sensorValue * (5.0 / 1023.0);

// print out the value you read:

float max_volt = voltage;

for (int i=0; i<2500;i++)

{

sensorValue = analogRead(A0);

voltage = sensorValue * (5.0 / 1023.0);

if (voltage > max_volt)

{

max_volt = voltage;

}

delayMicroseconds(5);

}

Serial.print(max_volt);

Serial.println(" V");

delay(1000);

}

Can the arduino analog inputs read AC voltage? I thought they could only read DC voltage. You might want to check the spec of the inputs your using.

They don’t like to be subjected to 14 volts either.

Valen:
They don’t like to be subjected to 14 volts either.

The voltage for inner probes is usually less than 4V. To clarify what is happening I got an oscilloscope and repeated the test this time with sin waves (instead of square wave)… I modified the Arduino code to sample 2500 times during a second and report the maximum value… Now Oscope, MM, and Arduino give me three different numbers: Oscope(Vp-p): 2.5V, Multimeter: 0.7V, Arduino: 1.55V

The circuit is simple and I have attached the scheme. I will be grateful if you can comment on this and how these values are related. Thanks.

Arduino Code:

/*

ReadAnalogVoltage

Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.

Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

*/

// the setup routine runs once when you press reset:

void setup() {

// initialize serial communication at 9600 bits per second:

Serial.begin(9600);

}

void loop() {

// read the input on analog pin 0:

int sensorValue = analogRead(A0);

// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):

float voltage = sensorValue * (5.0 / 1023.0);

// print out the value you read:

float max_volt = voltage;

for (int i=0; i<2500;i++)

{

sensorValue = analogRead(A0);

voltage = sensorValue * (5.0 / 1023.0);

if (voltage > max_volt)

{

max_volt = voltage;

}

delayMicroseconds(5);

}

Serial.print(max_volt);

Serial.println(" V");

delay(1000);

}

Jmartens2:
Can the arduino analog inputs read AC voltage? I thought they could only read DC voltage. You might want to check the spec of the inputs your using.

I’m definitely not an expert in this area but my understanding is that it can read the voltage instantaneously regardless of signal type as long as it is not higher than 5V. I did a modified test which I explained in last post, I will be grateful if you take a look at it and tell me of your thoughts. Thanks.

If you apply AC signals to it, doesn’t matter if they are square or sinewave, then they will have a negative part of the cycle. The digital inputs, or even ADC inputs, cannot measure negative voltages. They will just be considered 0 volt. Or worse negative voltages below the absolute maximum limit of -0.5 volt will blow up the pin. Yes, even -4 volt.

How about showing a picture of the oscilloscope plot. You say the signal has a peak to peak value. But what is the bias, or average level? I’m sorry, I don’t know how to explain those values. Looking at the images all I see is a bunch of wires jumbled on a table. What is lacking is information on how the multimeter is set up. Does it show max value? What resolution scale is it set to? Did you know that is usually measures the average of the signal, or the RMS value what is known as root (of sum of) mean squares. “Mean squares” being the square value of a deviation to the mean. [wiki. Also, you forgot to set the pin as input in the setup function.

p.s. In stead of showing just the max value, wouldn’t it be more telling to know what each value is? Then you can investigate better if there is some kind of distortion compared to the oscilloscope plot.](Root mean square - Wikipedia)