ESP32 - LM35 Temperature Sensor
|1||×||ESP-WROOM-32 Dev Module|
|1||×||Micro USB Cable|
|1||×||LM35 Temperature Sensor|
About LM35 Temperature Sensor
LM35 temperature sensor has three pins:
- GND pin needs to be connected to GND (0V)
- VCC pin needs to be connected to VCC (5V)
- OUT pin signal pin gives the output voltage that is linearly proportional to the temperature, should be connected to a analog pin on ESP32.
How It Works
The LM35 outputs the voltage linearly proportional to the Centigrade temperature. The output scale factor of the LM35 is 10 mV/°C. It means that the temperature is calculated by dividing the voltage (mV) in output pin by 10.
How To Program For LM35 Temperature Sensor
- Get the ADC value from the temperature sensor by using analogRead() function.
- Convert the ADC value to voltage in millivolt
- Convert the voltage to the temperature in Celsius
- (Optional) Convert the Celsius to Fahrenheit
- If this is the first time you use ESP32, see how to setup environment for ESP32 on Arduino IDE
- Copy the above code and paste it to Arduino IDE
- Click Upload button on Arduino IDE to compile and upload code to ESP32 board
- Grasp the sensor by your hand
- See the result on Serial Monitor. It looks like the below:.
We are considering to make the video tutorials. If you think the video tutorials are essential, please subscribe to our YouTube channel to give us motivation for making the videos.
※ NOTE THAT:
Note that this tutorial is incomplete. We will post on our Facebook Page when the tutorial is complete. Like it to get updated.