Before starting this project...
Credits go to Tapan Mojodra on www.instructables.com/id/ARDUINO-TEMPERATURE-SENSOR-LM35/
This project is a simple project which can be use as a thermometer. It can sense the temperature it is put around and transmit it to degrees Celsius. It consists of very little parts which is cheap and reliable. This project consists of a LM35 Temperature Sensor which is the most often used. To make this project, the parts needed are:
- 1 Arduino (the Keyestudio Uno is used in this example)
- 1 LM35 Temperature Sensor
- 3 Jumper Wires (Male to Male)
- 1 USB Data Cable (depends on the Arduino)
- 1 breadboard
Mounting the circuit
Let's start making the circuit. Remove the USB cable from the Arduino before starting this project. First, place the LM35 anywhere horizontally on your breadboard, the flat side of the sensor must be facing you. Then, connect three wires under the three pins of the sensor. The wire on the left will go to the 5v (+5 volts) on the Arduino. The middle wire will go to A1 (analog pin 1). The wire on the right will go to GND (-) on the Arduino. Upload the code and open the serial monitor as readings of the temperature is shown. Make sure that the serial monitor is on 9600 bauds. Use the code below:
About the code
The two first lines of the code are variables. It shows which pin the wire connects to. They are integers and you can prove that they do start with int. The void setup is really simple. You only start a serial connection with the Arduino at 9600 bauds. The four first lines of void loop, they are calculating what the Arduino will do to determine the temperature. It's just some math equations you don't need to worry about. The five other lines, in void loop, will print the required words for the temperature readings to be intelligible by you in serial monitor. The words are temperature, cel and C. The other second half will print the same thing except for cel, which will be farh and C, which will be F (it's optional). Uncomment that section if you want to use it by taking away the first line of that section. The code might have looked indomitable before, but it looks way less impressive now.
Also, be sure to check out PCBWay, a leading manufacturer and distributor in PCB design and manufacturing. They have amazing prices and excellent quality in their services, so don't miss out on them! Plus, right now, they are having an amazing Christmas promotion, where free gifts and packages will be gifted, so make sure you check out the link below: