We've all ran into the problem of arriving at a public library or shared learning space, ready to learn and work, only to realise there are no available space. With our project we aim to solve that issue by introducing an app that tracks seat occupation and with that giving you advanced notice of available space.
DescriptionOur project consists of two main parts, the Chair and an Android app.
The Chair has an Arduino Nano 33 BLE firmly attached to it and it tracks the chair's occupancy with an AI enchanced program, which has learned and was tested on our sitting habits.
Bluetoothand Arduino
For the project we used an Arduino 33 BLE, because it has a bluetooth module included as well as an accelerometer, both of which made writing the program easier, as there were fewer external variables and potential problems.
We initialised the Arduino's Bluetooth connection using a predefined ArduinoBLE library and then we used some parts of an example Bluetooth program to help us get started.
We had to register a new BLE service, through which the data will be sent and received in a string form of either a "1" or a "0" which indicate whether the chair is occupied or not.
After setting the local name, we tested the BLE connection by only sending our battery status and seeing if Arduino connects to the mobile phone. Fortunately it did, so we moved to the next part of the project, which was the machine learning algorithm.
To start off, we downloaded the.zip library from the Edge Impulse website and opened an example program called nano_33ble_sense_accelerometer_continuous. The program continuously tracked the chair's occupancy and transmitted the status through serial connection every second. We tested the program's accuracy in real world application and were happy with the result as it always detected the correct condition.
After the separate tests we tried combining both programs, which took a long time, because we didn't really
MITapp inventor
To receieve and display the data we use an android app, which is developed in MIT app inventor. It is a useful tool to quickly prototype and develop pretty complex apps.
The app has 3 main screens and functionalities.
On the main home screen you get connected to the BT module of the arduino and can display the data for the occupancy of the chair. On the top you can choose the library you would like to check the occupancy (for now you only choose the library and nothing really happens, as we have not implemented a global database or server, where you can save the data to)To access the other two screens you have two buttons on the main page.
The first button leads us to the page with a list and map of the nearby libraries. Unfortunately for now there are only three libriraries, but with future iterations it will be possible to add them manually inside of an app.
The third page is a timer, which can show us how much time we spent studying. By clicking the start button you can start the timer, you can also pause it, or reset it. With clicking reset you also save the time of study into the TinyDB, which then calculates the whole time spent studying and displays it on the bottom of the page.
Each page has its own scratch code, but just to get an idea, here is a part of the code for the main screen, but in the end you can also find the file of the mit app inventor, where you can further explore the details of the code.
To provide occupancy detection, we have implemented on-edge Machine Learning analysis of the specific vibration pattern produced when a user sits down or stands up. This was done using the Edge Impulse library. To provide a good dataset for training the neural network, we have recorded around five minutes of labeled recordings as well as test/validation data.
Before neural analysis, data is split into two-second chunks and parametrized using spectral analysis. This produces a vector of 207 features which are then passed into the input layer with 207 neurons. Three hidden layers with 96, 56 and 30 neurons are used and finally an output layer with 3 neurons representing three classification labels: Sit down, Stand up and Idle. On our labeled test data, an accuracy of 93 percent is reached.
Classification model is then exported as an Arduino library and integrated with our device firmware which analyses labels generated by the neural network and determines the occupancy state: Free or Occupied. To provide a direct visual feedback, an RGB LED is controlled to reflect the occupancy - green for Free and red for Occupied.
Possibleimprovements
Comments
Please log in or sign up to comment.