All work

AWS IoT Telematics & Vehicle Diagnostics

Vehicle telemetry and OTA updates on AWS

Year
2024
Kind
Vision & edge
Status
Finished
Built at
Krishworks Technology & Research Labs

A Raspberry Pi unit that reads a vehicle's OBD-II data and GPS position and sends it over 4G and MQTT to AWS IoT Core, with device onboarding and secure over-the-air firmware updates.

In the vehicle, a Raspberry Pi reads the OBD-II port over the CAN bus for live telemetry and diagnostic codes, and adds GPS position. It publishes readings over 4G to AWS IoT Core using MQTT. On the AWS side, IoT Core, Lambda, RDS (PostgreSQL) and S3 handle device onboarding, data and cryptographic over-the-air firmware updates. Alerts for anomaly conditions go out in under a second.

The problem

A vehicle reports a lot about itself through its OBD-II port: live readings and diagnostic trouble codes. This project put a Raspberry Pi unit in the vehicle to read that data, add GPS position and send it to AWS over 4G in real time. The same system onboards new units and updates their firmware over the air, so a fleet of units can be managed remotely.

How it works

  1. 01

    Onboard the unit

    Before a unit sends anything, it is onboarded to AWS IoT Core. In IoT Core's standard model, each device gets its own certificate and presents it every time it connects, so the cloud knows which unit is talking.

  2. 02

    Read the vehicle

    In the vehicle, the Raspberry Pi talks to the OBD-II port over the CAN bus, the network the car's own control units share. OBD-II exposes live readings such as speed and engine rpm, plus diagnostic trouble codes. A GPS module adds where the vehicle is.

  3. 03

    Publish over MQTT

    The unit sends its readings over 4G to AWS IoT Core using MQTT, a light publish/subscribe protocol made for small devices on unreliable links. Each reading is a short message on a topic, and anything in the cloud subscribed to that topic receives it.

  4. 04

    Store and alert in the cloud

    IoT Core receives every message. Behind it sit Lambda functions, code that runs on demand, and a PostgreSQL database on Amazon RDS. When a reading meets an anomaly condition, an alert goes out in under a second.

  5. 05

    Update firmware over the air

    New firmware reaches every unit over the network instead of by hand. In AWS's usual setup the firmware image is stored in S3 and units fetch it from there. The distribution is cryptographic: the image is signed, and a unit installs it only after the signature checks out.

Results

Sub-second
alert dispatch for anomaly conditions

Decisions

  • MQTT for telemetry

    MQTT keeps messages small and holds one connection open, which suits a device on a cellular link that may drop. AWS IoT Core speaks it natively.

  • Signed firmware updates

    A unit that installs any firmware it is sent can be taken over by anyone who reaches it. Making the OTA pipeline cryptographic means units run only firmware that came from the operator.