Easy Ride: Prototyping Biosensors with Arduino
Recently, there has been an increase in both the desire and opportunity to track personal health and fitness. Demand creates supply, so the tech market is flooding with gadgets designed to monitor our wellbeing: from calories burnt to heart rate.
In order to be precise and thus effective, each device uses a range of biosensors to monitor its owner’s health and analyze fitness training, also varying in price from several thousand dollars (BioRadio) to hundreds of dollars (Empatica) or even less (Jawbone). Regardless of cost, a great benefit (and at the same time requirement) of such devices is the fact that they rely on non-invasive methods, so here’s what different sensors and biosignals measure:
||Heart Rate Variability, Stress, Relaxation
||Heart Rate Variability, Stress, Relaxation
|Electrodermal Activity (EDA)
|Galvanic Skin Response (GSR)
||Arousal, Stress level
|Temperature and Heat Flux
||Activity, Context Info
||Movement, Steps counting
In this blog I will show you how to build a chip solution and make a feasible prototype with the Arduino open source platform. Recently, SoftServe’s R&D team started working on a project that requires collection and analysis of biosignals, which required the ordering of specialized equipment. Time passed, but due to a bunch of issues the long-awaited equipment appeared to be unavailable for use in an R&D Lab. The results of our work were dependent on the amount and quality of the recorded biosignals, but the deadline was looming and the ordered equipment hadn’t been delivered.
Trying to stay in control of the situation, I started looking for a worthy substitution. Having browsed all the existing electronics websites, I came across PPG sensors in a DIY section that accessed signals similar to an electrocardiogram. The price was around $10 including shipping, so I couldn’t but place an order right away. Additionally, I had two Arduino boards (Arduino Uno and Arduino Mega) at my disposal at a price ranging between $10 and $20 per piece.
Pic 1. Arduino Uno board and PPG sensor
Having this treasure chest in front of me, I started thinking how to put all the equipment together and write a desktop program for photoplethysmographic data recording, storage and visualization. The first question popping out in my mind was what those PPG sensor outputs are for and how to connect it with the Arduino board. Good guy Google brought me a ready made solution, part of which was written for Arduino and PPG data collection: recorded data was transferred to the desktop via serial ports cord. While another program read the data from the Arduino board and visualized it with the help of the Processing open source package developed by MIT, a Java-based language with its own IDE. The language is famous for its meticuluous visualizations.
Following the procedure, after about 30 min of reading user manuals, I successfully connected the LCD display module to the Arduino board and ended up with numerical values for the heart rate on it. So, Eureka, this is how to collect data without specialist devices.
The second challenge was to solve the problem of simultaneous on-line data visualization and storage on HDD. I experimented with Processing, Octave and R mathematical packages and proved that storing data is achievable, but it is visualized with a significant delay. So, the idea of using mathematical packages for visualization got rejected. My next choice was applying Python and PyQTGraph library. Having looked through Arduino code, I refactored it and left only the functions for reading data from the sensor and sending if to a desktop computer. This solution facilitates reaching up to 300 Hz of the signal sampling frequency which is enough for photoplethysmographic recording.
Pic 2. Biosignal visualization, collected with a help of an Arduino board (PPG on top, GSR – at the bottom) using Python
The next thing to implement was a recording of galvanic skin response (GSR). They say curiosity is the mother of invention, so our team decided to assemble sensors ourselves. After shopping in a radio store and some magic with the prototyping board, at the end of the day a proof of concept was done.
Pic 3. GSR sensor prototype on the test board
The board was working, but the received signal was unstable, so I soldered it onto a PCB. The result looked as follows:
Pic 4. GSR sensors
Getting closer to the end of the project, the GSR sensor was working and we used it to record signals.
Pic 5. Biosignal recording process
Pic 6. Structure of prototype for biosignal recording
Due to its approachability, the Arduino prototyping platform opens doors to the proactive creation of future system PoCs, confirmation of its feasibility in the short term, and offers a backup when equipment orders are delayed.