Create your own fall detection sensor using an Arduino! (README will be updated)
This code runs on an Arduino Nano 33 BLE Sense and uses the inbuilt 9 axis inertial sensor to detect falls using a custom trained machine learning model.
Clone this repository onto your local computer.
Follow these steps to collect your own data to train your model.
-
Upload
scripts/CollectData/CollectData.ino
to your Arduino. -
Create a folder in the project workspace e.g:
arduino
. -
Add a subfolder in the
arduino
directory with the name of the person whose data you are collection. Feel free to name it something likePerson1
if you want the data to remain anonymous. -
Run
scripts/collect_data.py
from the terminal usingpy ./scripts/collect_data.py
-
Connect to your Arduino over Bluetooth Low Energy (BLE) by selecting the Arduino from the list.
-
Once connected, the Arduino's light will turn green and you will be prompted for a command to send to the Arduino. Here is a list of available commands:
STOP, WALKING, SITTING, LYING_DOWN, and FALL
. The Arduino's LED will change to blue if a valid command has been received. If something went wrong, the LED will light up red. To start recording an action, send the command e.g:WALKING
. To stop recording an action, sendSTOP
. If you want to change the types of actions that can be recorded, editpossibleLabels
inCollectData.ino
to include your action. Important: remember to updatePOSSIBLE_LABELS_LENGTH
with the length ofpossibleLabels
.The Arduino will then start recording the action whose data will then be stored in the person's directory in
arduino
. The data, stored in the form of a CSV, will contain the following information:x_acc
,y_acc
,z_acc
,label_name
Use this guide to understand the Arduino's signals through its LED:
RED (Long)
: Waiting for connectionRed (Blink)
: Unknown commandBLUE
: Valid commandGREEN
: Connected over BLEYELLOW
: Sending data over BLE
Upload the contents of scripts/FallDetection
to the Arduino. The script currently needs to be plugged into the computer to work. README and script will be updated to support fall detection remotely.