Software apps and online services
Have you ever thought of turning on Air Conditioner/Heater of your car before 10mins you get in. Here in my country (India), hot sun may toast your car in parking area during day time. A system that can turn on/off engine ignition and Air Conditioner from your smart phone would be a solution for this issue. This system can also protect you from the threat of theft by providing real time tracking options and SMS alerts (you need to add just 2 lines of program). Along with these smart options some extended options like remote Lock/Unlock, On/Off alarm or head light, etc. are also incorporated. Remote temperature monitoring and human presence detection options make this Smart Vehicle Box (SVB) even more attractive. A low cost single board solution LinkIt ONE made this easy.
Overall System Arrangement
Smart Vehicle Box
Smart Vehicle Box consists of 4 major units.
1. LinkIt ONE board
The LinkIt ONE performs 2 important functions
(i) Uploading of sensor readings and information about performing operations like AC On/Off, Alarm On/Off, etc. to a server.
(ii) It performs On/Off operations based on the commands it receives, reads a web server page frequently for new commands.
This is how the uploaded data look like. [LinkIt ONE to dweet ("thing" name "anandsff")]
The command format (example) [dweet to LinkIt ONE ("thing" name "linkitonecommand")]
In both cased notice the things' names 'anandsff' and 'linkitonecommand'. These two unique names are required to extract information from "dweet.io" server (Mobile App and LinkIt ONE). You have to rename it as you like in your project.
The first piece of data is easy to understand ("thing" name "anandsff")
lattii - latitude of your vehicle
long - longitude of your vehicle
ac - Air Conditioner's state (1 - on, 0 - off) - ign - Engine On/Off light - Head Light On/Off alarm - Alarm On/Offbit1 and bit2 - Center Lock On/Off bit3 - Hazard Light Blink
(for this a
hacked remote entry system/keyless entry is requiredtmp - Current temperature inside your vehicle in 'c
pir - PIR Sensor data (1 - human presence, 0 - No human presence inside your vehicle)
Second box of data isn't that easy to understand as it is in a coded format (*xxxxx1xx) ("thing" name "linkitonecommand")
(Note: I used WiFi instead of GPRS as I have a portable WiFi dongle inside my car. Those who want to operate this device with GPRS need to use GPRS client instead of WiFi in the program and no need of changing other lines of this program)
2 Relay Board/Circuit
This circuit has 4 relay switches. These switches are used for Air Conditioner/Heater Control, Headlight On/Off, Engine On/Off and Alarm On/Off. It is quite easy to drive relays with a LinkIt ONE board.
Arduino Relay Ports Declaration
const int r1 = 0; //DO // pin of Relay 1
const int r2 = 1; //D1 // pin of Relay 2
const int r3 = 2; //D2 // pin of Relay 3
const int r4 = 3; //D3 // pin of Relay 4
Unlike other On/Off functions Engine On/Off function is a bit tricky.Simple On/Off may not work on modern vehicles. In most of the modern vehicles simple hot-wiring(shorting of ignition wire for a moment) technique will not work. A transponder or radio chip is required in order to start the ignition. You need to place this transponder near the keyhole of your car while hot-wiring.
(Note: I recommend you not to use Engine On/Off unless you know how the system works)
3. Hacked Remote Entry/Keyless entry System
It is not easy to access center lock/unlock system of a car without learning its internal wiring and microprocessor's connections. To lock/unlock your vehicle through a LinkIt ONE board, the easiest way is to hack the circuit of car's keyless entry system. Instead of switches on the Keyless entry system LinkIt ONE triggers each actions (Proper grounding and taping of wires from switches is required). You may find a 'KEELOQ hcs200' inside your keyless entry circuit. Since it is using complex techniques to secure the wireless connection between car and Keyless system, it is not easy to duplicate the circuit (refer datasheet to identify GND and other switch pins).
4. Sensor ArrayEven though there is no limitation in connecting any type of sensors, in this circuit I used 2 important sensors. (i) Temperature sensor (TMP36) and (ii) PIR Sensor.
Android App and freeboard.io service
The app looks really cool, right ? All credit goes to freeboard.io's free and awesome UI options. I'm not making another tutorial for freeboard.io or dweet.io, they already have good tutorial sessions in their sites. In short, freeboard.io provides a free and easy interface to display or plot different sensor readings and status information that it extracts from servers like pubnub, dweet.io etc. So, freeboard makes our job pretty easy. It even has a google maps interface. If anyone wants to access sensor readings, GPS location and current state of my vehicle, just access this freeboard link.
If LinkIt ONE is in off state you will not see any data on the page.
The mobile app is made using Android Studio. I used 2 WebView objects, one for showing freeboard's UI and other hidden WebView object for setting dweet variable values(LinkIt ONE commands).
this will set Air conditioner on.Similarly, any possible commands can be issued by accessing this page and changing 'c' variable accordingly (Above instruction is placed as click event of AC ON button).
How dweet.io Works
1. Choose a "thing" name.
Here variable is hello and its value is world. Similarly, you can add any number of variables and its value can be changes by calling dweet.io/dweet/.... address. In this project I used a couple of variables(we have already discussed).
2. Get variable names and values
By calling dweet.io/get... page the variables and its values can be accessed.
3. Yeah, done.
How "freeboard.io" Connects to "dweet.io" or pubnub
1. You need a freeboard.io account in order to start creating custom boards.
2. Add required dweet.io "thing" name as datasource.
3. Add required panel types and select its data source and variable names
5.After adding required panels with dweet thing as data sourse, the freeboard will automatically refresh/extract data from dweet periodically.
6. Yeah, done.
Easy to add options
this will make a call to your number, for example, if any human presence detected by PIR sensor above code can be used to make call alerts. (Need to add GSM header).
3. SMS based controlling is also possible and easy to implement if you need.
2. Since LinkIt ONE has audio playback and MMC support, it is possible use it as a audio player in your vehicle along with its other operations.
3. Hiding the device inside car bonnet will help you to track your vehicle in case of theft.
Note: Arduino LinkIt ONE sample programs were very helpful I recommend you to go through it for a better understanding of WiFi, Bluetooth, GSM, GPS and other features.
Thank you all.