***All open source credits are viewed as links in the text below***
What problem are we trying to solve?
In the less urban areas of the world, a common form of hobby is riding a vehicle such as bikes, quads, or ATVs. However, they commonly cause accidents. The National Security Council reported that in 2019, 308,864 non-fatal injuries were reported. That includes the 377 non-motor vehicle related deaths. Many of these injuries/deaths can be easily avoided if known prior to riding or if there was an easy way to contact emergency services. Many crashes cause people to be incapacitated and unable to contact people that they need to.
How is this different from current solutions?
To solve this problem, we will build a device to detect vehicular crashes (for example if a bike flips over), and attempt to talk to the user. If the user does not respond, then an emergency contact is sent a text message By doing this, we can minimize the risk of unconscious people, greatly injured people, or any other person not getting the help that they need.
This solution is different from others for mostly one reason: it is independent from cell phones. Current commercial devices such as BikerSOS, ICEdot, or ANGi Crash Sensor all require you to use some sort of other device to connect with it. Additionally, some of them can be very expensive; the ICEdot costs $149. Our device is estimated to cost less than this one and it operates simply from the device itself.
How it was built
We used Arduino as our software to program the Spresense. To detect if a user fell over, we used an accelerometer + gyroscope called the MPU6050. Using Adafruit's library, we programmed it so that x coordinates only change when the angle is changed. So for example, if the bike leans too far in too quick of a time, the x coordinate will read at 8 or above:
if(x >= 8 || x <= -8){
Serial.println("Fall detected!");
go = true;
}
Next, it's important to let the user know that a fall has been detected. We used Spresense's audio to play audio from a speaker we made. This speaker was ripped out of a pair of broken headphones and soldered onto an aux cord to fit easily into the Spresense extension board. In the following code snippet, you will see that "ask_help.mp3" is played, which tells the user to press a button to cancel the text message send, otherwise it will give it 20 seconds to press it. It's important to use a while loop here, since the audio frames have to be sent in a loop.
while (go) {
int err = theAudio->writeFrames(AudioClass::Player0, myFile);
if (err == AUDIOLIB_ECODE_FILEEND) {
Serial.println("File ended!\n");
myFile.close();
myFile = theSD.open("ask_help.mp3"); //asks user if theyre okay
After that, we wait 20 seconds, and if the button is not pressed we send a text message:
long int t1 = millis();
while (digitalRead(A4) == HIGH) {
long int t2 = millis();
long int t3 = t1-t2;
if (t3 >= 20000) {
//sms send
sms.beginSMS("2035559081"); //numbers must be preloaded
sms.print("John fell off their bike and has not prevented this message from being send!"); //message must be preloaded
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}
}
That's basically all!
Hardware connections
-----------------------------------------------------------------------------------------------------------------------
Mpu6050
GND --> GND
3.3V --> 3.3V
SCL --> D15
SDA --> D14
-----------------------------------------------------------------------------------------------------------------------
Button --> A4
Speaker --> Aux port
-----------------------------------------------------------------------------------------------------------------------
Problems we ran into
Due to some unforeseen circumstances, the two of us had to work together. That means that we did not have the chance to test the project all together on an actual bicycle. That also means that the SMS text messaging was not teste, nor were we able to 3D print the design. Additionally, we wanted to try to use a voice recognition board for the Arduino, but it did not work for the Spresense.
Additional change log is attached to show more problems we ran into.
Images
Comments