Overview

LinkIt ONE development platform enables you to design and prototype Wearable and Internet of Things (IoT) devices, using hardware and an API that are similar to those offered for Arduino boards.

MediaTek Cloud Sandbox (MCS) provides free cloud-based data and device management services used in the development and pre-commercial testing of Wearable and IoT devices.

In this tutorial, we will be setting up our LinkIt One development board as a Car Tracker device using GPS with MediaTek Cloud Sandbox. We will cover steps from setting up your LinkIt One device, to getting GPS from LinkIt One and connecting it to MediaTek Cloud Sandbox via API.

 

Hardware Used

  • LinkIt One Ultimate Development Board 
  • GPS Antenna (Included in LinkIt One kit)
  • WiFi/Bluetooth Antenna (Included in LinkIt One kit)
  • GMS Antenna (Included in LinkIt One kit)
  • Lithium-ion Battery (Included in LinkIt One kit)


 

Software Used

  • Arduino IDE
  • Internet Browser (Ex: Chrome, Edge, Firefox)

 

Application Discussion

To trace the location of our our vehicle, we need a microcontroller that extracts GPS location data and uploads that data to a cloud service. In this tutorial, we will use the LinkIt One development board as the microcontroller, and MediaTek Cloud Sandbox as the Cloud service.

The Global Positioning System (GPS) is a navigation system that uses satellites, a receiver and algorithms to synchronize location, velocity and time data for air, sea and land travel.

The satellite system consists of a constellation of 24 satellites in six Earth-centered orbital planes, each with four satellites, orbiting at 13,000 miles (20,000 km) above Earth and traveling at a speed of 8,700 mph (14,000 km/h). In order to get the GPS data, we will use LinkIt One development board.

 

The LinkIt ONE development platform is an open-source, high-performance board for prototyping Wearables and IoT devices. It is based on the world's leading SoC for Wearables, MediaTek Aster (MT2502) combined with high-performance Wi-Fi (MT5931) and GPS (MT3332) chipsets to provide you with access to all the features of MediaTek LinkIt.

Features:

  • Includes ARM7 EJ-S™, GSM, GPRS, Wi-Fi, Bluetooth BR/EDR/BLE, GPS, Audio codec, and SD card connector on a single development board.
  • Pin-out similar to Arduino boards, including Digital I/O, Analog I/O, PWM, I2C, SPI, UART and power supply, compatible with Arduino.
  • Provides various interfaces for connecting to most sensors, peripherals, Groves, and other widgets.

To track our car's movement using GPS and LinkIt One, the LinkIt One will upload the data to the MediaTek Cloud Service via Restful API.

 

 

MediaTek Cloud Sandbox (MCS) provides free cloud-based data and device management services used in the development and pre-commercial testing of Wearable and IoT devices. It frees you from having to develop your own cloud infrastructure to support such prototype developments.

RESTful APIs are used to collect data from the devices and view the data on a powerful web-based dashboard that offers a range of display and graphing options as well as the ability to issue commands to control your Wearable and IoT device. Also, a complimentary smartphone app lets you review collected data and control your devices anytime and anywhere.

 

Setup The Hardware

 

LinkIt One development board setup

Connect the battery, GPS antenna, Wi-fi antenna, and 4G/GSM antenna like this. No need to connect other boards or modules, the LinkItOne is a complete microcontroller and wireless communication board.

 

Setup the software

LinkIt one USB COM port driver

  • USB COM port driver is required for the LinkIt One SDK installation, download it here:

https://labs.mediatek.com/en/download/PfSCNbna

 

LinkIt One Development Board with Arduino IDE Setup

  • First, we will program our LinkIt One device. We need to download and install the newest version of Arduino IDE, you can download it here.

https://www.arduino.cc/en/software

 

LinkIt One Board Driver Installation

  • In the Arduino IDE, go to Preferences. You can press "CTRL+Comma", or click "File" then "Preferences" as shown in the screenshot below.

  • On the Preferences window, copy the text below and paste it on the "Additional Boards Manager URLs" field. This is for adding the LinkIt One board driver. Then click "OK".

http://download.labs.mediatek.com/package_mtk_linkit_index.json

  • Proceed to download the LinkIt One library on the Boards Manager. Click "Tools", then "Boards:(Your Current Board)", and "Boards Manager...". 

  • In the "Boards Manager" first select "All" on the Type drop-down box, then search for linkit. Download the LinkIt ONE by Seeed Studio and MediaTek Labs, by selecting the latest version and clicking Install. After installation, you may close it.

 

LinkIt One Firmware Update

  • We will now update LinkIt One firmware. You need to select the LinkIt One board, by clicking "Tools", then "Boards:(Your Current Board)", then "MediaTek ARM7 EJ-S(32-bits) Boards", and "LinkIt ONE" as shown below.

  • Then click "Tools" again, then "Programmer",  and select "LinkIt Firmware Updater".

  • Make sure to set the board to "Mass Storage Boot Up" mode, see the red arrows in the screenshot below. Move the topmost mini slide switch to the right position as shown below, to set to  Mass Storage Boot Up. Then connect the LinkIt One board to your computer using Micro-USB cable, the location of the Micro-USB cable is indicated by a red arrow also.

  • Run the LinkIt One Firmware updater by clicking "Tools", then select "Burn Bootloader".

  • In the LinkIt Firmware Updater, click the download button, as shown below.

  • Follow the instruction, see the screenshot below. Then, disconnect LinkIt One board and its power source, and reconnect it again.

  • The LinkIt Firmware Updater will indicate that it's downloading. Wait for it to complete.

 

  • When complete, the LinkIt Firmware Updater will confirm that firmware has been updated, see below.

 

