In this Project, we will see about how to interface LM35 Temperature Sensor with Arduino.
Circuit Diagram:
Arduino Code:
lm35_simple_code.ino
//This Code is Developed by Sdev //Follow Us Here : https://youtube.com/sdevelectronics #define LM35 A0 void setup() { Serial.begin(9600); } void loop() { float lmvalue = analogRead(LM35); float tempr = (lmvalue * 500) / 1023; Serial.print(lmvalue); Serial.print(" "); Serial.println(tempr); //Temperature in Celcius delay(500); }
lm35_condition_code.ino
//This Code is Developed by Sdev //Follow Us Here : https://youtube.com/sdevelectronics #define LM35 A0 #define RED 7 #define GREEN 6 void setup() { Serial.begin(9600); pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); } void loop() { float lmvalue = analogRead(LM35); float tempr = (lmvalue * 500) / 1023; Serial.println(tempr); //Temperature in Celcius //Condition if (tempr > 60) { digitalWrite(RED, HIGH); digitalWrite(GREEN, LOW); } else { digitalWrite(GREEN, HIGH); digitalWrite(RED, LOW); } delay(200); }
Youtube Video Tutorial:
Download our official Android App in PlayStore. Click Here
You can get the all the required files (like Circuit Diagram, Arduino.ino file, Libraries Used, and others) for the project in ZIP format and much more...
No comments:
Post a Comment