Using Embedded Systems to Find the Recipe for a Perfect Day

Premise

Using the Internet of Things (IoT) to find what makes a good day for an individual and provide recommendations on how to improve based on data.

Synopsis

A lot of factors influence the mental well-being, additionally which factors are relevant is highly specific to the individual. This work tries to track some of the factors and tries to correlate them to the subjective mood in order to identify which factors are important for the specific individual and thus find a personalised recipe for the perfect day. To minimise the impact of the tracking IoT devices were chosen and designed.

The final product is a combination of a self designed IoT device with five buttons to track the subjective mood in a day, an of the shelf fitness tracker and publicly available weather data.

The project combines techniques from embedded system design, laser cutting, soldering, data scraping and data analysis.

The finished product, a FitBit laying on a laser-cut wood box, containing electronics.
The final prototype: A FitBit and the IoT box

Substantiation

The quantified self movement has been gaining popularity in recent years. They aim to track and improve their health by collecting data about their daily activities (Bunz & Meikle, 2017). This was also made possible by the lower prices and higher availability of sensors and connected microcontrollers such as the Raspberry Pi Pico W.

Exercise has been shown to positively impact symptoms of disorders such as depressions (Mikkelsen et. al., 2017). As such it is interesting to track physical activity and correlate it with mood. Fitness trackers are already an available method of tracking this.

Next to active parts of the day the passive parts and in particular sleep play an important role in mental well-being (Berger & Riemann, 1993). The amount of REM and deep sleep is important for the brain and body to recover and to be able to function properly. While sleep itself can not be influenced directly having a good sleep environment can help, e.g. a temperature between 17°C and 28°C, no intermittent noises and eliminating lights. (Caddick et. al., 2018)

Outside of the factors that can be influenced by an individual there are also external factors like seasons and weather that have a strong impact on mental health (Melrose, 2015). In order to decorrelate the mood from these factors weather data needs to be collected and accounted for.

From this we can identify that physical activity, sleep quality and weather data would be interesting factors to track. As well as these factors the subjective measure of mood is needed to identify which of the factors influence a specific person.

Iteration 1

The first iteration was focused on gathering data. A participant filled in a logbook everyday for indicating with an emoji whether they had a good day or a bad day. Additionally, a FitBit device was configured to collect data such as steps, sleep quality, minutes of workout and heart rate. All collected data was combined to explore how different variables influence the users’ well-being. Additionally a diary with qualitative data was filled in to identify further factors that would be interesting to quantify and track.

The FitBit device was chosen as it provides an already well integrated IoT device. It integrates an accelerometer, ECG sensors, blood oxygen sensors and a pulse sensor. The vendor also provides a data export to get the raw data from the device. The device was chosen over a self build IoT device as it would allow to immediately start collecting data. Also it is way more durable then any device that could have been built during the project time.

Import of the FitBit data using the self written FitBit class to handle the details

Based on the first testing experience it could be concluded that a paper notebook as a data collection point became an inconvenient solution as time progressed. Participants described feeling annoyed with the logbook and his motivation to input the emojis started to decrease overtime.

Iteration 2

For the second iteration a focus group was employed to gather feedback on the design of an IoT device to track daily mood. participants were selected based on relevant experiences and perspectives, consisting of 5 adults aged 20-33 currently living in the Netherlands. Discussions focused on IoT device features, potential benefits, and integration into users’ routines. According to the participants the main concern was that the device should easily integrate into daily life without offering unnecessary distractions, also the interface should be as simple as possible.

From this feedback a sketch for a box featuring 5 buttons was created. These are used to rate the day on a scale from 1 (bad) to 5 (very good). The box can be placed on a nightstand to easily input a rating at the end of the day.

In order to implement the IoT device experiments with a Raspberry Pi Pico W were started. In particular the tools needed to program the device with MicroPython, making a WiFi connection, interfacing with a display and sending data over HTTP were explored.

Iteration 2 also included gathering of weather data from the KNMI. They provide daily measurements for a lot of different weather stations. Among other data wind, temperature, rain and sunshine were exported and added to the fitness and mood data.

Mean temperature over the prototyping period

Iteration 3

The third iteration turned the sketches from the last iteration into a physical prototype. The box is constructed from laser cut plywood. The design was created using MakerCase and Inkscape. To cut the wood a new laser cutter profile was needed. The first try burned to much of the wood so a faster setting was needed that would induce less heat into the material.

View into the laser cutter while cutting the wood box.

Next to the wood box an IKEA lunch box was tested as a base for the box. The laser cutter settings had to be adapted for this one as well. The material is polypropylene with 2 mm thickness which was not yet used in the makerspace. The lunch box provided a nice housing but was deemed too big for the night stand. So the wood box was chosen as the final housing.

First try on the laser cutter. The laser was set to a too slow speed causing the edges of the wood to burn.

To collect the button data, a Raspberry Pi Pico W programmed with MicroPython was used. It saves every button press along with the current time and date. That data can then be collected as JSON via HTTP. This setup required soldering wires to connect it to the pico, setting up connections on a breadboard and fixing all components to the box.

User testing consisted of 5 participants aged 20-33 currently living in the Netherlands. This testing allowed for testing the usability and convenience of the device. The outcome was missing feedback for button presses. This was solved by adding a buzzer that beeps when a press is detected. Another issue was the power supply via a cable that was annoying on the nightstand. This was solved by adding a LiIon battery and charge controller so that the device can work without a cable. Charging needs to be done only occasionally via USB.

Iteration 3 also included combining the data collected by the FitBit, Weather and Mood diary. A Jupyter Notebook and Python were used to combine the different data formats into a single CSV file containing all the data. Correlations between the different variables were explored but did not show strong correlations yet. This is in part because a range of three weeks or 21 days is just not enough data to identify strong correlations for a highly volatile variable like mood.

Conclusion

In conclusion, data collection methods can be integrated into the daily live pretty easily. The fitness tracker does not need any interactions and the IoT box can neatly be placed on a nightstand so that it does not require a lot of work.

During the course I was able to explore laser-cutting, basic 3D box design, MicroPython, LiIon batteries and protection circuits, dutch weather terminology, FitBit data exports and fitness tracker technology in general.

Unfortunately in order to build a recommendation system more data is needed. Especially data over a longer time frame needs to be collected. Also data from more than one participant would be needed. However with the IoT product from this work that should become easier. The mood is influenced by a lot more than the factors that were tracked. So to identify strong correlations more data is needed.

References

BERGER, M., & RIEMANN, D. (1993). REM sleep in depression—an overview. Journal of sleep research, 2(4), 211-223.

Bunz, M., & Meikle, G. (2017). The internet of things. Oxford, England: Polity Press.

Caddick, Z. A., Gregory, K., Arsintescu, L., & Flynn-Evans, E. E. (2018). A review of the environmental parameters necessary for an optimal sleep environment. Building and environment, 132, 11-20.

Melrose S. (2015). Seasonal Affective Disorder: An Overview of Assessment and Treatment Approaches. Depression research and treatment, 2015, 178564. https://doi.org/10.1155/2015/178564

Mikkelsen, K., Stojanovska, L., Polenakovic, M., Bosevski, M., & Apostolopoulos, V. (2017). Exercise and mental health. Maturitas, 106, 48-56.

Leave a Reply

Your email address will not be published. Required fields are marked *