Ecg circuit + arduino simulation

Hi can anyone help me with coding for ECG that i tried it..my oscilloscope from proteus just blank

const int ecgPin = A0;  // Define the analog pin connected to the ECG circuit output

void setup() {
  Serial.begin(9600);   // Start the serial communication at 9600 baud rate
  Serial.println("ECG Monitoring Started");  // Print a message to indicate the setup is complete
}

void loop() {
  int ecgValue = analogRead(ecgPin);  // Read the analog value from the ECG circuit
  
  // Print the value to the serial monitor for debugging
  Serial.print("ECG Value: ");
  Serial.println(ecgValue);
  
  delay(100);  // Delay to control the sampling rate, adjust as needed
}

Your topic does not indicate a problem with the IDE and hence has been moved.

Your schematic shows the input of the op amp circuit connected to analogue input A0.

You need to have the output of the circuit connected to A0.

Are you trying to generate an ECG signal or read an ECG signal?

The normal heart rate is typically between 60 and 100 beats per minute.
At the higher rate of 100 bpm, the period is 0.6 seconds.

In your code there is a delay of 100ms. This means that you are only taking 10 readings per second.

At 100bpm, you are only taking 6 readings per beat of your heart. This will give you poor resolution when plotting the output on the serial plotter.

So my op amp U2 output have to connected with pin A0

If can I want both but the important thing generate ECG signal

Your code certainly does not do that and the circuit is of course wrong.
Have you googled Arduino ECG (or EKG) simulator?

There is more than enough information here, even a proteus simu:

No, I would connect the output of the second stage U1 to input A0.

ECG circuits normally have a high gain to amplify the small voltages picked up by electrodes attached to the body.
Your circuit has no gain.

Why do you have R3 connected to -2.5V?
This will add a negative offset to the output voltage. An Arduino ADC can only measure positive voltages.

Hello. Now I have the same problem. Now I am working on my project about generate ECG signal with arduino and I want to see some material which can help me and inspirate for start with my project. Do you finished some work if yes could you send me some of it? I would be very grateful.