Week 2 - Implementation of Bio-Feedback

Week 2 Implementation of Bio-Feedback







Heartbeat Measurements:


During the Friday class the team looked at an open source code base for measuring HRV using a Micro: bit and a pulse sensor.

The serial plotter on the Micro: bit while running this code shows the different measurements being taken and calculated from the sensor. 

The most important of these measurements seemed to be HRV and the pulse detection.

As you breath out you can see the HRV value moving downwards as you exhale and increase as you inhale.






Bio-Feedback

Biofeedback can be done in many different ways for this project but over the last week this is what i have some up with:

Use of the Micro: bits LED matrix 



This can be achieved by mapping the analog input of the Pulse sensor and mapping the analog values 

0-1023 to 0-4 with respect to the locations of the LED matrix.

With this new function we can choose what LED column we want to move up/down according to the users pulse/HRV levels.



Use of external LCD display

Another means of taking HRV measurement could be by using an LCD display and connecting it to the Micro: bit via the I2C protocol, 

This is a 4-Wire protocol which takes VCC, GND, SDA(serial data line) and SCL(serial clock line) pins. 

For power we use a 5V supply for the LCD and use pin 20(SDA) and pin 19(SCL) on the Micro: bit in order for it to communicate. 

Once this connection has been established an LCD extension can be installed via the makecode website and it can be initialized with as little as 2-3 lines of code:





Components required for this method:


          
5v Power supply



Using Products for Bio-Feedback:

Bluetooth/Wired water speakers for displaying highs and lows of HRV

This water speaker could work as a visual to what we see on the serial plotter when taking HRV measurements. 

The lights on these speakers could also be adjusted, allowing us to map HRV readings to specific colors like Green for good breathing and Red is a person was breathing too quickly.




Breathing Pacer:


Mounting a servo motor to a hand fan to simulate breathing patterns as a "pacer"

For this example a servo motor could be mounted to one end of the fan and move up and down at a certain speed to guide the user on how they should be breathing. 
The fan expanding could indicate a deep breath inwards and the fan contracting could be a breath outwards.

I think this would be a good example for a pacer because it could also show the user how long they should hold their breath by the fan remaining static.





Micro: bit code for this pacer could be as simple as having a separate Micro: bit attached to a servo motor.



Another way you could do Bio-Feedback using this type of fan would be to map the pulse or BPM of the user to the position of the servo motor. This could be then clocked like a speedometer by setting up a dial with numbers behind the fan.






Demos:



YouTube: https://youtu.be/2Z-l0RFYu0Q

Code Examples: https://makecode.microbit.org/S68655-59547-22072-25516



Effects of battery on sensor:

Below is a specification list of the Pulse sensor, 
We can see that it is suitable for both 3.3V and 5V systems.

Ref: https://components101.com/sensors/pulse-sensor


Further research found that the Micro: bits power consumption ranges from 6-9mA but can increase depending on how complex the makecode script is.

Ref: https://www.instructables.com/BBC-Microbit-Power-Usage-Mu-an-Off-line-MicroPytho/



Battery Life Calculations:

In order to calculate the power consumption of this system we can now use this researched information:

Sensor current consumption = 4mA
Micro:bit current consumption = 10mA (varies based on complexity of code and use of Micro: bits led matrix)
Battery capacity = 500mAh


To find the total current consumption:
Total current consumption(TCC)  = Sensor current consumption + Micro:bit current consumption

TCC = 14mA

To find battery life:
Battery Life = Battery Capacity / TCC
Battery Life = 500mAh / 14mA


To ensure we are using consistent units we must convert Battery capacity and TCC to amp-hours/amps

Since 1mAh = 0.001 Ampere-hours (Ah), we convert battery capacity to Ah

Battery capacity = 500mAh * (0.001 Ah / 1mAh) = 0.5 Ah

Total current consumption(TCC) = 14mA * (0.001 A / 1mA) = 0.014A

Then to calculate battery life we divide Battery capacity by the total current consumption:

Battery life = 0.5 Ah / 0.014 A ≈ 35.71 hours


Bear in mind this is a theoretical calculation and does not account for current consumed on other parts of the system. 

In order to get a accurate Battery life time an experiment can be done using the Microbit HRV system and a Multi meter where measurements of current being supplied to the system can be measured over a period of time and recorded on something like an excel sheet where a visual graph of battery life can be created from the data collected.



Comments

Popular posts from this blog

Blog 2 - HRV Demo

Week 1: HRV Review

Lock In Day 1 (20/05/25)