Main Content

MQTT OBD Vehicle Telemetry

Fancy to see your’s vehicle data online in real-time? If so, continue reading!

1) In a nutshell
So today we will connect our car to the internet. Literally. Using Arduino MKR1000 & ELM327 micro-controllers we will send various data from car’s engine control unit (RPM, Engine temperature, Velocity…..) to the IBM Watson Cloud using MQTT protocol. Also we will create responsive web-app interface using Node-RED (available on IBM Watson Cloud) and custom iOS application with SwiftUI & CocoaPod’s MQTT library.

2) Hardware needed
Core of the project is based on Arduino MKR1000. The advantage of this little device is embedded WiFi shield, that allows us create connection to the IBM Watson Cloud. Next part is ELM327 - micro-controller connected through UART to the Arduino. This little fellow allows us to read ECU’s data using PID codes send from Arduino. Since we are connecting vehicle to the internet, it is good manner to see it’s location. So for this reason we are also using NEO-6M GPS module.

3) IBM Watson Cloud
Watson Cloud is great solution for processing & visualizing collected data. It has various resources, but what You’ll basically need is to register on and create resource for IoT platform. This resource is used as MQTT broker and will generate URL for broker (server). Inside the platform we will create authentication credentials for two MQTT clients - Arduino & iOS application. Also we can change security of broker to TLS optional, since we are sending data in plain text on port 1883. Next thing is creating Node-RED resource. This will allow us to process data from MQTT clients (publishers/subscribers), but also create a web-interface. After successful creation of Node-RED resource we have to import custom palettes. For interconnection between Node-RED resource & IoT platform resource, import node-red-contrib-scx-ibmiotap. For creating web-app ui import nodered-dashboard. Last, but no least, to interconnect Node-RED with IoT platform, go back to your Node-RED resource in Watson Cloud, select Connections/CreateConnection and choose Connect to your resource of IoT platform.

It is important to mention that we are working with free version of IBM Watson Cloud. But since we are sending small ECU data (JSON format) using MQTT (min. overhead size is just 2 Bytes), Cloud’s capacity at 200 MB / monthly means enough space in the end.”

Link to article