Arduino Nano-Based Smart Home Automation System with Gas Detection and Servo Control
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino Nano microcontroller interfacing with various components including an MQ-2 gas sensor, a servo motor, a 2-channel relay, a buzzer, LEDs, a fan, a bulb, and a 12V battery. The circuit is designed to control the relay, LEDs, buzzer, and servo motor based on inputs from the MQ-2 sensor. The fan and bulb are controlled through the relay.
Component List
Arduino Nano
- Description: A small, complete, and breadboard-friendly board based on the ATmega328P.
- Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
MQ-2
- Description: Gas sensor for detecting LPG, i-butane, propane, methane, alcohol, Hydrogen, and smoke.
- Pins: GND, VCC, ANALOG, Digital
Servo
- Description: A small motor with a feedback mechanism for precise control of angular position.
- Pins: GND, VCC, PWM
2ch Relay
- Description: A 2-channel relay module for controlling high voltage devices.
- Pins: NC, COM, NO, VCC, IN2, IN1, GND
Power 220V
- Description: Standard 220V power supply.
- Pins: hot wire, neutral wire
Bulb
- Description: Standard light bulb.
- Pins: GND, power
Fan
- Description: A small fan for cooling purposes.
- Pins: GND, 5V
Battery 12V
- Description: A 12V battery for powering components.
- Pins: +, -
LED: Two Pin (green)
- Description: A green LED.
- Pins: cathode, anode
LED: Two Pin (red)
- Description: A red LED.
- Pins: cathode, anode
Buzzer
- Description: A small buzzer for sound output.
- Pins: PIN, GND
Wiring Details
Arduino Nano
GND connected to:
- Buzzer GND
- Red LED cathode
- MQ-2 GND
- 2ch Relay GND
- Green LED cathode
- Servo GND
D2 connected to:
- Green LED anode
D3 connected to:
- Red LED anode
D4 connected to:
- Buzzer PIN
D5 connected to:
- 2ch Relay IN1
D6 connected to:
- 2ch Relay IN2
D8 connected to:
- MQ-2 ANALOG
D9 connected to:
- Servo PWM
5V connected to:
- MQ-2 VCC
- 2ch Relay VCC
- Servo VCC
MQ-2
GND connected to:
- Arduino Nano GND
VCC connected to:
- Arduino Nano 5V
ANALOG connected to:
- Arduino Nano D8
Servo
GND connected to:
- Arduino Nano GND
VCC connected to:
- Arduino Nano 5V
PWM connected to:
- Arduino Nano D9
2ch Relay
GND connected to:
- Arduino Nano GND
VCC connected to:
- Arduino Nano 5V
IN1 connected to:
- Arduino Nano D5
IN2 connected to:
- Arduino Nano D6
NC connected to:
- Fan GND
- Power 220V neutral wire
COM connected to:
- Battery 12V -
- Bulb GND
Power 220V
neutral wire connected to:
- 2ch Relay NC
hot wire connected to:
- Bulb power
Bulb
GND connected to:
- 2ch Relay COM
power connected to:
- Power 220V hot wire
Fan
GND connected to:
- 2ch Relay NC
5V connected to:
- Battery 12V +
Battery 12V
- connected to:
- 2ch Relay COM
+ connected to:
- Fan 5V
LED: Two Pin (green)
cathode connected to:
- Arduino Nano GND
anode connected to:
- Arduino Nano D2
LED: Two Pin (red)
cathode connected to:
- Arduino Nano GND
anode connected to:
- Arduino Nano D3
Buzzer
GND connected to:
- Arduino Nano GND
PIN connected to:
- Arduino Nano D4
Documented Code
Arduino Nano Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Additional Documentation (documentation.txt)