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:

Arduino LM35 Temperature Sensor Project Code

int val;
int tempPin = 1;

void setup()
{
  Serial.begin(9600);
}
void loop()
{
  val = analogRead(tempPin);
  float mv = ( val/1024.0)*5000;
  float cel = mv/10;
  float farh = (cel*9)/5 + 32;
  Serial.print("TEMPRATURE = ");
  Serial.print(cel);
  Serial.print("*C");
  Serial.println();
  delay(1000);
/* uncomment this to get temperature in farenhite
Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();
*/
}

 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 loopthey 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 temperaturecel and C. The other second half will print the same thing except for cel, which will be farh and C, which will be (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.

Amazing opportunities

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, PCBWay has an amazing website, online Gerber viewer function and a gift shop so make sure to check out their links below:

PCBWay Free Online Gerber Viewer Function:  https://www.pcbway.com/project/OnlineGerberViewer.html

PCBWay Gift Shop: https://www.pcbway.com/projects/gifts.html

Enjoy! Contact us for any inquiries!