GPS-based Home Automation
GPS-based Home Automation
"The Global Positioning System (GPS) is a space-based satellite navigation system that provides location and time information in all weather conditions, anywhere on or near the Earth. The system provides critical capabilities to military, civil and commercial users around the world. It is maintained by the United States government and is freely accessible to anyone with a GPS receiver."
Nowadays, most pockets have a GPS receiver owing to their integration in Smartphones. There are various apps available across platforms (iOS, Android, Windows) that provide the users with precise locations and features like:
Google Maps, Apple Maps, TomTom 1.8, Magellan RoadMate 2.0, Garmin StreetPilot Onboard, and TeleNav GPS Plus
What we are doing with GPS
We are developing a system supported by a smartphone-app which uses the location of the user to control the electrical devices at the user's home. The smartphone receives the user's location and sends commands to the controlling hub present at the user's home. The controlling mbed then controls the device as per the commands received.
What we are doing with sensors
We are using sensors connected to the controlling hub for providing ambient lighting conditions based on the light inside the room. There are sensors integrated in the system which sense motion in the room and if motion is sensed, the app cannot control the system. Also, we are using sensors to provide the user with a security feature.
Architecture of the system
The system works as follows:
- The smartphone, based on the mode (Manual/Automatic), sends the required data to the database
- The controlling hub receives the data
- Based on the command, controlling hub then checks for the data from sensors and based on pre-decided thresholds, alter the status of the devices connected it.
- mbed (x2)
- iPhone (x1)
- Proximity Sensor (x1)
- IR Sensor (x1)
- Light Sensor (x1)
- Ethernet break-out board and cable (x1)
- Power-Switch tail (x2)
- Lamp (x1)
- Fan (x1)
Smartphone app and Web Server
The iOS app provides an interface for the user to remotely control the devices at the user's home. The features on the application are Automatic/Manual mode, Security feature and the manual control of the 4 devices at the user's home through the application. The data from the application is serialized into JSON object which is then used to create a HTTP POST request to update the database.
The user can set the current location of the application by clicking on the set current location button. The near/far distance specifies the distance between the user and his home. If the distance is within 1 mile, it is considered as near otherwise it is considered as far. For demo purposes we have used approximately 100 meters as the threshold distance between the user and the home. Therefore, if the user is beyond 100 meters from his home, it is considered Far otherwise it is considered Near.
In the automatic mode, if the user does not want to wait for a minute, he can always press the Update Settings button and the HTTP post method is done where the corresponding value on the table in the database gets changed. This table consists of 3 columns. The first column is used to store the id, the second column is used to store the configuration (which includes - automatic mode, security mode and near/far mode) and the third column contains the configuration for the 4 devices. The on/off state of each of the device is stored as a single bit. Thus the possible values for second column ranges from 0 to 7 while the possible values for the third column ranges from 0 to 15. PHP code is written for HTTP Get, Post, Update and Delete methods.
The mbed client, on the other hand, parses the data in the URI using JSON array and JSON object library. After having processed the values, the networking mbed sends the control signals on its digital output pins to the mbed controller which then controls the devices at home. The synchronization between the two mbeds is accomplished through digital handshaking lines.
Controlling Hub consists of 2 mbeds (LPC 1768), one used for polling the server to check the current status of commands given by the user (to offload the networking side from the controlling mbed) and the other is used for controlling the devices based on both the commands received and the values processed from light sensor, IR sensor and Proximity sensor. Iphone app has controls for Automatic / Manual mode, Security feature and turning on / off device 1, device 2, device 3 and device 4. In automatic mode, when the user is near the house, the devices are turned on, where as if the user is far (based on GPS location provided by the iphone), all the devices are turned off unless there is someone in the house (detected currently using IR sensor), in that case the controlling hub doesn't change any devices' states. In Manual mode, user can control all the 4 devices using the iphone app. If the security feature is on, and someone is standing in front of the house, it turns on device 2 to give an illusion of the owner being home. This is detected using proximity sensor. Also, smart light control is provided, such that in automatic mode, the light is turned on only when ambient light is below certain threshold (detected using light sensor) and the user really needs the lamp to be turned on. Iphone commands update a database server which is polled by the mbed for getting the user commands.
The user can access the iOS app code and executables from the link below:
ECE 4180 final project- GPS based home automation: code for mbed controlling home devices
Video of the working system
1 comment on GPS-based Home Automation:
Please log in to post comments.