Hello I am having issues when reading the temperature values using pt1000. It seems to work properly till 30 degrees centigrade after that it doesn't respond properly. I am using lm358
This is the circuit diagram I am using.
I can also provide the code if needed. I am working on this for the first time so please help me out.
Kind Regards
Abdul Hadi
In post #10 the OP didn't say/write anything. Member EasyPeasy wrote this.
we all read post #12.
.. and there is a good reason why I underlined "OP´s".
But we all know that "want to use someone else's code" doesn't necessarily mean "they really used the same code".
Especially here in the forum.
A novice user may think that "a*10" is the same as "a*10.0"...but it isn't.
Inexperienced users don't know what to look out for. And we don't know if the OP is experienced or not.
There are so many possible errors: from simple typos to errors in adjustment (offset, range) to compiler setups, different pin assignments, different microcontroller usage and and and...
There seems to be an error and we need to validate the OP's information ourselves.
It's clear what he wants to do... but not what he actually did.
We don't need to validate the code of the "link" (neither the author reported problems nor any other person)
We need to validate the very OP´s code. Because first we have to guess that there is something wrong with what the OP did.
As said: if your car breaks down, bring your car to the workshop, not your neighbor's car and not the "owner's manual of your car".
OP, so that tells me the problem is not the PT100 and LM358, its your
A/D code / interface. And the fact there is an "abrupt" halt to reading
another clue.....
Regards, Dana.
--- Updated ---
In the code you used you declared the analog pin as an int,
but the analogRead() wants to see :
int analogRead(uint8_t pin)
Not sure this will make a difference, and compiler did not complain about your
code......maybe it converted type for you.....
Also good programming practice this :
float voltage = sensorvalue * (5.0 / 1023.0);
should be typed as :
float voltage = (float) sensorvalue * (5.0 / 1023.0);
Good compilers will do the conversion for you, but you never know unless you test
for this, so just good practice since you declared sensorvalue as an int.....or author did
of the code you used.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int PT1000_PIN = A0;
const float vt_factor = 1.88;//The relationship between temperature and voltage
const float offset =0;// Correction of temperature value
float temp_c;
void setup() {
lcd.begin();
lcd.backlight();
Serial.begin(9600);
}
void loop() {
int sensorvalue = analogRead(PT1000_PIN);// analog input in A0 of aurdino
float voltage = sensorvalue * (2.22 / 1050.0);// off set value / refrence resistance
temp_c = (((voltage * 100) / vt_factor) + offset);
Serial.print(voltage);
Serial.print(" V Temp: ");
Serial.println(temp_c, 1);
delay(300);
lcd.setCursor(0, 1); // set cursor to 2nd row
lcd.print("Volts: ");
lcd.setCursor(6, 1); // set cursor to 2nd row and colum 6
lcd.print(voltage);
lcd.setCursor(11, 1); // set cursor to 2nd row and colum 11
lcd.print("V");
lcd.setCursor(0, 0); // set cursor to first row
lcd.print("TEMP: "); // print out to LCD
lcd.setCursor(5, 0); // set cursor to secon row
lcd.print(temp_c );// print out the retrieved value to the second row
lcd.setCursor(11, 0); // set cursor to secon row
lcd.print("C" );
}
No. 1050.0 isn´t the reference resistance.
Originally it is 1023.0 and means the ADC resolution.
And to make it worse: even 1023 isn´t the correct value. It should be 2^10 which is 1024.
(I know many use the wrong value of 1023 ... why ever ... all datasheets I´ve seen use 1024).
and No. "2.22" isn´t the off set value. It is VRef and depend on your ADC and it´s setup.
No. 1050.0 isn´t the reference resistance.
Originally it is 1023.0 and means the ADC resolution.
And to make it worse: even 1023 isn´t the correct value. It should be 2^10 which is 1024.
(I know many use the wrong value of 1023 ... why ever ... all datasheets I´ve seen use 1024).
and No. "2.22" isn´t the off set value. It is VRef and depend on your ADC and it´s setup.
Thanks I will try changing it
However I have also found an alternative
Max31865 RTD to Digital Convertor
And I am extremely sorry for not giving you guys the proper Information...
Because my professor told me the issue is with your circuit not the code.
Again thanks for your help guys
Thanks Dana for your time