Go Down

Topic: LM 35 DZ + Arduino (Read 1 time) previous topic - next topic

Jul 06, 2012, 05:00 pm Last Edit: Jul 06, 2012, 05:19 pm by heckmic Reason: 1
My Problem is that my LM 35 DZ is not working right. Serial Monitor:

Quote

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
Quote
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 (A5), Right = GND
I've tested 5 of them with the same result.

What is wrong?


Krodal

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.

krutarth

Hello,

This link will help you.
http://www.ladyada.net/learn/sensors/tmp36.html

I know this link. But it dont helped me...

Krodal

Can you measure the output voltage of the sensor with a multimeter ?


Krodal


Its 0.45 Volts


If that is stable, the analogRead() must be stable.

Can you try this:
Code: [Select]

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.

#8
Jul 06, 2012, 09:14 pm Last Edit: Jul 06, 2012, 09:16 pm by heckmic Reason: 1
Yes, voltage is stable. When i take the LM in my Hand it raises constantly. So everything looks good.

But in Terminal:

Quote
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

Krodal

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.

#10
Jul 06, 2012, 09:27 pm Last Edit: Jul 06, 2012, 09:32 pm by heckmic Reason: 1


on the right my relay connected to my fans for cooling my reef tank.
Another analog input is used now (A0).

RIDDICK

what if u disconnect A0 and pull it high internally?
pinMode(14,INPUT); digitalWrite(14,HIGH);
http://arduino.cc/en/Reference/DigitalWrite
-Arne

Thank you for all help. I've managed it! - The Problem was a hair thin wire with connected  A0 AND A1.

Krodal

I'm glad you found it !

Go Up