SIM808 + ATMEGA328P-AU GPS Tracker
STDSIM808 + ATMEGA328P-AU GPS Tracker
License
:GPL 3.0
Description
This project started out as a fun way of exploring the possibility of GPS, mobile communication, 18650 battery powered, motion sensors and data logging through MQTT and to SD card. I know there are cheaper and better performing solution on the market, but hey what’s the fun in that.
I started this project by fully building it on a breadboard using standard modules and some dedicated hardware. This was mainly to discover if this project was even within doable limits and all components would play nicely with each other. I quickly discovered that prebuild modules are a big limiting factor and to make use of the full potential I would have to design my own board.
For debugging purposes I kept using the breadboard with standard modules as it was way easier to hook up my oscilloscope and make quick modification. To accommodate two hardware versions (a breadboard version and a pcb version) the firmware was written in two separate Atmel Studio 7 projects. This was necessary because the hardware was not actually identical and the mcu did run at a much slow 1mhz instead of the 16mhz on the breadboard.
For the breadboard version, the whole firmware was basically a debugging version, where on the final pcb a dedicated debugging mode was implemented. DEBUGMODE can be turned on to enable UART debugging on the led output pin. (Format: 8 data bits, no parity, 1 stop bit, Idle High) Then simply add a DEBUG_SendByte, DEBUG_SendString or DEBUG_Trigger to any line in the firmware.
I settled with a design using a Atmel ATMEGA329P-AU as the main mcu and the SIMCom SIM808 for GPS and data communication. A piezo vibration sensor is used to detect movement and start logging GPS data to the SD card and Adafruit mqtt server.
The piezo voltage is amplified 34x by a non-inverting op-amp and the output if controlled by a comparator to switch high to VCC or low depending on the set point which can be adjusted to the desired sensitivity level. The input to the mcu then triggers an interrupt as wakes mcu and modem to start logging every second to the SD card, and every 10 seconds to the MQTT server. When no movement is detected the modem is turned off and the mcu will automatically enter sleep. When sleeping, the mcu wakes up every hour to send battery and GPS to the MQTT server and return to sleep.
Since this project was a one of, it make no sense to change the pcb layout, however improvements could still be made.
- Add a dedicated debug output, instead of reusing the led output.
- Although the signal is of excellent quality it’s probably a good idea to redo the antenna traces. Check trace impedance and add guard traces with via stitching.
- Adding a dedicated reset switch. This is only for convenience but not actually necessary. In fact I never had to reset the mcu once. Currently the reset of the mcu is connected to the isp header and can easily be shorted low or connected to a wired switch if necessary.
- Add a interrupt directly to the 1PPS line of the GPS module.
- Add a input to the mcu connected to the status pin of the modem, this makes it easier to determine is the modem is on or off.
None of the above improvements are actually necessary for a working project. The firmware has been written such that none of these features are needed.
The firmware will be made available for download at a later moment, I’m still working of the final tweaks.
Features:
- SIMCom SIM808 GPRS/GSM + GPS
- Atmel ATMEGA328P-AU @ 1 mhz (Firmware written in Atmel Studio 7, but also Arduino ide compatible)
- USB Interface for charging
- Li-ion battery charger
- Micro SD card slot for data logging
- Piezo motion sensor (Used to triggers the GPS tracker)
- Support for active GPS antenna
- ISP Header (3,3v or 5v)
- UART Header connected to the data lines between mcu and modem (for debugging 3,3v Only)
Note: this project was built into the older version 02-2014 Rittal 9102.210 enclosure. The new version 03-2017 is slightly different.
Comment