# Seg 5: Schematic diagram and experiment of LM35

1. Schematic circuit

By the connection diagram shown in Figure 8-2, this experimental schematics is easily draw in Figure 8-3. Note that, we should design the circuit by the pin connection of temperature sensor.

Figure 8-3 Schematic circuit

8-4 Circuit diagram

1. Code

Run Program 8.

 01 // Program 8: use sensor to measure your environmental temperature 02  03 void setup() { 04   05   Serial.begin(9600);         //set the baud for serial communication 06 } 07   08 void loop() { 09   10   int n = analogRead(A0);    //read the voltage from A0 11   12   float vol = n * (5.0 / 1023.0*100);   //computation of temperature 13   14   Serial.println(vol);                   //output temperature 15   delay(2000);                           //wait for 2s for display 16 }

Open the serial monitor on the Arduino software platform, we can see the Celsius temperature sensed by the temperature sensor LM35. Note that, the baud of monitor should be the same as the above code, which can be seen in Figure 8-5.

Figure 8-5 the temperature value on the Arduino monitor

From Figure 8-5, we know that the environmental temperature is about 24.44 in this experiment.

1. Key points and summaries
2. We should know the features about the temperature sensor. For example, in such experiment, the temperature of LM35 is linearly proportional to the voltage. By this relationship, we can get the formula about the temperature and voltage.
3. We should the connection about the sensor logs. As for LM35 in this experiment, let the full-face having characters facing us. Then the left is connected to 5V port on the Arduino board, the right leg is a GND port, which should connect to the GND port on Arduino board, and the middle leg should connect to the analog port on the Arduino board, which can output the concrete value about temperature.
4. The output temperature value can be seen on the serial monitor. But, the baud for the monitor should be unanimous with the baud set in the experimental code.