Advance Smoke Alarm

by 627397 in Circuits > Arduino

303 Views, 2 Favorites, 0 Comments

Advance Smoke Alarm

instructable.png

The advance smoke alarm is an smoke alarm that utilizes a SR gated Latch. There are also additional features such as having an LCD

Supplies

- 1 Arduino Uno

- 2 Breadboard

- 1 gas sensor

- 1 pushbutton

- 1 slide switch

- 1 Quad NAND gate chip

- 5 resistors( 3 330 ohm resistors, 1 1k ohm resistor and 1 4k ohm resistor)

- 1 LCD display

- 2 LED(1 Red and 1 green)

- Jumper Wires(A lot)

Schematics(NAND SR Gated Latch)

instructable image.png
image4.png

For how the circuit works, its utilizing a NAND SR gated latch. Rather than using 2 pushbuttons for the inputs, one of them is changed for the gas sensor. The images show how a normal NAND SR gated latch is suppose to look without the use of fancy inputs.

Schematics LCD Display

image3.png

This is an image of the LCD display being set-up. The wiring is the same for the final section where everything is combined together. Any pin can be used but in my case, I have decided on using pin 2 to 7. Pin 7 is connected to the register select, Pin 6 is connected to the enable pin, while pin 5 to 2 are connected to the DB pins starting at DB4. Something to note is that the contrast pin should be connected to ground rather than a potentiometer. A potentiometer can be used but there is no use for it other than turning the LCD display on and off.

Schematic(Gas Sensor)

image1.png

The gas sensor is a sensor that detects gas. It uses an analog connection meaning these signals are continuous in both values and time. Due to this constant fluctuation, it makes it difficult to implement into the SR gated latch, so the connection that is being used for the SR gated latch will be a digital pin being controlled through code.

Schematic Final

image2.png
image6.png

As stated in the last step, a digital pin is being used as the input for the gas sensor(I'm using digital pin 8). Pins 7 to 2 are being used for the LCD display and one of the buttons are missing as it is being replaced by the gas sensor.

Code

code instructable.png

The code is pretty short as its just used for controlling the digital pin for the gas sensor. It just states that when the gas sensor detects a certain amount of gas, it should send a high signal and display a message on the LCD display. In the case that gas is not detected, the digital pin will be low and the LCD display will say there is no gas.

#include

int LED = 8; int const gas_sensor = A0;

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

void setup() {

pinMode(LED, OUTPUT);

cd.begin(16, 2);

Serial.begin(9600);

}

void loop() {

int work = analogRead(gas_sensor);

if(work >= 470)

{

digitalWrite(LED,HIGH);

lcd.setCursor(0,0);

lcd.print(" Gas Detected!");

}

else

{

digitalWrite(LED,LOW);

lcd.setCursor(0,0);

lcd.print("No Gas Detected!");

}

delay(100);

}

Links and Prices