In this example we will connect an LM35 temperature sensor to our Arduino
The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The LM35 does not require any external calibration or trimming to provide typical accuracies of ±1/4°C at room temperature and ±3/4°C over a full -55 to +150°C temperature range
Here is a picture of the pins, its important to get these correct or you can damage the sensor
I purchased a small module, which looks like this. This was clearly labelled and helps avoid any mistakes with wiring, I also prefer using cables to modules rather than breadboards
Parts Required
Here are the parts I used
Name | Links | |
Wemos Mini | ||
LM35 | ||
Connecting cables |
Schematics
Very simple to connect Vcc is 3v3, Gnd is any Gnd and out goes to Wemos Mini A0, you can see this below
Code
//initializes/defines the output pin of the LM35 temperature sensor int outputpin= 0; //this sets the ground pin to LOW and the input voltage pin to high void setup() { Serial.begin(9600); } //main loop void loop() { int rawvoltage= analogRead(outputpin); float millivolts= (rawvoltage/1024.0) * 3300; float celsius= millivolts/10; Serial.print(celsius); Serial.print(" degrees Celsius, "); Serial.print((celsius * 9)/5 + 32); Serial.println(" degrees Fahrenheit"); delay(1000); }
Results
Here are the results via the serial monitor
25.14 degrees Celsius, 77.25 degrees Fahrenheit
25.14 degrees Celsius, 77.25 degrees Fahrenheit
25.46 degrees Celsius, 77.83 degrees Fahrenheit
26.43 degrees Celsius, 79.57 degrees Fahrenheit
27.71 degrees Celsius, 81.89 degrees Fahrenheit
28.36 degrees Celsius, 83.05 degrees Fahrenheit
29.00 degrees Celsius, 84.21 degrees Fahrenheit
29.33 degrees Celsius, 84.79 degrees Fahrenheit
29.33 degrees Celsius, 84.79 degrees Fahrenheit
29.00 degrees Celsius, 84.21 degrees Fahrenheit
28.68 degrees Celsius, 83.63 degrees Fahrenheit
28.36 degrees Celsius, 83.05 degrees Fahrenheit
28.36 degrees Celsius, 83.05 degrees Fahrenheit
28.04 degrees Celsius, 82.47 degrees Fahrenheit
Good day,
We did what you did on this project, unfortunately we are having very low readings in temperature(Celsius).
We are using Wemos d1 r2 v2.1.0. Hope you can help us.
Yes me too. I am getting extremely very low readings such as 0.xx, but I dont know why, I am following exactly the same as it.
I have the same issue with low readings, I just don’t get it. Anyone find a solution to this?
thanks
i did and got response. but i want to show it on a page in browser. if anyone know please help.