LM35 temperature sensor


5 ₪

الناشر: متجر القطع الالكترونية

القسم: مستشعرات - سينسور

تاريخ النشر: 2021-02-03



Definition

A temperature is an objective comparative measure of hot or cold. It is measured by a thermometer, Several scales and units exist for measuring temperature, the most common being Celsius (denoted °C; formerly called centigrade), Fahrenheit (denoted °F), and, especially in science, Kelvin (denoted K).






Sensor Output:

Sensor gives linear + 10.0 mV/°C scale factor, as per that we have set the calibration in program Vref=5V ADC Count for 1°C = 10m/(5/1024) = 2.048 Temperature=ADC Count/2.048






Arduino Circuit for Temperature measurement






Arduino Code for Temperature measurement

code
نسخ
اقتباس
عرض
تنزيل
	
								
/* Temperature Measurement: Reads an analog input on pin A0, converts it to Temperature, and prints the result to the serial monitor. Graphical representation is available using serial plotter (Tools > Serial Plotter menu) Attach the LM35 Temperature Sensor as shown in Circuit. */ // the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0, we have connected LM35 Output int sensorValue = analogRead(A0); // Convert the analog reading (which goes from 0 - 1023) to a Temperature: float Temperature = sensorValue / 2.048; // print out the value you read: Serial.print("Temperature:"); Serial.println(Temperature); delay(1000); }





code
نسخ
اقتباس
عرض
تنزيل
	
								
#define ADC_VREF_mV 5000.0 // in millivolt #define ADC_RESOLUTION 1024.0 #define PIN_LM35 A0 void setup() { Serial.begin(9600); } void loop() { // get the ADC value from the temperature sensor int adcVal = analogRead(PIN_LM35); // convert the ADC value to voltage in millivolt float milliVolt = adcVal * (ADC_VREF_mV / ADC_RESOLUTION); // convert the voltage to the temperature in Celsius float tempC = milliVolt / 10; // convert the Celsius to Fahrenheit float tempF = tempC * 9 / 5 + 32; // print the temperature in the Serial Monitor: Serial.print("Temperature: "); Serial.print(tempC); // print the temperature in Celsius Serial.print("°C"); Serial.print(" ~ "); // separator between Celsius and Fahrenheit Serial.print(tempF); // print the temperature in Fahrenheit Serial.println("°F"); delay(1000); }


OR you can use LIBRARY : download



code for lib:

code
نسخ
اقتباس
عرض
تنزيل
	
								
#include <LM35.h> LM35 sensor(0); void setup() { Serial.begin(9600); } void loop() { Serial.println(sensor.getTemp()); // Temp in celcius delay(1000); }





سلة المشتريات افراغ السلة