You are on page 1of 38

MCE TrackMe (GPS) 2013

MCE TrackMe (GPS) - mcelectronics.com.ar 2012


Tracking system, telemetry and remote control
through cellular network.
electronics mc

We are a team of professionals that work with passion so as to ensure that our clients
have always a innovative product. We take care of all the details involved in the
fabrication of all our tools. All of our products are designed and assembled in Argentina.
This product counts with 1 year warranty.
More products at:
http://www.mcelectronics.com.ar/desarrollos
Alejandro Airoldi
Responsable for Quality Control
Quality Assurance
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
Introduction
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
TrackMe (GPS) is a telemetry system and remote control through cellular network. It
possesses a GPS and a GSM module. It can transmit through GSM or GPRS, plus it counts
with acceleration, light and temperature sensors. The battery is charged via USB and it
has the possibility to store the coordinates in the internal memory of the PIC18F26J50
microcontroller.
TrackMe (GPS) 2013 includes complete projects programmed in CCS. Plus, examples to
decode the GPS NMEA frames, receive commands trough
text messages , use the accelerometer and present the information on
a map using GoogleMaps !
Layout version 2013
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
(+) Size comparison
with a cellular phone.
54 mm
8
5

m
m
Components Distribution
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
Connector for
SIM Card
USB for battery charge and
data transfer.
Charge
indicator LED
GPS Antenna
GSM Antenna
(removable)
Power
indicator LED
Expansion
Header
Panic push
button
Expansion Header
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
SIM908
Module
SPEAKER P
SPEAKER N
MIC P
MIC N
BAT
BAT
+3V3
+3V3
GND
GND
XOUT
YOUT
ZOUT
IO5
IO4
IO3
IO2
IO1
GSM TX
GSM RX
RING
GSM STATUS
GSM NET
GSM ON
GPS TX
GPS RX
+3V3
PANIC
LDR
TEMP
NC
PGD
PGC
GND
+3V3
MCLR
PICKit 2,
PICKit 3 or
another
compatible
programmer
Switches and LEDs
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
N
E
T
R
E
A
D
Y
Flashes every 2sec
when the device
registers to the
cellular network
(must have an active
chip).
It lights up when
the SIM908
module is ready
to operate.
The RF switch can power
on/off the SIM908 module
while the rest of the board is
still working.
RF
MAIN
ON
Microchip Analog Devices
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
TC1262-3.3
ANALOG
Charger for
Li-ion
batteries of
each cell.
Includes
current
censing and
protection
against
inverse
discharge.
TC1047
3.3v
3.3v
Analog temperature sensor
10mV/C
VBAT
VIN
MCP73838
VBAT
PIC
18F26J50
Accelerometer
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
NC
AN2 X OUT
AN3 Y OUT
AN4 Z OUT
GND
3.3V
NC
NC
NC
NC
NC
NC
NC
3.3V
Freescale MMA7368L
It includes a 3 axis analog accelerometer (X OUT, Y OUT, Z OUT). They are connected
directly to the PIC analog channels.
1.5g Three Axis Low-g Micromachined Accelerometer
PIC Analog
channels
Change rate: 800mV/G
Z
Y
X
Accelerometer
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
NC
X OUT
Y OUT
Z OUT
GND
3.3V
NC
NC
NC
NC
NC
NC
NC
3.3V
Freescale MMA7368L
SIM908 GSM Module
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
GSM
SIM908
Quad-band : GSM850, EGSM900,
DCS1800, PCS1900
GPRS multi-slot : Class 10 / Class 8
Noise Suppression
Echo Cancelation
Sleep mode current consumption:
1.5mA
GSM Module Connections
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
SIM CARD
RFIN
ANT
PIC 18F26J50
SIM TX
SIM RX
GSM
SIM908
SIM BUS
1,8 - 3v
PWRKEY
NET STATUS
The SIM908 module connects to the PIC through SIM TX (RP0) and SIM RX (RP1) pins. It
also needs the antenna connector and SIM Card to operate.
SIM908 GSM Module
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
The SIM908 module needs a 0 on the PWRKEY pin to start. In this case the board has a
common emitter transistor (inverter), for which we must switch the PIC RC1 pin (GSMON)
to 1 to turn on the module.
PWRKEY
Low > 1s. Delay > 2s.
STATUS
The module will automatically shut down (STATUS = low) when supply
voltage is detected outside the 3.3 < VBAT < 4.6 range or when the
temperature is over 85C.
However 0.1v under the limits it sends warnings through the USART.
AT Commands
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
The GSM Module is controlled via commands through the USART.
These commands are denominated AT commands.
The AT commands allows you to make phone calls, text messages, consult the module
parameters, measure the cellular signal and set all the SIM900 configurations.
Conversation type communication. The answer must be received before the next
command is sent.
AT (Attention)
Synchronization
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
By default it is autobauding enabled. To synchronize the PIC speed with the SIM908 an
A must be sent and up to 3 to 5 seconds must be waited. Then we send the AT
command before initiating communication Once synchronized the SIM900 responds
OK
AT
GSM
SIM908
PIC
18F26J50
Autobauding Range: 1200 bps to 115200 bps (N,8,1)
A
OK
Basic Commands
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
ATI
SIMCOM_Ltd
SIMCOM_SIM900
Revision:1008B10SIM900S32_(SPANSION)SIMCOM_Ltd
AT+GSN // IMEI number from the SIM900
355117001566879
OK
AT+CSQ // Signal level [rssi,ber]
rssi (0= -113dBm o 1= -111dBm o 2 a 30= -109dBm a -53dBm o 31= -51dBm
o >/99 no se conoce). ber (% bit error rate)
[17,0]
These commands can be sent through the HyperTerminal (using the USB-GSM driver
included) or through the microcontroller without using the PC.
Basic Commands
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
ATD51065802; Make a phone call - SIM908 dials 51065802
AT+CLIP=1 // Show the number of the incoming call (Caller ID)
OK
RING
+CLIP: 51065802",129 // Incoming call number 51065802
OK
ATH // Hang up
RING
ATA // Attend incoming call
OK
Send a SMS
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
Sending of the SMS to 51065802
AT+CMGF=1 // Selecting of text mode
AT+CMGS=51065802 <ENTER> // Phone number and 0x0D
> YOUR MESSAGE <CRTL+Z> // Write the message and 0x1A
Returns the position in the memory of sent
OK
+CMGS: 123
Recieve an SMS
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
Reception of SMS
AT+CMGF=1 // text mode
AT+CNMI=2,2,0,0,0 // doesnt save in memory, it sends it through
USART
When a message comes it sends it through TX automatically !
+CMT: 12345678,,28/05/10,11:20:28+32
Hello World
SIM908 GPS Module
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
GPS Receiver bases on the 42
channels SIRFstarIII
Consumption less than 77 mA
NMEA protocols or SiRF
Rapid Acquisition of satellites
30 s.
Tracking Sensibility :
-160dBm
GPS
SIM908
GPS Module Conections
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
VANT
VRF = 2.85v
RFIN
PIC 18F26J50
GPS TX
GPS RX (*)
GPS
SIM908
ON
ANT LNA
The GPS Module connects to the PIC through the GPS TX (RP3) and GPS RX (RP4) pins. It
needs the antenna and the LNA (Low Noise Amplifier) to operate.
(*) GPS RX is used to request other
frames or vary the reception
interval from the PIC.
NMEA Frame
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
NMEA 0183 is a protocol through which the navigational and terrestrial instruments can
communicate. Its been defined, and controlled, by the National Marine Electronics
Association.
In the NMEA frame we have information such as position, velocity, movement direction,
UTC hour, satellite position, intensity of incoming and data control.
Basic NMEA frame
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
The $GPRMC frame includes basic tracking information and its the one were going to
use to determine the position and other data as velocity, direction and hour.
Recommended
Minimum
Message
UTC Hour
04:03:02.663 AM
$GPRMC,040302.663, A,3939.7, N,10506.6,W, 0.27, 358.86,200812,*1A
A = Active (at least 3 satellites), V = Invalid A
N = North, S = South N
W = West, E = East
W
Latitude 3939.7'
Longitude 10506.6'
Velocity meassured in Knots
1 knots = 1.85200 kilometers
Movement direction
(azimuth) 358.86
Date 20/08/12
Checksum
*1A
Program to decode the NMEA
frame
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
TrackMe GPS includes a program (SirfDemo) to decode the NMEA frame and show
information graphically. We must open the HyperTerminal and select GPS mode (option
2), then we open the SirfDemo software at 4800 bps and click Connect to visualize the
information in real time.
Programto decode the NMEA
frame
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
At least 3 satellites are required to determine the position. In this case all the satellites
are in red which means that there still isnt enough signal.
The GPS must have a clear view to the sky so as to work properly.
Examples and Applications
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
All the examples are programmed in C for the CCS compiler. The complete code can be
found along with the board files. Next well describe the basic rutines.
The shaded represents code lines.
Examples and Applications
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
void inicializacionSIM900(void)
{
int cont;
delay_ms(1000);
puts("A",SERIAL_GSM); //to synchronize the SIM900 baudrate
delay_ms(300);
putchar(0x0d,SERIAL_GSM);
delay_ms(3000);
for(cont=0;cont<5;cont++) // I send several AT for the autobauding
{
puts("AT",SERIAL_GSM);
delay_ms(300);
putchar(0x0d,SERIAL_GSM);
delay_ms(200);
output_high(LED);
delay_ms(200);
output_low(LED);
}
puts("AT+CMGF=1\r",SERIAL_GSM); // I configure for it to work in text mode, not PDU
delay_ms(100);
putchar(0x0d,SERIAL_GSM);
delay_ms(100);
return;
}
SIM908 Module Initialization
Its important to respect the delays to initialize the module correctly.
Examples and Applications
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
#define X_ADC 2 // Define the analog channel
#define Y_ADC 3
#define Z_ADC 4
#define TEMP_ADC 11
set_adc_channel(X_ADC); // Select the channel sith the multiplexor
delay_ms(3); // Define a delay of 3 ms to charge the lecture capacitor
eje_x=read_adc(); // Save the value in the variable
set_adc_channel(Y_ADC);
delay_ms(3);
eje_y=read_adc();
set_adc_channel(Z_ADC);
delay_ms(3);
eje_z=read_adc();
set_adc_channel(TEMP_ADC);
delay_ms(3);
temperature=read_adc();
Read analog channels
In this example the analog channels of the accelerometer and temperature sensor are
selected and the values are stored in variables (definition isnt showed in the box)
Examples and Applications
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
sprintf(string_temp,"Temp=%1.2f C ",grados);
fprintf(SERIAL_GSM,"AT+CMGS=\"1512345678\"\r"); // put here the cell phone number that receives the SMS
delay_ms(200);
fputs(string_temp,SERIAL_GSM);
delay_ms(100);
fprintf(SERIAL_GSM,"%c",0x1a);
output_high(led);
while(input(PANIC)==0);
Send the temperature through SMS
The complete example consists in reading the TC1047 sensor, convert the tension value
to degrees and send it through SMS when the panic button is pressed. In this fragment
we see that data must be passed as string, for which we convert the degrees variable
from float to string with sprintf. The same applies when sending the measures of the
accelerometer.
Examples and Applications
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
if ( kbhit (SERIAL2) ) // Waiting for new data in USART2
{
e=0;
e=getchar(SERIAL2); //Characters are stored in variable e
switch(e)
{
case 10: // Waiting for new line feed
if(cbuffGPS[0]=='$' && cbuffGPS[1]=='G' && cbuffGPS[2]=='P' && cbuffGPS[3]=='R' && cbuffGPS[4]=='M' &&
cbuffGPS[5]=='C' && cbuffGPS[18]=='A' ) //Validates if the data is valid (detect at least 3 satellites)
{
PIN_ON(LED);
strcpy(cbuffGPS2,cbuffGPS); // The complete $GPRMC frame is stored in cbuffGPS2
}
xbuff=0;
flag=0;
break;
default:
cbuffGPS[xbuff++]=e;
if(xbuff>(lenbuffGPS-1))
xbuff=lenbuffGPS;
}
}
Read and save GPS NMEA frame
The idea is to read and save a valid frame in a variable, so as to process it later and send
it as a GoogleMaps link.
Examples and Applications
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
if(cbuffGPS2[0]=='$' && cbuffGPS2[1]=='G' && cbuffGPS2[2]=='P' && cbuffGPS2[3]=='R' && cbuffGPS2[4]=='M' &&
cbuffGPS2[5]=='C')
{
strncpy(latg,&cbuffGPS[20],2); // convert to googlemaps coordinates
strncpy(latm,&cbuffGPS[22],7);
strncpy(longg,&cbuffGPS[32],3);
strncpy(longm,&cbuffGPS[35],7);
latitudgoogle=(atof(latm))/60;
longitudgoogle=(atof(longm)/60);
sprintf(&latitud[1],"%.6f",latitudgoogle);
latitud[0]=latg[0];
latitud[1]=latg[1];
sprintf(&longitud[2],"%.6f",longitudgoogle);
longitud[0]=longg[0];
longitud[1]=longg[1];
longitud[2]=longg[2];
}
Convert to GoogleMaps format
We must obtain latitude and longitude from the $GPRMC frame (cbuffGPS2), plus
convert the values to decimal coordinates. Later they are stored in latitude and
longitude variables.
Examples and Applications
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
fprintf(SERIAL_GSM,"AT+CMGS=\"1512345678\"\r"); // put here the cell phone number that receives the SMS
delay_ms(200);
printf("http://maps.google.com/maps?q=-%s,+-%s+(TrackMe esta aqui)",latitude,longitude);
delay_ms(100);
fprintf(SERIAL_GSM,"%c",0x1a);
output_high(led);
while(input(PANIC)==0);
Sending a GoogleMaps compatible link
All we have to do is include the latitude and longitude variables, with the appropriate
format, inside the GoogleMaps URL.
User receives a SMS with a
link that shows the location of the board.
Examples and Applications
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
Sending data through GPRS
We can send the information to GoogleEarth in real time through GPRS. The trick
consists in sending the complete NMEA frame (without processing) to a TCP server.
Then in the server, which can be our computer, we run an application that allows us to
re transfer the received data through TCP to a Virtual COM Port. Finally we open
GoogleEath and select that virtual port as data entry.
This way we can see in real time the position and speed of the board in a GoogleEarth
map.
Examples and Applications
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
Storing data in the PIC internal memory
Its also possible to store the complete frame in the PIC18F26J50 program memory and
then convert this information to KML in the PC to open it with GoogleEarth or
GoogleMaps.
Loading the PIC firmware
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
To load a new program to the PIC18F26J50, first we must conect the programmer to
the 6 programming pins, open the program for the PICKit2 and select File->Import
HEX
The manufacture file is mce_trackme_2012.hex and it can be found inside the server
Firmware folder. Then we click Write and the legend Programacin exitosa must
appear concluded the verification.
Loading the PIC firmware
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
Its possible to change the register CONFIG settings without the need of recompiling
the project, clicking on Configuration.
The connecting and programming procedure is identical for the PIC18F26J50.
Its also possible to use MPLAB in case of possessing a PICKIT 3 or ICD3.
Line Activation
MCE TrackMe (GPS) - mcelectronics.com.ar 2012
Before sending and receiving messages or making a phone call we must activate the
CHIP CLARO so that the cellular company assigns us a number. If you already posses an
activated CHIP you can use it instead.
To activate the simcard (Argentina only):
1 Insert the CHIP on your phone
2 - Dial *22#
3 Answer the requested information (Tax-ID, gender, area code)
4 - A few minutes later a message is received with the designated TE number
5 Insert the CHIP in the TrackMe (GPS) board to start working.
Please ask your local mobile phone provider to activate your SIM card.
You must charge credit to your line in order to send messages and make phone calls.
mcelectronics
Buenos Aires - Argentina
Septiembre 2012
MCE TrackMe (GPS)
Manual REV: 09042012
Austria 1760 - OF 8
Ciudad de Buenos Aires (1425).
BA. Argentina.
(011) 3531-4668
www.mcelectronics.com.ar
info@mcelectronics.com.ar
www.mcelectronics.com.ar
MCE TrackMe (GPS) - mcelectronics.com.ar 2012

You might also like