This addon helps you get the heartbeat (BPM and IBI) and use it in your openFrameworks project using the GPIO's of your RaspberryPi or by using an Arduino to send the signal by Serial connection.
Clone this addon repository into your
cd openFrameworks/addons git clone https://github.com/patriciogonzalezvivo/ofxPulseSensor
On you computer through an Arduino Using Arduino as Server and your laptop (tested on OSX) as a client:
- Flash your Arduino with this firmware
- Connect the Arduino by USB to this computer and the PulseSensor to the arduino following this guide or this video
- Add this addon to your program (see arduino-example) and compile
In the RaspberryPi through the GPIOs:
RaspberryPi don't have analog-in like Arduino. That's why we are going to use MCP3008 to transform the resistance of the photocell into pulse frequency. Maybe you also want to by the Pi Cobbler breakout to make the connections easier.
Everything is almost like this tutorial except that we are not using
#25instead we are using SPI just like Jason Van Cleave and Andreas Muller did in this example. Off course instead of using a potentiometer the PulseSensor.
Configure your RaspberryPi for wiringPi ( https://github.com/openFrameworks-RaspberryPi/openFrameworks/wiki/Raspberry-Pi-Using-the-GPIO-pins-with-Wiring-Pi-and-openFrameworks ).
sudo nano /etc/modprobe.d/raspi-blacklist.conf
Comment with # (or remove) those lines
Add ofxPulseSensor to your addons.make file, compile and run as root. (Attention! Because the wiringPi the App need to be run in super user mode or sudo )
make sudo make run
More References about Analog Inputs in RaspberryPi: