Introduction: Geofencing With the Mediatek LinkIT One

So i wanted to play around with my MediaTek LinkIT One,

the first thing i was excited about was the GPS on board, so without a moments notice, i wanted to make a geofence.

A geofence is a term used to describe a virtual fence around a certain area that the GPS knows if its inside or outside of this area.

this is vary crude and not very accurate but its my 1st ever GPS code job!!

Full disclosure, this board was sent to me by MediaTek for me to play with.

Step 1: The Parts

This is one of the shortest lists i have made due to the awesome built in features of the Mediatek LinkIT one. the only part i added was the also awesome Adafruit i2c bus LCD sheid so i could see the long and lat.

Mediatek LinkIT One:http://www.seeedstudio.com/depot/LinkIt-ONE-p-2017.html

Adafruit RGB LCD shied: https://www.adafruit.com/products/714

The MediaTek LinkIT One is an amazing board with loads of power, memory etc... but where it really stands out are its "sensors" this thing has GPS, GPRS,GSM,Bluetooth, Wifi and Lipo charging and monitoring on board along with being arduino compatible.

The Adafruit LCd backback is really cool. it allows you to add a screen and 5 buttons to any i2c compatible board using only 4 wires, i2c (2 wires) and power and ground. this makes it very easy to work with and add on to a project like this.

Step 2: The Code

So the code is more or less the example given with the board but i added a few things:

Libraries:

include LGPS.h - for the gps
include Wire.h - for the lcd
include Adafruit_MCP23017.h - for the lcd
include Adafruit_RGBLCDShield.h- for the lcd

Key Variables:

double lattarget=33.4097;//this is the latitute to target
double longtarget=82.9643;//this is the longitude to target
double latrange=0.0001;//this is the offset for how big your geofence is
double longrange=0.0001;//this is the offset for how big your geofence is

the Geofence:

fairly simple, if the lat or long is within the offset range of the target turn the screen green, else keep it red.

if((longitude >= (longtarget-longrange) && longitude <= (longtarget+longrange))&& (latitude >= (lattarget-latrange) && latitude <= (lattarget+latrange))){lcd.setBacklight(GREEN);}

else{lcd.setBacklight(RED);};

Attachments

Step 3: The Device in Action

Basically what it does is when it is within the fence the screen goes green when it is outside the fence it goes red.

I expect to expand on this in the near future!!!!

please let me know what you think!