Home Automation cont'd.
Moisture sensors can be used to control the sprinklers for watering the garden. They can be fixed in the soil and based upon the water level of soil sprinklers will be switched on for a particular period of time. It will save the water and make sure that plants are watered timely.
Temperature sensors can be used to switch ON AC/Fan when the temperature rises above a particular temperature, they can also be used to control fan intensity. Also the ON time period of a geyser can be controlled dynamically as per the outside temperature.
Smoke sensors are used for detecting fire at an early stage. They can be connected near to ironing area, near to kitchen or any other fire prone area. In case of fire it will trigger alarm and switch on water sprinklers.
In case of emergency like short circuit, fire, etc. the lights on the path of safe exit can be illuminated using the backup batteries.
Fig 6: Detection of fire and temperature sensing.
Reed sensors can be connected on one sash of window and magnet on another sash. Circuit will be the same as for glass sensors. To hide and prevent the damage of the sensor by outside world, a small laser light can be fixed on one side and photo diode on the other side, if someone tries to intrude, the light will be interrupted and alarm can be triggered on this event.
There are many other sensors, which can be really useful in home automation. The interfacing of these sensors is easy and it is left to the readers to research and interface them in their homes:
1. Gas Sensor: LPG gas detection can be fitted in kitchen. Smoke sensors, which detect CO and other gases emitted during cooking, can be used to control the speed of exhaust fan/electrical chimney.
2. Water level sensor: It can be used to switch the water pump ON/Off for filling the water tanks if required.
3. IR sensors at gates and windows to detect any intrusion.
4. Timers can be used to control the ON period of electrical devices where continuous operation is not required like geyser, coffee machine etc.
5. RFID tag can be fixed on the car for auto detection to open the shutter of car garage.
Communication between sensors
Proper communication channel between different sensors and processing units makes sure that signals are communicated properly within a home. There are different medium of connecting sensors - either through wires or wireless, both have pros and cons over each other. The best method is to use a trade-off on both of them as per the requirement as well as factors like distance between sensors, cost and ease of use.
Powerline Communication (PLC)
PLC is the way of communicating data from one device to another over the existing power lines within the home, thus it saves a lot of work and cost required for rewiring. Data can be transferred over AC or DC lines. Data to be transferred is modulated with high frequency signal using frequency shift keying and then it is coupled over existing power lines. There are specific ICs available in the market, which takes care of modulation in the device itself. External circuit is required to amplify the outgoing and incoming data. To couple the modulated data over existing power lines a transformer is required. For consumer use with CENELEC protocol, 125-140KHz frequency is used for modulation. CENELEC protocol ensures that only one device communicates at a time, thus improving reliability. ICs used for PLC take care of the protocol and data can easily be transferred over power lines.
PLC devices can be fitted at different locations in the home along with other devices. Electrical appliances can be directly interfaced with PLC device along with an interface circuitry.
Fig 7: Interfacing of electrical devices using powerline communication
Below is an example of interfacing an LED lamp with PLC. PLC device will provide brightness information to LED driver, which in turn will control the current to change the brightness of LEDs.
Fig 8: LED lamp interfaced through PLC
Bluetooth with PLC
Bluetooth technology is by far the most successful as compared to any other short-range wireless standards. Since Bluetooth is available in almost all smart phones and laptops that makes it very handy and easy to use. Smart phone or laptop can be used as a universal remote for controlling all the devices in a home; all that is required is a Bluetooth module connected with the PLC device. Signals over Bluetooth are sent using AT commands, once a phone/laptop is synchronized with this modem then whatever data we are sensing from phone will be received by the Bluetooth modem. Bluetooth modem in turn will transfer the signal to PLC device. PLC device will decode the data and as per the commands will transfer it over power lines. All PLC devices connected within the home will receive those signals and one for which the signal is intended will decode the signal and give the output signals accordingly. Electrical devices can be connected with PLC device via a relay or a thyristor based upon the type of device.
Fig 9: Controlling electrical devices through Bluetooth
Control has to be intuitive and easily accessible so that user can control the home any time with minimum number of remotes.
For controlling the appliances using mobile phone when outside the home, GSM/CDMA network can be used. SMS can be sent from mobile to activate/ deactivate any particular device. For sending and receiving SMS a GSM modem is required. GSM modem works on AT commands. AT commands are sets of predefined commands that GSM modem can understand. GSM modem can be interfaced with a micro-controller through UART. AT commands coming from/going to GSM modem are decoded/encoded in the micro-controller and functions can be performed accordingly. Generally GSM modem works at 3V, so a voltage level shifter is required to convert to 5V in case the micro-controller works on 5V. Another advantage of using GSM modem over fixed telephone lines is that in case of theft, intruders won’t be able to cut telephone lines and also no extra wiring is required.
Fig 10: GSM modem interface with Electrical Devices
DTMF stands for dual tone multiple frequency. These tones can be used for controlling the electrical appliances. Each button on the mobile phone corresponds to a unique frequency, these tones can be decoded using a DTMF decoder IC or within an advanced system on chip device. Different functions can be defined in the microcontroller and based upon the input DTMF tone the corresponding function can be triggered. Using DTMF tones any phone can be used to control the home, even the fixed landline can be used from the same. User can send DTMF tones either by calling the sim number, which is fixed in home or by sending tones through Bluetooth. Even a laptop can be used to send DTMF tones via Bluetooth. Following figure shows the block diagram for processing the DTMF tones.
Fig 11: Control of electrical devices using DTMF tones
As discussed till now we can use mobile phones for controlling the appliance by sending a message or by calling and pressing number buttons (DTMF tones). Another way is making a mobile application GUI for the user, which will send SMS at back end, and it will also be very easy for user to operate the appliances. Mobile app will opt for Bluetooth if inside the home and communicate over GSM when at a distant place.
A secure website can be created for user login. After logging in the website, it will show a GUI to the user and that will vary from user to user based upon the appliances inside his home. User can switch ON/OFF or control intensity of any of the electrical device. Whatever selection the user has selected will be stored in the GUI and immediately it will send this information to a SMS gateway, SMS gateway will in turn send the SMS to the user SIM connected in the GSM Modem. GSM modem will decode this information and send it to micro-controller, which will work accordingly.
Fig 12: GUI for user control through Internet
If we control any appliance using our mobile phone/internet, it is very important to get the acknowledgement. There can be many reasons because of which certain equipment will not work like no electricity, issue with appliance, etc. So when we switch the device ON, the relay may be powered up using back up batteries but still the electrical device will remain in OFF state.
Current transformer can be used as one of the method to get the feedback. Whenever any appliance is switched ON, current will start flowing in the wire connected to that device. This current can be sensed to monitor the state of device. Some of the voice commands like ON, OFF, etc. can be stored in an IC capable to store voice, and this voice can be transferred through mobile phone by connecting the voice output to microphone wires.
Fig 13: Block diagram for sensing feedback
For enhancing home security following devices can be added apart from the sensors, which have been already discussed earlier.
* Door camera, which will take a picture and store it whenever it detects a human being, a camera can be triggered using a PIR sensor. Similarly camera inside the home can also be switched ON to send live photos to user via email in case it detects a human being when no family person is there inside the home.
* Secure home access using finger print scanning /face recognition.
* Electronic key lock or doors for double security.
With a single touch complete home can be set for different modes
* Home Theater
In this mode all the curtains in the entertainment room will be closed. Projector will come out of the roof, lights will become dim and all speakers will be switched ON.
* Out of Home
This mode will check whether all the doors and windows are closed or not. If not then it will trigger an alarm. All the electrical equipment will be switched OFF & PIR sensors and security cameras will be activated. Any movement sensed during this time will be immediately reported to the user.
* Vacation Mode
It’s the extended mode of ‘Out of Home’ and can be activated when going on long holiday. Apart from the functions performed in the above mode it will also perform certain activities everyday so as to give an illusion that someone is there in home. These activities will include playing music at loud volume, switching lights of different rooms randomly and opening and closing curtains.
* Night Mode
Will close all the lights expect the porch one and activate PIR sensors in the corridors and check whether the main gate, windows are closed or not.
* Day Mode
Disable PIR sensors, windows, door sensors and security cameras.
Implementation using system on chip
When it comes to actual implementation of these features in hardware, a system on chip-based implementation seems the best fit due to small form factor of the system and small product development cycle. System on chip integrates configurable analog and digital peripherals like Op Amp, ADCs, filters, DACs etc., memory and a microcontroller on a single chip, which are needed to interface different type of sensors, which we discussed. It makes easier and faster for designers to make the end product and reduces the BOM.
Some of the advanced PLC devices have in build system on chip as well on a single device (like Cypress’s PLC devices), using such PLCs ensures that no other micro controller is required for processing the decoded signals, received from power line.
Figure 14 shown below indicates the interfacing of a few sensors in PSoC3. Similarly any other sensor can be interfaced. Passive components have to be connected externally.
Fig 14: Implementation in PSoC3
About the Author
Akshat Gupta is currently working with Cypress Semiconductor India Pvt. Ltd. as an Applications Engineer. He holds a BA degree in Electrical and Electronics engineering. He loves working on embedded system and robotics. He can be reached at email@example.com.