Microcontroller Projects: Home Automation System

By Kulbhushan Srivastava. He is B.Tech (ECE) from Lovely Professional University. His interests include circuit and complex logic designs, and programming microcontrollers including PIC, AVR, ARM and 8051


Similarly, in order to determine Y coordinate, it is necessary to connect the bottom contact on Y surface to ground and the upper contact to +5V power supply.

The 128×64 LCD is divided into two equal halves, with each half being controlled by a separate KS0108 controller. Such LCDs (using KS0108 controllers) involve a paging scheme, that is, the whole LCD is divided equally into pages. Paging scheme of the graphical LCD can be understood from Table I.

Fig. 9: PCB of the relay module
Fig. 10: Component layout of the relay module

Keyboard interface module

The keyboad interface module circuit is shown in Fig. 6. This module includes an ATmega8 microcontroller (IC8), keyboard input, 7805 regulator (IC7), 16×2 LCD (JHD162A) and a few other components. The input given from the keyboard is displayed on the LCD, and is simultaneously transmitted to the main module through connector CON9.

This module is basically for doing various settings like date and time, testing of each module and turning off the system using a specific command. It thus helps to set the system to correct values and operating parameters. This module is not used during normal operation and may therefore be kept disconnected.

A 16×2 LCD can display 16 characters per line and there are two such lines.

Software program

The program for the microcontroller is written in C language and compiled using gcc compiler. The compiler is used to convert C program into a hex file for burning into the flash memory of ATmega8 microcontroller.

In this project, the default internal oscillator is used for ATmega8 operation. The complete program is a combination of different functions. There are four main programs for this project: main_m.c, touchpannel.c, rlmod.c and lcdkbd.c.

The program starts with the main function that is used to configure the various ports of ATmega8 microcontroller as input/output and initialise UART module, and it calls UART_init() function to initialise to 4800bps and enable reception. The main function also enables the power-on relay used in the project to provide supply to the other sections.

 [stextbox id=”grey”]

devswit() is used for switching between different devices connected in the system.

shut_down() is used to shut-down the complete system in shut-down mode and configure it in standby mode.

device_on() is used to switch on/off the corresponding relay for different appliances.

testm() is used to test system time configuration when powered on.

time_set() is used to set RTC time and date.

d_fnc( uint8_t l) is used to select various modes of operation of the system.

readm() is used for module name verification.

All functions related to LCD operation are included in lcd.h header file.




Please enter your comment!
Please enter your name here