Elevate your heart's performance with our intelligent ECG solution
A
A
Hardware Overview
How does it work?
ECG 4 Click is based on the BMD101, a highly integrated specialized bio-signal sensing System-on-Chip (SoC) from NeuroSky, which produces heart-monitoring-related ICs and applications. This IC is the third generation of bio-sensors from this company. It features the complete HR and ECG system on a chip: the analog front-end (AFE) section contains a very precise and low-noise instrumentation amplifier (LNA), which allows very low bio-signals generated by the heart to be amplified enough for the 16-bit ADC to be able to sample them. These voltage impulses are naturally weak and in the range of just a few millivolts, even microvolts. Therefore, any external interferences might obscure them. These interferences might be induced in the human body itself or appear as the result of the activity of other muscles, such as skeletal muscles. Therefore, the input signal from the electrodes is processed by several filtering sections, both in the analog (HP filter at the input) and digital domain (LP filter at 100 Hz and BP filter for removing the 50/60 Hz hum from the mains). However, the correct placement of the
measurement electrodes is crucial for accurate readings. More about the electrodes and their placement can be found in the blog article, as mentioned above. ECG 4 Click allows several types of electrodes to be used. It supports both stainless-steel and silver-chloride electrode types. The electrodes are used to perform differential measurements of the voltage generated by the heart. Therefore, the heart can be monitored from a single plane only - the coronal plane. However, this is quite enough for fitness, heart rate monitoring, and similar applications. The 3.5mm electrodes connector is further protected by two TVS diodes, which prevent electrostatic discharge (ESD) through the SoC and the Click board™. The absence of the electrodes is detectable by the BMD101, which turns the sensor OFF if there is approximately 19 to 25 MΩ between the electrodes. The BMD101 SoC uses the UART interface for communication. The UART interface works at a 57600 baud rate and has 64 bytes of TX FIFO. It uses the 8-1-1 configuration (1 start bit, 8 data bits, 1 stop bit), allowing communication beyond the
host microcontroller. The UART interface could be used with any USB to UART clicks, allowing the PC or smartphone to process and display the HR and ECG data. More information about the UART interface can be found in the datasheet of the BMD101 SoC. However, provided mikroSDK library offers ready-made functions which speed up the software development process. There is a CS pin on the BMD101 SoC, which is routed to the CS pin of the mikroBUS™. This pin should be set to a HIGH logic level to activate the internal power supply. The RESET pin is routed to the mikroBUS™ RST pin. Setting it to a LOW logic level will trigger a RESET of the BMD101. This Click board™ can only be operated with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Features overview
Development board
Arduino UNO is a versatile microcontroller board built around the ATmega328P chip. It offers extensive connectivity options for various projects, featuring 14 digital input/output pins, six of which are PWM-capable, along with six analog inputs. Its core components include a 16MHz ceramic resonator, a USB connection, a power jack, an
ICSP header, and a reset button, providing everything necessary to power and program the board. The Uno is ready to go, whether connected to a computer via USB or powered by an AC-to-DC adapter or battery. As the first USB Arduino board, it serves as the benchmark for the Arduino platform, with "Uno" symbolizing its status as the
first in a series. This name choice, meaning "one" in Italian, commemorates the launch of Arduino Software (IDE) 1.0. Initially introduced alongside version 1.0 of the Arduino Software (IDE), the Uno has since become the foundational model for subsequent Arduino releases, embodying the platform's evolution.
Microcontroller Overview
MCU Card / MCU
Architecture
AVR
MCU Memory (KB)
32
Silicon Vendor
Microchip
Pin count
28
RAM (Bytes)
2048
You complete me!
Accessories
Click Shield for Arduino UNO has two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the Arduino UNO board without effort. The Arduino Uno, a microcontroller board based on the ATmega328P, provides an affordable and flexible way for users to try out new concepts and build prototypes with the ATmega328P microcontroller from various combinations of performance, power consumption, and features. The Arduino Uno has 14 digital input/output pins (of which six can be used as PWM outputs), six analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header, and reset button. Most of the ATmega328P microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the Arduino UNO board with our Click Shield for Arduino UNO, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
3-wire ECG/EMG cable comes with a convenient 3.5mm phone jack, and it is designed for electrocardiogram recording. This 1m cable is a practical companion for medical professionals and enthusiasts. To complement this cable, you can also use single-use adhesive ECG/EMG electrodes measuring 48x34mm, each equipped with an ECG/EMG cable stud adapter. These electrodes ensure a seamless experience when paired with our ECG/EMG cable and guarantee reliable ECG/EMG signal transmission for comprehensive cardiac monitoring. Trust in the accuracy and convenience of this setup to effortlessly record electrocardiograms and electromyograms with confidence.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
Software Support
Library Description
This library contains API for ECG 4 Click driver.
Key functions:
ecg4_uart_isr
- Function performs the uart interrupt routine, reads a data from uart rx buffer and makes a response from the BMD101 deviceecg4_enable_ldo_ctrl
- Function powers up or down control of LDO (Low Drop Out)ecg4_generic_read
- Generic read function
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* \file
* \brief Ecg4 Click example
*
* # Description
* This example reads and processes data from ECG 4 clicks.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver, sets the driver handler and enables the click board.
*
* ## Application Task
* Reads the received data and parses it on the USB UART if the response buffer is ready.
*
* ## Additional Function
* - ecg4_process - The general process of collecting data the module sends.
* - plot_data - Displays raw ECG data.
* - log_data - Displays the real time BPM heart rate.
* - process_response - Checks the response and displays raw ECG data or heart rate (BPM).
* - make_response - Driver handler function which stores data in the response buffer.
*
* @note
* Use the Serial Plot application for data plotting.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "ecg4.h"
#include "string.h"
// ------------------------------------------------------------------ VARIABLES
static ecg4_t ecg4;
static log_t logger;
static uint8_t response[ 256 ];
static uint8_t row_counter;
static uint8_t row_size_cnt;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
static void ecg4_process ( void )
{
int32_t rx_size;
char rx_buff;
rx_size = ecg4_generic_read( &ecg4, &rx_buff, 1 );
if ( rx_size > 0 )
{
ecg4_uart_isr( &ecg4, rx_buff );
}
}
void plot_data ( int16_t plot_data )
{
log_printf( &logger, "%d;\r\n", plot_data );
}
void log_data ( uint8_t code_val, uint8_t data_val )
{
if ( code_val == ECG4_HEART_RATE_CODE_BYTE )
{
log_printf( &logger, "** Real-time Heart Rate : %d BPM **\r\n", ( int16_t ) data_val );
}
}
void make_response ( uint8_t *op_code, uint8_t *row_size, uint8_t *rx_buff, uint8_t *row_cnt )
{
uint8_t idx_cnt;
if ( *row_cnt == 0 )
{
row_size_cnt = 0;
}
response[ row_size_cnt ] = *op_code;
response[ row_size_cnt + 1 ] = *row_size;
for ( idx_cnt = 0; idx_cnt < *row_size; idx_cnt++ )
{
response[ row_size_cnt + 2 + idx_cnt ] = rx_buff[ idx_cnt ];
}
row_size_cnt += ( *row_size + 2 );
row_counter = *row_cnt;
}
void process_response( )
{
uint8_t cnt;
uint8_t idx_cnt;
int16_t raw_data;
idx_cnt = 0;
for ( cnt = 0; cnt <= row_counter; cnt++ )
{
if ( response[ idx_cnt ] == ECG4_RAW_DATA_CODE_BYTE )
{
raw_data = response[ idx_cnt + 2 ];
raw_data <<= 8;
raw_data |= response[ idx_cnt + 3 ];
plot_data( raw_data );
}
if ( response[ idx_cnt ] == ECG4_HEART_RATE_CODE_BYTE )
{
log_data( response[ idx_cnt ], response[ idx_cnt + 2 ] );
}
idx_cnt += ( response[ idx_cnt + 1 ] + 2 );
}
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
ecg4_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
ecg4_cfg_setup( &cfg );
ECG4_MAP_MIKROBUS( cfg, MIKROBUS_1 );
ecg4_init( &ecg4, &cfg );
ecg4.driver_hdl = make_response;
Delay_ms( 500 );
ecg4_module_reset ( &ecg4 );
ecg4_enable_ldo_ctrl ( &ecg4, ECG4_ENABLE_LDO_CTRL );
Delay_ms( 1000 );
}
void application_task ( void )
{
ecg4_process( );
if ( ecg4_responseReady( &ecg4 ) )
{
process_response( );
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END