/AccidentDetection-Pico-EdgeImpulse

Car state detection (normal, accident, idle) for RP2040/Pico board, using TinyML and Edge Impulse

Primary LanguageCMIT LicenseMIT

CarAccidentDetection-EdgeImpulse-Pico

Car state detection (idle, normal, accident), powered by TinyML and Edge Impulse. It's developed for Raspberry Pi RP2040/Pico board.

This demo projects were used during online webinar entitled "Pi Day: The Taste of Raspberry Pi Pico" to celebrate Pi Day, March 14, 2021. Webinar recording is on this Youtube link, which you should watch it as I explained about this project. Sorry, in Bahasa Indonesia.

Youtube thumnail

Edge Impulse

Public project: https://studio.edgeimpulse.com/public/21576/latest

The Edge Impulse project consists of dataset and Impulse design. Dataset contains acceleration data from IMU sensor with 3 labels: idle, run, incident, and are collected using a setup explained below. Dataset may only be working for that specific setup. But you should get the idea.

Data Acquisition Setup

Acceleration data are retrieved from MPU6050 sensor, mounted in such as way as this photo. Car setup

Obviously, to simplify data acquisition, I use a toy car. Yes, I'm a big fan of BMW cars and own one, and have some BMW car models in my collection.

As photo, I use two Pico boards, one is the target board, another as PicoBoard for flashing firmware, logging serial output, and debugging. You can use just 1 Pico board, though.

Projects

There are two VSCode projects in this repository.

It's the firmware to acquire acceleration data, using the setup above. It essentially outputs the acceleration data (in axis X, Y, and Z) to serial port, formatted as tab-delimited data, as understood by Edge Impulse data forwarder. Edge Impulse data forwarder will then forward that data to Edge Impulse Studio.

The firmware that actually does the inference/recognition of car state based on accelerometer data. This project already integrates C++ library and model data exported from Edge Impulse Studio.

Again, please watch Webinar recording video above which I demoed how to use those 2 projects, and work with Edge Impulse Studio. If you're impatient, jump to this timemark when I start to discuss and work with Edge Impulse and the projects.

Credits

MPU6050 library is adapted from this repo. I change the code for I2C communication that's specific for RP2040.

This project is heavily inspired and adopt some code from these: