In this tutorial, you will learn how to connect a Heart Rate Pulse Sensor to a Raspberry Pi and read the output data coming from the sensor using a UWP (Windows 10) Application.
First of all, the output data coming out from the sensor is analog, so we need an analog-to-digital converter to be able to connect it the Raspberry Pi, so we are using an ADC here which is "MCP3008".Step One - Connecting the parts together:
Our sensor is very simple with three legs:
- BLACK: Ground
- RED: Input: +3V or +5V
- PURPLE: Signal
So, we need to connect the signal coming from the sensor to one of the channels in our ADC. To know how to connect the ADC, here's a scheme of our IC to know the function of each leg. (I got it from the datasheet of the IC, you can google it):
You will find attached the scheme of the entire circuit.Step Two: UWP (Windows 10) App
In order to read the coming data from the sensor, we need a software/app to handle this circuit and get the data out of it, so I will attach a UWP App written in C# to perform this function, it's very simple, you can find it on GitHub also, and I will try to explain each code line to understand it more, and maybe I will record a tutorial for that.Lessons Learned
Okay, now you can read the data coming out from the pulse sensor, so what is the next step? What are the most important things to learn from this tutorial?
First of all, important things to consider from this tutorial:
- Now, you can read any analog data via Raspberry Pi.
- You can use the same concept, and implement it with any other tools.
- You can use the same ADC, same Code(almost) and the same connection(almost) to read any other analog data.
- Now, you know how to use SPI Interface in Raspberry Pi.
There are a couple of scenarios in mind now for further implementation of this simple demo:
- You can use this data coming out from the sensor which is a signal (pulses) in real time and build a monitor system, in this case, you will need to visualize this data, so you can simple visualize it on the same app, by connecting the raspberry pi to a screen, in this case you might use one of the easy to use and customize charts provided by: https://www.syncfusion.com/products/uwp/sfchart OR http://www.telerik.com/universal-windows-platform-ui/chart
- Another good scenario and practice for building an IoT Solution is to send this data to Microsoft Azure, and use Power BI to visualize this data into any other client.
- Another scenario is to calculate the BPM (Beat Per Minute) from this data, and to know more how to use it and learn further about it. I highly recommend to visit the official website of Pulse Sensor to further your knowledge about how to calculate the BPM.
For more blogs, visit my personal blog: https://mohamedemam0.wordpress.com/