Greenwich University
INTERNET OF THINGS
<Project Name>
Assignment 2
Name: Huỳnh Thanh Đức
Code:
Group: GCS0604
HCMC, 05/08/2019
1. Hardware
1.1. Arduino Uno R3
Figure 1: Arduino Uno R3
Technical specifications
Microcontroller: Microchip ATmega328P
Operating Voltage: 5 Volts
Input Voltage: 7 to 20 Volts
Digital I/O Pins: 14 (of which 6 provide PWM output)
Analog Input Pins: 6
DC Current per I/O Pin: 20 mA
DC Current for 3.3V Pin: 50 mA
Flash Memory: 32 KB of which 0.5 KB used by bootloader
SRAM: 2 KB
EEPROM: 1 KB
Clock Speed: 16 MHz
Length: 68.6 mm
Width: 53.4 mm
Weight: 25 g
1.2. Breadboard
1.3. MQ-2 Smoke detection sensor
Operation source: 5V
Data type: Analog
Wide detection range
Fast response speed and high sensitivity
Simple circuit
Stable when used for a long time
1.4. Male/Female Jumper Wires
1.5. Buzzer
2. Assembly
2.1. GAS Sensor MQ-2 with Arduino UNO
2.2. Buzzer MQ-2 with Arduino UNO
3. Process flowchart
4. Coding
4.1. Coding for Arduino
int redLed = 12;
int greenLed = 11;
int buzzer = 10;
int smokeA0 = A5;
// Your threshold value
int sensorThres = 400;
void setup() {
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(smokeA0, INPUT);
Serial.begin(9600);
void loop() {
int analogSensor = analogRead(smokeA0);
Serial.print("Pin A0: ");
Serial.println(analogSensor);
// Checks if it has reached the threshold value
if (analogSensor > sensorThres)
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, LOW);
tone(buzzer, 1000, 200);
else
{
digitalWrite(redLed, LOW);
digitalWrite(greenLed, HIGH);
noTone(buzzer);
delay(100);
5. Some photos of the project
6. Result of the project
After completing this project, we obtained an arduino board product for gas sensor. It is
applied without warning when the gas exceeds the specified level
7. Future development direction of the project
In the future, we will research and develop various types of sensors such as temperature
sensors, humidity sensors, ... to perfect fire protection systems automatically. In addition,
we can do more if we can study large gas sensors - they will help us find natural deposits or
undiscovered oil fields.
8. Conclution
Smoke detectors are one of the easiest and least expensive devices.Most industries use it,
because it acts lethal to protect and most effective.In the future, the use of gas and smoke
will increase.In the future, we include Bluetooth Modules