Doctor Robot’s Heart Rate Monitor – Raspberry Pi Project
Last week I attended the Manchester Picademy training, and became a certified Raspberry Pi Educator! As part of the training, we spent a day creating our first hack. We could be as creative as we wanted to be, and produce anything we liked. We produced, the Doctor Robot’s Heart Rate Monitor.
I arrived in the morning with my box of kit, things I have acquired over the last few years, but not really used (as I didn’t know what to do with them), and teamed up with my partner in crime Claire Foster. We decided to come up with a project that used the coolest items in my kit, which we decided would be;
- Adafruit Heart Rate Monitor Educational Kit
- 4tronix Picobot
The plan was to hook the heart rate sensor up to the Raspberry Pi and an LED, and have the LED blink at the same rate as the heart beat. We would then also connect the Display-O-Tron HAT to the Raspberry Pi, which would analyse the information received by the sensor, and output to the display the average beats per minute. THEN, our Doctor Robot (the picobot) would spin at a speed relative to the heart beat.
I think it’s fair to say at this point that in 5ish hours, being the very first time we had attempted a hack with a Raspberry Pi, that we didn’t quite manage to achieve our original plan for Doctor Robot’s Heart Rate Monitor. But we are very proud of what we came up with!
First, we hooked up our Heart Rate monitor receiver as per these instructions. it took a few tweeks to make sure we had everything connected the right way, but we soon had our LED blinking away. We did have some trouble setting up Initial State. The instructions first tell you to create an Access Key in your Initial State account under a menu option that no longer exists, so we wouldn’t work out how to do this. In the end, we carried on with the other instructions and found that the Access Key is actually provided during step 4 & 5, so don’t waste time on step 1!
Once we had our LED blinking, we moved onto our next task of getting the Display-O-Tron HAT added in, to display the average beats per minute. This was quite time consuming for us, as after attaching the HAT to our Raspberry Pi, we discovered that the available GPIO pins required soldering, which we couldn’t do. First we had to amend our code to use the now available GPIO pins, but nothing worked. We removed the Display-O-Tron and reconnected the circuit to the new pins direct and the code worked fine, so we knew our issue was with the HAT, and not the code. We reconnected the HAT, and thanks to a great fix by Claire Foster, we managed to wedge the jumper leads to the side of the pins enough to get the code up and running again.
Despite our success, we now had 40 minutes left to finish our hack, and as neither of us had ever programmed using HATs before, we weren’t sure we were up to the task. We checked our Initial State stream, but something had gone wrong, and even though the code was working to flash the LED, no information was being passed to our stream. We had assumed that this would be where we pulled the information from to analyse and generate our average beats per minute, and with this not working, we couldn’t work out how to either fix it, or gather the information we required in an alternative way.
It was at this point that discovered the true art of hacking;
Just hash something together that represents an idea, don’t worry about it being perfect
Therefore, our last 20 minutes were spent adding in a few lines of code to send a message to the Display-O-Tron which said, “Average beats per minute = 78”. Yes this was a random number we chose, no it did not actually pull any information from the heart rate kit and analyse it, but this was a 5 hour hack, and it was a good representation of what we were trying to achieve.
Finally, our poor Picobot was left unspinning, but he did make for a cute doctor, and was happy to pose for a picture with our final product, the Doctor Robot’s Heart Rate Monitor.
Thanks for reading!
Like me on Facebook - Follow me on Instagram - Follow me on Twitter