Home automation system with 8051 microcontroller (p89v51rd2) [for beginners]

 

Home automation is the residential extension of building automation. It is automation of the home, housework or household activity. Home automation may include centralized control of lighting, HVAC (heating, ventilation and air conditioning), appliances, security locks of gates and doors and other systems, to provide improved convenience, comfort, energy efficiency and security. Home automation for the elderly and disabled can provide increased quality of life for persons who might otherwise require caregivers or institutional care.

The popularity of home automation has been increasing greatly in recent years due to much higher affordability and simplicity through smartphone and tablet connectivity. The concept of the "Internet of Things" has tied in closely with the popularization of home automation.

A home automation system integrates electrical devices in a house with each other. The techniques employed in home automation include those in building automation as well as the control of domestic activities, such as home entertainment systems, houseplant and yard watering, pet feeding, changing the ambiance "scenes" for different events (such as dinners or parties), and the use of domestic robots. Devices may be connected through a home networkto allow control by a personal computer, and may allow remote access from the internet. Through the integration of information technologies with the home environment, systems and appliances are able to communicate in an integrated manner which results in convenience, energy efficiency, and safety benefits.

Automated homes of the future have been staple exhibits for World's Fairs and popular backgrounds in science fiction. However, problems with complexity, competition between vendors, multiple incompatible standards, and the resulting expense have limited the penetration of home automation to homes of the wealthy, or ambitious hobbyists. Possibly the first "home computer" was an experimental home automation system in 1966.

Home automation is a category that can span really simple to extremely complex tasks depending on who you ask. It's easy to get overwhelmed by jargon and devices and standards. The simplest way to wade into home automation is eliminate the clutter and focus on what you actually want to do.P

Deciding what you want will go a long way in determining your budget, your method, and how much time you'll be investing setting things up. With the right level of ingenuity, the sky's the limit on things you can automate in your home, but here are a few basic categories of tasks that you can pursue:P

  1. Automate your lights to turn on and off on a schedule, remotely, or when certain conditions are triggered.P
  2. Set your air conditioner to keep the house temperate when you're home and save energy while you're away.P
  3. Open your blinds during the day and shut them at night (or when it's particularly hot).P
  4. Feed your pets on a schedule and with pre-determined amounts of food.P
  5. Open your garage door with voice commands.P
  6. Set your coffee maker to have a fresh pot ready as soon as you wake up.P
  7. Create an emergency party button that goes from one to funky in seconds.

P

This is, of course, just a sample. To put it very simply, if you do something repeatedly, you can probably automate it one way or another. Just about everything that runs on electricity, and several things that aren't can be made smarter and possibly even hooked in to a central system.

Mostly, the system in houses are connected via I/O lines or wifi. Both are reliable and have their advantages and disadvantages. Example:  I/O lines can be messy but cheaper and on other hand wifi will be clean and costly.

You can observe in the image, that all the devices are connected to an embedded system via I/O bands. But this is a bit outdated method in todays era. Because today, we have wifi in almost all houses. so why not use that?

By using wifi sometimes its very easy to code the logic of the system. and anytime, you can just add or remove any device on network. Below is also the image of a clean and very advance homeautomation system implementation.

Going into deep (specific)


As, we know that these projects are very large and can have various output devices to be controlled or automated, in that case, we should always choose any platform which is very low in cost. This will prevent you to go overbudget. Next, we will now take a small task related to the home automation project. Obviously! we will be making very complex system at last, but my main aim is to make things easier to you, not flash your eyes with complex things at once.

So, our task we will be "To calculate the number of persons already in the room and switch Fans and lights in the room according to present number of people in the room". For this, currently we are not using wifi, expensive microcontrollers like arm cortex8 and so on with linux, instead we are using 8051 architecture microcontroller development board, so that you can learn with less budget. For the sensing or input part, we will use IR sensor module created by us in last article. and for output, we will use a DC motor connected to a ULN IC.

Now for further information i want you to see my youtube video embedded here. In this video, i have explained the working of this project.

 

I hope that, you have clear understanding about the circuit through this video. I have not given a seperate circuit diagram to you people because i want you to understand the working and not just see and make circuits. But after this video, you could still not figure out how to make circuit on this board or at your custom board then for that, i have made a small PDF file for all the steps you should follow, while making this circuit. you can download this file from hereWith this, you can also download the codes of 8051 microcontroller interfacing and specially the code for this project on this git link. 

 

A little code explaination


Before, we proceed, i highly recommend you to read detailed information about IR sensor module which we created, 8051 microcontroller intro & programming environment setup and Motor driving circuitBelow given code snippet of this project.

Here, you can see the logicial part of this program, where sin and sout are the variable holding the IR sensors values of the sensor monitoring at input end and output end of the entery door. (eventhough using IR sensor is not reliable for these tasks, but for learning phase, it doesnot matter. later, i will tell you about the image processing with attached camera in much higher level microcontroller)

With two if statements, we are polling on the IR sensor events that is if some one has entered or left.  In both the statement, on the basis of the sensor which get activated first, we decide whether a person has come in or went out of the room. In action, we are turning fan1 and tube1 variable for relay on/off.

if you dont know how to compile and then burn the hex file into your microcontroller, then follow this tutorial.

Apart from this, I will also write about the advance room automation with the android application to controll the automation parameters soon. There, we will also be switching and controlling the home applicances through android app by using profile system.

I hope this article helped you. Please feel free to comment below or contact me, for any query. :)