OpenAVL, an AVL Open Source project that tracks you down.
AVL stands for Automatic Vehicle Location, which is accomplished by means of a tracking GPS and M2M modules. Actually a small AVL can be used to track any objects, including kids and pets. It is not a new idea. The tracking device was already available several years ago. It seems that AVL is less competitive than PND (Personal Navigator Device) marker. I decided to develop my own AVL reference design based upon some open source projects. The OpenAVL project should be able to communicate with my tracking web server or any web server via SMS and IP/GPRS.
- The 3rd generation highly precise GPS module. SiRF-III is preferred, MediaTek GPS is also all right.
- AVL sends latitude, longitude, altitude, course, velocity, heading, UTC time and satellites in view to any mobile phone, optional web site and email account.
- Smarter power saving algorithm for M2M/GPS modules and long enough battery life.
- Over-the-air Configuration via text message commands from mobile phone and optional web.
- Password security and unique identifier.
- Manual locate and automatic tracking modes via text message.
- Automatic tracking mode depends on the velocity.
- Alerts when speed limit is exceeded.
- Reports of mobile phone battery and signal status.
- Retains tracking messages if out of GSM coverage, and sends when back in coverage.
- Retains and reports last good fix if it loses GPS coverage. (Optional)
- Reports of mobile phone Cell ID in case GPS is out of coverage, i.e. in a building. (Optional)
- Watchdog timer prevents device lockup.
- AVL should support GSM-SMS, and optionally support GSM-CSD and GPRS depending on device configuration.
- More to be updated...
I got a Leadtek GPS module and a Cinterion (formerly Siemens Wireless Module) GSM module from Taobao.com (a local C2C auction web site, you can find these devices from eBay as well). The Leadtek GPS module has SiRF-III chip inside and supports NMEA-0183 protocol and SiRF binary protocol. The Cinterion GSM TC35i only supports SMS and CSD modes. However it is the most commonly used and stable M2M module in the market. The GPRS M2M module, TC39i is pin-to-pin compatible with TC35i. The GPS module is 25USD and GSM module is 35USD. So the total BOM cost can be limited to 70USD. A complete AVL in the market is 130USD and more. At first I selected LPC2106 from NXP as the system controller. Finally I change my mind and pick the ATMega128L from Atmel. This chip is powerful enough and supported by the WinAVR, which is a GCC for AVR. ATMega128L has two UARTs, 128KB flash memory, 4KB SRAM and internal EEPROM. It is a perfect microcontroller for a RAM intensive application like AVL.
I employ a Bluetooth GPS (Holux M1000) and a Bluetooth GSM phone (Sony Ericsson K750C) as my testing platform. The GPS and GSM phone connect to my PC with Bluetooth Serial Port Profile (SPP) on COM9 and COM10 individually. All the communications between modules and PC are verified in Hyperterminal first. It is also possible to build the code with a native GCC, so the native version can be tested locally and then recompiled with WinAVR and downloaded to the AVL board. It is quite convenient in software development before hardware is available.
I have collected source files from different applications. I put them together and try to reorganize the code base in a unique naming convention.
- The application note AN322 from Atmel. This AN offers a reference code base of GSM phone for SMS communication. The code supports IAR C compiler only.
- The AVRLib, which offers a comprehensive code base for AVR applications, including NMEA GPS connectivity. The library supports WinAVR GCC only.
- The C source template from ConnectOne Israel. It has its own AT+i command set, which is a derivate from the traditional AT command. I use part of the source template to handle the AT command for M2M module. The reference code can be compiled by a standard GCC.
- The assembly from Open Source GPS Tracker. It is a big single assembly source file for AVR I don't want to use the file. However it is a good reference of the AVL project.
- The reference C source file from OpenDTMP project. It is a great open source project for online tracking. However the protocol is too large and complicated.
As most of the sources come from AVRLib, I decided to port AN323 source code from IAR CC to WinAVR CC according to AVRLib's naming convention. I have to wrap the code with macros, because WinAVR is a standard ANSI C compiler, which doesn't support some keywords and extension like IAR does. For example, __flash, __interrupt is supported in IAR, but not in WinAVR, I have to update the code according to WinAVR user manual.
I checked the NMEA and AT command set. Basically the GPS driver reads the NMEA sentences from serial port and keeps parsed parameters in the memory. Two major NMEA sentences (GGA/VTG) offer enough parameters for the AVL application. Since the user Over-the-Air commands and status reports and alerts are carried in the SMS communications, most of the programming tasks are OTA commands parsing (SMS receiving), report and alert sending (SMS sending) and AT command drivers.
In the next blogs, I will plan the software structure, list the OTA commands and alerts format, and compares the M2M modules for next generation GPRS based AVL product. Of course, the first version of AVL firmware will be released in case any programmer can not wait for any longer.
AT commands - Forum NOKIA Wiki.
SiRF-III NMEA Reference Manual from a GPS OEM module from Sparkfun Electronics.
Formerly Siemens Wireless Module, now Cinterion. Its TC35 GSM module is the cheapest M2M module in the market. Cinterion also offers GPRS, and combined module integrated GPRS and GPS.
Wavecom is the leading M2M module supplier. It offers wider M2M modules, including GSM, GPRS and CDMA with Bluetooth, Java and GPS. Wavecom also offers OpenAT as the development environment.
A Taiwan GPS module supplier. Leadtek offers low cost SiRF-III and MTK based GPS OEM modules and GPS receivers.
Repost: Sep 15th, 2008