I'm fairly new on the arduino subject or electronics overall so I would really need help on this one.
I have a temp sensor (PT100 with 2 wires). In order to read the value I would do the following:
One wire goes to ground
second one goes through a resistor to 5v and A0(analog_input).
right?
I used 220ohm resistor. If I get it right now, arduino reads voltage on it's analog pins?
When I look at PT100 datasheet or use this page for an example: http://crivens.dyndns.org/project_pages/electronics/pt100.html
I can say that resistance for 100degrees is 138.500005. so:
Vout=Vin(R2/R1+R2) = 2.78
If I'm right so far then how can I get that reading back into degrees?
I may be completely off with my physics and math so any kind of additional explanation is welcome
the values I get with these are around 378 or so. It doesn't make any sense at the moment. I'm probably doing something very wrong
would changing the resistor to 10kohm would change it? or should I use float instead of int?
yes it's working as it should.
and I can see I have accidentally pasted a wrong bit of code. Since it's only a part of a longer code I copy-pasted the sensor part.
templimit is something that should not have been there
Also wanted to say that I used map function to translate those readings back to degrees. I have a laser temperature gun to check the actual temperature against the value of the sensor which I get in the serial monitor. For an example:
Yes, it is still a bit confusing, but if we work through it step by step, I bet we will have success.
First, take the arduino, and voltage divider away from the sensor. Use an ohm meter and record the resistance at 100, 150, 200 and 250. Are the readings about what the web page calculates?
Second, hook the voltage divider back up. Use a small value resistor 100 to 220 ohm. Hook the ground, and 5v up (the sensor should be the resistor that goes to ground, if you want your voltage to go up as heat goes up). Do the same test, but this time measure and record the voltage.
Yes, that should be enough. The voltages are pretty low. I usually prefer the voltages about half of the supply voltage. If we could get it into the 2 to 3 volt range we would have better resolution.
What value was the second resistor for those tests? Can you get it smaller, pretty close to the resistance of the sensor is best.
Then our next test should be to read the voltage through the analog pin, and display the reading, without any calculations, just the raw readings with the same temp. tests you just did.
since I had trouble keeping a constant temperature for testing I had to play with the numbers again. We had established that the sensor is working as expected so no need to do these tests again.
I used an ice cube to get the 0 C value and my own body temp (from fingertips) I used regular digital body thermometer for 34 C.
so I used these values to map it and I got something like this:
int sensorpin = A0;
void setup () {
Serial.begin(9600);
}
void loop () {
int sensorval = analogRead(sensorpin);
int tempC = map(sensorval, 320, 348, 0, 34);
Serial.print (tempC);
Serial.print (" ");
Serial.println (sensorval);
delay(250);
}
I tested several times and it seems to be working just fine with the temperatures from 0 to 34. seems accurate. I tried cigarette lighter flame to get some extreme high temperatures for a brief second, the C value went up to 141 for a second. Since i'm not sure if it's right or not I can't say if it's accurate but it's certainly better than before. I'll do some more testing and post the results
That's great. Is the resolution within the range you can live with. If not, there may be a few more things we could try. But If acceptable, then no need.
Yes, let us know how it progresses.
well I'd actually need it to sense temperatures 150-300
I found one heating element from home which I turned on and took readings from with the laser temp gun ( I know it's not that accurate but at least I get some idea of how hot it is). It showed me ~500 C. I then placed the sensor on top of the element surface and got a reading of ~240 C. half off
LOL, I am not sure what you just said meant.
Actually, I think that sensor is not real linear. Meaning you may want to have 2 or 3 map() areas. One for the 10c area, one for the 70c area, and one for the 300c area.
LOL, I am not sure what you just said meant.
Actually, I think that sensor is not real linear. Meaning you may want to have 2 or 3 map() areas. One for the 10c area, one for the 70c area, and one for the 300c area.
What do you think?
EDIT: BTW, you will need a way to celebrate this system. Depending on which you think is the most accurate. Maybe the resistance reading (web page calculator, or your other thermometers). Don't use your thumb at 300C tho, lol
btw. I understood that when I connect the sensor the other way around (swap 5v and ground) then I get a reading that is decreasing instead of increasing. What really happened is that on one occasion the value started to cound around 320 (0 C) and after swapping 5v ang gnd the count started around ~600. both were increasing...