Comments on: Guide for LM35, LM335 and LM34 Temperature Sensors with Arduino https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Tue, 14 Apr 2026 11:19:35 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Sotea https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/#comment-1178872 Tue, 14 Apr 2026 11:19:35 +0000 https://randomnerdtutorials.com/?p=87221#comment-1178872 In reply to Blessing.

Personally, I use DS18B20 which is OneWire bus device. Very accurate. Best for weather stations.

]]>
By: Sotea https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/#comment-1178869 Tue, 14 Apr 2026 11:13:13 +0000 https://randomnerdtutorials.com/?p=87221#comment-1178869 In reply to Julen Trapilla.

Power your motor from a different power source, keep only the ground common.

]]>
By: Sotea https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/#comment-1178867 Tue, 14 Apr 2026 11:04:41 +0000 https://randomnerdtutorials.com/?p=87221#comment-1178867 In reply to Mike Sims.

Which is correct. If the ADC reports a maximum value, then you indeed have a maximum value on the ADC pin 🙂

Try to randomize the value of ADC in your calculations. And keep in mind that the sensor will never report such high values. So, according to the datasheet of LM35, what would be the maximum reported ADC value? Or voltage in millivolts?

An accurate reading of the LM35 sensor would require you to lower the reference voltage of the ADC… I believe that ATmega328P can be set to have a reference of 1.1 volts… if I remember correctly – in which case, the formula changes accordingly.

]]>
By: Sotea https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/#comment-1178863 Tue, 14 Apr 2026 10:47:17 +0000 https://randomnerdtutorials.com/?p=87221#comment-1178863 In reply to Pedro Perez.

Which is still wrong, because the correct formula is:
Vin = ADC_Res x (Reference Voltage / 4096)
Where, Reference Voltage = (VREF+) – (VREF-)

And reference voltage can be 3.3 or lower, depending of your ADC hardware configuration. Look in the datasheet.

]]>
By: Sotea https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/#comment-1178860 Tue, 14 Apr 2026 10:31:59 +0000 https://randomnerdtutorials.com/?p=87221#comment-1178860 In reply to Pedro Perez.

ESP32 might be powered at 3.3 volts, and its ADC might be 12bit…

So, the formula changes:
voltageOut = (sensorValue * 3300) / 4096

]]>
By: Blessing https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/#comment-810018 Thu, 12 Jan 2023 23:33:59 +0000 https://randomnerdtutorials.com/?p=87221#comment-810018 Hi how can I use esp32 with lm35 sensor to read both negative and positive temperature values.
for example reading temperature values below zero, instead of giving me 0 degrees, when temperature is below that.

]]>
By: Mike Sims https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/#comment-797696 Wed, 16 Nov 2022 09:26:14 +0000 https://randomnerdtutorials.com/?p=87221#comment-797696 I’m a little confused concerning your calculations. For example, you have Voltage calculating by taking the PWM value from the ADC times 5000, then divide by 1024.

So if the ADC says that the value is 1024, then (1024 * 5000) / 1024 will be 5000 volts. Which if you then divide that by 10, the temperature comes out as 500 degrees C … is it possible that the code you published is not the exact same code that you used to get the values you published?

]]>
By: Julen Trapilla https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/#comment-584749 Mon, 05 Apr 2021 10:26:08 +0000 https://randomnerdtutorials.com/?p=87221#comment-584749 Hi there!

Great tutorial! it really helped me with my project. However I still need a little push to have it fully completed.

I’m using a LM335Z sensor to activate a DC motor when it reaches a certain temperature. The sensor gives the correct temperature readings out. And these values increase or decrease correctly following the temperature changes.

When the temperature readings go above the temperature limit I´ve previously set the DC motor turns on. But just at the same exact moment the temperature readings (voltage) increases drastically and stay constant so I could never cool down the sensor so the DC motor turns off when the temperature goes under the limit temperature I´ve mentioned before.

I’m struggling with this issue and can’t really figure out what’s going on.
I am a beginner using ARDUINO and I’d really appreciate some help.

Thanks a lot!
Julen

]]>
By: Sara Santos https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/#comment-578410 Thu, 25 Mar 2021 15:04:49 +0000 https://randomnerdtutorials.com/?p=87221#comment-578410 In reply to Pedro Perez.

Hi.
Yes, you are right. It corresponds to GPIO 36. So, it can read analog values.
Bur, try another GPIO, for example GPIO 32.
Regards,
Sara

]]>
By: Pedro Perez https://randomnerdtutorials.com/arduino-lm35-lm335-lm34-temperature-sensor/#comment-578394 Thu, 25 Mar 2021 14:29:47 +0000 https://randomnerdtutorials.com/?p=87221#comment-578394 In reply to Sara Santos.

I am using ESP32 DEVKIT V1 DOIT board, so I thought that VP pin could read analog reading. Where do you suggest to connect it?

Thanks

]]>