Objective:
The aim of this project is to create a Bluetooth-based smart home automation system that allows the control of household appliances (such as lights, fans, locks, and more) using a smartphone app. This project will demonstrate how to use microcontrollers, Bluetooth modules, and relays to manage home appliances, with an optional extension for sensor-based automation.
Project Overview:
Smart home Automation project uses a Bluetooth module to enable wireless communication between a microcontroller (such as Arduino or ESP32) and a smartphone app. The app will send commands to the microcontroller, which will control appliances through relays connected to devices like lights, fans, and locks. The system will operate locally without requiring an internet connection, making it ideal for energy-efficient and cost-effective home automation.
Hardware Components:
- Microcontroller:
- Arduino Uno or ESP32: The brain of the system. ESP32 is preferred because it has built-in Bluetooth and Wi-Fi, providing options for future expansion. Arduino Uno, on the other hand, will require an external Bluetooth module like HC-05 or HC-06.
- Bluetooth Module (if using Arduino):
- HC-05/HC-06: This module allows the Arduino to communicate with the smartphone via Bluetooth.
- ESP32: Has built-in Bluetooth, so no additional Bluetooth module is required.
- Relay Module:
- 4-channel or 8-channel relay module: Used to switch high-voltage devices (like lights, fans, and appliances) using the low-voltage control signals from the microcontroller.
- Smartphone (Android or iOS):
- A Bluetooth-enabled smartphone to control the system using a custom app that sends commands to the microcontroller.
- Power Supply:
- Power the microcontroller and connected devices (5V for Arduino/ESP32, and appropriate voltage for the appliances being controlled).
- Connecting Wires and Breadboard:
- For connecting all components.
- Home Appliances:
- Light bulbs, fans, or other devices that will be controlled.
- Optional Sensors:
- PIR motion sensor: To detect movement and trigger automated actions.
- Temperature sensor (DHT11 or DHT22): To automate the switching of devices based on temperature.
Software Requirements:
- Arduino IDE: For programming the microcontroller.
- Android Studio: To develop a smartphone app to send commands to the Bluetooth module.
- MIT App Inventor (Optional): For beginners, MIT App Inventor is an easier tool to develop simple Android apps without coding.
- Bluetooth Terminal App (Optional): To test Bluetooth communication between the phone and microcontroller before building the custom app.
System Design and Circuit Diagram:
1. Circuit Design:
The system consists of three primary elements: Bluetooth communication, relay control, and the power supply to operate the appliances.
- Microcontroller and Bluetooth Module:
- The Bluetooth module (HC-05 or ESP32’s built-in Bluetooth) will be used to receive signals from the smartphone. The TX and RX pins of the HC-05 module are connected to the microcontroller’s RX and TX pins, respectively.
- Power the Bluetooth module through the microcontroller’s 5V and GND pins.
- Relay Module:
- Connect the relay module’s inputs (IN1, IN2, IN3, etc.) to the corresponding digital pins on the microcontroller.
- The relay module will control the appliances by switching them on/off. It requires separate power and grounding, so connect the VCC and GND of the relay module to the microcontroller, and the IN1/IN2/etc. to the GPIO pins that will control it.
- Home Appliances:
- The home appliances (lights, fans, etc.) will be connected to the relay module’s output. The relay will act as a switch to control whether the appliance is on or off.
2. Circuit Diagram:
A simple circuit for controlling two home appliances would involve connecting two relays to the microcontroller and setting up the Bluetooth module for wireless communication.
Here’s a basic wiring setup:
- Connect the HC-05 Bluetooth module to Arduino Uno:
- VCC → 5V
- GND → GND
- TX → RX (Pin 0)
- RX → TX (Pin 1)
- Connect two relays to Arduino’s digital pins:
- IN1 → Pin 7 (Controls Appliance 1)
- IN2 → Pin 8 (Controls Appliance 2)
- VCC → 5V
- GND → GND
- Connect the household appliances to the normally open (NO) terminal of the relay and the neutral wire to the common (COM) terminal.
- Power both the Arduino and relay module using an appropriate power supply.
Microcontroller Programming (Arduino or ESP32):
Use the Arduino IDE to program the microcontroller. The code will listen for Bluetooth commands from the smartphone and switch relays based on the received input.
Example Code for Arduino with HC-05 Bluetooth Module:
// Programmed By KAVIKUMARAN G
// Visit our website : Pickupmyskills.com
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX | TX for Bluetooth Module
int relayPin1 = 7; // Pin for controlling Appliance 1
int relayPin2 = 8; // Pin for controlling Appliance 2
void setup() {
pinMode(relayPin1, OUTPUT);
pinMode(relayPin2, OUTPUT);
BTSerial.begin(9600); // Start Bluetooth communication
Serial.begin(9600); // Start serial communication for debugging
}
void loop() {
if (BTSerial.available()) {
char command = BTSerial.read(); // Read command sent via Bluetooth
if (command == '1') {
digitalWrite(relayPin1, HIGH); // Turn ON Appliance 1
} else if (command == '2') {
digitalWrite(relayPin1, LOW); // Turn OFF Appliance 1
} else if (command == '3') {
digitalWrite(relayPin2, HIGH); // Turn ON Appliance 2
} else if (command == '4') {
digitalWrite(relayPin2, LOW); // Turn OFF Appliance 2
}
}
}
App Features:
- Bluetooth Pairing: The app must scan and pair with the Bluetooth module (HC-05 or ESP32).
- On/Off Buttons: Create buttons in the app to control each appliance.
- Real-time Feedback (optional): The microcontroller can send feedback to the app about the current state of the appliance (e.g., ON or OFF).
For beginners, MIT App Inventor provides a visual drag-and-drop interface for creating basic Bluetooth apps.
Sample Flow for App Development (Android Studio):
- Set up Bluetooth permissions in the Android app’s manifest file.
- Add a Bluetooth pairing function that lets the app discover and connect to nearby Bluetooth devices.
- Develop a user interface (UI) with buttons for each appliance (e.g., Lights, Fans).
- Use BluetoothSocket to send commands from the app to the Bluetooth module.
Future Enhancements:
- Sensors for Automation: Integrate sensors like PIR motion detectors or temperature sensors to automate certain actions, such as turning on lights when movement is detected.
- Energy Monitoring: Add functionality to monitor the energy consumption of connected devices.