LM35DZ waterproof not accurate data

hi i have arduion with waterproof sensor but every time i get different values

its give different data up to 10 digress changes every time

is the sensor bad ... or i missing something .. ?

  • i tried with and without risistor 4.7 k same problem ..

Please read and follow the directions in the "How to use this forum" post.

If you show us how you have it powered and connected to the Arduino and what code you're using to read it we might be able to help. Until then...

Steve

i treid this 3 combintaions :

1. https://i.imgur.com/UXoePeD.jpg 2. https://i.imgur.com/YvfZvOc.jpg 3. https://i.imgur.com/bMvn3av.jpg

1 and 2 gives me the same unstable results 3 gives me the same ubstable result plus 4k

the code :

vout=analogRead(sensor); vout=(vout*500)/1023; tempc=vout; // Storing value in Degree Celsius Serial.print("water_temp="); Serial.print(tempc); delay(1000); //Delay of 1 second for ease of viewing

You ask a question about an analogue LM35 sensor, but you post pictures of a digital DS18B20 sensor. Two completely different sensors. So what do you have. Leo..

this what i have :

Waterproof Digital Thermal Probe LM35DZ Temperature Probe sensor for Arduino

boze: this what i have :

Waterproof Digital Thermal Probe LM35DZ Temperature Probe sensor for Arduino

As said, the pictures show a DS18B20. Post a link to where you have bought it. Leo..

Simple sketch for a DS18B20.
Picture 3 (post#3) is correct.
Leo…

#include <DallasTemperature.h>
#include <OneWire.h>

OneWire oneWire(6); // pin D6
DallasTemperature sensors(&oneWire);
float temp;

void setup() {
  Serial.begin(115200);
  Serial.println("DS18B20 thermometer");
  sensors.begin();
}

void loop() {
  sensors.requestTemperatures();
  temp = sensors.getTempCByIndex(0);
  Serial.print("Temp is ");
  Serial.print(temp, 4);
  Serial.println(" C");
}

i dont anderstend the logic of it …
if i connect the wires without the resistor , i receive for example 30 degrees , but with the resistor i get 430 degrees , its just adding 4k to the result .

but even so with or without the resistor i get a non stable results every second of test .
get from 25 degrees , after 3 sec 34 degrees , and back to 20 degrees and …

Did you use the code from post#7. And connect the sensor to pin D6.

Post a picture of your setup. Leo..

How long is the wire? Is it screened? Have you tried adding a 100nF to ground on the analog pin to reduce EMI pic-up?

Wawa: Did you use the code from post#7. And connect the sensor to pin D6.

Post a picture of your setup. Leo..

i dont have DS18B20 so this code is not right... i connected the wires like in pic 3

this is the link for the product i but http://www.ebay.com/itm/Waterproof-Digital-Thermal-Probe-LM35DZ-Temperature-Probe-Sensor-1M-For-Arduino-/122609592516?hash=item1c8c19e8c4:g:PXkAAOSwdNFZcc6q

this is the code :

///****************************************************

const int sensor=A1; // Assigning analog pin A1 to variable 'sensor' float tempc; //variable to store temperature in degree Celsius float tempf; //variable to store temperature in Fahreinheit float vout; //temporary variable to hold sensor reading void setup() { pinMode(sensor,INPUT); // Configuring pin A1 as input Serial.begin(9600); } void loop() { vout=analogRead(sensor); vout=(vout*500)/1023; tempc=vout; // Storing value in Degree Celsius tempf=(vout*1.8)+32; // Converting to Fahrenheit Serial.print("in DegreeC="); Serial.print("\t"); Serial.print(tempc); Serial.println(); Serial.print("in Fahrenheit="); Serial.print("\t"); Serial.print(tempf); Serial.println(); delay(1000); //Delay of 1 second for ease of viewing }

///****************************************************

You should have bought a waterproof DS18B20.
Much easier to use than the LM35.

Don’t use a pull up resitor with the LM35.

Try this sketch. It uses the more stable 1,1vot Aref and averaging.
See the comments for temp calibration.
Leo…

// LM35 temp sensor connected to analogue input A1, +5volt and ground

unsigned int total; // A/D readings
float tempC; // Celcius
float tempF; // Fahrenheit

void setup() {
  analogReference(INTERNAL); // use the internal ~1.1volt Aref | change to (INTERNAL1V1) for a Mega
  Serial.begin(9600);
}

void loop() {
  total = 0; // reset total
  for (int x = 0; x < 64; x++) { // 64(max) analogue readings for averaging
    total += analogRead(A1); // add each value
  }
  tempC = total * 0.001632; // Calibrate by changing the last digit(s)
  tempF = tempC * 1.8 + 32.0; // Celcius to Fahrenheit

  Serial.print("The temperature is  ");
  Serial.print(tempC, 1); // one decimal place
  Serial.print(" Celcius  ");
  Serial.print(tempF, 1); // one decimal place
  Serial.println(" Fahrenheit");

  delay(1000); // use a non-blocking delay when combined with other code
}

Wawa you'r code works great.

it fix the problem .

thanks a lot !!!!!

Reading this I have to say I think OP was cheated at least a bit by the advertisement, which advertises a digital sensor while in reality it's an analog one.

Also I must question the wisdom of buying from a vendor that uses a description that reads like a failed Google translation of Klingon or so. It's just about totally unintelligible what's written there! Do some research before ordering and save a lot of trouble later.

http://www.ebay.com/itm/Waterproof-Digital-Thermal-Probe-LM35DZ-Temperature-Probe-Sensor-1M-For-Arduino-/122609592516?hash=item1c8c19e8c4:g:PXkAAOSwdNFZcc6q

It seems someone stuffed an LM35DZ into a waterproof case that has been used for DS18B20 sensors before. Leo..