Hi,
I have a circuit which consists in a wheatstone bridge where one of the resistors is a two wire RTD for measuring temperature.
On the arduino analog pins, the difference in voltages relative to ground on the bridge is 0.17 Volts.
When I measure the voltages with my multimeter I read 0.1 Volts which seems more accurate because when I convert the value to temperature I get a more reasonable value.
I know that the multimeter internal resistance and the arduino's are different.
How can I asdjust the value on the arduino to be more similar to the real value ?
Thanks,
Regards
Please post your code, and a schematic of the bridge and the Arduino connections to it.
And a photo of your setup.
Hi,
At the moment I cannot upload a picture of the physical setup, but I am attaching an image with the connections I have on the circuit on the perforated board.
Each resistor R has the value 1000 Ohms, and the RTD is rated at 1000 Ohms at zero degrees celcius.
I didn't mention before but I am getting the arduino A0 and A1 pins from a shield (Velleman VMA205) that does Wifi. I use it to send the temperature values to a linux host that in turn inserts them in a MYSQL database.
I could arrange a reference value to adjust the value I get from the sensor (like measuring the temperature with a thermometer and adding/subtracting the difference to the value I get on the analog pins), but I wanted to know if there is some other way of getting a more accurate value.
Thanks,
Regards
Use the internal reference of the MCU. You'll have to change a few parameters but its more stable.
If I do that, the reference will be either 1.1V or 2.6V (Depending on the board), and I am powering the circuit with the 5V from the Arduino.
What ranges of values will I get on the analog pins ?
Most any range you want by using a voltage divider. For best results use precision resistors and in your calculation use the actual resistor values.
Voltage Divider Calculator (ohmslawcalculator.com)
Say you set a 2.6v reference. Put your output voltage to 2.6. I use 10K for R2, 5V for the input , calculate. And you'll find a 10ishK works.
Here is an example of code I use to measure volts used on a ESP32.
void fReadBattery( void * parameter )
{
float adcValue = 0.0f;
const float r1 = 50500.0f; // R1 in ohm, 50K
const float r2 = 10000.0f; // R2 in ohm, 10k potentiometer
float Vbatt = 0.0f;
int printCount = 0;
float vRefScale = (3.3f / 4096.0f) * ((r1 + r2) / r2);
uint64_t TimePastKalman = esp_timer_get_time(); // used by the Kalman filter UpdateProcessNoise, time since last kalman calculation
SimpleKalmanFilter KF_ADC_b( 1.0f, 1.0f, .01f );
TickType_t xLastWakeTime = xTaskGetTickCount();
const TickType_t xFrequency = 1000; //delay for mS
for (;;)
{
adc1_get_raw(ADC1_CHANNEL_0); //read and discard
adcValue = float( adc1_get_raw(ADC1_CHANNEL_0) ); //take a raw ADC reading
KF_ADC_b.setProcessNoise( (esp_timer_get_time() - TimePastKalman) / 1000000.0f ); //get time, in microsecods, since last readings
adcValue = KF_ADC_b.updateEstimate( adcValue ); // apply simple Kalman filter
Vbatt = adcValue * vRefScale;
xSemaphoreTake( sema_CalculatedVoltage, portMAX_DELAY );
CalculatedVoltage = Vbatt;
xSemaphoreGive( sema_CalculatedVoltage );
/*
printCount++;
if ( printCount == 3 )
{
log_i( "Vbatt %f", Vbatt );
printCount = 0;
}
*/
TimePastKalman = esp_timer_get_time(); // time of update complete
xLastWakeTime = xTaskGetTickCount();
vTaskDelayUntil( &xLastWakeTime, xFrequency );
//log_i( "fReadBattery %d", uxTaskGetStackHighWaterMark( NULL ) );
}
vTaskDelete( NULL );
}
If you notice I use a Kalman Filter to smooth the readings.
Updating the process noise before each reading, improves filtering.
KF_ADC_b.setProcessNoise( (esp_timer_get_time() - TimePastKalman) / 1000000.0f ); //get time,
Oh. I found that if R2 is a !)K pot, you can zoom in that reading.
Bu the output voltage cannot be set. The principle I am using is :
I read the voltages in A0 and A1, and then subtract them. this difference is then used to calculate the Resistance in the RTD.
Each side of the circuit is already a voltage divider and I am reading the voltage in the center point between each pair of resistors. If the reference voltage for the Analog Pins on the Arduino is 5V and I change them to be 1.1 or 2.6, I suspect I will get values in those ranges.
How does that improve the accuracy of the readings ?
Sorry, I tried.
Hi,
You are using a bridge to measure the changes in the RTD1000.
Why not use a ADC designed for this job?
Google;
arduino hx711 wheatstone bridge
It is designed just for your application.
It does ALL the differential calculations and uses a a library for your code and uses digital comms.
Tom..
So you are suggesting I gety a Hx711 IC, that is an amplifier followed by a 24 bit ADC.
Using a 24 bit ADC instead of the arduino's 10 bit ADC ?
Yes, get a ready built breakout/module and you have it all.
Not so much the 24Bits, its the stable and controlled voltage conditions supplied to the bridge by the module and 711 independent of the Arduino's voltages and currents.
Tom...
Thanks for the tip. I will investigate that possibility.
Is your sensor is a platinum RTD? If so, what resistance range are you expecting.
One of the first things I learned in college was never subtract two large number to find a small number.
The first thing I would do is calculate the A0 and A1's for you expected range. Look at the numbers to see if the Arduino has the resolution you require.
I really don't know. What is that ? I have a two wire RTD.
the RTD is a PT1000, which means that at zero degrees celcius its resistance will be 1000 Ohms.
At that point A0 and A1 should read the same voltage and the difference will be zero.
I measure A0 and A1, what I calculate is the resistance on the RTD to know its value according to environment temperature. Then using a lookup table, I find the temperature that corresponds to that resistance value
Hi,
You can also google;
arduino pt1000
There are some boards ready to go for PT000 temperature sensors.
Their libraries may also do the resistance to temperature conversion for you, simple.
Look here;
Tom...
What you say is correct. However Lets go back to your original post.
On the arduino analog pins, the difference in voltages relative to ground on the bridge is 0.17 Volts.
When I measure the voltages with my multimeter I read 0.1 Volts which seems more accurate because when I convert the value to temperature I get a more reasonable value.
Can you post the multimeter voltage of A0 to common and A1 to common (aka ground)?
BTW the board @TomGeorge suggested is really the best way to go.
John
measured with the multimeter is around 2.5 Volts, which is expected because all the resistors and the RTD are around 1000 Ohms and the supplied voltage to the circuit is 5V from the arduino.
Its the "around 2.5 Volts" that is of concern. Still a 0.07 volt disparity is excessive.
I would:
- Print out the raw A/D counts for both A0 and A1.
Print them for more that a few seconds to see if the readings are stable.
It would be best to use the IDE Serial Monitor if you can. (simple is best for troubleshooting) - with your voltmeter measure the A0 and A1 voltage right at the board.
- Also measure with your voltmeter the 5V right at the board.
- Don't change the reference (for now).
These numbers should allow the error source to be found.
Hi,
If you have long leads to your bridge, even if you don't, place 0.1uF capacitors from each A0 and A1 to gnd.
Can you please post a picture of your project?
Can you please post a circuit diagram?
Just a pen(cil) and paper one would be fine.
Thanks.. Tom...