Adding DC offset to AC signal (ECG signal)

Thread Starter

Dusan123

Joined Aug 7, 2023
5
Hey all, first time posting here, and I need your help! :)

I am making an ECG circuit and I want to connect my ECG to a microcontroller. The ECG signal has both negative and positive values so I can't directly connect it to the microcontroller. For this reason, I am designing a circuit that will add adjustable DC offset to the signal so the signal never goes below 0V.

So here is the problem, I made the circuit and it adds 2.5V DC offset (I will make it adjustable by simply putting variable resistor instead of regular one) to the signal correctly but for some reason it also weakens the amplitude of the original AC signal (picture). The blue graph is signal before adding the offset and the green is after. You can see in pictures how the amplitude of the AC signal is weaker.

Why does this happen? What am I doing wrong? Can someone explain to me how to do this without losing amplitude of the AC signal? Lastly, if this is not the optimal solution for my problem, can you guys give me the better solution, I would really appreciate it.

Thank you very much!
 

Attachments

Thread Starter

Dusan123

Joined Aug 7, 2023
5
Also I should add that the whole point of the last few steps I am doing is that I want to be able to adjust my signal to be 0V-5V so I can hit the full resolution of the ADC. For this reason I added adjustable gain step before the circuit in the picture. That way i can control both the amplitude of the signal and the offset and make signal be 0V-5V.

Just thought I should clarify this so people can give me better solutions if mine is not optimal hahah.

Thank you!
 

Ian0

Joined Aug 7, 2020
8,942
You have succeeded in building an attenuator. Your circuit divides the signal level by two.
To understand it think of it as an AC signal. From the point of view of an AC signal any fixed DC voltage is earth, so you have two resistors of equal values from the signal to ground, so the output is half the original signal.

Bias the input of your op-amp to half supply using two high value resistors, one to 0V and one to 5V. The couple the signal to the op-amp input using a capacitor. You will need a large value capacitor because you need all the frequencies above 1Hz. (60 beats per minute)
so C=1/(2πfR) Where R is half the value of the high value resistor you chose. Half the value because from the point of view of an AC signal the two resistors are in parallel to ground (because any DC level is ground to an AC signal); an f is a frequency well below 1Hz, say 0.1Hz.
 

Thread Starter

Dusan123

Joined Aug 7, 2023
5
You have succeeded in building an attenuator. Your circuit divides the signal level by two.
To understand it think of it as an AC signal. From the point of view of an AC signal any fixed DC voltage is earth, so you have two resistors of equal values from the signal to ground, so the output is half the original signal.

Bias the input of your op-amp to half supply using two high value resistors, one to 0V and one to 5V. The couple the signal to the op-amp input using a capacitor. You will need a large value capacitor because you need all the frequencies above 1Hz. (60 beats per minute)
so C=1/(2πfR) Where R is half the value of the high value resistor you chose. Half the value because from the point of view of an AC signal the two resistors are in parallel to ground (because any DC level is ground to an AC signal); an f is a frequency well below 1Hz, say 0.1Hz.
Thank you, I made the circuit the way you described it and it works! I can't believe it didn't occur to me that I halved the signal because of that hahahah!

One more question, is it possible to make the circuit adjustable (to add any offset 0-5V) just by replacing one of the resistors with a variable resistor or does that introduce some possible problems in the future? I tested it and it seems to work just fine and the DC offset changes as desired.

Thank you!

P.S. Picture of the circuit is uploaded.
 

Attachments

Ian0

Joined Aug 7, 2020
8,942
You can replace both of them with a single pot.
However, if you do that, the highest and lowest settings are not useful, so putting the pot between the two resistors, and the input signal to the wiper would be better.
 
Top