This shows you the differences between two versions of the page.
iothings:proiecte:2022sric:crash-detection [2023/06/01 23:10] alexandru.careja [Introduction] |
iothings:proiecte:2022sric:crash-detection [2023/06/02 01:13] (current) alexandru.careja [Results] |
||
---|---|---|---|
Line 7: | Line 7: | ||
Previously working on another project that enhances the experience on riding a bike (at PM in 2021 when I designed | Previously working on another project that enhances the experience on riding a bike (at PM in 2021 when I designed | ||
[[https://ocw.cs.pub.ro/courses/pm/prj2021/apredescu/gps_tracker|a dashboard for my bike]]) I thought of what can I make with what I've learnt during the IoT course to make my bike rides better. Since moving to Bucharest for uni I've left my bike at home because I'm afraid of riding a bicycle in Bucharest's traffic. This has determined me to create a crash detection system for my bike. I already had the Neo-6M GPS module and the bike attachment "system" I designed 2 years ago, I just had to remove the old Arduino and the display. | [[https://ocw.cs.pub.ro/courses/pm/prj2021/apredescu/gps_tracker|a dashboard for my bike]]) I thought of what can I make with what I've learnt during the IoT course to make my bike rides better. Since moving to Bucharest for uni I've left my bike at home because I'm afraid of riding a bicycle in Bucharest's traffic. This has determined me to create a crash detection system for my bike. I already had the Neo-6M GPS module and the bike attachment "system" I designed 2 years ago, I just had to remove the old Arduino and the display. | ||
- | {{:iothings:proiecte:2022sric:proiect_final_montat_2.jpeg?direct&300 |}}{{ :iothings:proiecte:2022sric:proiect_final_montat_closeup.jpeg?direct&300|}} | + | |
+ | {{:iothings:proiecte:2022sric:proiect_final_montat_2.jpeg?direct&300|}}{{ :iothings:proiecte:2022sric:proiect_final_montat_closeup.jpeg?direct&351|}} | ||
===== Hardware ===== | ===== Hardware ===== | ||
Objects used: | Objects used: | ||
Line 35: | Line 37: | ||
<code> | <code> | ||
- | x_adc_value = analogRead(ACCEL_X_Pin); /* Digital value of voltage on x_out pin */ | + | x_adc_value = analogRead(ACCEL_X_Pin); // Digital value of voltage on x_out pin |
- | y_adc_value = analogRead(ACCEL_Y_Pin); /* Digital value of voltage on y_out pin */ | + | y_adc_value = analogRead(ACCEL_Y_Pin); // Digital value of voltage on y_out pin |
- | x_g_value = ((((double) x_adc_value /1023) - 1.8 ) / 0.3); /* Acceleration in x-direction in g units */ | + | x_g_value = ((((double) x_adc_value /1023) - 1.8 ) / 0.3); // Acceleration in x-direction in g units |
- | y_g_value = ((((double) y_adc_value /1023) - 1.8 ) / 0.3); /* Acceleration in y-direction in g units */ | + | y_g_value = ((((double) y_adc_value /1023) - 1.8 ) / 0.3); // Acceleration in y-direction in g units |
</code> | </code> | ||
For every accel read, the acceleration values are checked, and if any of them is higher than a set threshold, then an alarm is triggered. The set threshold was chosen to be higher than the maximum deceleration a bicycle is physically capable of doing when using its brakes. That maximum is 0.71 according to [[https://www.nathanarose.com/blog/bicycle-accident-reconstruction-bicyclist-braking-capabilities-and-limits#:~:text=Across%20all%20bicycle%20types%2C%20the,of%200.25%20to%200.37%20g.|this source]]. So, the threshold I chose is 0.8g. | For every accel read, the acceleration values are checked, and if any of them is higher than a set threshold, then an alarm is triggered. The set threshold was chosen to be higher than the maximum deceleration a bicycle is physically capable of doing when using its brakes. That maximum is 0.71 according to [[https://www.nathanarose.com/blog/bicycle-accident-reconstruction-bicyclist-braking-capabilities-and-limits#:~:text=Across%20all%20bicycle%20types%2C%20the,of%200.25%20to%200.37%20g.|this source]]. So, the threshold I chose is 0.8g. | ||
- | Every approximately 50 seconds, the program tries to record the location to have it stored for future use if needed. | + | Every approximately 10 seconds, the program tries to record the location to have it stored for future use if needed. |
When an alarm is triggered, the program tries to read the location from the GPS module 5 times with 100ms in between tries. In case the GPS isn't available, it will use the last known location which is recorded every 50 seconds. It creates an alert message which includes a Google Maps location of where the crash happened or the last known location before the crash and sends it to the phone via Bluetooth using the BluetoothSerial library. | When an alarm is triggered, the program tries to read the location from the GPS module 5 times with 100ms in between tries. In case the GPS isn't available, it will use the last known location which is recorded every 50 seconds. It creates an alert message which includes a Google Maps location of where the crash happened or the last known location before the crash and sends it to the phone via Bluetooth using the BluetoothSerial library. | ||
Line 73: | Line 75: | ||
===== Results ===== | ===== Results ===== | ||
+ | {{:iothings:proiecte:2022sric:bike-crash-detection.jpeg?direct&460|}}{{:iothings:proiecte:2022sric:crash-serial-bluetooth-result.jpeg?direct&275|}} | ||
+ | |||
+ | Since I didn't have my bicycle in Bucharest, the only way to test this was to move the wooden mount with the system attached with my hand violently so that its acceleration surpasses the threshold acceleration. And it did work! I got the notification in the Serial Bluetooth Terminal app on my phone. | ||
+ | |||
+ | Looking at future improvements of this project, I would like to have the Bluetooth notification be able to trigger the Emergency SOS feature from Android. | ||
===== References ===== | ===== References ===== | ||
Line 80: | Line 87: | ||
* https://forum.arduino.cc/t/adxl335-converting-to-gs/110499 | * https://forum.arduino.cc/t/adxl335-converting-to-gs/110499 | ||
* https://randomnerdtutorials.com/esp32-bluetooth-classic-arduino-ide/ | * https://randomnerdtutorials.com/esp32-bluetooth-classic-arduino-ide/ | ||
+ | * https://www.nathanarose.com/blog/bicycle-accident-reconstruction-bicyclist-braking-capabilities-and-limits |