Hello, essentially I'm trying to create an ECG monitor that displays a heart waveform on Serial Plotter.
void setup() {
// initialize the serial communication:
Serial.begin(9600);
pinMode(10, INPUT); // Setup for leads off detection LO +
pinMode(11, INPUT); // Setup for leads off detection LO -
}
void loop() {
if((digitalRead(10) == 1)||(digitalRead(11) == 1)){
Serial.println('!');
}
else{
// send the value of analog input 0:
Serial.println(analogRead(A0));
}
//Wait for a bit to keep serial data from saturating
delay(1);
}
We are using Arduino UNO and have tried changing wires, electrode placement and laptops already, yet we cannot produce a signal (not even a noisy signal).
Any ideas on why this is happening would be greatly appreciated!! Thank you
Thanks for that. I can't see anything obvious wrong, but solderless bread board is notorious for not making reliable connections so you could try very small pressure backwards and forwards on the pins and connections.
This bit doesn't look right to me:-
For a start is is saying if pin 10 or pin 11 read a logic high then there is something wrong with the reading. Then if it is it prints a "!". That is only going to upset a display being sent to the serial plotter.
I would try things without this test first. Just take the A0 reading and plot it. Also it could be too fast to see, so change that delay(1) to something bigger.
Failing that it is likely to be down to the electrodes and the placement of them. Are you using KY jelly or some other water based lubricant, on the pads to get a better contact. That is what they use in UK hospitals. I was given half a tube by a nurse in the mid 70s when I was doing experiments with picking up brain waves and feeding it into an analogue synthesiser.
It was only later that I learned what other use this was put to.