Arduino LM35 Temperature Sensor and Temperature Measurement

tarafından
33921
Arduino LM35 Temperature Sensor and Temperature Measurement

With the use of Arduino lm35, we continue the Arduino projects where we left off. In our previous project we measured the ambient temperature and humidity with DHT11 and displayed it on our LCD screen. In this project, we will print the ambient temperature on our computer with the LM35, so we will also learn how to use the Serial Monitor via the Arduino IDE program.

Necessary Materials:

Arduino UNO
breadboard
jumper cable
LM35 Temperature Sensor

Before we begin the Arduino lm35 project, let’s talk about using the LM35 sensor with Arduino. The LM35 temperature sensor is a temperature sensor with analog output. The temperature measurement range is between -40 and +110 degrees. The input voltage is minimum 4V and maximum 20V. We will accept the input as 5V as we will realize this project with Arduino. It consists of 3 pins in total as ground pin and signal output.
You can browse the datasheet to learn more about the LM35 temperature sensor.

Since the value we will read on the serial monitor with Arduino lm35 is given in degrees Celsius, we will have to use some dials. Arduino reads the values between 0-1023 from its analog input. We can convert the value we read from the output branch of the sensors into voltage. To do that, we need to know: The value 0 equals 0V and the value 1023 equals 5V. Each value between these numbers is calculated by the ratio of these equivalents. For example, if we read the value 523 from Arduino’s analog output, we calculate the voltage corresponding to this value as follows: 523/1023 * 5 = 2,5562 V. If we adapt it to the Arduino programming language, we can create a formula like this: “Voltage = Sensor / 1023 * 5”.

Now that we have learned about the logic of the ADC (analog-to-digital converter), we will try to learn the operating principle of this sensor. Since every 10mV voltage we read at the analog output corresponds to a temperature of 1°C, we calculate the ambient temperature with the LM35 temperature sensor using the formula “temperature = voltage / 0.01”. Let’s write these formulas, which we have created with Arduino IDE.

Programming with Arduino:

int analogPin = A0;
float sensor = 0;
float gerilim = 0;
float sicaklik = 0;

void setup() {

Serial.begin(9600);

}

void loop() {

sensor = analogRead(analogPin);
gerilim = sensor / 1023 * 5;
sicaklik = gerilim / 0.01;

Serial.print(“Sicaklik Degeri: “);
Serial.println(sicaklik);

delay(500);
}