LM35 Thermometer With LCD, Fan, Speaker and LED
by Vincent Cheng in Circuits > Arduino
220 Views, 0 Favorites, 0 Comments
LM35 Thermometer With LCD, Fan, Speaker and LED
Let everyone to know the precise temperature inside the house and everywhere in the house. Automatically turn on USB fan, and high temperature sound warning. LED light warning.
Step 1: Prepare Your Supplies
Arduino Leonardo
Breadboard
Jumper Wires
USB Cord
LM35 temperature sensor
USB fan
16*2 LCD screen
1 red LED, 1 green LED
1 speaker
30 Wires
Welding torch
Box
Powerbank
Step 2: Wiring
Connect supplies voltage to 5V
Connect output to A2
Connect Ground to GND
make sure LM35 face your Leonardo boards.
Connect LCD to Leonardo
Connect fan to board
extend LED wires
Connect speaker
Step 3: LCD Screen
GND to GND
VCC to 5V
SDA to SDA
SCL to SCL
Steps 4: LED
Extend your LED make it go though the box
Do the same thing to red LED
Step 5: Fans
Connect to digital 12 and GND
Step 6: Speaker
Step 3: Coding
#include <Wire.h> #include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd_I2C_27(0x27,16,2); // set the LCD address for a 16 chars and 2 line display
void setup(){ // put your setup code here, to run once: lcd_I2C_27.init (); // initialize the lcd lcd_I2C_27.backlight(); pinMode( 7 , OUTPUT); pinMode( 8 , OUTPUT); pinMode( 12 , OUTPUT); }
void loop() { int sensorValue = analogRead(A0); float millivolts = (sensorValue / 1024.0) * 5000; float celsius = millivolts / 10; lcd_I2C_27.setCursor(2, 0); lcd_I2C_27.print( "Temperature" ); lcd_I2C_27.setCursor(4, 1); lcd_I2C_27.print(celsius); lcd_I2C_27.setCursor(10, 1); lcd_I2C_27.print("C"); if ( celsius >= 28 ) { digitalWrite( 8 , HIGH ); digitalWrite( 7 , LOW ); digitalWrite( 12 , HIGH ); tone(11, 1000, 100); } else { digitalWrite( 7 , HIGH ); digitalWrite( 8 , LOW ); digitalWrite( 12 , LOW ); } delay(50); }
Step 4: Video
When temperature over 28degC, the LED with change from Green to RED with Speaker alert, Fan will start to cooling,
When temperature back to under 28degC, the LED will change back to Green, fan and Speaker will stop.