The Story of My ECG
Saga 3 - Analog, no one likes analog
The weird thing about me is, I like analog circuits. I used to design them (old job) and just find them very fun. So at first glance, I thought this circuit would be a piece of cake. I quickly drew up a design and built the circuit. Little did I know how difficult it would be. I won't bore you with the details, but here are only a few of the complications I encountered.
Offsets are evil, and noise...that just sucks
Each op-amp has its own characteristic input offset. For the particular op-amps I had, they were in the range of 3-5mV. That doesn't sound like much, but when you consider that I'm trying to detect voltages in the range of 1mV, you see my predicament. The input offsets of the op-amp were eating the range of my output. Thus, the output would always rail.
The other problem I had was the evil noise that came through the wire. The electrode wires were several feet long, so it gave plenty of opportunity to pick up noise. The shielding helped a lot, but there was still a lot of noise from my body picking up energy. I tell you, it's all a conspiracy!
My guess is that you don't want to know the details on how and why I chose certain parts of the circuit. A lot of it was chosen to defeat the problems I encountered above. Therefore, the final analog portion of the circuit is:
Of course, to get a bigger one, please click on the image. Graphic is courtesy of EAGLE (a free schematic tool)
Hey! Some things changed!
After some really good comments from other people, I decided to add a few components for extra safety. It didn't cost much more and makes things quite a bit safer. The changes from my last design are:
Diodes across every input to decrease the risk of shock. By doing this, the maximum voltage across any two electrodes will be .7V. This is much higher than the heart signal, so it won't effect any other performance.
Resistors on the input of the amplifier. This is to reduce shock hazard. If the op-amp fails and creates a direct short from the input to the supply, the extra resistor will offer the second layer of defense. (Redundant backup is gooooooood).
I really want to know why you did ______
A few of my design choices may seem odd. Here's some of my reasoning. I wanted my ECG to be relatively safe and easy to construct. I could have used a +12V supply and a -12V supply, but that would require two power supplies, or two 12V batteries. I decided that a 9V battery is pretty safe considering how many people have licked them. Therefore, I chose to power this thing by a single 9V battery! Thus, you see a reference to a VDD/2 node. This is basically an op-amp configured as a buffer to provide a constant 4.5V voltage. Therefore, removing the need for two batteries. (Admit it, I'm brilliant - okay, this type of thing is done all the time).
Next, I chose 100k resistors as the standard because I wanted this to be low power. 100k was also the largest resistor I had which was plentiful. I also had a lot of 1k, 10k, and 4.7k Ohm resistors. So I had to design everything around that. Back to safety. I needed to bias the body to some constant DC voltage, but I wanted that to be as safe as possible. Therefore, I put a 10k resistor before the connection to the body so that if I happened to touch some bad node, the currents would be small. I didn't put the same resistance on the electrode inputs because the inputs to the op-amp have around 10^12 Ohms of resistance. I think 10^12 resistance is big enough. Someone emailed me on the problem with my thinking. Extra resistance on the inputs would be good because a JFET is only high resistance going one way. A good power surge coming back won't see the 10^12 ohm resistance. So people - you may want to add some to that input.
If you would like more explanations on why I did something some way, I'd be happy to tell you. However, I could spend days on this topic and like I said above, not everyone wants to hear it. The basic point is, I wanted someone who had little knowledge in electronics to be able to build this. It should be fairly safe and require no fine tuning. It may not be perfectly accurate, but you don't need to buy .01% tolerance parts.
Quite a few people are concerned about safety with this circuit. I am too. I was 99.9999% sure that my configuration would not hurt ME. I don't have any possible other ground node around me, and so the only real way I could get involved in a ground loop is by going out an intentionally try to make one.
If you do not understand the need for isolation, you shouldn't be building this project. I will refresh the memories of the people who may not know what I mean. The computer is connected to a 120V power source. Say something goes wrong and that 120V gets injected back into the analog circuit above. Although the op-amp should prevent anything from coming back, there is a possibility it will fail and send 120V to your chest.
Another example is: say the ground of the computer isn't quite ground (say it's 50V). (House is wired up wrong or some other bad reason). Since there is a direct connection to the battery (-) terminal, the whole system goes up to 50V, including your body. If at the same time you touch something that is truely at ground, the current will flow through the electrodes and into the true ground. Potentially killing you.
Therefore, the suggestion for optical isolation (optocoupling) is very warranted! The reason I cannot put it on my web page is a) I don't know how to make a linear optoisolator, b) I have not tested any method to isolate the analog portion from the computer. As soon as I come up with a good isolation technique, I will post it. But this won't change my stance: Don't attempt this unless you know what is going on!
Now I'm depressed. Aren't there some workarounds?
Yes. Someone else suggested that I use a portable tape recorder to record the signal out of the analog circuit. This would benefit with a completely isolated system, and I could play it back later.