Designing an ESP32-Based OBD-II Scanner with GPS & Multi-Sensor Support?
Hi everyone! I’m working on a DIY OBD-II scanner that uses an ESP32 to read vehicle data (like RPM, speed, coolant temp) via CAN bus, integrate GPS for geo-tagging, and capture additional sensor data such as tire pressure, vibration, and cabin temperature—for advanced diagnostics and logging. I recently came across a helpful ESP32 tutorial for setting up GPIO control and multitasking, great background for handling additional sensors: https://www.theengineeringprojects.com/2018/09/introduction-to-arduino-due.html.
I’ve seen projects combining ESP32 with CAN-to-OBD adapters, taken inspiration from examples on GitHub for interfacing with ELM327-style modules, and looked at GPS timestamp synchronization techniques on Reddit. My main question is: What’s the best way to synchronize multiple data streams, OBD, GPS, and custom sensors on the ESP32? Should I rely on FreeRTOS with hardware timers, or is there a more straightforward software-based approach that ensures accurate alignment and avoids data loss?
Comments
It depends from what you want to do with the data in the end?
Often data can be described using average value, standard deviation, min, max. You can for example build these values over 10 Minutes and log them every 10 minutes.
If you know, what you are looking for and have the rules, you can combine sensor data to calculate desired values.
For example I have got an esp32 running which collects temperature, humidity and sun intensity to calculate the need for watering for my tomatoes. Sampling rate is high but one result per day is sufficient.
Normally it is sufficient to synchronise the internal clock once a day or so.
Christof
Espressif systems IDF is the ticket. It integrates the RTOS seamless into your project giving you the ability to do many tasks without the loss of data.
They have many example projects that cover most things you want to do.
Mike