A machine learning classifier that detects sleep paralysis.
Full report (PDF) here: https://github.com/xaviervilla/sleep-paralysis-interrupt/blob/master/CSE195_Final_Report.pdf
- Set up MATLAB 2019B
- Install Matlab Coder, DSP ToolBox, Classification Learner and other dependencies
- Use signal processing to find characteristics of accelerometer data for different activities
- Compute Mean, Standard Deviation, and Principle Component Analysis Coeeficients of accelerometer data
- Create a classifier that analyzes and labels accelerometer data based on the characteristics
- Read documentation for Matlab Coder and Classification Learner, figure out what is required for c code translation
- Convert classification learner into C
- Go back into Matlab and simulate a live stream of accelerometer data
- Get classifier to work with live stream of data (smaller bursts of samples 16, 64, 128 etc.)
- Get real-time classifier converted into C
- Compile in C for an Atmel 8 bit system
- Configure the generated C code as a library for Arduino IDE
- Get code to compile in the IDE with random sample data
- Get code to FIT on an Atmega328P... *sigh
- Remove Gyroscope from the classifier and data stream to save dynamic memory
- Remove PCA computations completely from the library to save program storage space
- Optimize classifier for new data stream without PCA and Gyroscope
- Recompile Matlab into C code after each of the above steps
- Finally load the code onto an Arduino
- Find a good library for MPU6050 accelerometer chip
- Format data in a way that allows the matlab functions to be called
- Get MPU library and custom library to both fit on an Atmega328P
- Solder up the mpu6050 and turn on an LED when walking is detected
- Turn Arduino light on when Sleep paralysis is detected
- Determine the cause of classifier only working when accelerometer is in specific orientation
- Fix code to allow for different orientations of the accelerometer
- Reduce size of code for more stability
- Record better accelerometer data for training and predicting
- Make it easier to make fundamental changes and recompile all of the code to the arduino
- Improve accuracy and reduce false alarms using some type of counter to measure confidence
- Get more capable embedded controller, perhaps arduino mega or RPi zero
- Enable low pass filtering in MPU6050 of 30 Hz and sample rate of 200hz
- Set up interrupts to communicate with sensor through SPI instead of I2C
- Recompile code with much better sample frequency for better predictions on better platform
- Design wearable for overnight testing
- Come up with way to record overnight data, or at least data without tethering to PC??
- Possibly reenable mean function if it improves accuracy
- Reinvestigate frequency domain characteristics and determine if necessary
- Disable gravity subtraction (world-frame view) for sensor data and re-train
- Investigate accuracy/memory tradeoff of KNN vs. Decision Tree models
- Impliment sliding window of samples to improve speed of response rather than descrete sample windows
- Record better quality SP data for training