Smart Home Automation let the user to control the
home from his or her phone and assign actions that should happen
depending on time or other sensor readings such as light, temperature or
sound from any device in the Home Automation network.
WHAT CAN HOME AUTOMATION DO?
Features of our project:
[The project shown here is more a prototype,but it is fully tested and working and ready to be implemented in realtime]
[Please vote for me,if you like my work.]
WHAT CAN HOME AUTOMATION DO?
- Increase your independence and give you greater control of your home environment.
- Make it easier to communicate with your family.
- Save you time and effort.
- Improve your personal safety.
- Reduce your heating and cooling costs.
- Increase your home’s energy efficiency.
- Alert you audibly and visually to emergency situations.
- Allow you to monitor your home while you are away.
Features of our project:
- Control upto four home appliances wirelessly (expandable based on free IO pins).
- Monitor status of your home like temperature inside and outside of your home,light intensity inside and outside of your home, motion (presence) on the main entrance,LPG leak in the home and status of you main door.
- Open/close your main door electrically and wirelessly.
- As the android application is password protected ,it automatically adds security to your home as it can be controlled by the user only.
- Automate your indoor lightening, outdoor lightening and fan/AC to switch ON/OFF automatically when the light intensity and temperature conditions exceed the programmed threshold values.(This feature, we named it “SENSOMATE”).
- It automatically monitor your home against LPG leaks and cases of fire.If it detects something wrong, it automatically switches off all home appliances instantly and immediately opens the door to let the LPG/fire exhaust off your home.
- Has a “SLEEP MODE” , once activated will switch your light off and program the motion sensor and door sensor to raise alarm if anything goes wrong.
- At last, as it uses Bluetooth the user can use the android phone within a range from 10-100m .
[The project shown here is more a prototype,but it is fully tested and working and ready to be implemented in realtime]
[Please vote for me,if you like my work.]
Step 1: What we proposed : The solution
Home automation can allow you to make the things that you need and
do in your home easier to accomplish. Perhaps you want to control your
security system? Or, perhaps you want to voice automate the lights in
your home so that you can get into bed and then turn the lights out. Or,
perhaps you want to be able to control your sound system from any place
in your home. No matter what it is you are looking to accomplish, home
automation products are probably available to help you to make it
happen. A typical home automation system allows one to control house
hold appliances from a centralized control unit. These appliances
include lights, fans, air conditioners, television sets, security
cameras, electronic doors, computer systems, audio/visual equipment,
etc. These appliances usually have to be specially designed to be
compatible with each other and with the control unit for most
commercially available home automation systems.
The project Smart Home Automation, demonstrates a system that can be integrated into a home/building’s electrical system and allows one to wirelessly control lights, fans, and turn on or off any appliance that is plugged into a wall outlet. The system can be controlled from a Bluetooth or Wi-Fi enabled device such as a mobile phone or laptop, while a microcontroller powered box act as the server. Thus the installation cost and hardware cost is kept to a minimum as most users already own the requisite hardware such as a mobile phone and desktop PC.
A Bluetooth dongle or a standard Wireless Access Point is used to provide connectivity between the server and the mobile device. The system is capable of detecting when the user enters or leaves the room by measuring the change in environmental thermal equilibrium, and can accordingly turn on or off appliances such as lights and fans. The power supply for each appliance is wired through an electromechanical relay. A number of relays are used depending on the number of appliances to be controlled. All the relays are controlled by a microcontroller. The microcontroller based host acts as the mmain server.. The server can also receive connections over the internet and can be controlled from a remote location. This opens up many possibilities. For example, one could remotely turn on the air conditioner from the office before leaving so that the room is cool before reaching home. Home automation can range in complexity from the simple gadgets and gizmos that provide control over individual components to individual home sub-systems and integrated whole house systems.
The project:
The project Smart Home Automation, demonstrates a system that can be integrated into a home/building’s electrical system and allows one to wirelessly control lights, fans, and turn on or off any appliance that is plugged into a wall outlet. The system can be controlled from a Bluetooth or Wi-Fi enabled device such as a mobile phone or laptop, while a microcontroller powered box act as the server. Thus the installation cost and hardware cost is kept to a minimum as most users already own the requisite hardware such as a mobile phone and desktop PC.
A Bluetooth dongle or a standard Wireless Access Point is used to provide connectivity between the server and the mobile device. The system is capable of detecting when the user enters or leaves the room by measuring the change in environmental thermal equilibrium, and can accordingly turn on or off appliances such as lights and fans. The power supply for each appliance is wired through an electromechanical relay. A number of relays are used depending on the number of appliances to be controlled. All the relays are controlled by a microcontroller. The microcontroller based host acts as the mmain server.. The server can also receive connections over the internet and can be controlled from a remote location. This opens up many possibilities. For example, one could remotely turn on the air conditioner from the office before leaving so that the room is cool before reaching home. Home automation can range in complexity from the simple gadgets and gizmos that provide control over individual components to individual home sub-systems and integrated whole house systems.
The project:
- Use five sensors to monitor the state of home namely temperature, light intensity,motion, LPG leak and door/window status.
- Use a host device that will be mounted on wall and will have connection to all your home appliances like lights, fans, etc and to all the sensors.
- Use “ANDROID” based smartphone, tablets as the user interface and control panel.
- The ANDROID client will use bluetooth to wirelessly connect to the host device.
- Simply logging in the android application will grant access to the user to control and automate his home wirelessly.
Step 2: BLOCK DIAGRAM
The block diagram of the project is shown if
figure above. The main heart of the project that do all data processing
and decision making is the microcontroller. Here it serves the purpose
of data acquisition from the sensors and comparing then with the
programmed values stored in the microcontroller’s EEPROM and then
actuating the devices accordingly. A 16x2 character LCD is used for
displaying the messages, appliance state and sensor readings. It is
directly connected to the microcontroller in 4-bit addressable mode.
Whenever a new action or event is raised like fire alarm, LPG leak, etc
it is displayed on the LCD too. Next we have the Bluetooth UART module
connected to the serial port of the microcontroller. It act as an access
point for the android client on the another side and logically it act
as complete serial cable replacement for the serial port. The data is
exchanged serially between the two devices. A LINK status pin to the
microcontroller from the Bluetooth UART tells it that the android client
is successfully connected to the host. Next, to control two light one
inside and other outside the home , a fan/AC and a television we have
four relays connected to the microcontroller via the NPN transistor
based buffer circuit. The relays consume a lot current while being
activated and the microcontroller on any pin can source only 20mA of
current so a buffer circuit is utmost indispensable between the relay
and the controller.
There are five types of sensors used in the project those are being directly interfaced to the microcontroller. To sense the light intensity we use two LDR sensors that is light dependent resistors interfaced to the ADC input of the microcontroller. To sense the temperature we used two solid state semiconductor temperature sensors from analog devices also interfaced to the ADC input of the microcontroller. To sense the LPG leak in the home we used the MQ-5 LPG sensor and it is interface to the ADC input of the microcontroller. After them, we used a hook switch to sense the door whether it is opened or closed. This sensor is connected to the digital input of the microcontroller pulled up externally. To sense the presence and motion we used the PIR (Pyroelectric InfraRed) sensor that has a digital output and it is also connected to the digital input of the microcontroller pulled up externally. The main door is driven by the geared DC motor and as it has to close and open the door, it has to be moved bi-direcionally. To do so, we used the NPN transistor based H-bridge bidirectional motor driver circuit interfaced to the digital output of the microcontroller. The microcontroller can digitally control the motion and direction of the motor to open and close the door. A software feedback is implemented between the motor and the door hook sensor output so that when the door reaches its max position and is being shut the motor stops driving the motor to prevent any damage.
There are five types of sensors used in the project those are being directly interfaced to the microcontroller. To sense the light intensity we use two LDR sensors that is light dependent resistors interfaced to the ADC input of the microcontroller. To sense the temperature we used two solid state semiconductor temperature sensors from analog devices also interfaced to the ADC input of the microcontroller. To sense the LPG leak in the home we used the MQ-5 LPG sensor and it is interface to the ADC input of the microcontroller. After them, we used a hook switch to sense the door whether it is opened or closed. This sensor is connected to the digital input of the microcontroller pulled up externally. To sense the presence and motion we used the PIR (Pyroelectric InfraRed) sensor that has a digital output and it is also connected to the digital input of the microcontroller pulled up externally. The main door is driven by the geared DC motor and as it has to close and open the door, it has to be moved bi-direcionally. To do so, we used the NPN transistor based H-bridge bidirectional motor driver circuit interfaced to the digital output of the microcontroller. The microcontroller can digitally control the motion and direction of the motor to open and close the door. A software feedback is implemented between the motor and the door hook sensor output so that when the door reaches its max position and is being shut the motor stops driving the motor to prevent any damage.
Step 3: The Circuit Diagram
The circuit diagram of the project is shown above in figure above.
The starting from the power supply section, we have the 9V AC input
from the secondary output of the transformer. This is the fed to the
bridge rectification section that converts AC supply into DC supply.
This is done by four 1N4007, 1 A diodes in bridge configuration. Then on
the DC output of this section a large capacitor (1000uF, 16V) and
another small 100nF capacitor is there to filter the DC supply and
remove off all AC components from it. This is because here we are
operating pre digital circuitry that fails to operate on unregulated and
unfiltered supply. After the DC supply is being filtered as it is
unregulated is turned into a regulated 5V DC supply using LM7805
regulator. Again after that a small 100nF capacitor is there to filter
the regulated DC supply. A regulated 3.3 volt supply is also derived
from another regulator that is the UA78M33 whose input is fed from the
regulated 5V output of the LM7805 voltage regulator. Regulated 5 volt
supply is needed to drive the microcontroller, relays and all the
sensors, while a regulated 3.3 volt is required by the Bluetooth UART
module to operate. After that the regulated supply is fed to all the
sensors ,relays and the microcontroller.
There are five types of sensors used in the project those are being directly interfaced to the microcontroller. To sense the light intensity we use two LDR sensors that is light dependent resistors interfaced to the ADC input of the microcontroller. One pin of the LDR is connected to Vcc via a 330K resistor and other tied to ground. This creates a potential difference in between of the circuit and is fed to pin A.3 and A.2 of the microcontroller respectively. To sense the temperature we used two solid state semiconductor temperature sensors from analog devices also interfaced to the ADC input of the microcontroller. The two pins are connected to the power supply to power the sensors and the third pin is the output pin is connected to the ADC7 and ADC6 channel of the microcontroller. To sense the LPG leak in the home we used the MQ-5 LPG sensor and it is interface to the ADC5 channel input of the microcontroller. When an LPG leak is detected the output of the LPG sensor decrease gradually and that is being sensed by the ADC of the microcontroller. After them, we used a hook switch to sense the door whether it is opened or closed. This sensor is connected to the digital input pin D.7 of the microcontroller pulled up externally.Whe the door is closed, the hook switch is closed and the output is logic low as it bypasses the ground. When the door is open, the hool switch is also open and it bypasses logic1 throught 10k resistor to the output. To sense the presence and motion we used the PIR (Pyroelectric InfraRed) sensor that has a digital output and it is also connected to the digital input (pinA.4) of the microcontroller pulled up externally. When a motion is detected ,the output goes high for a few seconds and comes back to low in case of absence of motion. The main door is driven by the geared DC motor and as it has to close and open the door, it has to be moved bi-direcionally. To do so, we used the four BC107 NPN transistor based H-bridge bidirectional motor driver circuit interfaced to the digital output of the microcontroller. The microcontroller can digitally control the motion and direction of the motor to open and close the door. To display messages and sensor values a 16x2 character LCD is used in 4 bit mode to portB of the microcontroller.
The H-bridge circuit is used to drive a DC motor in both the directions. It can also use relays to function but here we used the BJT based one. It comprises of four BC107 NPN transistors as shown in figure 2. The two transistor T1 and T2 are in series and those T3 and T4 are also in series. The base of all four transistors are protected y current limiting resistors R1-R4. The prevent damaging the transistors. The base signals of T1 and T4 are the same and that of T3 and T2 are also the same. The operation is simple that when Sig1 is logic 1 and Sig 2 is logic 0, it will turn ON T1 and T4 and will turn the motor in one direction same if we reverse the input logics, the motor will go in reverse direction. All four transistors are used as simple switches here.
There are five types of sensors used in the project those are being directly interfaced to the microcontroller. To sense the light intensity we use two LDR sensors that is light dependent resistors interfaced to the ADC input of the microcontroller. One pin of the LDR is connected to Vcc via a 330K resistor and other tied to ground. This creates a potential difference in between of the circuit and is fed to pin A.3 and A.2 of the microcontroller respectively. To sense the temperature we used two solid state semiconductor temperature sensors from analog devices also interfaced to the ADC input of the microcontroller. The two pins are connected to the power supply to power the sensors and the third pin is the output pin is connected to the ADC7 and ADC6 channel of the microcontroller. To sense the LPG leak in the home we used the MQ-5 LPG sensor and it is interface to the ADC5 channel input of the microcontroller. When an LPG leak is detected the output of the LPG sensor decrease gradually and that is being sensed by the ADC of the microcontroller. After them, we used a hook switch to sense the door whether it is opened or closed. This sensor is connected to the digital input pin D.7 of the microcontroller pulled up externally.Whe the door is closed, the hook switch is closed and the output is logic low as it bypasses the ground. When the door is open, the hool switch is also open and it bypasses logic1 throught 10k resistor to the output. To sense the presence and motion we used the PIR (Pyroelectric InfraRed) sensor that has a digital output and it is also connected to the digital input (pinA.4) of the microcontroller pulled up externally. When a motion is detected ,the output goes high for a few seconds and comes back to low in case of absence of motion. The main door is driven by the geared DC motor and as it has to close and open the door, it has to be moved bi-direcionally. To do so, we used the four BC107 NPN transistor based H-bridge bidirectional motor driver circuit interfaced to the digital output of the microcontroller. The microcontroller can digitally control the motion and direction of the motor to open and close the door. To display messages and sensor values a 16x2 character LCD is used in 4 bit mode to portB of the microcontroller.
The H-bridge circuit is used to drive a DC motor in both the directions. It can also use relays to function but here we used the BJT based one. It comprises of four BC107 NPN transistors as shown in figure 2. The two transistor T1 and T2 are in series and those T3 and T4 are also in series. The base of all four transistors are protected y current limiting resistors R1-R4. The prevent damaging the transistors. The base signals of T1 and T4 are the same and that of T3 and T2 are also the same. The operation is simple that when Sig1 is logic 1 and Sig 2 is logic 0, it will turn ON T1 and T4 and will turn the motor in one direction same if we reverse the input logics, the motor will go in reverse direction. All four transistors are used as simple switches here.
Step 4: 5 PCB FOR THE PROJECT
The PCB for the project is designed in EAGLE layout designer. The
schematic is designed in the schematic editor and the board is designed
in the board editor. The simple TONER TRANSFER METHOD is used here to
develop PCB at home.
Step 5: Microcontroller code and algorithm used !!
The algorithm that is driving the code on the microcontroller is a
multi-tasking algorithm. It has three basic functions, first is the
main function to read all sensors and actuate the actuators according
to the programmed threshold values. Next is the timely updating of the
LCD display and the transmission of encoded string serially to the
android client if the android client is present. The last task is to
check the input serial buffer for commands from the android client and
process them accordingly.
When the microcontroller is powered up it reads the eeprom for recovery of all programmed sensomate values and device states that whether which device was ON/OFF the last time the power failed. Then after recovery, it read all the sensor readings and process them accordingly in meaningfull values. After that the microcontroller checks the sensor readings against the programmed sensomate values and turns ON/OFF the appliances accordingly. The checking of fire occurance and LPG leak is done here in this main loop only. If there is a sign of fire or LPG leak, the microcontroller automatically switches off all the appliances and open the door to exhaust the gases and reduce emergency cricality. The sleep mode is also processed here in this loop. If the sleep mode is activated and motion is detected or someone open the door, the alarm fires and alert the user.
In the second loop, the microcontroller runs timer0 in interrupt mode and approx every 1.5 seconds it updates the LCD for sensor values and device states. The presence of the Bluetooth link is also displayed here. Also the microcontroller sends the encoded system status in a string serially to the bluetooth UART if the link is present. It is done every 0.8 second approximately. This loop is repeated infinitely as that of the main loop.
The third section programs the serial receive complete interrupt and thus whenever a serial command is received from the android client, it processes it here and actuate the command. This is again an infinite procedure and microcontroller keeps on sensing the arrival of new command.
The transmission and reception of commands to and from the android client is done wholesomely in ASCII code.
When the microcontroller is powered up it reads the eeprom for recovery of all programmed sensomate values and device states that whether which device was ON/OFF the last time the power failed. Then after recovery, it read all the sensor readings and process them accordingly in meaningfull values. After that the microcontroller checks the sensor readings against the programmed sensomate values and turns ON/OFF the appliances accordingly. The checking of fire occurance and LPG leak is done here in this main loop only. If there is a sign of fire or LPG leak, the microcontroller automatically switches off all the appliances and open the door to exhaust the gases and reduce emergency cricality. The sleep mode is also processed here in this loop. If the sleep mode is activated and motion is detected or someone open the door, the alarm fires and alert the user.
In the second loop, the microcontroller runs timer0 in interrupt mode and approx every 1.5 seconds it updates the LCD for sensor values and device states. The presence of the Bluetooth link is also displayed here. Also the microcontroller sends the encoded system status in a string serially to the bluetooth UART if the link is present. It is done every 0.8 second approximately. This loop is repeated infinitely as that of the main loop.
The third section programs the serial receive complete interrupt and thus whenever a serial command is received from the android client, it processes it here and actuate the command. This is again an infinite procedure and microcontroller keeps on sensing the arrival of new command.
The transmission and reception of commands to and from the android client is done wholesomely in ASCII code.
Step 6: The Android Application
The application for the android smartphone is wriiten completely in BASIC4ANDROID.
BASIC4ANDROID is a BASIC high level language. Basic4android is a simple
yet powerful development environment that targets Android devices.
Basic4android language is similar to Visual Basic language with additional support for objects.Basic4android compiled applications are native Android applications, there are no extra runtimes or dependencies. Unlike other IDEs Basic4android is 100% focused on Android development. Basic4android includes a powerful GUI designer with built-in support for multiple screens and orientations. No XML writing is required. You can develop and debug with the Android emulator or with a real device (USB connected or over the local network). Basic4android has a rich set of libraries that make it easy to develop advanced applications.
The android application so designed is fully applicable of controlling your home. There are a total of six screens including the screen containing the authors name. The application is a little bit voice acknowledged. Whenever you click on the help menus, it tells you about the particular with the voice acknowledgemnt too.
FIG 1 This screen displays a boot animation on startup when you click the Smarthome application icon. Along with the animation, an audio message and welcome can be heared in the background.
FIG 2 This is the manual appliance control screen. Here you can manually turn ON/OFF each appliance individually or can simultaneously switch all ON/OFF in one go.
The particular device so controlled manually will disable its sensomate feature automatically. The button label shown in blue shows the status of the device.
FIG 3 This is the sensors monitoring window. From here you can see all the sensor readings and also save them in a text file in the ROOT/smarthome folder of your android smartphone. You can activate/deactivate the sleep mode from here only.
FIG 4 With this window ,you can check the status of your door whether it is open/close. You can also open or close the door from here.
FIG 5,6 From this Sensomate (Sense and automate) window, you can program the threshold values for your two lights and fan. You can also program your motion sensor to raise an alarm if it detects a motion.
FIG 7 This is the settings window. From here you can turn Bluetooth ON/OFF manually. You can manually connect to the android host from the paired list. You can change the login password here and program the threshold value for the fire alarm to raise.
FIG 8 This screen displays the author involved in developing the application.
The android app currently supports 320x240 resolution screens,but with a simple designer code script it can be modified to suit any screen size.
Basic4android language is similar to Visual Basic language with additional support for objects.Basic4android compiled applications are native Android applications, there are no extra runtimes or dependencies. Unlike other IDEs Basic4android is 100% focused on Android development. Basic4android includes a powerful GUI designer with built-in support for multiple screens and orientations. No XML writing is required. You can develop and debug with the Android emulator or with a real device (USB connected or over the local network). Basic4android has a rich set of libraries that make it easy to develop advanced applications.
The android application so designed is fully applicable of controlling your home. There are a total of six screens including the screen containing the authors name. The application is a little bit voice acknowledged. Whenever you click on the help menus, it tells you about the particular with the voice acknowledgemnt too.
FIG 1 This screen displays a boot animation on startup when you click the Smarthome application icon. Along with the animation, an audio message and welcome can be heared in the background.
FIG 2 This is the manual appliance control screen. Here you can manually turn ON/OFF each appliance individually or can simultaneously switch all ON/OFF in one go.
The particular device so controlled manually will disable its sensomate feature automatically. The button label shown in blue shows the status of the device.
FIG 3 This is the sensors monitoring window. From here you can see all the sensor readings and also save them in a text file in the ROOT/smarthome folder of your android smartphone. You can activate/deactivate the sleep mode from here only.
FIG 4 With this window ,you can check the status of your door whether it is open/close. You can also open or close the door from here.
FIG 5,6 From this Sensomate (Sense and automate) window, you can program the threshold values for your two lights and fan. You can also program your motion sensor to raise an alarm if it detects a motion.
FIG 7 This is the settings window. From here you can turn Bluetooth ON/OFF manually. You can manually connect to the android host from the paired list. You can change the login password here and program the threshold value for the fire alarm to raise.
FIG 8 This screen displays the author involved in developing the application.
The android app currently supports 320x240 resolution screens,but with a simple designer code script it can be modified to suit any screen size.