Biohacking Anxiety

We built a wearable to ease anxiety, using sensors to detect symptoms and a mix of features to alleviate them. Here’s how we did it

By Robert Greene, Senior Software Engineer at BCG Digital Ventures

As a front-end focused software engineer at BCG Digital Ventures, I thought it would be really interesting to dive into the opposite side of the spectrum and learn about hardware. My colleague DJ Carter is a Senior Engineer at DV who I’ve worked with on a previous project. DJ has a passion for hacking hardware, and I had an idea around alleviating anxiety with wearables. We decided to put our heads together to see what we could build.

Why an Anxiety Wearable?

I was diagnosed with an anxiety disorder in 2017, becoming one of over 40 million adults in the United States age 18 and older. The challenges for recovering and maintaining good mental health can sometimes be harder than living the disorder itself. Pharmaceuticals have many side effects that can cause an array of problems: oftentimes these drugs don’t work as expected, and you have to go from one drug to another until you find something that does. Some drugs take weeks or even months to start working, and their effects can be unpredictable. In the face of these issues, I wanted to create a device that could sooth a person with these problems. We came up with the idea of creating a jacket to help mitigate anxiety symptoms, working in tandem with effective pharmaceutical treatment. The jacket needed to be low-cost, fun, and tailored to the user’s unique circumstances.

Getting Started

There are many different levels of anxiety, and a range of symptoms. Medical research was a key resource in determining what type of anxiety would be best to focus on. We chose to focus on everyday anxiety rather than deal with cases of extreme panic attacks.

I dug up some really thorough research from Texas A&M University that started to point the project in the right direction.The research contained information on determining whether heart rate variability could be used to determine if a person is experiencing anxiety. It describes methods for collecting the data, the type of models used, the science behind the models and the hardware used to collect the data. It also contained information on what didn’t work and why. All of this information ended up being a key resource for the project.

After finding the medical research we needed, we started to validate some of the findings by reaching out to medical professionals and asking questions around project feasibility. We then started to dig up recent medical papers that could validate the primary articles we intended to use as our sources.

Once we’d determined that our project was feasible, I created a rough mockup of the idea, laying out the most desirable product features. We then started to purchase some cheap hardware to use for prototyping.

The hardware for the initial prototype includes an ESP32 Arduino circuit board. This would be the brain of the product. The board comes with built-in WIFI, Bluetooth and 32 pinouts and costs around $10 USD. The jacket cost around $50 USD and is waterproof, lightweight, and lined with cotton on the inside, enabling us to properly install the sensors.

To collect anxiety data, we purchased a pulse sensor to determine heart rate, a circuit playground to collect body temperature, pressure sensitive conductive fabric to detect breathing patterns and a four-digit keypad for receiving user feedback and training the model.

For relieving anxiety, we purchased a haptic motor controller with seven vibrating mini disks that correspond to the 7 chakras used in mediation, 3 LEDs for feedback and thermal heat fabric for warmth, an audio bone conductor which is used to play soothing music through your bones by converting sound waves into vibrations that can be received directly by the Cochlea instead of the eardrum.

We chose to fix the control system on the sleeve of the jacket, with three LEDs used as indicators and A 4 button keypad for user input.

Putting the Pieces Together

After we’d decided on the components and what we wanted the vest to do, it was time to assemble the jacket.

First, we talked through the design and ordered parts for prototyping the jacket’s circuit. We started to wire up everything to a breadboard, and quickly began to collect some preliminary heart rate data to start building out a model. In order to collect enough data as a starting point for our model, we needed to run three sets of tests on four individuals. Each test would be split into three twenty-minute sessions.

The first session would be an ‘at rest’ test. Essentially, the test subject is waits for the test to begin. The second session is a “stress test.” During this session the user completes a speed algebra test, with the objective of completing the test within twenty minutes. The final session is a meditation test, where the user meditates for twenty minutes. This gives the model a baseline for determining if the user is experiencing anxiety.

This is the jacket with the circuits and battery hidden within custom made pockets along the lining. The top pocket contains the circuit board and vibration modules. The right sleeve contains the keyboard for user feedback and 3 LEDs used as indicators.

The model is contained in a Jupyter Notebook. It uses a k-nearest neighbor classification algorithm and currently consumes two inputs; heartbeats per minute and heart rate variability. At the time of this article, the model has a 70% accuracy score, and we are still collecting data from our tests. As we continue to collect more data, we predict that the accuracy will reach 85–90%. In the future we plan on adding in body temperature, breathing patterns and humidity as secondary indicators of anxiety. These additional metrics are not key in determining anxiety but can help increase the accuracy score per individual.

To connect the jacket to the model, we are using AWS SageMaker and IoT services. The ESP32 board connects to WIFI to send real time heart rate data to the Jupyter notebook, hosted on AWS. This will then return the current state of anxiety from that user, with the possible values being rest, relax or stress.

If the return value from the model states that the user is experiencing anxiety, we activate the bone conductor to play Beethoven’s Fur Elise, turn on the 7 vibration modules, warm up the heat pads and set the LED color to red to indicate anxiety. In the future, we will have a model that will detect if the combination of modules are working or not, and have the model figure out which combination works best for relieving anxiety for that particular user.

DJ pressing the keypad for input. Below the keypad are the the led indicators. On his collar is the audio bone conductor.

Next Steps

As we continue to build out the first prototype of the jacket, we suspect that we will need to upgrade some of the hardware to get better readings with less noise. We want to keep the jacket affordable, and some of the hardware can be really expensive. We are also reaching out to more medical professionals to get their advice on practicality and marketability. As society becomes more comfortable with talking about mental health, I predict that devices like these will become start to become more popular. We hope our jacket can play a part in alleviating anxiety for as many people as possible.

Interested in working with us at BCGDV? Want to find out more? See our current vacancies.

Find us on Twitter @DV_Engineering.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store