Intermediate
30 min

Experience next-level of health monitoring with AS7030B and PIC18F57Q43

Get diagnosed from anywhere

ECG/GSR Click with Curiosity Nano with PIC18F57Q43

Published Feb 13, 2024

Click board™

ECG/GSR Click

Dev. board

Curiosity Nano with PIC18F57Q43

Compiler

NECTO Studio

MCU

PIC18F57Q43

Step into the future of vital-sign tracking by combining PPG and ECG technology for precise pulse rate measurement and comprehensive bio potential analysis

A

A

Hardware Overview

How does it work?

ECG/GSR Click is based on the AS7030B, a vital sign sensor based on Photoplethysmography (PPG) and Electrocardiogram (ECG) operations from AMS-AG. These two popular methods are suitable for heart rate monitoring (HRM) and heart rate variability (HRV), which measure the pulse rate by sampling light modulated by blood vessels that expand and contract as blood pulses through them. The ECG is the reference for any measurement of the bio-potential generated by the heart. This vital sign sensor features a low-noise analog front end, a single device integrated optical solution, and a synchronous demodulator. It consists of two 527nm green LEDs and one 940nm IR LED. The built-in infrared emitter and dedicated photodiode enable easy integration of the proximity function. Besides the HRM and SpO2, the AS7030B

is also anoptical measurement system for GSR (galvanic skin resistivity) and skin temperature obtained via an external temperature sensor connected to an onboard header labeled NTC. ECG/GSR Click communicates with MCU using the standard I2C 2-Wire interface that supports Standard-Mode (100 kHz) and Fast-Mode (400 kHz) operations. Also, it uses two additional pins, the INT pin of the mikroBUS™ socket, used as an interrupt, and the EN pin, routed on the CS pin of the mikroBUS™ socket, used to put the AS7030B into Normal operation mode or in a Shutdown. The AS7030B does not require a specific Power-Up sequence but requires a supply voltage of 3.8V to work correctly. Therefore, the Click board™ uses a low dropout linear regulator AP7331 from Diodes Incorporated, providing a 3.8V out of 5V mikroBUS™

rail.This Click board™ consists of two input channels routed to the 3.5mm jack connectors labeled as ECG and GSR, to which a 1m long ECG/EMG cable connects the electrodes to the appropriate Click board™ securely. The two electrode holders consist of a metal piece with a dent in the middle that perfectly fits the rivets on the electrodes. The contact with the measurement Click board™ remains good and secure while mounting the cable's electrodes is simple and easy. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.

ECG/GSR Click top side image
ECG/GSR Click lateral side image
ECG/GSR Click bottom side image

Features overview

Development board

PIC18F57Q43 Curiosity Nano evaluation kit is a cutting-edge hardware platform designed to evaluate microcontrollers within the PIC18-Q43 family. Central to its design is the inclusion of the powerful PIC18F57Q43 microcontroller (MCU), offering advanced functionalities and robust performance. Key features of this evaluation kit include a yellow user LED and a responsive

mechanical user switch, providing seamless interaction and testing. The provision for a 32.768kHz crystal footprint ensures precision timing capabilities. With an onboard debugger boasting a green power and status LED, programming and debugging become intuitive and efficient. Further enhancing its utility is the Virtual serial port (CDC) and a debug GPIO channel (DGI

GPIO), offering extensive connectivity options. Powered via USB, this kit boasts an adjustable target voltage feature facilitated by the MIC5353 LDO regulator, ensuring stable operation with an output voltage ranging from 1.8V to 5.1V, with a maximum output current of 500mA, subject to ambient temperature and voltage constraints.

PIC18F57Q43 Curiosity Nano double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC

MCU Memory (KB)

128

Silicon Vendor

Microchip

Pin count

48

RAM (Bytes)

8196

You complete me!

Accessories

Curiosity Nano Base for Click boards is a versatile hardware extension platform created to streamline the integration between Curiosity Nano kits and extension boards, tailored explicitly for the mikroBUS™-standardized Click boards and Xplained Pro extension boards. This innovative base board (shield) offers seamless connectivity and expansion possibilities, simplifying experimentation and development. Key features include USB power compatibility from the Curiosity Nano kit, alongside an alternative external power input option for enhanced flexibility. The onboard Li-Ion/LiPo charger and management circuit ensure smooth operation for battery-powered applications, simplifying usage and management. Moreover, the base incorporates a fixed 3.3V PSU dedicated to target and mikroBUS™ power rails, alongside a fixed 5.0V boost converter catering to 5V power rails of mikroBUS™ sockets, providing stable power delivery for various connected devices.

Curiosity Nano Base for Click boards accessories 1 image

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.

ECG/GSR Click accessories image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
Enable
PD4
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Interrupt
PA6
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PB2
SCL
I2C Data
PB1
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

ECG/GSR Click Schematic schematic

Step by step

Project assembly

Curiosity Nano Base for Click boards front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity Nano with PIC18F57Q43 as your development board.

Curiosity Nano Base for Click boards front image hardware assembly
Charger 27 Click front image hardware assembly
PIC18F47Q10 Curiosity Nano front image hardware assembly
Prog-cut hardware assembly
Charger 27 Click complete accessories setup image hardware assembly
Curiosity Nano with PICXXX Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
PIC18F57Q43 Curiosity MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for ECG/GSR Click driver.

Key functions:

  • void ecg_gsr_cfg_setup ( ecg_gsr_cfg_t *cfg ); - Config Object Initialization function.
  • ecg_gsr_err_t ecg_gsr_init ( ecg_gsr_t *ctx, ecg_gsr_cfg_t *cfg ); - Initialization function.
  • void ecg_gsr_default_cfg ( ecg_gsr_t *ctx ); - Click Default Configuration function.

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

cmake_minimum_required(VERSION 3.21)
if (${TOOLCHAIN_LANGUAGE} MATCHES "MikroC")
    project(example_ecg_gsr LANGUAGES MikroC)
else()
    project(example_ecg_gsr LANGUAGES C ASM)
endif()

set(PROJECT_TYPE "mikrosdk" CACHE STRING "" FORCE)

add_executable(example_ecg_gsr
        ecg_gsr_example.c
    
)


############################ example_ecg_gsr GENERATED CODE START ###########################
find_package(MikroC.Core REQUIRED)
target_link_libraries(example_ecg_gsr PUBLIC MikroC.Core)
find_package(MikroSDK.Board REQUIRED)
target_link_libraries(example_ecg_gsr PUBLIC MikroSDK.Board)
find_package(MikroSDK.Log REQUIRED)
target_link_libraries(example_ecg_gsr PUBLIC MikroSDK.Log)
add_subdirectory(lib_ecg_gsr)
target_link_libraries(example_ecg_gsr PUBLIC Click.ECG_GSR)
############################ example_ecg_gsr GENERATED CODE END ###########################

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.