Overview

Overview of the functions implemented in the firmware.

WiFi

The system starts trying to connect to a local WiFi access point, if not vailable, it switches to a Hotspot, allowing WiFi clients connection.

GPRS/GPS/MQTT

  • The modem is started, connecting to the GPRS network via a sim card.
  • The GPS receiver is started.
  • The module connects an mqtt broker on internet.
  • The SD card interface is initialized.

Web Server/websocket client

A web server is started (connected via WiFi) it provides the following facilities:

  • Web Socket Client handling API messages (gps - valid - GPS - del: - AT )
  • Web pages, usual HTML pages may include javascript code used to interract with the module using websocket connection.
    • /upload OTA server page
    • / serves index.html from SD card
    • /files displays a page with the files in the root dir.
    • /upload upload a file to the SD
    • /file Web File Manager (List/upload/delete)
Example index.htmlFile Manager

GPS Data handling

Data read from the GPS module is received every 30 seconds (fixed at the moment but can be changed at the UART console).

When the first valid data is received from the GPS module, a new path file is created on the SD card under /paths/DD-MM-YYY/pathxxx.loc

When a new reading is available, it is checked for validity and stored in the current path file on the SD card.

The distance between the actual and last measure is calculated (Haversine).

If the ditance is greater then 5 meter and the speed is greater then 5 Km/hr then an mqtt message is sent to the broker on Internet.

Sampls data written in the path file

{"latitude":50.73275,"longitude":5.684257,"alt":112.1,"speed":0.816,"gps_accuracy":1,"course":0,"date":"020126","time":"102320.00","GPS":12,"Galileo":0,"BEIDU":0,"Glonass":7,"VDOP":2.01,"HDOP":1.62,"PDOP":2.58,"valid":true,"distance":"5666793.50"}
{"latitude":50.73272,"longitude":5.684271,"alt":109,"speed":0.548,"gps_accuracy":1,"course":0,"date":"020126","time":"102350.00","GPS":13,"Galileo":0,"BEIDU":0,"Glonass":7,"VDOP":2.01,"HDOP":1.62,"PDOP":2.59,"valid":true,"distance":"3.54"}
{"latitude":50.73272,"longitude":5.684273,"alt":108.5,"speed":0.835,"gps_accuracy":1,"course":0,"date":"020126","time":"102420.00","GPS":12,"Galileo":0,"BEIDU":0,"Glonass":8,"VDOP":1.99,"HDOP":1.77,"PDOP":2.66,"valid":true,"distance":"0.17"}
{"latitude":50.73273,"longitude":5.684263,"alt":107.4,"speed":1.012,"gps_accuracy":1,"course":0,"date":"020126","time":"102450.00","GPS":14,"Galileo":1,"BEIDU":0,"Glonass":8,"VDOP":1.99,"HDOP":1.77,"PDOP":2.67,"valid":true,"distance":"2.25"}
{"latitude":50.73272,"longitude":5.684257,"alt":105.9,"speed":0.609,"gps_accuracy":1,"course":0,"date":"020126","time":"102520.00","GPS":16,"Galileo":1,"BEIDU":0,"Glonass":8,"VDOP":2,"HDOP":1.77,"PDOP":2.67,"valid":true,"distance":"1.75"}