This Arduino sketch is designed for running on Freematics ONE+ and the ESP32 Arduino Telematics Kit, to collect vehicle telemetry data from OBD-II, GPS and motion sensor, store the collected data in Flash or microSD card and provide access for data through WiFi and BLE.
The sketch collects follow data.
- Vehicle OBD-II PIDs data (from OBD port)
- Battery voltage (from OBD port)
- Geolocation data (from connected GNSS receiver)
- Acceleration data (from built-in motion sensor)
- Orientation data (computed from motion sensor data fusion)
When GNSS receiver is connected and detected, geolocation data will be obtained and logged. GPS UTC time is used to sync the device's real-time clock.
The device orientation (yaw, pitch roll) can be calculated from collected motion sensor data with quanterion algorithm. This normally reflects the orientation of the vehicle if the device is fixed to vehicle (e.g. firmly plugged in OBD port) This feature consumes extra computation power and is disabled by default.
By default, ESP32's internal flash is used for data storage (file-based, using SPIFFS). Simple rotation logging is implemented due to limited storage size. MicroSD data logging is also supported.
A multiple-connection HTTP server HTTP server runs over ESP32's WiFi (AP and/or station). A set of REST API provides remote access to device status, statistics and real-time data and logged data.
Implemented HTTP APIs:
- /api/info - device info
- /api/live - live data (OBD/GPS/MEMS)
- /api/list - list of log files
- /api/log/[file #] - content of CSV format log file
- /api/data/[file #]?pid=[PID # in HEX] - JSON array of PID data
NMEA TCP Server
A TCP server (default port 4000) is brought up and the NMEA data stream from GNSS receiver is redirected to a incoming TCP connection. This can be used to visualize GNSS signal with software like u-blox u-center over WiFi.