I’m working on a wearable heartbeat sensor project using the HW-502 and a Micro:bit. My initial configuration is using the Micro:bit for data collection and display, an Arduino to provide 5v power to the sensor, and the sensor is the HW-502 from the 37 sensors kit.

As I was building this, I initially wanted the Micro:bit to show its heart icon when the sensor triggered, but there was a significant delay when showing the heart icon. Apparently there is an interval parameter that’s not shown in the block code editor – only in Javascript and Python. That should speed up the heart display.

I’m planning on getting this pulse sensor, which seems to provide much smoother data and works with the 3v power provided by the Micro:bit. In the mean time, I’m also planning on using this moving average library for Makecode to smooth the data on the HW-502.

The next challenge is how to put it all together as a wearable device. I have a charge for Micro:bit to power and hold the Micro:bit, I have a wearable circuits kit from brown dog gadgets that I may be able to use maker tape and felt to attach it to my arm and connect the pulse sensor, and the pulse sensor comes with a velcro strap to attach it to my finger, so I think that could be a good setup.

First version of the hardware
Makecode blocks

Here’s the makecode file. You can copy and paste it into the Python section of Makecode and make it your own!