The e-Tracker from Elementz features an ATmega328 and SIM808 which provides the flexibility of arduino along with the added features of SIM808 which has GSM,GPS and bluetooth functionality. 

SIM808 module is a complete Quad-Band GSM/GPRS module which combines GPS technology for satellite navigation. 


[image:73 align:left size:orig]



The compact design which integrated GPRS and GPS in a SMT package will significantly save both time and costs for customers to develop GPS enabled applications. Featuring an industry-standard interface and GPS function, it allows variable assets to be tracked seamlessly at any location and anytime with signal coverage. It has high GPS receive sensitivity with 22 tracking and 66 acquisition receiver channels. Besides, it also supports A-GPS that is available for indoor localization. The module is controlled by AT command via UART and supports 3.3V and 5V logical level. You can buy it from [ here](http://elementzonline.com/e-tracker-arduino-compatible-atmega328-sim808-based-gsm-gnss-gps-tracking-module-board-with-call-sms-gprs-facility-387?search=e-tracker).
#
**Features**

* Quad-band 850/900/1800/1900MHz
* GPRS multi-slot class12 connectivity: max. 85.6kbps(down-load/up-load)
* GPRS mobile station class B
* Controlled by AT Command (3GPP TS 27.007, 27.005 and SIMCOM enhanced AT Commands)
* Supports Real Time Clock
* Supply voltage range 5V ~ 12V
* Integrated GPS/GNSS and supports A-GPS
* Supports 3.0V to 5.0V logic level
* Low power consumption, 1mA in sleep mode
* Supports GPS NMEA protocol
* Standard SIM Card

# Familiarising The Board

e-Tracker is specially designed to make use of all possible features of both SIM808 module and Arduino. On the top side of the board, there are two power input terminals. One for connecting Battery (3.6-4.4V) and one for connecting any other external power supply (9-12V). Near to the power terminals you can see a ''supply select switch''. This is used to select the power supply.    


[image:74 align:left size:large]
    Front View

[image:75 align:left size:large]
    Rear view

#

The Digital pins D13-D8 are free for our use along with the Analogue pins A0-A5. The digital pin D6 is connected to the built-in LED (L1). So when testing the '''Blink''' code for Arduino Uno in e-Tracker, remember to change the LED pin to 6 from 13. Along with the built-in LED  there are 4 more LEDs on the top side of the board. 


|LED|Indication|
|------|----:|
|Power LED (ON)|Board is powered or not|
|GPS LED (TM)|validity of the GPS data|
|Network LED (NW)|connection status to the network |
|Status LED (ST)|ON/OFF status of the SIM808 module|


The D0 and D1 pins, which are the Rx and TX of Arduino are given as the Hardware UART pins. D2 and D3 are used as the software serial pins in the Elementz library ( D3-Rx and D2-Tx). These pins can be used as digital I/O pins if necessary. The UART pins of SIM808 are also made available in the Board. See the figure below.

[[File:Serial sim808.jpg|thumb|center|360px|Serial Pins]]

The digital pin D4 is used for power control of the SIM808 module, which is explained later. Pins D5 and D7 are not usable. 

|Arduino Pin|e-Tracker Pin|
| ------ | -----: |
|A0-A5|A0-A5|
|D0|Hardware Serial Rx|
|D1|Hardware Serial Tx|
|D2|Software Serial Tx|
|D3|Software Serial Rx|
|D4|Powerkey Control|
|D5|Not Usable|
|D6|Built in LED|
|D7|Not Usable|
|D8-D13|D8-D13|

There is provision for connecting a Microphone and Speaker to the board. Which can be used at the time of making a call. The antenna connectors for GPS and GSM are also on the top side of the board.

The bottom side of the board carries the detailed pin mapping of Atmega328P. The SIM card slot and SD card slot are also there at the bottom of the e-Tracker. 

# Powering the module 

First, insert the SIM card in the SIM holder. A standard SIM card is best suited for the e-Tracker. You can use a micro or nano SIM card along with a SIM card adaptor. 

In normal applications make sure there is a jumper connecting the VBAT pin and POWERKEY pin in the e-Tracker board. If not connect these terminals using a jumper before powering up the board.

You can either power the board from a power adaptor (9V/12V) by connecting it to the EXT terminals (Make sure the supply select switch is in EXT position) or using a battery (3.6-4.4V), by connecting it to the BATT terminal (Make sure the supply select switch is in BAT position).

The e-Tracker board comes with a built-in battery charging circuit (suitable for Li-Ion and LiPo). For charging the battery, connect a power supply to the external terminal while the battery is connected and the supply select switch is in BAT position. Now the battery is being charged while it is powering the board.


[image:76 align:left size:large]
#


You can control the power of SIM808 module on the board using software. As mentioned in the previous section, the digital pin D4 is connected to the
power key of the SIM808 using a circuit shown below. By giving a pulse of duration not less than 2 seconds will turn ON/OFF the modem. Such a feature is very helpful in low power applications. You can do this by programming the D4 pin as output and providing a pulse through the same pin. '''Make sure that the jumper connecting the VBAT pin and POWERKEY pin is removed while doing this action'''.


[image:77 align:left size:large]



# Programming the Board Using Arduino IDE. 

The board has an Atmega328 on board based on the Arduino UNO. You can program it using Arduino IDE. Select Arduino UNO from the Tools --> Board --> Arduino UNO. Now you need an FTDI/CP2102 USB to UART converter/adapter to program the board. Connect it to the computer. Select the COM port. Connect the RX of the USB to UART converter to the Hardware TX of the board and vice versa. Connect VCC and GND. Connect DTR of the converter to DTR of the board. Now you are all set.

For starters choose the Blink code from examples and change the LED pin to D6, then upload to e-Tracker. You can see the '''L1''' LED blinking.

An Alternative to Arduino IDE is the [http://platformio.org/ PlatformIO IDE]. It is a next-gen IDE for IOT with Cross-platform build system and intelligent code completion.

# Using the board as a Standalone one

The e-Tracker board is designed so as to combine the strength of Arduino with the capabilities of the SIM808 module. We can program the board to make it work as required. 
We can collect data from sensors using e-Tracker and transfer the data to a remote location using SMS or GPRS capabilities of the SIM808 module in the e-Tracker. This is a perfect tool for implementing IoT, internet of things. There are endless possibilities for the board that ranges from collecting sensor data to device automation. 

First, you have to connect the UART pins of the SIM808 module in the board to the Software serial pins of the board. The [E-tracker library](https://github.com/elementzonline/Arduino-Sample-Codes/tree/master/e-Tracker) we developed to use with the board, uses D3 as software Rx and D2 as software Tx. So connect these pins using jumpers as shown in the figure below.


[image:85 align:left size:large]

#

Now you can program the e-Tracker as described in the previous session, with the help of our [https://github.com/elementzonline/Arduino-Sample-Codes/tree/master/e-Tracker library], to avail the full capability of the board. 


# Using only the SIM808 functionalities

If you want to use only the SIM808 functionalities, you can do so by connecting to the Rx and Tx pins of the SIM808 on the board. [ Click here](https://elementztechblog.wordpress.com/2015/12/06/sim900a-ttl-modem-interfacing-with-pc/) to know more about interfacing with a computer. To check the GSM module we have made a [GSM Test Utility](https://elementztechblog.wordpress.com/2016/06/29/the-new-gsm-test-utility-from-elementz/).

# Testing in Windows 

To communicate with the network we use [http://www.elementzonline.com/downloads/SIM900A/GSM_MODEM_Tester.exe ELEMENTZ GSM Modem Test Utility software]. It is an executable file which supports serial data transmission and reception similar to HyperTerminal.

[image:83 align:left size:large]
#
## Using the test utility 

: The steps required for connecting the modem to the PC is shown below:

* Right click My Computer -> select the Device manager -> Ports(COM & LPT).


[image:78 align:left size:large]
#

* Note the COM PORT. Here you can see it's COM3.
* Double click GSM Tester.exe ? click on Scan ports. The Status box will show “Port Scan complete”.

[image:79 align:left size:large]
#


* Click on '''Port''' drop-down menu. Select COM Port for your device. Here it's COM3.

[image:83 align:left size:large]
#



* Then click on Open port. The status box will show '''Port opened successfully. Message cleared'''. Power up the modem. You can see the following details in the status box.

<pre>
“+CFUN: 1 ”

“+CPIN: READY”

“CALL READY”  This means that the modem is ready for normal functioning.

Please note if SIM is not inserted then it will show “+CPIN: NOT INSERTED”.
</pre>

### Making a CALL

To make a call, enter the phone number and press the Call button.

The status box will show '''Data received: ATD903720XXXX; '''. This is the AT command for making a call.

If a call is coming to the GSM modem, a series of “RING” will appear on the Status box. If you want to connect to the call ,then type “ATA” in the AT command window and press “Execute“.

[image:82 align:left size:large]
#


### Sending message 

The first thing you have to do before sending a message is to make the modem to text mode. To do that type ''' AT+CMGF=1;&W ''' in the AT command window and press execute. DO NOT TYPE THE DOUBLE QUOTES. &W is used to write to the SIM808a memory permanently.

To send a message, type the phone number in Phone number window and the message content in the Message window and press the Send button.

You can see that after the message has been sent, the modem gives a response”+CMGS: 234?. From this you can confirm that message has been sent successfully.


[image:80 align:left size:large]
#


The number 234 means 234 messages has been sent from the modem.

The AT command for sending message is '''AT+CMGS=”903680XXXX?'''. When you press enter , '''>''' prompt will appear. Type the content of the message and after that press Ctrl+z to send the message.

### Using Putty

[[wikipedia:PuTTY|PuTTY]] is a serial emulator which is works with windows OS.

Double click '''putty.exe''' -> select serial bullet?change the com port number to the number shown earlier in the device manager -> click open.

Then a new window is opened and we give the commands in the window to communicate with the GSM modem and the other network through GSM modem. The commands are called ‘AT commands’ or ‘Attention commands’. To check the connection type '''AT''' in the putty command window and press enter. If there is a connection it displays '''OK'''.


[image:81 align:left size:large]

#

Please note if SIM is not inserted then it will show “+CPIN: NOT INSERTED”.

### Make call

To make a call type ATD<phone number>;
e.g.: ATD9020XXXXXX;

If a call is coming to the GSM modem, a series of “RING” will appear on the window. If you want to connect to the call ,then type “ATA” & press enter.

### Send message 

To send a message, first you may have to change the message format from PDU to TEXT by typing AT+CMGF=1;&W . To send the message type the following
AT+CMGS=’’9020XXXXXX” and press ENTER
After this, you can see the message prompt (>). Then type the message and press Ctrl+z to send the message.

Or press Esc to abort.



You can see that after the message has been sent, the modem gives a response”+CMGS: xx?. From this you can confirm that message has been sent successfully.

eg: “+CMGS: 23”

The number 23 means 23 messages has been sent from the modem.


# Testing in Linux PC 

The test utility is developed using Python with PySerial and PyQT modules. The code is tested in Ubuntu 12.04 and LinuxMint 17.


[image:84 align:left size:large]
#


Program Features:

* Auto scan Serial/COM ports in Linux when clicked on the device COMBO button
* Configurable Baud Rate
* Call button needs only Phone number in the TextBox above it.(Command compatible with SIM808 Modules)
* AT command input support
* Intelligent button enabling functionality.
* Serial Data logger
* Invalid ASCII Data notification– Indicate wrong BaudRate selection

The source code is available through our GITHUB channel [ GSM Tester](https://github.com/elementzonline/GSM).

For users not familiar with Python and configuring python module, a standalone executable with all dependencies is also distributed along with the source code.

For executing the python code use the following command from the Terminal.

<pre>
tar -xvf GSM_tester_Linux.tar.gz
cd Linux
python GSM_ui.py
</pre>

Note: Users require PyQt and PySerial in the system. The standalone executable is built using pyinstaller utility.

For running the standalone executable use the following commands

<pre>
cd dist/GSM_ui
chmod 777 +x GSM_ui
./GSM_ui
</pre>

# Connecting with RaspberryPi 

Connect a USB to Serial converter to the RaspberryPi USB port. A compatible USB to Serial converter can be obtained from this link.

Create a new file named serial_test.py by typing the following command

nano serial_test.py

write the following lines to the file

<pre>
"""
author: dhanish
company: Elementz Engineers Guild Pvt Ltd
Created on: Aug 12 20:17:12 2016"""

import serial
import time
ser = serial.Serial(‘/dev/ttyUSB0’,9600,timeout=1) # 9600 is the default Baudrate for SIM808A modem
ser.flush()
ser.write(‘ATD9020XXXXXX;\r’) # AT command to call a number using GSM Modem — Edit here
#ser.read(2) # read 2 bytes of data from the serial port
time.sleep(10) # wait for 10 secondsser.write(‘ATH\r’) # Hold the call
ser.close() # close the serial port

</pre>

And finally save the file using '''Ctrl+O''' and '''Ctrl+X'''
Run the following command in the terminal

'''python serial_test.py'''

[ Python sample code](https://github.com/elementzonline/RaspberryPi-Sample-Codes)

# Connecting with Arduino 



[image:86 align:left size:large]
#


The code is tested with SIM808A and Arduino UNO. Connect the Tx and Rx pins of arduino pins to Rx and Tx pins of GSM Modem.

## Using Hardware serial



Note: The UART(Serial) pins should be cross connected, ie. GSM Tx –> Arduino Rx and GSM Rx –> Arduino Tx. Make the ground common between Arduino and GSM modem.

TTL pins can be seen just behind the 9 pin DB9 connector. If you are using DB9 connector for interfacing you need MAX232 circuitry for converting RS232 output of DB9 to TTL levels.

Copy and paste the following code to your Arduino IDE as a starting point for GSM-Arduino interfacing test.

: Note: Before powering SIM808A module user should insert the SIM into the module.

Change the phone number in the below code before running the code.

<pre>
/*
Author: Dhanish
Created on: 19-08-2016
Company: Elementz Engineers Guild Pvt Ltd
Run this code only after SIM808A Module has powered and connected to a Network.
Please make a call to the module knowing whether the connection is established.
If connected a ring will be heard at the caller end
*/

void setup() {
   // initialize serial communications at 9600 bps:
   Serial.begin(9600);

   delay(10000);
   // print the serial data to GSM
   Serial.print("ATD9020XXXXXX;" ); // change here to call a number using SIM808A
   // wait 10 seconds before the next loop
   delay(10000);
   Serial.print("ATH" ); // hold the call
}

void loop() {
}
</pre>


## Using Software serial 

Another code using Software serial is as seen below

Note: Connect as follows

digital pin 3 — connect to TX of GSM Modem
digital pin 2 — connect to RX of GSM Modem

<pre>
/*
Author: Dhanish Vijayan
The circuit:
* RX is digital pin 3 (connect to TX of GSM Modem)
* TX is digital pin 2 (connect to RX of GSM Modem)
*/
#include <SoftwareSerial.h>

SoftwareSerial mySerial(3, 2); // RX, TX

void setup()
{
   // Open serial communications and wait for port to open:
   Serial.begin(9600);

   Serial.println("Calling through GSM Modem");

   // set the data rate for the SoftwareSerial port
   mySerial.begin(9600);
   delay(2000);
   mySerial.println("ATD81290255XX;"); // ATD81290255XX; -- watch out here for semicolon at the end!!

   Serial.println("Called ATD81290255XX");
}

void loop() // run over and over
{
   // print response over serial port
   if (mySerial.available())
      Serial.write(mySerial.read());
}
</pre>

[ Arduino sample code](https://github.com/elementzonline/Arduino-Sample-Codes/tree/master/e-Tracker) can be downloaded from our [ GitHub channel](https://github.com/elementzonline/Arduino-Sample-Codes/tree/master/e-Tracker).

# Working with GPS/GNSS 

To work with the GNSS module in SIM808, GNSS commands are to be used. Find the Application Note [ SIM808 GNSS Application Note](http://www.elementzonline.com/downloads/SIM808/SIM808_Series_GNSS_Application_Note_V1.00.pdf). Some important commands are given below


|Command|Description|
|-------|------:|
|AT+CGNSPWR|GNSS power control|
|AT+CGNSSEQ|GNSS navigation information parsed from NMEA sentences|
|AT+CGNSINF|Serial Clock|
|AT+CGNSURC|GNSS navigation, GEO-fences and speed alarm URC report|
|AT+CGNSCMD|Send command to GNSS|-
|AT+CGNSTST|Send data received from GNSS to AT UART|

# Important Links 

[Product Page: ElementzOnline](http://elementzonline.com/e-tracker-arduino-compatible-atmega328-sim808-based-gsm-gnss-gps-tracking-module-board-with-call-sms-gprs-facility-387)

[Sample Codes: GitHub](https://github.com/elementzonline/Arduino-Sample-Codes/tree/master/e-Tracker)