LinkIt One Upload Code Test

  • Set your LinkIt One to Normal Boot Up Mode as we change earlier, disconnect Linkit One board first then follow the screenshot below. And also make sure to set it to SPI as indicated in red arrow number 4. After changing to Normal Boot Up Mode reconnect the LinkIt One to your computer. 

  • We need to open the Device Manager, first open the "Run" dialog box by pressing and holding "Windows key", then press the R key. Input "devmgmt.msc" and click the button "ok".

  • In the Device Manager select "Ports (COM & LPT)" and look for "MTK USB Modem Port" and get the "COMXX" value, as shown below. 

  • Go back to Arduino IDE, click the "Tools", then "Port", then select your "COMXX" value as an example below.

/*
 * LinkIt One: LED Blink built in test
 * create by jeminico
 */

// Link-It-One LED built in pin
#define LED_BUILT_IN 13

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILT_IN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILT_IN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILT_IN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
  • Paste it to your Arduino code editor (or open the downloaded file), then click Upload by clicking the -> icon as shown below.
  • Locate the LinkIt One built-in LED as shown below, as you can see the built-in LED is blinking.

 

MediaTek Cloud Sandbox Prototype Device Setup

  • Click the link below, log-in if already have a MediaTek account and if not click "Create an account!" to create an account and log-in.

https://mcs.mediatek.com/oauth/login

  • This will be displayed as you log-in. Click the "Start" button to set up a Prototype device.

  • Next, click the "Create" button to create a Prototype.

  • Fill up the needed field values, you may copy the values as shown below. After filling up the corresponding fields click the "Save" button to proceed.

  • Now click the "Detail" button as indicated below.

  • We will create a data channel for GPS coordinates from your LinkIt One board. Click the "Add" button as indicated below.

  • Then click the "Add" button on the Display section tab, as indicated below.

  • Fill up the needed fields, or you may copy the values in the screenshot below. Take note of the "Data Channel ID" in this example. It's value is "gps01, we will need it later. Also make sure the "Data type" drop-down field value is GPS.

  •  Now click the "Create test device" button as indicated below.

  • Fill up the needed fields, you may copy the values in the screenshot below. You may choose to set your prototype publicly or privately by checking the "Create as public device" check box.

 

  • Now you have successfully created a prototype device, now click the "Test devices list" as indicated in the screenshot below.

  • Then click your prototype as indicated below:

  • Next, take note of the "DeviceID" and "DeviceKey" we will need them for the code later as indicated below.

 

LinkIt One Car Tracker Project Setup

  • Download the Createlabz repository here, extract it and open the "createlabz-public-main" folder, then open "link-it-one", then "CarTracker" folder, and open the file "CarTracker.ino", this will be displayed as you can see below.

 

GPRS Connection

  • If you're using a GPRS (Sim Card) connection, then look for the indicated code below and set it to "true".
#define useGPRSConn true
  • Then search for your Sim Card's APN, APN USERNAME, and APN PASSWORD configuration values. Every Sim Card has a different configuration, then look for the indicated code below and change its corresponding values.
#define APN "YOUR_SIM_APN"
#define APN_USER "YOUR_SIM_APN_USER"
#define APN_PASS "YOUR_SIM_APN_PASS"

 

WiFi Connection

  • If you're using a WiFi connection, then look for the code below and set it to "false".
#define useGPRSConn false
  • Look for the code indicated below, and replace the value of "YOUR_WIFI_SSID" with your actual WiFI SSID, and "YOUR_WIFI_PASSWORD" with your actual Wifi password.

#define WIFI_SSID "YOUR_WIFI_SSID"
#define WIFI_PASSWORD "YOUR_WIFI_PASSWORD"

 

MediaTek Parameters

  • Now we will set up the MediaTek parameters we take note of earlier. See the codes below, replace the value of "YOUR_DEVICE_ID" which is the "DeviceID" you take note of earlier, then for "YOUR_DEVICE_KEY" which is the "DeviceKey", and lastly "YOUR_GPS_DATA_ID" which is the "Data Channel ID" of the GPS we created earlier, for this example our ID will be "gps01".
// Mediatek parameters
#define DEVICE_ID "YOUR_DEVICE_ID"
#define DEVICE_KEY "YOUR_DEVICE_KEY"
#define GPS_DATA_ID "YOUR_GPS_DATA_ID"
  • Upload the codes to your LinkIt One Device.
  • If you want to set your power source between  USB or Li-Battery follow the instruction on the red arrow labeled number 1 indicated below and set it to arrow labeled number 2.

 

Check the GPS coordinates

  • Go to the MediaTek Cloud Sandbox dashboard by clicking the link here. Then click again the "Test devices list" and check if your LinkIt One is online by checking the "Status". It should indicate "Online". You can also trace and check your LinkIt One activities by checking the "Recent Activity" as shown below.

  • Now click again the prototype name as indicated below.

  • To see your LinkIt One board GPS Coordinates, click the mini three-dotted button inside the GPS section tab and click "Show History" as shown below.

  • Now you can see the history of your LinkIt One GPS coordinates, you can play also and set it to a specific time as shown below.

 

Demo Video

!To Be followed!


Conclusion

Now that we have successfully tracked a Car, you may explore other features that LinkIt One board can do like integrating accelerometer and gyro sensors to know where the car is facing, using SD card for logging, using Bluetooth function, or setting it up as a weather station, and many more.

 

References

https://docs.labs.mediatek.com/resource/linkit-one/en/tutorials/car-tracker

https://wiki.seeedstudio.com/LinkIt_ONE/

 

Leave a comment

All comments are moderated before being published