Arduino – The Microcontroller part of the project
Arduino IDE
In this chapter we learn how to prepare the Natrix Gateway to communicate via serial interface to the Arduino board, and how to load the scripts on to the Microprocessor board.
Enabling serial communication on the Natrix Gateway
To enable the serial port on our Natrix Gateway, we call ‘raspi-config’ in a terminal and enable [P6 Serial Port] and [P8 Remote GPIO].
raspi-config

Loading Pulsesensor libraries from to the Arduino Board
Next step is to load the libraries provided by WorldFamousElectronics to our Arduino Board. (Arduino(4), 2021)
We start the Arduino IDE from the Natrix Gateway desktop and go to the menu [Sketch]->[Include Library]->[Manage Libraries].
This opens the ‘Library Manager’ of the Arduino IDE, and we search for Pulsesensor:

Here we see that the current version 1.5.1 has been found, which we install with a double-click on the [Install] button. Once the installation has finished, we see an updated ‘Installed’ status for the PulseSesor Playground libraries.

Now we plug our Arduino into an unused USB port of our Natrix Gateway, open up Arduino IDE, and select the [File]->[Examples]->[PulseSensor Playground]->[PulseSensor_BPM] sketch from the examples folder.

This opens a second windows of the Arduino IDE with the corresponding script/library which we have selected. We want to load this library as it is onto the Microcontroller. We are doing this with [Tools]->[Port]->[/dev/ttyACM0(Arduino Uno)]

Press the [Upload] button (Arrow to the right) to upload the script to the Microprocessor.

This compiles the sketch and manages the upload.

Once the sketch has been uploaded, it immediately starts to work.
Now you can attach the PulseSensor to your ear using the ear-clip, or you fix it with the Velcro to one of your fingertips. Please take care that the side with the heart of your PulseSensor rests well fixed on your fingertip.

You can see the output in two different ways: as a plot, and with the raw numbers.
To see the raw numbers, go to [Tools]->[Serial Monitor] and set the baud-rate to 115.200 baud.

For the graphical plot, go to [Tools]->[Serial Plotter], same baud-rate:
