Disconnecting Thermistor
Last week I've noticed some noise on ADC port, which was connected to thermisotor. This week I’ve removed two connections between ADC and the thermistor by unsoldering R36 and R37.
Connecting Heartbeat Sensor
This allowed me to use P10_1 and P10_2 for other sensors. I’ve connected my heartbeat sensor output to P10_2. And I’ve connected P10_0 to the sensor ground line and P10_3 to the sensor VDD line.
Adding Power to the Sensor
I’ve modified the code to power on the sensor by configuring GPIO P10_0 and P10_3 to low
void set_my_pins_on(){
cy_rslt_t rslt;
/* Initialize pin P10_3 GPIO as an output with strong drive mode and initial value = false (low) */
rslt = cyhal_gpio_init(P10_3, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, false);
if (rslt != CY_RSLT_SUCCESS)
{
printf("P10_3 failed to set up");
}
/* Initialize pin P10_0 GPIO as an output with strong drive mode and initial value = false (low) */
rslt = cyhal_gpio_init(P10_0, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, false);
if (rslt != CY_RSLT_SUCCESS)
{
printf("P10_0 failed to set up");
}
}and than toggling P10_3 to high. So the heartbeat sensor LED is now light up.
set_my_pins_on(); init_adc(); cyhal_gpio_toggle(P10_3);
Running the heartbeat sensor on CY8CPROTO-062-4343W
After all initial configuration has been done I've run some tests. The objective of this tests is to identify a strategy to deal the noise on ADC channel.
#define ADC_SAMPLES 16 int int_dec = ADC_SAMPLES; static long accumulator=0L; void read_adc() { /* Read the 16 bit ADC conversion result for corresponding ADC channel */ uint16_t adc_out = cyhal_adc_read_u16(&adc_chan_0_obj); accumulator += adc_out; int_dec--; if (int_dec == 0) { int_dec = ADC_SAMPLES; printf("%hu\r\n", accumulator / ADC_SAMPLES); accumulator=0L; } }
I've stored results into Excel and visualized them on line diagrams. Here is one of such test, where I'm using 16 samples from ADC reads to reduce noise.


