image-20231209214526509

image-20231209214545232

Worked well with my AWG and oscilloscope.

Did not work as well when I connected it to a floating function generator and through an Arduino to a laptop. The signal stayed between about 2-5V where I hoped for the full range of 0-5V. Aside from that, the tunable amplification and level shifting did work.

Solved the problem! I should not connect the Arduino's ground to -4 V when using an 8 V battery. When I want the virtual ground to be in the center, the Arduino's ground should be at -2.5 V! So I added in a voltage divider to make that happen.

This is what it looks like now:

image-20231216213436385

image-20231216213550374

Pull down against floating static

One more improvement! I later added a 1M pull down resistor from the signal IN to the Arduino's ground. When the IN signal is turned off the signal at the Arduino's A0 pin goes to -0.3 V DC (not sure why this value, I measured it on my scope), which I assume won't hurt the Arduino. This fixes the (possibly harmful relatively high voltage) 'static' that the Arduino sees when the IN is left floating.

AWG at 2 mVpp

When using my AWG with an input signal of 2 mVpp (it won't go lower) the waveform is clearly visible to the Arduino as a sinewave but with some noise (presumably environment mains noise, or through the AWG which is grounded to mains). But I have no way of testing this away from mains as my floating function generator is set at a fixed 200 mVpp.

Next step is trying to measure my heartbeat again. I did that using these clamps (which I thought were finger clamps when buying them but they are actually sized to go around a wrist). I placed one on each of my wrists during this test.

Set met 4 klemelektroden voor de ledematen

I also did the measurement far away from any mains wires and devices to prevent any noise. What I got in the end (forgot to screenshot) was a graph that I am convinced did show a heart rate, it was faint but still showed a distinct repeated pattern (but I guess I forgot to make a screenshot...).

Now to improve my circuit, I am thinking about:

It occurs to me the I thought of a ECG signal as AC when in reality (according to this page) it is a signal between 0.5 and 5 mV.

The front end of an ECG must be able to deal with extremely weak signals ranging from 0.5 mV to 5.0 mV, combined with a dc component of up to ├▒300 mV-resulting from the electrode-skin contact-plus a common-mode component of up to 1.5 V, resulting from the potential between the electrodes and ground. The useful bandwidth of an ECG signal, depending on the application, can range from 0.5 Hz to 50 Hz-for a monitoring application in intensive care units-up to 1 kHz for late-potential measurements (pacemaker detection). A standard clinical ECG application has a bandwidth of 0.05 Hz to 100 Hz