In modern world home automation is necessary requirement. And if it is Android based home automation system then it will be the best solution. Here in my post we will see how easily we can build Android based home automation system. To go forward please refer my early post on “Interfacing android with pic microcontroller via Bluetooth”.

Project Objective:

The main objective of my project is to on/off all home appliances like light, fan, AC etc and we can check back to back status of which appliance is on and which is off by pressing button inside android aps. It can be possible by implementing Interfacing android with pic microcontroller via Bluetooth. Now see the block diagram of my project in bellow.

Android based home automation system

To complete my project Android based home automation system, I used


  • Android Mobile
  • Microcontroller PIC16F877A
  • LED
  • Bluetooth module (hc05)
  • Android apps “Nbcafe”(which is made by me)

Android based home automation system


To download this .apk file click nbcafe.apk

Project Description:

In my project Android based home automation systems. Our aim is control whole electrical equipment through our mobile. So it is clear that our mobile act as a remote control for those home equipment. We made an android apps for that to control two equipment. You can switch on and off two device and simultaneously check the status that which equipment is on and which is off. From this apps you can send some character like “a;b;c;d;e;f;g;h;i” via Bluetooth serial communication. This send data will receive by our Bluetooth module which is added with microcontroller pic16f877a. Now I write my program accordingly to control the total system. See the circuit block diagram at bellow.

 Android based home automation

Bluetooth connectivity with Microcontroller:

Now major question should come to our mind that how can we connect Bluetooth with microcontroller pic16f877a. Answer is you have to connect Bluetooth module with UART port (the pin number 26 and 25 of pic16f877a is used for Rx and Tx).only thing we should remember that Bluetooth Rx pin should connect with Tx pin of microcontroller and Bluetooth Tx pin should connect with Rx pin of microcontroller. If you have any confusion on “How to interface UART port with microcontroller? “See my previous post “Serial communication with Pic 16f877 using UART”.

In bellow you will find the code to run my project

See the Complete Embedded C Code

Embedded C Code
// Name : Android based home automation system
// Author : Subham Dutta
// Date : 11-09-15
// Website :
unsigned int uart_rd;
void main() {
int i;
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilizewhile (1) { // Endless loop
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read();
UART1_Write(uart_rd); // read the received data,
if (uart_rd == ‘a’){
if (uart_rd == ‘b’){
if (uart_rd == ‘g’){
if (uart_rd == ‘h’){
if (uart_rd == ‘ ‘){if (portb == 0b00000001)
{UART1_Write_Text(“L1 On”);
if (portb == 0b00000010)
UART1_Write_Text(“L2 On”);
if (portb == 0b00000011)
UART1_Write_Text(“L1 and L2 On”);
if (portb == 0b00000000)

 And see the video of my project, Android based home automation system which is presented by our college student at project