My Problem is that my LM 35 DZ is not working right. Serial Monitor:
3.42
11.23
38.09
24.90
0.00
115.72
118.65
33.20
13.67
43.95
25.39
27.83
16.60
100.10
112.79
example code
float temp;
int tempPin = 5;
void setup()
{
Serial.begin(9600);
}
void loop()
{
temp = analogRead(tempPin);
temp = temp * 0.48828125;
Serial.println(temp);
delay(1000);
}
I've connected it like described on the data sheet. Flat surface on top. Left = VCC (5V) center = Data (A 5), Right = GND
I've tested 5 of them with the same result.
What is wrong?
Did you connect it to digital input 5, while you are reading analog input A5 ?
It looks like if the input A5 is not connected.
Sorry, i connected it do A5. I've corrected it on top.
I know this link. But it dont helped me...
Can you measure the output voltage of the sensor with a multimeter ?
heckmic:
Its 0.45 Volts
If that is stable, the analogRead() must be stable.
Can you try this:
double temp;
int tempPin = 5;
void setup()
{
Serial.begin(9600);
}
void loop()
{
int rawADC;
rawADC = analogRead(tempPin);
Serial.print("rawADC = ");
Serial.print(rawADC,DEC);
temp = (double) rawADC * 0.48828125;
Serial.print(", temp = ");
Serial.println(temp);
delay(1000);
}
If that doesn't work well, try a different analog pin and perhaps upload a photo of how it is connected.
Yes, voltage is stable. When i take the LM in my Hand it raises constantly. So everything looks good.
But in Terminal:
rawADC = 48, temp = 23.44
rawADC = 54, temp = 26.37
rawADC = 65, temp = 31.74
rawADC = 73, temp = 35.64
rawADC = 0, temp = 0.00
rawADC = 61, temp = 29.79
rawADC = 91, temp = 44.43
rawADC = 112, temp = 54.69
rawADC = 73, temp = 35.64
rawADC = 61, temp = 29.79
rawADC = 78, temp = 38.09
rawADC = 9, temp = 4.39
rawADC = 66, temp = 32.23
rawADC = 29, temp = 14.16
rawADC = 50, temp = 24.41
rawADC = 45, temp = 21.97
system
July 6, 2012, 7:27pm
10
Thanks.
So the sensor is good. And your readings are all over the place.
I can't think of anything else than that the wiring is not right.
(1) try my little sketch -> check, you've done that
(2) upload a photo of your wiring.
(3) try a different analog input pin
(4) Use a power supply for the Arduino (not just the USB power).
(5) Connect all digital and analog pins one by one to ground, while the sketch is running and see if something changes.
(6) try a different Arduino
(7) connect a potmeter to the analog input pin and vary that.
system
July 6, 2012, 7:27pm
11
on the right my relay connected to my fans for cooling my reef tank.
Another analog input is used now (A0).
system
July 7, 2012, 7:23am
12
what if u disconnect A0 and pull it high internally?
pinMode(14,INPUT); digitalWrite(14,HIGH);
The Arduino programming language Reference, organized into Functions, Variable and Constant, and Structure keywords.
system
July 7, 2012, 7:39am
13
Thank you for all help. I've managed it! - The Problem was a hair thin wire with connected A0 AND A1.