rightskins.blogg.se

Falling hearts imvironment
Falling hearts imvironment









falling hearts imvironment

FALLING HEARTS IMVIRONMENT CODE

The trained model was ported to the plain C code using micromlgen Python library. The training was done on the extracted feature using scikit-learn Python library. I used Edge Impulse Studio for feature extraction purpose only. It consists of 19 ADLs and 15 fall types performed by 23 young adults, 15 ADL types performed by 14 healthy and independent participants over 62 years old, and data from one participant of 60 years old that performed all ADLs and falls.

falling hearts imvironment

I used the SisFall: A Fall and Movement Dataset which is a dataset of falls and activities of daily living (ADLs) acquired with accelerometer. I gave it a try and it is tiny by design it could easily fit into the available flash. While exploring small size model, I came across a recent algorithm SEFR: A Fast Linear-Time Classifier for Ultra-Low Power Devices which uses only one weight for each feature. So the Random Forest model can not be stored in the flash. Another problem was the Random Forest model keeps all weights in the code and the available space in the flash memory is only 8 KB since AWS Node application uses almost 93% of the flash. Using this strategy we need only 1,536 bytes and that would fit in the available RAM. While doing feature extraction we divide the data points by 100 and convert back to the floating point.

falling hearts imvironment

One way to cope up with this problem is to keep the data in a 16-bit (2 bytes) signed integer instead of 4 bytes floating point and multiply it by 100 to keep the precision up to two decimal places. So the total is more than 3KB and it would not fit in the RAM. Also, to use the snapshot of the data to extract features we need another 1,536 bytes. If we downsample the 3 axis accelerometer floating point data to 64 samples per second, we need 4 x 3 x 64 x 2 = 1536 bytes to keep the 2 seconds data in a ring buffer. The machine learning model needs at least 2 seconds of 3-axis accelerometer data to reliably predict. So doing neural network based machine learning is not feasible for such a small memory device but we can do tree based for example Decision Tree or Random Forest classifiers.

falling hearts imvironment

But I always wanted it to do at the edge. Another option could be using the AWS lambda to do the heavy lifting of the Tensorflow Lite. I wanted to use TensorFlow Lite but the AVR-IOT board has only 6KB of RAM and more than 3KB is being used by the AWS IoT Node application. We cannot reliably detect only using the accelerometer raw readings. We can monitor the heart rate and set a threshold if it goes above or below the safe range it should make an alert.įall Detection machine learning model selection The code calculates the average BPM (Beats per minute) and sends to the cloud. This is a simple step and the MAX30105 sensor is connected to the AVR-IOT over I2C connection. The Qwiic adapter pins arrangements (GND, 5V, SDA, SCL) are exactly same (see below) as on the AVR-IOT boards so it was really easy to stick them together. A Sparkfun Qwiic adapter is used to connect the sensors. The heart rate and accelerometer sensors are connected over I2C. #include #include #include #include "millis.h" volatile static uint32_t timerMillis // CPU frequency in Hz #define F_CPU 3333333 // 20MHz/6 (CPU Clock prescalar=6) //#define PERIOD_VALUE 0xC // Overflow after 1 ms = 0.001s, (0.001 * F_CPU / 256) - 1, (TCA0 prescalar=256) #define PERIOD_VALUE 0xD3 // Initializes the use of the timer functions by setting up the TCA timer. All the included libraries and code are available in the GitHub repository.Īlso, to have Arduino's millis() equivalent function in AVR I have written my own function. I have ported the code for the above two sensors from the Arduino libraries to work with AVR-IoT. At this point we have a working application connected to the AWS IoT.įor the fall detection and heart rate monitoring we need two sensors:











Falling hearts imvironment