I am trying to interface the AD8232 Heart Rate Monitor with CYW920737 TAG-04 to implement a simple cardiac monitor.
The pins of AD8232 are: (1) output that can be connected to P0 (analog input of CYW20737 TAG-04), (2) GND, (3) 3.3 V, (4) LO-, (5) LO+. 4 and 5 are leads off detection that can be connected to digital GPIO pins.
My question (A): after reading WICED Smart Tag hardware user manual & CYW20737 SoC datasheet, a) when the circuit is powered on USB cable mode not battery, I did not find the a ground pin for (2) and output voltage pin for (3), any ideas on how to hoop these pins up to CYW20737?
Second question: which pins are suitable for digital Inputs to be hooked up to LO- and LO+? like P3 and P4 would work?
Then, I can define two digital input pins:
#define GPIO_PIN_P0 0 // analog input of the heart monitor
#define GPIO_PIN_P3 3 //digital input from LO-, should be set LOW (enabled)
#define GPIO_PIN_P4 4 //digital input from LO+, should be set LOW (enabled)
// define the settings for digital inputs and configure them
#define GPIO_SETTING GPIO_INPUT_LOW | GPIO_INPUT_HIGH
gpio_configurePin(GPIO_PIN/8, GPIO_PIN_P3, GPIO_EN_INT_LEVEL_HIGH | GPIO_PULL_DOWN | GPIO_INPUT_ENABLE, GPIO_PIN_OUTPUT_LOW);
gpio_configurePin(GPIO_PIN/8, GPIO_PIN_P4, GPIO_EN_INT_LEVEL_HIGH | GPIO_PULL_DOWN | GPIO_INPUT_ENABLE, GPIO_PIN_OUTPUT_LOW);
//set up an interrupt (rising) if GPIO_PIN_P3 or GPIO_PIN_P4 is HIGH, send interrupt
gpio_configurePin(GPIO_PIN/8, GPIO_PIN_P3, GPIO_EN_INT_RISING_EDGE, GPIO_PIN_OUTPUT_LOW);
gpio_configurePin(GPIO_PIN/8, GPIO_PIN_P4, GPIO_EN_INT_RISING_EDGE, GPIO_PIN_OUTPUT_LOW);
Also, (C) to get 3.3 output voltage to be able to power the AD8232. Do I need to change the tiny resistors RFB1 to = 470K ohm and RF2 to= 150Kohm , C2 = 100 pF as suggested in the Hardware User Manual?
Then, I can use Heart Rate Monitor App example on WICED Smart IDE : first by including:
#include "adc.h" // added to enable converting analog Input to digital
#include "gpiodriver.h" // added to enable using P0 and P1 pins
and adding some commands to handle ADC conversions: before the line: blehrm_connDown();
Also, inside the function: heart_rate_monitor_create(void), we add:
// configuring the ADC converter
and set the sampling frequency and reference voltage for ECG signal by adding the following commands:
// Setting the sampling frequency to be 11.7 KHz
ADC_SAMPLE_FREQUENCY sample_frequency = ADC_SAMPLE_FREQUENCY_MEDIUM_LOW; // instantiate an onject.
adc_setAdcSampleFrequency(sample_frequency); // setting the sampling freq
UINT32 refVoltageInMicroVolts = 10; // setting the reference voltage for the ECG
ADC_INPUT_CHANNEL_SEL referenceInput = GPIO_PIN_P0; // selecting the input channel
ADC_INPUT_RANGE_SEL input_range = ADC_RANGE_0_3P6V;
Also, in the main program, I need to read the ADC voltage by calling:
UNIT32 ADC_reading = application_read_adc_voltage()
and Reads the voltage from any ADC channel from Po of the GPIO:
Does this seem right?
Your advice is highly appreciated.