Introduction
Home automation systems have become increasingly popular due to their convenience and ease of use. Adding voice control to such systems enhances their accessibility and functionality. This project demonstrates how to design a voice-controlled home automation system using the 8051 microcontroller. The system allows users to control home appliances using voice commands through a Bluetooth-connected smartphone.
Components Required
8051 Microcontroller (e.g., AT89S52)
HC-05 Bluetooth Module
Voice Recognition Module (e.g., Elechouse V3 or compatible)
Relay Module (4-channel for controlling multiple appliances)
16x2 LCD Display (optional for displaying status)
Resistors (10kΩ, 1kΩ)
Capacitors (33pF, 100μF)
Crystal Oscillator (11.0592 MHz)
Breadboard and Connecting Wires
Power Supply (5V for the 8051 and Bluetooth module, separate supply for relays)
Circuit Diagram
The 8051 microcontroller interfaces with the HC-05 Bluetooth module for wireless communication and the relay module to control home appliances. The voice recognition module processes voice commands and sends them to the 8051 via UART.
+5V ----- +5V
|
|
HC-05
+---+
+5V |VCC|
GND |GND|
TX |TXD|------- RXD (P3.0 of 8051)
RX |RXD|------- TXD (P3.1 of 8051)
+---+
Voice Recognition Module
+5V |VCC|
GND |GND|
TX |TXD|------- RXD (P3.0 of 8051)
RX |RXD|------- TXD (P3.1 of 8051)
Relay Module
VCC to +5V
GND to Ground
IN1 to P2.0 (Relay 1 control)
IN2 to P2.1 (Relay 2 control)
IN3 to P2.2 (Relay 3 control)
IN4 to P2.3 (Relay 4 control)
Pin Connections
HC-05 Bluetooth Module:
VCC to +5V
GND to Ground
TXD to RXD (P3.0 of 8051)
RXD to TXD (P3.1 of 8051)
Voice Recognition Module:
VCC to +5V
GND to Ground
TXD to RXD (P3.0 of 8051)
RXD to TXD (P3.1 of 8051)
Relay Module:
VCC to +5V
GND to Ground
IN1 to P2.0 of 8051
IN2 to P2.1 of 8051
IN3 to P2.2 of 8051
IN4 to P2.3 of 8051
Software Implementation
The code is written in C using Keil uVision IDE. It involves initializing the UART for communication with the Bluetooth module and voice recognition module, reading commands, and controlling the relays based on these commands.
#include <reg51.h>
sbit RELAY1 = P2^0; // Relay 1 control pin
sbit RELAY2 = P2^1; // Relay 2 control pin
sbit RELAY3 = P2^2; // Relay 3 control pin
sbit RELAY4 = P2^3; // Relay 4 control pin
void delay(unsigned int count) {
int i, j;
for(i=0; i<count; i++)
for(j=0; j<1275; j++);
}
void uart_init(void) {
TMOD = 0x20; // Timer1 in mode 2
TH1 = 0xFD; // Baud rate 9600
SCON = 0x50; // 8-bit data, 1 stop bit, REN enabled
TR1 = 1; // Start Timer1
}
char uart_receive(void) {
while(RI == 0); // Wait for reception to complete
RI = 0; // Clear reception interrupt flag
return SBUF; // Return received character
}
void main() {
char command;
uart_init(); // Initialize UART
while(1) {
command = uart_receive(); // Receive command from Bluetooth or Voice module
switch(command) {
case 'A': // Turn ON Appliance 1
RELAY1 = 1;
break;
case 'B': // Turn OFF Appliance 1
RELAY1 = 0;
break;
case 'C': // Turn ON Appliance 2
RELAY2 = 1;
break;
case 'D': // Turn OFF Appliance 2
RELAY2 = 0;
break;
case 'E': // Turn ON Appliance 3
RELAY3 = 1;
break;
case 'F': // Turn OFF Appliance 3
RELAY3 = 0;
break;
case 'G': // Turn ON Appliance 4
RELAY4 = 1;
break;
case 'H': // Turn OFF Appliance 4
RELAY4 = 0;
break;
default:
// Handle unrecognized command
break;
}
delay(100); // Small delay for stability
}
}
Explanation
Initialization:
UART Initialization: The uart_init() function configures the UART for communication at a baud rate of 9600.
Receiving Commands:
The uart_receive() function waits for and reads a character from the Bluetooth module or voice recognition module via UART.
Relay Control:
The main loop continuously receives commands and uses a switch-case structure to control the relays based on the received commands. Commands 'A' to 'H' are used to turn the appliances on or off.
Conclusion
This project demonstrates the use of the 8051 microcontroller to create a voice-controlled home automation system. By integrating a Bluetooth module and a voice recognition module, the system can receive voice commands and control home appliances accordingly. This project is a great way to learn about wireless communication, voice recognition, and using microcontrollers for home automation applications.
Want us to guide you through your project or make the project for you ?
Create Various Projects
Check out our Free Arduino Projects Playlist - Arduino Projects
Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects
Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects
Check out our Free IoT Projects Playlist - IoT Projects
Check out our Free Home Automation Projects Playlist - Home Automation Projects
Check out our Free NodeMCu Projects Playlist - NodeMCu Projects
Comments