Two-wheelers have claimed 69, 240 lives, contributing to 44.5% of road accident deaths. This report is with respect to only one country, India. The world's count would be much more. Unfortunately, about 30% of deaths are caused due to delayed ambulance service. With a paradigm shift in electronics baked into every, can we resolve this issue with a smart solution?
We propose a proof of concept smart helmet that detects fatal crashes and generates SOS to concerned authorities autonomously. The Unique Selling Proposition of this project is the helmet works autonomously without being connected to any smartphone. This is possible because of emerging low-power cellular networks such as LTE-M, suitable for urban area wireless connectivity with lower data rates. Pioneering this technology is blues wireless, who is offering full stack support ranging from hardware to software for incorporating cellular networks into everyday devices and perhaps making them smart as well.
The data is collected wirelessly using Blues Wireless Notecard to train our model over the cellular network on the Edge Impulse Cloud Platform using Data Ingestion Services via Notehub routes. This makes collecting real-time data far more straightforward for a field device like the helmet.
System DesignThe system includes an ADXL355 accelerometer to collect motion data from the helmet. The swan microcontroller from the blues team is used as the choice of MCU for being small and low power. The accelerometer is interfaced with MCU using SPI. The I2C bus is used for communicating with the anchor of the project blues wireless notecard. Initially, we wanted to collect data onto the SD card and upload it later for training. However, that would defy the purpose as frequent model updates might be required even after deployment as the road condition might vary depending on region to region. So we set up a pipeline to collect data from the sensor and send it over the air to the edge impulse server for training. More details on this are covered in a separate section below. The model is trained to detect three classes idle (helmet stationary), riding (when the driver is riding), and crash (occurrence of crash). Once the data acquisition is over, the model is trained and deployed back on the system. In case of a crash, SOS is generated through Twilio to the concerned authority.
Hardware Build:The anchor of the project is the Blues Notecard which is used for a device-to-cloud data pump that reduces the complexity of building connected solutions with a secure and reliable connection. The building block of the project are mentioned below:
AXL355: This is a low-power 3-Axis MEMS Accelerometer with inbuilt activity threshold detection. This would help us capture the different vibration patterns of helmets under different conditions. The size and precision of the accelerometer also make it a good candidate for such a project.
Blues Wireless Starter KitIt has LTE Cat-1 Notecard – EMEA is designed to be used in the EMEA (Europe, Middle East, Africa) regions and uses Quectel EG91-EX modem, which connects to LTE Cat-1 / WCDMA / GSM networks.
To facilitate the cellular network in India, we used an external Airtel Sim, which seemed to work well. The Kit comes with a feather-compatible carrier board, the Notecarrier F, designed for quick prototyping. It comes with Blues Swan MCU. A low-cost, embeddable STM32L4-based microcontroller designed to accelerate the development and deployment of battery-powered IoT solutions.
Interfacing Sensor and NotecardThe project is developed using Arduino Library. note-Arduino is the official Arduino library for communicating with the Notecard over serial or I2C. The library can be installed from the Arduino Library Manager.
For the prototype, Swan MCU collects accelerometer data from ADXL355z over SPI and sends it to Notecard with JSON APIs over I2C Bus. A slim 1000 mAh Lion Battery supplies power to the whole system. Below refer to the image below for more details on the jumper connection.
Routing The Data from Notehub to Edge Impulse Cloud:One powerful feature of Notehub is Routes, which allows you to forward your data from Notehub to a public cloud like AWS, Azure, or Google Cloud, a messaging platform like MQTT, a data cloud like Snowflake, or a custom HTTP endpoint. A Route is an external API or server location where Notes can be forwarded upon receipt. For more on creating routes, refer to the link: Route Tutorial - ThingSpeak - Blues Wireless Developers.
For the smart helmet project, I've created a route named EIBluesTest.
Route Configuration:Edge Impulse Ingestion service is used to send recently acquired data to Edge Impulse. It's available on HTTP/HTTPS endpoints and requires an API key to authenticate. Here is the link to the ingestion API: https://ingestion.edgeimpulse.com
And three endpoints are available for training, testing, and anomaly dataset, respectively.
- POST /api/training/files
- POST /api/testing/files
- POST /api/anomaly/files
However, we faced an internal server error while making these POST requests. You can learn more about the issues on this thread of the Edge Impulse forum: Error:500 {"success":false, "error":"No data found (in data form field)"} - Help - Edge Impulse
Basically, for CBOR/JSON file types, the endpoint should be POST /api/training/data because POST /api/training/files expect multipart form data (with a files[]
object).
URL: https://ingestion.edgeimpulse.com/API/TRAINING/DATA
Additional Headers:They include an API key to uniquely identify your Edge Impulse Project, a header to enable the addition of date and time to the file log, and the file name.
Data Aquisition Format:Before routing, it is crucial to convert the raw JSON into a specific data acquisition format compatible with the Edge Impulse platform. This is a small specification that describes the type of data, the sensor data itself, and information about the device that generated the data. More about Data Acquisition Format: Data acquisition format - Edge Impulse API
Notehub Route allows us to modify the JSON before routing it to HTTP Endpoints. It is done with the help of JSONata Script.
The “values” field has the raw data in the form of a 2D Array of various accelerometer readings in respective x, y, and z-axis. It is enclosed in structure - body.
The JSON file was verified using Webhook.site, which allows us to preview the data transferred to the endpoint. You can use it by changing the POST request URL to https://webhook.site/00971415-2c0a-4747-8bd4-9d7f69b47abb in Route Configurations.
Please take a look at the demonstration below of collecting training datasets wirelessly over the cellular network to Edge Impulse Cloud Platform with Blues Notecard.
All the collected is routed wirelessly over the cellular network to my Notehub project - smart_helmet. The logs can be seen in the Events tab, as shown below.
To train the dataset, we created our first smart helmet prototype. We made space by removing the cushion and thermocouple at the helmet's base to fit our prototype PCB.
Then, the PCB inside the Helmet was fixated with the help of a glue gun.
Idle data - I left it stable on the table, hanging it to the two-wheeler and cupboard-like places to record Idle data. This is to ensure that when the helmet is not in use, we can put the device in a deep sleep and save some battery. This class was also necessary because while testing, sometimes weird placements of the Helmet (like upside-down) were also classified as crashes.
Riding Data - It's time for a road test! I wore the helmet and ride my two-wheeler around Bangalore to collect actual riding data with turns, bumps, humps, potholes, traffic, frequent braking, etc.
Crash Data - This was a bit difficult, I can't put my life at stake by becoming a stuntman! So, I recreated a crash by acting like getting hit and thrashing my bed. I ensured it felt like sudden braking, the vehicle skidding, or the rider rolling.
Edge Impulse ModelOur whole concept is now dependent upon the performance of the model. Edge Impulse makes all this a hassle-free process. After collecting data, we create our model pipeline in the impulse design tab. We wanted to keep the design simple without being compute-intensive, so we selected flattening the data set as the preprocessing stage. Another reason is that flattening the data works quite well with slow-moving averages, and we only had three classes for inference.
The model generated gives us good accuracy and seems to be a bit overfitting, however, the model does perform well in new data, which is demonstrated in the below sections.
You can access the whole project through this public clone:https://studio.edgeimpulse.com/public/171803/latest
Below is a snapshot of the Twilio configuration for generating an SOS from the note card hub.
We can also send GPS coordinates to specify the accident location. But the device has to be outdoors (which is obvious for a real scenario).
Future Scope1. Power profiling for low-power optimization.
2. Autonomouly deploy the trained model back to the device using https://blues.io/blog/notecard-outboard-firmware-update/
3. Make a better chassis with explosive contents like battery outside
4. Solar panel to charge the device
Comments