IoT Smart Home with Intruder Detection

Published Jun 22, 2022
 5 hours to build
 Intermediate

IoT Smart Home with Intruder Detection helps detect intruders near my home by scanning for MAC addresses emitted by nearby devices such as smartphones and alerts me on the app. I can also automate repetitive tasks such as turning on/off appliances like geyser in the morning or mosquito repellents at a pre-set schedule among other features that include emails of any motion captured at my front door, motion activated lights, gas and smoke detection.

display image

Components Used

NodeMCU
NodeMCUNodeMCU
1
ESP32 DevKitC 32E
ESP32 DevKitC 32E
1
Raspberry Pi Camera V2
Raspberry Pi Camera V2
1
TTP223N 1 KEY TOUCH PAD DETECTOR IC
TTP223N is a touch pad detector IC for 1 touch key.
4
MQ2 Gas Sensor
MQ2 is a gas sensor used for gas leakage detection.
1
LM35 Temperature Sensor
LM35 is a sensor which is used to measure temperature. It provides electrical output proportional to the temperature (in Celsius).
1
Raspberry Pi 3 - Model B+
Single Board Computers The factory is currently not accepting orders for this product.
1
PIR Sensor
PIR motion sensors sense the Infrared signal radiated from moving objects including human or animal body. It is generally used to detect the presence of human or animal motions.
1
Sony Spresense Main Board and Extension Board
Cameras & Camera Modules Sony Spresense Pack - Main Board + Extension Board + Camera
1
Solenoid Lock
SparkFun Accessories Solenoid - 12V (Latch / Lock)
1
Connecting Wire Jumper Wires
Connecting Wire Breadboard wires
1
Magnetic Reed Switch
1
Description

 

The Problem

  • Many people who either live alone or in isolated locations, pose the threat of home thefts / intruders
  • They have no way to know if a door has been opened when no one is home
  • The elderly or the disabled often depend on others for help, such as turning ON/OFF lights, fans especially when they are about to sleep or when they wake up in the middle of the night
  • We can enhance our quality-of-life by automating repetitive tasks be it turning ON the geyser in the morning or mosquito repellent devices like All Out or Good Knight at a pre-set schedule

The Solution 

  • Wouldn’t it be nice if I could be notified on my phone if an unknown person is detected near my house?
  • And if I could watch a live stream of a camera placed at my front door?
  • And get mails of video clips if any motion is detected?
  • And… And… And… ???

Features - Security

  • Get notified on the app if an unknown person is detected around the home
  • Watch a live stream from camera on a browser or the app
  • Get emails of video from camera if any motion is detected
  • Get on notified on the app if door is opened

Features - Safety

  • Get notified on the app if smoke or gas is detected
  • Turn ON light in the night when motion is detected. This is helpful especially for the elderly when the wakeup during the night
  • Remotely lock and unlock the door from the app. This allows keyless entry, thus limiting the spread of the deadly Coronavirus
  • This keyless entry can be used to remotely open doors so that delivery agents can drop packages safely and securely even when the user isn’t home

Features - Quality of Life Enhancements

  • Occupancy awareness can be used to turn ON/OFF lights automatically depending on whether the user is home or not. This helps save a lot of electricity
  • Control appliances remotely from the app
  • Touch switches to control appliances without the app
  • Set schedules to automatically turn ON/OFF appliances. E.g. Turning ON/OFF geysers in the morning, so the user has hot water ready to use as soon as they wakeup

 

How Does It Work?

MAC Address Detection

  • These days almost everyone carries a smartphone with them
  • These smartphones constantly emit Wi-Fi packets to look for already known access points
  • These packets contain a source and destination MAC address
  • We can look at the source MAC address to identify the smartphone and hence the person

 

Camera Stream

  • To local web server in MJPEG format
  • Can be viewed on a browser or the app
  • If any motion is detected, it is recorded, saved locally and then, a copy is emailed

Sensors Used

Technologies Used

  • C++ to program Sony Spresense, Node-MCU, ESP-32
  • Motion Software to get the video from the camera and stream it to a web-server
  • Python to e-mail the video clips
  • Kotlin to make the Android app
  • Google Firebase Realtime Database as the cloud database

Schematics and Circuit Diagram

 

Hardware Architecture 

Software Architecture

Future Scope and Improvements

  • Move schedules from app to a backend cloud service
  • Improve latency in getting data from Firebase by ESP-32
  • Automate heating and cooling of the house

Challenges I Faced

  • I wasn’t successful in setting up a web-server on the Sony Spresense because of some issue. I’m still trying to figure it out
  • Hence, I used a Raspberry Pi as a fix. But I would love to get the web-server working on the Spresense especially for the huge power savings it provides

How is it Going to Benefit Others

  • Leave / Live at home without any fear of theft or robbery as :
  • They get notified when an unknown person is in the vicinity of their home for a certain period of time.
  • Can watch a live stream of their home.
  • Control devices or set schedules to automatically control devices from the app.
  • Motion activated lights help navigate in the dark.
  • Elderly can become much more independent as they can control devices from their bed or any other convenient place.
  • Get notifications on the app in case any smoke or gas leakage is detected or the door is opened.
  • Relocate hard to access switch panels by using touch switches that can be placed in an easy to access location.
  • Touch switches enhance the look and feel of the home, making it look modern.

 

I have made this project open source 

You can have a look at the Source Code here

Link to App

Link to Presentation and Demo

 

Codes

Downloads

Updated Presentation Paper Number 10 Download
Comments
Ad