How to code an ECG (Electrocardiogram) click 3 using STM32F446RE?

Good morning Sir
Thank you so much.
Ok, I have done the connection on a breadboard for now. But still having wrong values with the ecgData and the outRR. Talking of the heartbeat rate, it is varying between 60-72 bpm .
But was wondering about my connection , I have only connected the 6 pins on the left of the ECG 3 click (from GND to CS) to the STM32F446E , I have not touched the right side. Is it the right connection ?

In addition, I have noticed that the output generated by the terminal or console stops generating after 4 or 5 minutes . Why is it like that please ? is it not supposed to continuously generate till I decide to disconnect my board ?

Thank you .

Morning,

How you can see in the schematic - ecg-3-click-schematic-v102 (mikroe.com), most of pins, on the right side, are not connected. And the rest…

  • CLK is required only when you want use it with an external clock signal - CLK SEL = EXT
  • 5V only if you want to power it with 5 volts - PWR SEL = 5V
  • INT can be used as trigger for your board via interrupt handling, but it is not necessary

ECG 3 click use MicroBus standard, that is why here is more pins than it is used. It is compatible with all Microe products.

You need to determine what is the source of this issue. PC side or Nucleo.

  • When you close and reopen the terminal app, will it work again?
  • When the output stops, what do the green led?

Ok, and the heartbeat rate corresponding with the reality?

BR, Jan

Hello Sir

Ok, so what is the issue with the other reading ? The ecgData and the RR ? If the connections are correct , what can it be the issue ?
Yes, the heart beat rate corresponds to the reality.

  • I might say it’s the NUCLEO , because before it stops generating values , the RGB LED on the board will be blinking as if a new .bin file is being sent to the board .
    _ Yes please , It works , I have to close and OPEN the software again before it works
    _ The green LED continuing blinking with an interval of 3 seconds, but this time round even throughout the intensity is very low .

What does it mean if the intensity is very low ?

Thanks a lot for your help.

That it is cool the heart beat rate is OK . With the rest it will be hard, maybe tomorrow I will try some changes in library, I will let you know. But it will be probably about configuration, I think.
You can look into the init method in the library and if you know what you want then you can to set it - page 26+ of MAX30003 - datasheet

That blinking of RGB led, on the ST-link, mean St-link connection initialization. That seems like…

  • power source issue on USB port
  • broken USB cable
  • But probably… check this topic

You need to change the value in wait(3) (3sec) function. Normally it run much faster, maybe 100ms or something like that.

BR, Jan

Good morning Sir
I’m grateful for everything , you are such a great help. Thanks a million

I have checked the datasheet and the library , everything was perfectly done, registers were well assigned . But I have realized from the datasheet that ECG burst and the ECG (FIFO memory) could read ECG voltage sample data , so I decided to read the ECG values from the ECG burst register , I have then changed the address 0x21 to 0x20 . So the output this time is not that bad , it seems to be okay, but I want to confirm it first. And want to do more experiment to see if it will continue working perfectly.

But please Sir, you can still try what you wanted :slight_smile: , I want to be sure , I have not made any mistake.

Ok Sir , will work on it and get back to you please. Thank you so much

Oh okay, I was referring to the brightness of the LED. it is very low …

Ah, ok I misunderstood. I do not know the reason for lower brightness. Maybe it is in the context of resets of the board.

BR, Jan

Good day Sir

Please I have been testing the code as I promised, but still it is not perfectly giving results was expected. When I plot the generated values, it does not generate a perfect or like shape of heart beats. I tried my best to adjust it throughout the week but still getting same results. So was wondering if there is still something you can try to help ?

Thank you Sir.

Hello,

trully I do not know, I do not have this hardware in my hand so I can not test it.
From my point of view, when you receive some data, then the communication is OK and it is only about settings in registers, maybe about frequency of reading - for example.

You can try to read only getRTOR and then only getECG, if there is a difference.

BR, Jan

Good day Sir.
Sorry for this again.
Like the reading for Heart beats rate is correct, as well as the R-R interval . Only the ECG reading is not correct. And that is what I really want to displayed. It gives this huge number 262042.

Thank you Sir, I did not see much on getRTOR and getECG. But I have read the plotECG () , And I have written an ECG function accordingly as well to see if it will generate good result since the condition in the function is if (ecgData>50000) but still not getting any good result , kindly check my code below to see if I have made some mistakes

uint32_t ecgData = 0;
uint16_t outHR = 0, outRR = 0;
char text[ 50 ];
uint32_t measTimeCnt;

void plotECG()
{
if (ecgData > 50000)
{
//Convert long unsigned to String
sprintf(text, “%lu” ,ecgData );
sprintf(text, “%lu” ,measTimeCnt );
printf(“$ECG: %zu;”,text);

    if (measTimeCnt == 0xFFFFFFFF)
    {
        measTimeCnt = 0;
    }
    else
    {
        measTimeCnt++;
    }
}

}

int main()
{
printf(“ECG_example\n”);
DigitalOut led(LED1, 1);

printf("Init\n");
SPI spiBus(D11, D12, D13);
ECG_3_click ecg3click(spiBus, D10);

printf("swReset\n");
ecg3click.swReset();
printf("fifoReset\n");
ecg3click.fifoReset();
wait(5);
printf("init\n");
ecg3click.init();
printf("Start of loop\n");


while(1)
{
    led = !led;
    ecg3click.getECG(&ecgData);
    plotECG();        
}
        
    wait(5);

}

Thank you for your help

Hello SIR
Please can you help me with a suitable library to program my GSM-GPS click sim808 which can send SMS and get exact location ?

Hello,

I already made an answer

BR, Jan