Close

Serial Temperature Sensor– Arduino Workshop

mr-sarful-hassanMr. Sarful hassan wrote 06/15/2020 at 13:53 • 6 min read • Like
This project we know about Serial Temperature Sensor Arduino uses the LM35 analog temperature sensor. This sensor is part of the LM135 range of sensors from National Semiconductors. It has a range from −40°C to +100°C The circuit and code is designed for an LM35 sensor, but you can just as easily substitute an LM135 or LM235 if you wish. You will need to adjust your code accordingly to the relevant sensor. You can substitute a standard rotary potentiometer of a similar value for the 5K ohm trim pot (potentiometer). A trim pot, or trimmer potentiometer, is simply a small potentiometer designed to adjust, or trim, part of a circuit and then, once calibrated, be left alone. Any value trimmer or potentiometer with a value between 5K ohm and 10K ohm will do

Required Component

1.Arduino 2. Resistors 3. LM35 Temperature Sensor 4. 5K ohm Trim Pot 5. connecting wire 6. Breadboard 7. 6×2 LCD Display Module

This book will help you to gain more knowledge about Arduino

Beginning Arduino

Circuit diagram Serial Temperature Sensor Arduino:

Serial Temperature Sensor If you have the flat side of the LM35 temperature sensor facing you, the left-hand leg is the adjustment pin that goes to the center pin of the pot, the middle leg is the positive supply pin, and the right-hand leg is the ground pint. The center pin goes to analog pin 0 on the Arduino

Code Serial Temperature Sensor Arduino:

#define sensorPin 0
float Celsius, Fahrenheit, Kelvin;
int sensorValue;
void setup() {
Serial.begin(9600);
Serial.println("Initialising.....");
}
void loop() {
GetTemp();
Serial.print("Celsius: ");
Serial.println(Celsius);
Serial.print("Fahrenheit: ");
Serial.println(Fahrenheit);
Serial.println();
delay(2000);
}
void GetTemp()
{
sensorValue = analogRead(sensorPin); // read the
sensor
Kelvin = (((float(sensorValue) / 1023) * 5) * 100); // convert to
Kelvin
Celsius = Kelvin - 273.15; // convert to
Celsius
Fahrenheit = (Celsius * 1.8) +32; // convert to
Fahrenheit
}
Enter the code and upload it to your Arduino. Once the code is running, open the serial monitor and make sure your baud rate is set to 9600. You will see the temperature displayed in both Fahrenheit and Celsius. The temperature may look incorrect to you. This is where the trimmer comes in; you must first calibrate your sensor. For proper calibration, you should be using a mixture of ice and water that has had time to stabilize at the temperature at which the ice melts. Place chopped or crushed ice in a Styrofoam cup (to limit outside influences) and either let it thaw until partially melted (in a fridge), or add some clean (ideally, distilled) water. The mixture should be at least 50 percent ice. Stir to mix well, and wait at least several minutes to make sure the water has had a chance to cool to the just freezing point. Then put the sensor (protected by a thin plastic bag with as little air as possible) in the water-ice slurry and wait until the reading stops changing. Then adjust the trimmer for a reading of 0°C. Now turn your trimmer or pot until the reading in the serial monitor shows the correct temperature. Your sensor is now calibrated. If you are using heat shrink tubing for the purpose of waterproofing the sensor, you should use a dual wall or filled-core heat type of heat-shrink tubing. You can remove the trimmer part of the circuit and it will run just fine. However, the temperature will be a close approximation, within 1°C. How the sensor works is not important (and is in fact pretty complicated) so I will simply look at how the code works for this project

All Arduino tutorial available Click here

 ALL ARDUINO TUTORIAL 

Like

Discussions