# using Atmega328p and its ADC to read both negative and positive values

I am currently working with a Heart Pulse Sensor I am using a 0-9v supply voltage which is capped at 5v using a voltage regulator 7805. The 5v powers up the ATmega328P as well as the Heart Pulse Sensor. When measuring the signal from my pulse the voltage ranges between 2.5 to 3.5 v approx, however, the signal has a min voltage of approx -1 to 2.5v. Now since the signal is an analogue signal i am required to use the ADC to convert the values and act upon them. The ATmega328P does not have the differential of negative or positive voltage reference. Therefore, i am forced to do something about it. I was thinking of using a potential divider and a pot to add some DC on to it making a composite signal and letting it rise above zero.

Is it possible to do this using the 5volts supply, or do i need to make this supply voltage from negative to positive... say -9 to 9v?

And what other recommendations can you give to fulfill the requirements regarding the approach?

## 1 Answer

What you're looking for is AC-coupling.

Since you don't care about the DC-content of your signal, you can simply use a capacitor to transfer the signal to any other voltage level, as for example provided by a voltage divider bias: simulate this circuit – Schematic created using CircuitLab

This will place the ADC input in the middle of the ADC range if there's no external signal present, and will make it oscillate around that if there is external signal. The values of C1 and R1, R2 depend on the frequencies you want to let through, and how the sensor is driving its signal output – what you're building here is effectively a RC-highpass filter.

• Hi thanks for you reply, i really appreciate you interest. – J.Mauro Jan 16 '17 at 20:08
• This means that i would need a voltage supply that originates from -5v to +5v right? my current supply of 0 to 5 volts can only be used for the rest of the MCU, correct? – J.Mauro Jan 17 '17 at 16:44
• That depends. The 5 V were just an example. ADCs usually have a separate power supply to set their "maximum value". – Marcus Müller Jan 17 '17 at 16:47
• Oh ok i understand thanks again for your help. Im still waiting for my sensor to arrive since i burnt the last 1! Reverse current i assume. – J.Mauro Jan 20 '17 at 3:21
• hi, I attempted this using the following, the period for my signal was 795.8ms. 1/period = 1.2566KHz, therefore, my cutoff freq at 1KHz assume is approriate, and can be obtained using the Fc = 1/RC, 1/ 10k * 0.1uF = 1k. using R1 with a 10K to divide the 0-5volts exactly by half, and my sensor once again is damaged. lol. Any ideas why this might be? – J.Mauro Feb 1 '17 at 12:40