This shows you the differences between two versions of the page.
iothings:proiecte:2022sric:crash-detection [2023/06/01 23:12] alexandru.careja [Introduction] |
iothings:proiecte:2022sric:crash-detection [2023/06/02 01:13] (current) alexandru.careja [Results] |
||
---|---|---|---|
Line 37: | 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 75: | 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 82: | 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 |