I hooked it up according to the layout and when I run it, I get pretty much random numbers in the Serial Monitor. Like this:
0
0
34
84
70
9
0
14
74
84
24
0
11
7
Am I just misinterpreting the output or is the sensor broken ?
I hooked it up according to the layout and when I run it, I get pretty much random numbers in the Serial Monitor. Like this:
0
0
34
84
70
9
0
14
74
84
24
0
11
7
Am I just misinterpreting the output or is the sensor broken ?
For those of us without the starter kit, is this an analog sensor connected to an analog pin on the processor? Is the software just printing out the raw ADC count or is this processed in some way?
If you have a voltmeter, what is the voltage at the analog pin (if it is indeed an analog sensor)? Does it jump around as well?
Do you have any noisy devices (motors, …) connected to the Arduino?
fll-freak:
For those of us without the starter kit, is this an analog sensor connected to an analog pin on the processor? Is the software just printing out the raw ADC count or is this processed in some way?If you have a voltmeter, what is the voltage at the analog pin (if it is indeed an analog sensor)? Does it jump around as well?
Do you have any noisy devices (motors, …) connected to the Arduino?
Yes this is an analog sensor called TMP36 and it is connected to analog input 0 on my Uno R3.
There are nothing else hooked up to the Arduino. Just breadboard.
Ninja edit: It reports a voltage metering that gives a 0.5 step values between 0 and 1023, so you just have to convert it to degrees.
i found some code that did the converting but that program output crazy values as well.
Could you attach the code (using the code tags)?
As a note, there has been a rash of questions on this sensor in the last 6 months. One other person found their sensor to be dead on arrival. Not sure if that was a fluke or not. I seem to remember that they may have connected it up backwards before trying it.
Others claim it is noisy (but not as noisy as yours!). The explanation is that temp sensors are indeed noisy. This part may have ±2 degrees of noise.
This is the code:
/*
AnalogReadSerial
Reads an analog input on pin 0, 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.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
//getting the voltage reading from the temperature sensor
int reading = analogRead(A0);
// converting that reading to voltage, for 3.3v arduino use 3.3
float voltage = reading * 5.0;
voltage /= 1024.0;
// print out the voltage
Serial.print(voltage); Serial.println(" volts");
// now print out the temperature
float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree wit 500 mV offset
//to degrees ((volatge - 500mV) times 100)
Serial.print(temperatureC); Serial.println(" degrees C");
// now convert to Fahrenheight
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
Serial.print(temperatureF); Serial.println(" degrees F");
delay(1000); //waiting a second
}
Why is it you don’t see the “volts”, degrees C" or “degrees F” in the printout above ? Even if your readings are somehow screwy, I’d expect the strings to print OK. Was the above just the expected data, with the strings filtered out ?
Mee_n_Mac:
Why is it you don’t see the “volts”, degrees C" or “degrees F” in the printout above ? Even if your readings are somehow screwy, I’d expect the strings to print OK. Was the above just the expected data, with the strings filtered out ?
Yes it is printing the values in both cases. Just that both the raw values and the calculated values are random…
OK then, the serial link is working and I don’t see anything obviously wrong code-wise so the next thing to check is the connection to the sensor. Do you have a voltmeter (DMM) ? If so probe the sensor output and the A0 pin. See if they’re the same and anything close to 0.75V. If the sensor doesn’t read anything but around 0V, then you’ve either got a bad sensor or it’s missing power and/or ground. I’d double check all the connections, verify the power with a DMM if you’ve got one.
If you have a potentiometer handy (a 10k trimpot was in the SIK) you can connect that to the same power (I assume it’s the Arduino 5v) and ground and then connect the wiper of the pot to the same wire used to connect the temp sensor to the A0 pin. You should be able to confirm your A/D code by dialing up any “temperature” you want with the pot.
ps - if you don’t have a DMM, go get one. For $20 or less, it’s the most basic and useful tool you’ll ever have in electronics.
I just got a multimeter! Not quite sure how to use it yet! It came with chinese instructions. (and i bet a ‘manual’ of that size wouldnt even help a chinese)
I got one called DT 9205A. I will re-hookup the tempsensor project soon (i just did the photoresistor one again)
Will post result soon !
Ninja edit: found the manual at http://arduino-info.wikispaces.com/dt92 … ter-manual
Chuck Norris edit: For some reason, my Arduino is in great shape today. The sensor just magically worked today. Thanks for the input. I will still measure up the voltage just to get to know the multimeter.
I still have one more question about this, will post that later when i can think out a sentence! will mark this thread closed after that !
Here’s my final question:
Why is it that when i hook up the 6V battery pack (4xaa), then the sensor readings increase by about 20 celcuius. Is the thermristor getting overheated ?
I thought the board only supplied 5.5 trough the 5.5 line no matter what the input voltage is,
When i hook up to only the USB (which is basically 3.3 volts right but i have 3x boost on all my usb ports) the temperature seems normal.
Do i need to increase the resistance between the thermristor and the 5v?
Are you connecting the the 6V pack to the power input (barrel connector) of the Arduino?
Where are you getting the power to apply to the temp sensor? The pin labeled 5V?
Board takes in raw voltage and converts it to 5.0V (not 5.5). You must apply at least 6V to allow enough overhead for the on board regulator to work.
When powered from USB, you are giving the board regulated 5.0V (not 3.3). That voltage skips the regulator and powers the board directly.
If you are powering the sensor from the 5V pin, then I am surprised you see much of a difference. Use your new voltmeter to measure the supply voltage to the sensor in both conditions. From USB, I think you will see about 4.9-5.0 volts. And from the battery pack, something lower. That difference could change the results of the sensor.
I am connecting it to the power barrel of the arduino, yes.
i connect the pin to the 5.5 line next to the 3.3 abn GND lines.
I thought that this board just regulated everything it got to operate at 5v.
I will try to measure with a voltmeter but ive not used one before! (just bought it !)
regards eivind
Oki am not quite sure how this works.
i have the black voltmeter plugged into the Ma plug and the red wire hooked to the V-omega I put the voltmeter into position V~ Itilde) at the 20-setting
That gves me readings about 5 when connecting the red volmeter plug to the 5v pin of the thermoresistor and the voltmeter gnd plug to the gnd pin. that gives me a reading about 5-6.
if i connect the gnd from the analog pin on the resistorm it shows about the same, but if i blow cold air on the thermristor, the voltage goes down, as i would suspect.
doesn’t seem, that the thermristor changes wether i connect my 6v pack or not. maybe i did something wrong.
Does this sound reasonable or have i done something wrong ?
regards eivind
does these readings and the volmeter setting seem ok ?
You should have the black test lead plugged into the COM terminal and the red into the one to the right from the picture.
Next you need to select a DC voltage range that will read to more than 5 volts. The ‘~’ indicates AC measurements. Stay away from those for DC work.
Black lead to ground. Red lead to the point you want to measure. In your case the 5.0V pin (with or without the pattery pack) and the sensor output pin.
fll-freak:
You should have the black test lead plugged into the COM terminal and the red into the one to the right from the picture.Next you need to select a DC voltage range that will read to more than 5 volts. The ‘~’ indicates AC measurements. Stay away from those for DC work.
Black lead to ground. Red lead to the point you want to measure. In your case the 5.0V pin (with or without the pattery pack) and the sensor output pin.
i replugged the voltmeter as suggested, using DC at the 20 V—…setting position
red vmeter cable to the 5 volt pin on the resistor
black vmater cable to the gnd pin on the resistor
I get 4.4 volts without battery pack
i get 4.6 volts with battery pack
I get 3.5 volts connecting the red to the analog output of resistor and it changes if i blow on it.
This sound normal?
for some reason now, the temperature stays constant wether i use 6 pack or just USB
maybe i wired it wrong (5 volt to thermoresistor to gnd and vice verca the first time ?
regards eivind
KirkHamster:
I am connecting it to the power barrel of the arduino, yes.i connect the pin to the 5.5 line next to the 3.3 abn GND lines.
I thought that this board just regulated everything it got to operate at 5v.
What Arduino do you have ? I don’t know of one that has a 5.5 pin. Here’s a pic of the most recent Uno. Note there’s a 3.3V pin, a 5V pin, two ground pins and a Vin pin in the “power” header.
I wonder if some of the oddness you’ve been seeing (it works one day and not the next) is because the battery pack is in “no mans land” of voltage, not high enough for the regulator to work as intended and not low enough for the UNO to just not work at all ??? From the UNO page …
The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
I have a brand new Arduino Uno R3 from Sparkfuns inventors kit. Sorry, its ofcourse a 5 volt line, not a 5.5 volt line. sorry about that. i misread,
are you sying my battery package is not good enough ? it s the rsfPRT-09835 one.
It might not be 'good enough" to get accurate temperature readings. To do so, you need a stable voltage. You will only get that if you run from the USB’s regulated 5V or from an exteranal power supply that is over the 7V as indicated by Mee_n_Mac.
The issue is that the on board regulator can’t do its thing with less than about 2 volts of extra voltage to ‘play with’.
In a word ... yes.KirkHamster:
are you sying my battery package is not good enough ? it s the rsfPRT-09835 one.
With fully charged alkaline batteries you might see a bit over 6.5V. Then as the batteries are used the voltage will drop. Using rechargeable batteries will result in an even lower initial voltage, though less “droop” over time. None of these will get you the 7V minimum needed to run the Uno reliably.