Background
Cardiovascular diseases take a life every other second. A large proportion of these deaths happen to healthy people who could have survived with simple diagnostics and medicine. An ECG is one of the most useful cardiovascular exams. In most cases, it is sufficient to detect diseases, is safe, and simple to administer. My aim with this project was to create an ECG machine that was portable (battery-powered and phone operated) and low-cost.
V1
V1 started off pretty simple. I had no idea how an ECG worked, but I knew the objective was to measure millivolt signals, so I just perfboarded some op-amps with low and high pass filters.
This design was so susceptible to noise that I thought it completely didn't work. But one day I had the idea to turn off the main breaker for my apartment for a short moment and test the ECG, and I was able to see something close to an ECG waveform. This made me realize that the design, in theory, worked and I just had to work on minimizing noise.
V2
For V2, I wanted to use some more precise and lower noise components, and as they were SMD components, I decided to manually make a PCB using ferric chloride.
Noise still totally polluted the ECG signals, but I was able to notice something close to a waveform, so I knew that lowering noise was the path forward.
V3
For V3, I decided to make a proper PCB and put an MCU in the same board, so that the device could work standalone. After testing the new board, I realized that I had to make some changes to the power supply, so I made a bodge board to create the needed split-rail supply. I also used shielded cables to connect the electrodes to the ECG, so noise was reduced even further.
This design worked quite well. I could record proper ECGs.
V4
After verifying that V3's design worked well, I designed a new board with some bug fixes I discovered in V4 and I added a battery I took from a phone power bank.
V5
After V4, I wanted to create an even better ECG that could pass regulatory tests. For this, I took another route. Instead of using standalone op-amps to amplify the ECG signals, I decided to use an ASIC from TI that combined a programmable gain amplifier with an ADC and some right-leg drive circuitry in one single package. This was only a couple of dollars more expensive but saved on board space and provided better accuracy and lower noise.
An ECG machine requires very stringent levels of isolation (2xMOPP) between any external power / signal source and the patient. It would have been expensive to design a power supply that provided this level of isolation and could also power the entire board, so I decided to take another route: I only isolated the analog front-end and used optocouplers to let the ASIC communicate with the MCU through the isolation barrier.
This version worked great and I could record clinical-grade ECGs.
Final schematics & PCB
Software
The ECG machine was controlled with a React Native app. The device would stream data to the phone using BLE, process the signals to extract measurements, and would then save the exam to the cloud. I used MongoDB and Firebase Functions for the back-end.