- How to Adjust X and Y Axis Scale in Arduino Serial Plotter (No Extra Software Needed)Posted 2 months ago
- Elettronici Entusiasti: Inspiring Makers at Maker Faire Rome 2024Posted 2 months ago
- makeITcircular 2024 content launched – Part of Maker Faire Rome 2024Posted 5 months ago
- Application For Maker Faire Rome 2024: Deadline June 20thPosted 6 months ago
- Building a 3D Digital Clock with ArduinoPosted 11 months ago
- Creating a controller for Minecraft with realistic body movements using ArduinoPosted 12 months ago
- Snowflake with ArduinoPosted 12 months ago
- Holographic Christmas TreePosted 1 year ago
- Segstick: Build Your Own Self-Balancing Vehicle in Just 2 Days with ArduinoPosted 1 year ago
- ZSWatch: An Open-Source Smartwatch Project Based on the Zephyr Operating SystemPosted 1 year ago
Build Temperature & Humidity & Smoke Detector Alarm System Based on Arduino
Web site:
http://www.icstation.com/product_info.php?products_id=3665Project Summary:
Build temperature & humidity & smoke alarm system based on ICStation Mega 2560 compatible with Arduino( Cost is USD32.39 ONLY) .
The working voltage of this system is DC5V.It can measure the current temperature, humidity and smoke. It can display real-time data by the 1602 LCD and can realize the sound and light alarm when in the dangerous temperature and humidity. It is a simply and easily to operate monitoring alarm system about temperature humidity and smoke.
Full Project:
1.When connect to the power supply, after the initialization of hardware, the1602 LCDwill display the current temperature,humidity and smoke volume
2.When we press the NO.1 key, the1602 LCD will turn the page and enter the dangerous temperature setting page.At this time, press NO.2 key once, the dangerous temperature will add one. If the actual temperature is higher than the setting value, the gree LED will light, at the same time the buzzer will alarm. When the actual temperature is lower than the dangerous temperature, the LED will go out and the buzzer will stop alarm.
3.When the 1602LCD display stays on the second page , we press the NO.1 key, you will see the 1602LCD will turn page to the third page and enter the dangerous humidity setting page.At this time, press the NO.3 key, the dangerous humidity will add one.If the actual humidity is higher than the setting value, the red LED will light,at the same time the buzzer alarms. When the actual humidity is lower than the dangerous humidity, the LED will go out and buzzer stop alarming.
Circuit diagram:
Bill of Materials:
- 1 x ICStation ATMEGA2560 Mega2560 R3 Board Compatible Arduino
- 1 x DHT11 Digital Humidity Temperature Sensor
- 1 x MQ-2 Gas Sensor Module
- 1 x 1602A HD44780 Character LCD Display Module LCM Blue Backlight
- 1 x Active Buzzer Module for Arduino
- 1 x 830 Point Solderless PCB Bread Board MB-102 Test DIY
- 1 x 100K ohm 3296W Trim Pot Trimmer Potentiometer 3296W-104
- 1 x 100pcs 1K ohm 1/4W 1% Accuracy Metal Film Resistor
- 1 x 10pcs Dupont 20cm Color Cable Line 1p-1p Pin Connector
- 3 x 12X12X5mm Tact Switches 4 Legs
- 1 x 40pcs Dupont Wire Color Jumper Cable 2.54mm 1P-1P Male to Female
- 1 x Green LED 5mm DIP Hole Though
- 1 x Red LED 5mm DIP Hole Though
Firmware:
#include<LiquidCrystal.h> LiquidCrystal lcd(12,11,5,4,3,2); int temp; int humi; int tol; int j; int H=50; int T=25; int B=1; int flag=0; int led=7; int LED=9; int BU=2; int BUTTON=3; int FMQ=13; int fmq=10; unsigned int loopCnt; int chr[40] = {0}; unsigned long time; #define pin 8 void setup() { pinMode(fmq,OUTPUT); pinMode(FMQ,OUTPUT); pinMode(LED,OUTPUT); pinMode(led,OUTPUT); Serial.begin(9600); } void loop() { HH(); TT(); keyScan(); bgn: delay(200); pinMode(pin,OUTPUT); digitalWrite(pin,LOW); delay(20); digitalWrite(pin,HIGH); delayMicroseconds(40); digitalWrite(pin,LOW); pinMode(pin,INPUT); loopCnt=10000; while(digitalRead(pin) != HIGH) { if(loopCnt-- == 0) { Serial.println("HIGH"); goto bgn; } } loopCnt=30000; while(digitalRead(pin) != LOW) { if(loopCnt-- == 0) { Serial.println("LOW"); goto bgn; } } for(int i=0;i<40;i++) { while(digitalRead(pin) == LOW) {} time = micros(); while(digitalRead(pin) == HIGH) {} if (micros() - time >50) { chr[i]=1; }else { chr[i]=0; } } humi=chr[0]*128+chr[1]*64+chr[2]*32+chr[3]*16+chr[4]*8+chr[5]*4+chr[6]*2+chr[7]; temp=chr[16]*128+chr[17]*64+chr[18]*32+chr[19]*16+chr[20]*8+chr[21]*4+chr[22]*2+chr[23]; tol=chr[32]*128+chr[33]*64+chr[34]*32+chr[35]*16+chr[36]*8+chr[37]*4+chr[38]*2+chr[39]; Serial.print("temp:"); Serial.println(temp); Serial.print("humi:"); Serial.println(humi); Serial.print("tol:"); Serial.println(tol); if(temp>T) { digitalWrite(LED,HIGH); digitalWrite(FMQ,LOW); }else{ digitalWrite(LED,LOW); digitalWrite(FMQ,HIGH); } if(humi>H) { digitalWrite(led,HIGH); digitalWrite(fmq,LOW); }else{ digitalWrite(led,LOW); digitalWrite(fmq,HIGH); } int val; val=analogRead(0); Serial.print("smo:"); Serial.println(val,DEC); delay(100); if(flag==0) { lcd.begin(16,2); lcd.setCursor(0,0); lcd.print("TEMP: C"); lcd.setCursor(9,0); lcd.print("SMO:"); lcd.setCursor(0,1); lcd.print("HUMI: %"); lcd.setCursor(9,1); //lcd.print("BEP:"); lcd.setCursor(5,0); lcd.print(temp); lcd.setCursor(5,1); lcd.print(humi); lcd.setCursor(13,0); lcd.print(val,DEC); } if(flag==1) { lcd.begin(16,2); lcd.print("ALARM TEMP:"); lcd.setCursor(11,0); lcd.print(T); } if(flag==2) { lcd.begin(16,2); lcd.print("ALARM HUMI:"); lcd.setCursor(12,0); lcd.print(H); } } void keyScan() { if(analogRead(BUTTON)>600) { delay(20); if(analogRead(BUTTON)>600) { flag++; if(flag>=3) flag=0; while(analogRead(BUTTON)>600); } } } void HH() { if(analogRead(B)>600) { delay(20); if(analogRead(B)>600) { H++; if(H>=61) H=40; while(analogRead(B)>600); } } } void TT() { if(analogRead(BU)>600) { delay(20); if(analogRead(BU)>600) { T++; if(T>=31) T=20; while(analogRead(BU)>600); } } }
Software & Code Snippets:
The experimental effect:
First, connect to the power supply,the LCD will display the first page of current temperature ,humidity and smoke volume.When we press the NO.1 key, the LCD will turn the page and enter the dangerous temperature setting page.At this time, press NO.2 key once, the dangerous temperature will add one.When we at the dangerous temperature setting page, we press the NO.1 key again, you will see the LCD will turn to the first page,at this time use your hand to touch DHT11 humidity and temperature sensor module,you can observe that the temperature and humidity increase gradually( Because the humidity and temperature of hand is higher than the air. When the temperature is higher than the temperature we set, the green LED will light and the buzzer will alarm. When the humidity is larger than the dangerous humidity we set, the red LED will light and the buzzer will alarm.
7 Comments