Introduction: Temperature Sensor LM35 on PcDuino
LM35 Linear Temperature Sensor can be used to detect ambient air temperature. This sensor is produced by National Semiconductor Corporation and offers a functional range between 0 degree Celsius to 100 degree Celsius. Sensitivity is 10mV per degree Celsius. The output voltage is proportional to the temperature.
It is commonly used as a temperature measurement sensors. It includes thermocouples, platinum resistance, thermal resistance and temperature semiconductor chips, which commonly used in high temperature measurement thermocouples. Platinum resistance temperature used in the measurement of 800 degrees Celsius, while the thermal resistance and semiconductor temperature sensor suitable for measuring the temperature of 100-200 degrees or below, in which the application of a simple semiconductor temperature sensor has good linearity and high sensitivity.
The output of LM35 has a linear relationship to the temperature in degree Celsius. When the temperature is 0 degree Celsius, the output is 0V, and when the temperature rises for 1 degree Celsius, the output voltage will increase 10mV.
The equation is as follows:
V (T)=10 mV * T
In this post, we look at how to use LM35 on a pcDuino.
Step 1: BOM
1. pcDuino experiment platform
2. 1 x LM35 temperature sensor
3. 1 x Red LED, 1x Green LED, 1 x Blue LED
4. Resistor of value 220 ohm
5. Jumper wire
Step 2: Wire Diagram
Step 3: How It Works
ADC2 to ADC5 on pcDuino outputs from 0-4095, i.e., 0V corresponds to a reading of 0, and 3.3V corresponds to a reading of 4095. Other voltage can be mapped accordingly.
From the principle of LM35, we know that when the temperature rises for 1 degree Celsius, the output voltage will increase 10mW.
When the voltage is 0.2v to 0.3V (which means temperature is between 20 degree Celsius to 30 degree Celsius), the reading of ADC will be 248 to 372. The green LED will turn on at this time. It means the environment is comfortable.
When the voltage is 0.3v to 0.4V (which means temperature is between 30 degree Celsius to 40 degree Celsius), the reading of ADC will be 372 to 496. The yellow LED will turn on at this time. It means the environment is uncomfortable.
When temperature is below 20 degree Celsius or higher than 40 degree Celsius, red LED will turn on to indicate that the environment is extremely uncomfortable.
Step 4: Code
The full code can be downloaded from here (temperature).
The code is shown below:
int sensorPin =A5;
printf("I am here");
Step 5: Program in Action
When the environment is between 20 degree Celsius and 30 degree Celsius, the green LED will turn on:
Step 6: Pragram in Action
When we heat it using hand to above 30 degree Celsius, the yellow LED will turn on:
Step 7: Program in Action
When we burn it using a lighter, the red LED will turn on:
We have a be nice policy.
Please be positive and constructive.