Introduction: SMART KITCHEN GAS ALARM DEVICE BASED ON YEELINK PLATFORM

Source of creativity:

An ordinary domestic gas alarm device can only alarm or cut off the gas pipeline. In the event of gas leakage when the owner is not home, such alarm device will be useless. We truly need a type of alarm device which can remotely notify the owner and effectively eliminate risks.

Product design:

A Gas detection: A high-performance gas sensor may be used to detect multiple gases, including carbon monoxide, alkanes, petroleum gas and natural gas, comprehensively.

B Alarm methods: supporting local alarm and remote alarm. During local alarm, the exhaust fan and window (supporting expansion solenoid valve) can be also opened.

C Alarm mode selection: The alarm mode can be selected through self-locking switch (buzzer ringing or not ringing), to allow users to seek the leakage source confidently.

D Remote alarm: Users may know the gas alarm conditions at home by connecting to the network cable and logging in Yeelink client. In the event of gas leakage at home, the client will push notification at once.

E Novel risk elimination method: compatible with traditional alarm method and making up for the deficiency of old alarm method; windows and exhaust fan are opened to thoroughly ventilate and create a safer indoor environment.

Component:

DFRduino UNO R3(similar as Arduino UNO R3) *1

Gravity: IO Expansion Shield for Arduino V7.1 *1

DFRduino Ethernet Shield V2.1*1

Gravity:Digital RED LED Light Module *2

Gravity: Digital Buzzer For Arduino *2

Homemade gas pipeline, gas source (lighter) *1

7.4V Lipo 2500mAh Battery *1

Paper box *1

Gravity:Digital Self-Locking Switch*1

Gravity: Analog CO/Combustible Gas Sensor (MQ9) For Arduino *1

Gravity: DC Fan Module *1

TowerPro SG90C 360 Degree Micro Servo *1

PH2.0 - PH2.0 connect module *2

Threshold module *2

Making procedure:

A Circuit connection:

Arduino Uno is used as the main controller, and W5100 expansion board and I/O expansion board are overlaid on it. All sensors and output devices are connected through this I/O board without additional welding or wiring.

Wiring index:

MQ9 sensor is connected to the branch module. One circuit is connected to the pin A0 and the other circuit is connected to the pin A1 through the threshold value module.

Pins 3 and 4 are connected to LED module.

Pins 5 and 6 are connected to the buzzer module.

Pin 7 is connected to the self-locking module.

Pin 8 is connected to 9g 180° steering engine.

Pin 9 is connected to the fan module.

The Ethernet expansion board is connected to the Internet.

B Code:

CODE: SELECT ALL

/* ******************************

* Kitchen gas alarm active risks elimination system

* Made by: Zhou Zining from Class 20, Senior Grade I, Huainan No.1 Middle School

* Wiring index:

* MQ9 sensor is connected to the branch module. One circuit is connected to the pin A0 and the other circuit is connected to the pin A1 through the threshold value module.

* Pins 3 and 4 are connected to LED module.

* Pins 5 and 6 are connected to the buzzer module.

* Pin 7 is connected to the self-locking module.

* Pin 8 is connected to 9g 180° steering engine.

* Pin 9 is connected to the fan module.

* The Ethernet expansion board is connected to the Internet.

* Update Log:

* 20170301231051 writing started.

* 20170304004603 basic part writing finished, fan module with bug, Yeelink not written.

* 20170304100237 correcting bug of main cycle return failure and cancelling fan module view effect.

* 20170304152002 correcting bug of fan module.

* 20170304225615 correcting bug; remaining Yeelink unfinished.

****************************** */

#include #include

#include #include

#include #include

#include

#include

#include

#define LED1 3

#define LED2 4

#define Beep1 5

#define Beep2 6

#define Switch 7

#define fan 9

int Deg = 0; //setting steering engine angle (global variable)

int Dly = 1000;// setting delay time (global variable)

Servo windowServo;

void setup()

{

Serial.begin(9600);

// pin definition

pinMode(LED1,OUTPUT); // pin 3 is defined as output port

pinMode(LED2,OUTPUT); //pin 4 is defined as output port

pinMode(Beep1,OUTPUT); //pin 5 is defined as output port

pinMode(Beep2,OUTPUT); // pin 6 is defined as output port

pinMode(Switch,INPUT); // pin 7 is defined as input port

pinMode(8,OUTPUT); // pin 8 is defined as output port

pinMode(fan,OUTPUT); //pin 9 is defined as output port

windowServo.attach(8); // defining windowServo steering engine position

}

void loop() {

// Variable setting

intGasD = analogRead(1); //gas sensor (for alarm)

intGasA = analogRead(0); //gas sensor (for uploading)

intPower = digitalRead(Switch);//self-locking switch state

//Yeelink code here, and acquiring value for uploading.

Serial.println(GasD); // serial port test

if(GasD >= 512 & Power ) { // The self-lock switch will be pressed if the gas exceeds the threshold value. OpenWindowAlarm(); } // calling window opening alarm function

if(GasD >= 512 & !Power ) { // The self-lock switch will be released if the gas exceeds the threshold value. OpenWindow(); } // calling window opening function

if(GasD <512 ) { // If the gas does not exceed the threshold value

CloseWindow(); } // calling window closing function

}

void OpenWindowAlarm(){

Deg =100; //setting Deg value

windowServo.write(Deg); // setting the steering machine angle as Deg

delay(1000); // delaying time by 1 s to allow the steering engine to rotate to 100°

digitalWrite(LED1,HIGH);//LED1 on

digitalWrite(LED2,HIGH); //LED2 on

digitalWrite(Beep1,HIGH);//Beep1 on

digitalWrite(Beep2,HIGH);//Beep2 on

digitalWrite(fan,HIGH); // fan start

}

void OpenWindow(){

Deg =100; // setting Deg value

windowServo.write(Deg); // setting steering machine angle as Deg

delay(1000); // delaying time by 1 s to allow the steering engine to rotate to 100°

digitalWrite(LED1,HIGH);//LED1 on

digitalWrite(LED2,HIGH);//LED2 on

digitalWrite(Beep1,LOW);//Beep1 not ringing

digitalWrite(Beep2,LOW);//Beep2 not ringing

digitalWrite(fan,HIGH); // fan start

}

void CloseWindow(){

Deg =0; //setting Deg value

windowServo.write(Deg); //setting steering engine angle as Deg

delay(1000); // delaying time by 1 s to allow the steering engine to rotate to 0°

digitalWrite(LED1,LOW); //LED1 not on

digitalWrite(LED2,LOW); //LED2 not on

digitalWrite(Beep1,LOW);//Beep1 not ringing

digitalWrite(Beep2,LOW);//Beep2 not ringing

digitalWrite(fan,LOW); // fan off

}

The codes of local modules are as described above.

C Installation:

1. Unfold the paper box horizontally, drill holes at corresponding hole position and reserve outlets for air source connection lines and battery at the rear end.

2. Open the display slot on the paper box; open the steering engine slot at the side to simulate "window".

3. Bond the "window" on the steering machine and fix is at the side with hot melt adhesive.

4. Fix all components properly with screws and nuts.

5. Separate the simulated display zone from the wiring zone.

6. Power on, and the indicator will be on , which indicates successful installation.The procedure above is for making a paper box. Later, it is changed to storage box.

Step 1: