Two weeks ago I posted about how to interface an AVR microcontroller to a Telit GM862. You can read it here: Interfacing an AVR controller to a GPS Mobile Phone.
That post got listed on Hack-A-Day, Engadet and Makezine among many others! w00t! Thanks for posting and reading it, I really appreciate it.
This post will show you, how to use this equipement to send an SMS with your current position and how to display it in Google Maps.
How does it work?
The controllers serial port is attached to the serial port of the GM862 module. This way the controller is able to send AT commands to the module and receive responses. The GM862 has two serial ports, one for controlling the modem, the other for receiving GPS data in NMEA 0183 format. Fortunately we can access the GPS through the modem port, what saves us from using a second serial port.
To be able to debug and control the controller, I use a second serial port, that connects the controller to my PC. That way I am able to send commands to the controller and steer the program flow as long as it is not fully tested and completed. The following steps are needed to get it up and running.
- Power on the circuit.
- Power on the GM862 module (done by the ATmega8)
- Initialize the modem.
- Initialize the GPS module (may be omitted).
- Request a GPS position (repeat until the position is fix).
- Send an SMS with GPS position to an SMS-to-Email service.
- Open your email and click the Google Maps link.
As the ATmega8 has only one hardware UART, I use this to communicate with the modem at 19200 baud. For debugging purpose, the second serial port is implemented with a software UART with communicates with the PC with 9600 baud.
Starting the controller gives the following menu on the terminal:
Beacon v0.02 2007/07/28
s - Change sms phone number
o - Switch modem on/off
i - Init modem
m - Send SMS
c - Cold start GPS
p - Request GPS
Switching the modem on and off is done by pulling the pin 17 of the GM862 to low for at least a second. The status LED of the modem should start to blink in response.
Initializing the modem is done with the following sequence of AT commands:
AT, say hello
AT+IPR=19200, set the baud rate to 19200
AT+CPIN=<pin>, set your PIN for the SIM card
AT+CMEE=2, choose extended error messages
The modem should respond with the status LED blinking slower, if the PIN matches and the network is reachable.
Initializing the GPS is optional, as the modul starts the GPS on power on. You can force a cold or a warm start.
AT$GPSR=1, issue a cold start
AT$GPSR=2, issue a warm start
If you ommit the cold or warm start, you should be able to see a fixed position within 30 seconds after you powered up the module. This time may vary with your position and the reachability of the satellites.
The current position is requested by sending
AT$GPSACP, read the acquired position
The response contains information about current time and date, the position and the number of available satellites.
To send send an SMS, send the following commands:
AT+CMGF=1, select text sms format
AT+CMGS="<phone number>", send the message to the given phone number. This command responds with an prompt
>. Now the text of the SMS can be transmitted. The message has to end with
Parsing the GPS position
The position string received from the GPS looks like this:
GPSACP: 131924.999,5343.9291N,00954.7841E,2.6,34.0,3,29.78,0.32,0.17, 130707,07
All tokens are separated with comma. The tokens are:
- time, hhmmss.SSS
- position, latitude, degrees and minutes
- position, longitude, degrees and minutes
- hdop, horizontal diluition of precision
- position, altitute, meters
- fix, 0=invalid, 2=2D, 3=3D
- cog, course over ground
- spkm, speed in km
- spkn, speed in knots
- date, ddmmyy
- nsat, number of satellites
The position data received is not directly usable for Google Maps, because the GPS returns degrees and minutes, but GM wants degress as a floating point number. That means the minutes have to be converted to decimal fraction of degrees.
Sending a Google Maps link
Now that we have received and converted the GPS position, we are ready to send an SMS with a link to GM. The link has the following format:
You can embed a message, which appears in the popup box. It is surrounded by encoded brackets. Further you can control the zoom factor and the type of map (k=satellite, m=map).
Now this link has to be send as an SMS to an SMS-to-email service that forwards the SMS as email to the given address.
If everything went well, you should be able to click the link and see your browser opening Google Maps with your position.
Next todos are pollishing the code to be able to show it and having it more self-sufficient. Send me an email or comment, if you would like to see it online.
Is this the full source code for the part one of the project? im planning to construct the project here in the Phil. but I dont know yet about progrmming the ATmega8 microcontroller. Can teach me? Thanks!
no, I am still working on the source. But I plan to release it soon.
If you are new to programming of microcontrollers, I would suggest to try a tutorial on that first. Instructables has some very good, for example this one:
hi Alex, can u plz temme that how to start with the project and which Gsm hanset can be used and hot to interface them to the avr port.
I am not really familliar with GSM handsets.
But if you want to try the GM862, the easiest way would be to get a breadboard and assemble the components as shown in the schematics https://tinkerlog.com/wp-content/uploads/2007/07/beacon.zip
You will need the Eagle CAD software to display it. http://www.cadsoftusa.com/
hi Alex, can u plz put up the codes that has to be programed in the microcontroller.
Also, when the Sms is sent as on email, how to convert (the content of the SMS) this in to a file which can be taken sucessfully by the google map.
thanks for your quick reply.
I would like to know also
I am interested in your tracking device. Please can you contact me if you would be interested in business deal number is +44786xxxxxx
hi alex, how r u doing?, thanks for the codes.
Alex, do u know any other gsm module other than telit which has a SIM slot for sening the sms., coz this module is not available here in India.
thanks for your response
if you are looking for modules with GPS functionality I think the Telit is the only one. Have you asked roundsolutions.de, if they ship to India?
Others without GPS are produced by Siemens or Sony Ericsson for example.
This is a very interesting project. I have tried to put it together and came up on few obstacles.
1. SUART is using PB0 and PB1. Which one is used as TXD and which one is used as RXD. (Just found it in suart.c PB0 is RXD)
2. I am using 4.0MHz oscillator. What value do I have to set in uart.c for F_CPU?
3. In your assembly picture there is a push button which is not present in schematics. What is the pushbutton used for?
Thanks a lot.
hi, can i use gm863 instead of gm 862.
if yes, what r the necessary changes need to b made?
@DOL, I will check which pins are used. I’m currently not able to look into it. If you are using 4.0MHz, then F_CPU should be set to 4000000. The pushbutton is just for the reset.
@sha, I am not sure if the gm863 works. I think it should have the same functionality but not sure about the pinout.
Thanks for your help. I was able to connect to Br@y++. Below is the portion of the input received in Br@y++ terminal. (I was not able to get anything in HyperTerminal). I have tried different baud rate settings 9600 and 19200 with the same results. I am thinking that there is something wrong with usart.c. Just FYI currently the circuit is on breadboard.
Please advise. xxâ‚¬xÃ¸â‚¬Ã¸Ã¸â‚¬Ã¸Ã¸â‚¬xÃ¸â‚¬xÃ¸â‚¬Ã¸Ã¸â‚¬xÃ¸xxÃ€Ã¸â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬Ã¸â‚¬â‚¬â‚¬â‚¬Ã¸Ã€â‚¬Ã¸â‚¬Ã¸â‚¬â‚¬â‚¬â‚¬â‚¬â‚¬Ã¸â‚¬â‚¬â‚¬Ã¸â‚¬â‚¬â‚¬â‚¬â‚¬>â‚¬|â‚¬â‚¬Ã¸
Hi there, is there a site where I can get a full run down of this project? I’d love to build it but want all the facts before I start!
sorry, all infos are a bit scattered in my blog. Be sure to check the first part of this series, see the links section above.
I am currently using the builtin Python, so the list of needed materials will shrink soon, I hope.
Is there anyway i could also get those codes for the unit ?
Thanks very much
please have a look at: https://tinkerlog.com/2007/08/08/firmware-for-the-gps-tracking-device/ for the firmware.
The easier and smaller version in Python is here: https://tinkerlog.com/2007/09/23/using-twitter-and-twibble-for-mobile-tracking/
I am working on a similar poject where the device sends the co-ords to a mobile phone via SMS and then the co-ords are typed into Mappoint. Is it possible to get the device to send an SMS to the mobile with a link to mappoint and then select that link on the mobile and call up the map?
how do you convert the gps position into a format for google
if you can open a location in Mappoint with a single link, then it should be possible, to send a text SMS with the formatted link.
For the conversion of coordinated, it depends on what your GPS puts out. Mine formats the location DD MM.mmmm where DD are the degrees, MM are the minutes and mmmm are the fractions of a minute. Google wants DD.ddddddd, degrees and fractions of degrees.
Take a look at the source in C:
Or in Python:
There are a number of mapping sites that will open up the location with a single link in this format via a PC web browser.
Does anyone now of a way of doing this on a mobile?
I want someone to be able to get this SMS and automatically open up a map showing the location on a mobile.
hi alex, can i use GE863-gps module instead of gm862, as the gm862 module is not available in india.
please help me out.
I haven’t tested the GE863 module, but I would expect, that the code could be easily ported. But the hardware may need more investigation, as the GE863 is smaller and does not come with an onboard sim card holder.
Alex, fine work here! Would it not be possible to also accomplish the same task by sending a request for position (via SMS) to one of the newer GPS-enabled handsets (like Nokia) and simply have it respond with the lat/lon via SMS, and then convert this to a GoogleEarth query format at the receiving end, or a Google Maps app on a Blackberry or Treo? I am looking to do what you have done but wish to leverage as much off the shelf technology as I can find. Thanks.
yes that should be possible. It exists even a Python for Series 60.
Hi Alex , Great project and well done .
I am working NOW on project exactly like this.
Could you plaese send the code to me ?
it will be very helpful to me :)
Thanks AHMAD .
just scroll 20cm up and you will find links to the code ;)
Thanks for your fast replaying ,
but unfortunately, I am using the Telit GM862-GPS with Arduino. So, I thought I shoud use the Arduino code for that ,unless you have any comments for me .
I mean , Must I use the (C) code or Python one ?
your advice plz :$
the Arduino should be well suited for this.
As the Arduino programming language is C with some additional features, it shouldn’t be a problem to port my C version of the firmware to an Arduino. The most interesting part is the communication by AT commands. At least that should be ported to the Arduino.
And don’t forget to drop me a line, if you get it working ;)
i want start with AVR and i want build an tool that show gps
can u help me?
nice to meet ur site
Hi Alex from Greece
Can you explain the mathematical way to convert the GPS Telit answer to a suitable format for Google?
just scroll 3 or 4 pages up, there is the answer.
Thank you for your reply. But this is not the answer to my problem because I don’t know C, so the only way to help me is to tell me the math type that you use. I programm all the AVRs in assembly language.
Thank you again.
Ok, here you go.
The format that is comming from the Telit module is DDMM.mmmmN where DD are the degrees, MM are the minutes and mmmm are the fractions of a minute.
Google wants DD.ddddddd, degrees and fractions of degrees.
* first copy the first two chars (degrees) into the new var.
* delete the last char (the N,E, …) and the last digit. (MM.mmm)
* delete the ‘.’ (MMmmm)
* multiply with 1667 (ddddddd), convert from minutes to decimal.
* combine the copied DD, ‘.’ and ddddddd (DD.ddddddd)
I have to develop a simple handset that able to send sms and make calls using GM862-GPS… My problem is I really dont know how to write the Python Programme and really unclear about the connection for the whole circuit ( the schematic and circuit layout which I also need a display and keypad to operate like a handset).. Do you have any idea to solve this out or any source or link should I refer..Really need your help…Thanks in advance
I appreciate your project, it’s amazing and lovely. I’m embarking on a similar project but it involves an immobilizing system. pls I’ll like you to assist me in this, believing that your assistance will give me a detailed information on what I need
we have a gps tracking device which send’s it’s location with a map link to our smart phone, the link includes the internet address to maps.google.com/maps, followed by the parameters which include longitude and latitude (similar to what you mention). However, the problem is, when we use the link on the phone (palm treo 500) the internet is started and the google map screen is displayed, but without any map. the google screen displayed as a search box which is empty (which normally you would enter the search parameters into if you were going directly to the google screen). if you enter the search parameters in here and press search, you get the same result (the screen is re-displayed but no map). Note. we have checked with our network supplier and they have confirmed we have a gprs data connection. this link works fine if you use it on a pc. any idea why it will not work on the smart phone, or if it could work. any assistance would be grateful. thanks.
this work just what i anted to do at my final thesis.
hello i’m bilguun. i’m studying at department of electronics ( in Mongolia) .
but total 283$ + shipping cost is too expensive for me.. any one know any cheaper or company which offers discounts for student
is there any software that just display the path of destination from current location
i am searching for a software that works as follow:-
1.enter the current location
3.will display the path to the destination
the path of destination is already store in software it has to display
plz give some suggestion it will be very thanks of u
Comments are closed.