How to make a Home Automation Model

Tanuka Mondal
3 min readJul 22, 2020

I am going to demonstrate how we can make a simple home automation model using arduino and some sensors.

Components list:

Arduino UNO, Breadboard, HCSR04, PIR sensor, LDR, TMP 36, MQ2 gas sensor, Servo motor, DC motor, LED, Bulb, Buzzer, Connecting wires, Resistors.

Connect all the components according to the image.

Connection of the components with arduino
Connection of the components with arduino

Connection:

Connect the negative rail of the breadboard with GND of arduino and positive rail with 5V. Then whenever you have to connect any sensors or any device with ground, just connect it with the negative rail and when you have to connect any device with power, connect it with positive rail.

  1. HCSR04: GND Pin to GND, 5V pin to 5V, SIG Pin to DIGITAL 7.
  2. Servo Motor: Power to 5V, Ground to GND, Signal to DIGITAL 8.
  3. Bulb: One terminal with GND and another with DIGITAL 13. Don’t forget to connect a resistor.
  4. DC Motor(Fan): One terminal with GND and another with DIGITAL 11.
  5. PIR Sensor: Ground to GND, Power to 5V, Signal to DiGITAL 10.
  6. LDR: One terminal with 5V and another terminal with GND and A0. Connect a resistor with a terminal.
  7. TMP 36: Power to 5V, GND to GND, VOUT to A0.
  8. MQ2: The actual MQ2 sensor is slight different from the picture. Connect the VCC to 5V, GND to GND and Output pin to A2.
  9. Buzzer: Negative to GND and Positive to DIGITAL 12.
  10. LED: Cathode to GND and I have connected the anode to A5 , just to show that we can use those analog pins as digital pin also. But you can connect it to any digital pin.

Then write the code in Arduino IDE in a new file and save. Connect the arduino with your pc and upload the code.

The code is in this repo: https://github.com/Tanuka-Mondal/Home-Automation/blob/master/home_automation.ino

Description:

When anyone will come near at the door (which is represented by a servo motor) within 40 cm, the door will open itself. Then when they will enter in the room or go away, the door will close. HCSR04 sensor will measure the distance between any people and the door.

The door is open, as there is someone near at the door
The door is open, as there is someone near at the door

If the room is dark and there is someone in the room, then only the bulb will glow. LDR is used to detect the presence of light and PIR sensor is used to sense any movement in the room.

The bulb is glowing
The bulb is glowing

When the temperature of the room will be more than 20° c and the room will detect any movement the fan (DC Motor) will start. TMP36 is used to measure temperature and PIR sensor is used to detect movement.

The fan is moving
The fan is moving

There is a fire alarm in the room. When MQ2 sensor will detect smoke, the fire alarm will start to ring.

The fire alarm is ringing
The fire alarm is ringing

So, what are you waiting for? Quickly grab all the components and make a mini home automation model.

--

--