PulseSensor – Architecture
Architecture
While the PulseSensor as such would only require the Arduino uno to operate, there are two reasons why there is a need to also have a Raspberry PI model in the architecture.
Firstly, the Raspberry PI does not support analog input so we would have to convert the analog signal coming from the sensor into a digital signal using e.g. an MCP 3008 A/D converter. With a sampling rate of approximately 50Hz , this is not an ideal scenario. Furthermore, we leverage the Raspberry PI among other things to host the IoT Edge framework to communicate with the IoT Cloud platform.
The Arduino uno reads the raw pulse data from the PulseSensor and calculates three values: The BPM (Beats per minute), the IBI (Inter Beat Interval – time between two beats) and the digital value of the measured sample in voltage. It provides these calculated values to the serial interface from where it can be picked up by external software modules to be further processed.
UART is used called serial communication. UART is the abbreviation for Universal Asynchronous Receiver Transmitter and is the common serial interface on PCs and microcontrollers. As the name implies serial communication means sending and receiving data bit by bit over a single line. The Arduino uno board has one serial port at digital pins 0(RX) and 1(TX) to communicate with other external serial devices or with computer through USB cable. The process of sending and receiving data can be observed by flashing of TX and RX LED’s on the Arduino board. They are located just beside the Atmega 8U2 chip on the.
The communication between the Arduino uno and Raspberry PI over USB is established at a specific baud rate. The baud rate specifies how fast the data is sent over the serial line or in simple terms, the speed of serial communication. Some common rates for UART are 9600 baud, 11520 baud etc. To start the serial communication between both components, the baud rate set for Arduino uno and the Raspberry PI must be the same.
Hardware Architecture
First step is to build the hardware circuit which connects the Arduino with both the PulseSensor and the Raspberry PI.
The PulseSensor operates with 5V and receives both the power supply and ground from of the Arduino uno. The analog signals of the PulseSensor flow via the A0 analog input into the microcontroller.
The Arduino uno connects via USB (USB A -> USB A) to the Raspberry PI. This connection provides the power supply to the Microcontroller and access to all serial interfaces of the Microcontroller.
The breadboard is used to host the 3 LEDs for signaling a BPM detection (yellow), an Alarm state (if BPM exceeds a certain threshold value) and the OK state when the BPM value is compliant with a predefined range. All LEDs are connected with their cathode to the ground (regardless if grnd comes from Arduino uno or Raspberry PI). The anodes of the LEDs are connected to their corresponding control lines. The control line for the BPM detection LED (yellow) is PIN 13on the Arduino uno board. The Alarm LED is controlled by GPIO_GEN4, and the OK LED by GPIO_GEN5, both on Raspberry PI.

Software Architecture
On the Edge
On the Raspberry PI we have the Arduino IDE application running. With this IDE we can work with the prebuild PulseSensor – library collection for Arduino. An Arduino library is a collection of code and examples on a specific topic or device. For example, the PulseSensor-Playground Library is a collection of code and projects made just for the PulseSensor and Arduino. (World Famous Electronics(4), 2021)
The Gateway also operates the Eclipse Kura framework which basically extends the Eclipse IoT cloud solution into the edge device. The framework offers a Java/OSGi-based container for running applications in so-called components. In terms of Eclipse Kura, a component can exist out of 1 or multiple OSGI bundles. Eclipse Kura components are designed as configurable OSGi declarative services exposing service APIs and raising events. While several Eclipse Kura components are in pure Java, others are invoked through JNI and have a dependency on the Linux operating system. (Eclipse IoT(4), 2021)
The Eclipse Kura framework also hosts the PulseSensor component which we developed as part of this project. The Pulsesensor component has several functions:
- Reading the discrete PulseSensor values coming from the Arduino uno board
- Determine BPM compliance based on the patient individual pulse compliance settings
- Pushing the discrete Pulsesensor values via MQTT to the Eclipse Kapua cloud platform
- Controlling the BPM Alarm (red)– and OK LED (green)
- Setting Alarm notification in the App via the openHAB Smarthome application
Open Home Automation Bus or openHAB is an open source home automation project started back in 2010. Like Eclipse Kura, openHAB is also running on an OSGI framework it consists out multiple bundles.
All the controlling actions for automation are triggered by rules, voice commands, or controls on the openHAB user interface. A binding in openHAB is an additional package used to connect or interact with other devices. It is like a plugin that provides support for different smart devices. For example, bindings include Bluetooth, ZigBee, Google Assistant, etc. The user interface can be accessed via a Browser as well as leveraging an Android or iOS App. It provides webpages with user-defined information as well as user-defined tools/items to interact with all devices.
In the Cloud
We have some cloud applications in the architecture to support that information is available everywhere, and to ensure we can configure Edge components remotely.
All applications are running in a Docker environment, managed by Portainer – a simple but efficient Container Management System.
The counterpart of the Eclipse Kura IoT Edge application in the cloud is Eclipse Kapua. From a high-level perspective, Eclipse Kapua provides services for device connectivity, message routing, security, device management, data management, application integration and administration.
For the graphical representation of the metrics data from our PulseSensor we are using Grafana. Grafana has basically two data sources. ElasticSearch from the Eclipse Kapua™ stack for more historical data, and a direct feed from the MQTT Broker running on our Natrix Gateway for real-time measurement data.

Sequence Diagram
A pulse wave is the change in the volume of a blood vessel that occurs when the heart pumps blood, and a detector that monitors this volume change is called a pulse sensor. Reflection-type pulse sensors (Optical Sensors for Heart Rate Monitor) emit infrared, red, or green light (~550nm) towards the body and measure the amount of light reflected using a photodiode or phototransistor. Oxygenated hemoglobin present in the blood of the arteries has the characteristic of absorbing incident light, so by sensing the blood flow rate (change in blood vessel volume) that changes following heart contractions over time we can measure the pulse wave signal. (ROHM Semiconductors(1), 2021)
As you can see in the sequence diagram below, everything starts with when the patient puts on the sensor. The Arduino reads periodically (~50times/sec) the analog input (A0) where the PulseSensor is connected to and calculates the InterBeatInterval (IBI) and BeatsPerMinute(BPM) value. Along with the latest (digitalized) sample value, this data is exported in a formatted way on the Arduino’s serial port.
Here Raspberry picks the formatted data up and processes them further. It identifies if the patient is within his pulse compliance range and pushes the data in real-time towards the Eclipse Kapua IoT platform. It also manages setting the Alarm notification on both the LED and the App.
Finally, Grafana is fed by a Telegraf injection via the Grafana Live API to display real-time measurement data. Furthermore, we are using historical data which Eclipse Kapua stores in a TimeSeries database (ElasticSearch). We show both set of data in different plots on a dashboard. This dashboard can be obtained via an URL in a browser. Furthermore, the App has an embedded a link to that dashboard, so you have the graph also being displayed in the App.
