For a long time, I was always looking to make a miniature device location finder not using GPS and GSM modules. So I decided to make a project of my own to provide complete end-to-end solution. In this all we need is WiFi connectivity to get the device location. So let's get started.
All we need to do this project is any ESP board Arduino compatible.
NO GSM, GPS, GPRS MODULES NEEDED.
Compile the code for ESP8266 in Arduino IDE. I have used Wemos Mini v1 board.
Below are places in code to be changed when you run.
char myssid = "SunShineLabz"; // your network SSID (name) char mypass = "scienceprojects"; // your network password String key = "AIzaSyBHqoRnGvcJjT3c08_htHvCLBTGxxxxxxx"; // Get your own key Google Geo Location Key String posturl = "/dweet/for/DeviceLocator?Latitude=" + String(latitude) + "&Longitude=" + String(longitude); // DeviceLocator => Dweet.io -> My Thing Name. You can change to anything. Only need to change in code is fine before upload.
Get your own Google Map Geo Location API key.
Once received replace it in the code shared.
No sign up required. No specific action to be taken as I have already done published 2 fields to Dweet.io system: latitude and longitude.
Just need to think what name you want to give to your device. :-)Step 4: http://freeboard.io
How to get started?
Its quite simple. The location get updated in Async manner. That's cool no page refresh needed.
If all of the above steps goes fine you should be able to see the device location showing/updating at every 3 seconds which is mentioned in code.
- Low cost solution
- Smaller modules.
- Low power consumption as less modules.
- No SIM card required.
- Accuracy of exact location is less compared to GPS based modules.
- No Wifi connection required.
- SMS to registered user about device location
- email user about device location
- Will try to share live video of this project shortly.
1. Since we do not use GPS to identify position which more often more accurate in our case we use nearest tower our Wifi router is connected to. In this case Accuracy returned from Google API would be handy.
2. In case you are trying outside India you might have to update this configuration section as well.
jsonString += "\"homeMobileCountryCode\": 234,\n"; // this is a real UK MCC jsonString += "\"homeMobileNetworkCode\": 27,\n"; // and a real UK MNC jsonString += "\"radioType\": \"gsm\",\n"; // for gsm jsonString += "\"carrier\": \"Vodafone\",\n"; // associated with Vodafone