# Negative voltage on ADC (ARDUINO MEGA 2560)

Hello all,

I have a sinusoidal signal varying from 5V to -5V (50Hz with no offset) and need to convert it to a digital value. I think I can't just plug the signal to the ADC input since negative voltage would destroy it. Am I wrong? Is it still possible to use the ADC?

Thank you!

You are correct: do not apply negative voltages to the ADC input (or any pin).

You will need some kind of interface circuit to translate -5V<–>5V to 0V<–>5V for use by the ADC.

The Rugged Circuits Yellowjacket: 802.11 WiFi module with ATmega328P microcontroller, only 1.6" x 1.2", bootloader

Wondering with my limited, "I've been learning" knowledge. Could he put the signal into 1 op amp that adds a stable +5 volts to the signal (therefore its always over 0) and then put that into a division op amp circuit and divide it by 2 so its output ranges from the 0- +5 volts the arduino needs?

Thanks for your reply. What is the best approach? To use a capacitor to avoid any DC offset, followed by a voltage divider and finally by a voltage buffer?

If you need “zero-crossing” detector, use a resistor 10 kOhm or so to limit a current. Polarity is not an issue for < 1 mA current, there are build-in protecting diodes in microcontrollers.

What is the best approach? To use a capacitor to avoid any DC offset, followed by a voltage divider and finally by a voltage buffer?

That's not going to work too well at 50 Hz as you'll need a really big capacitor (since capacitors are high-pass filters). At 50 Hz a 100uF capacitor has an impedance of 32 ohms, which isn't too bad as long as your voltage divider resistors are quite a bit higher.

I forgot that we actually posted a sample circuit a while back that does exactly what you requested, without the blocking capacitor:

http://ruggedcircuits.com/html/circuit__25.html

Hope that helps...

-- The Flexible MIDI Shield: MIDI IN/OUT, stacking headers, your choice of I/O pins

Many thanks for your replies. RuggedCircuits sample circuit would work like a charm but, unfortunately I do not have free space to mount it on my custom board. I am thinking of following Magician suggestion or, to use a diode with 0.3V as forward voltage in order to process only the positive part of the signal (affected by a 0.3V voltage drop from the diode).

Thanks for your reply. What is the best approach? To use a capacitor to avoid any DC offset, followed by a voltage divider and finally by a voltage buffer?

I should think a simple circuit as follows would work ok for your app, assuming the audio source has a reasonably low output-impedance.

``````                        +5V
|
10K
|
--- 5.1K ---+--- 10uF ---+----- A/D
|
10K
|
gnd
``````

If you try it, tell me how it works, as I plan to use it myself soon.

Globe,

What kind of "information" are you trying to get from this signal?

Since you seem to already know it's 5V (peak-to peak?) at 50Hz, I'm pretty sure you don't need the negative-half of the waveform. And, since you know it's 5V, the 0.5 to 0.7V drop across a diode shouldn't be an issue either.

If you're looking for the zero-crossing, a diode will mess that up slightly, but that's no big deal because the time between the zero crossing and any phase angle along the waveform is constant. You can calculate it, or write some experimental test-code to find the timing that works best. And, you don't need to sense both positive-going and negative-going zero-crossings, because once you find one zero crossing, you know the next one is coming 1/100th of a second later.

Many thanks for all your replies :D !

The signal I am trying to digitally convert is a 10V peak-to-peak (-5V to +5V) 50Hz sinusoid and I need to calculate its Vrms. Since I do not have free space on my board, I'm thinking on processing only the positive part of the signal.

Magician:
If you need “zero-crossing” detector, use a resistor 10 kOhm or so to limit a current. Polarity is not an issue for < 1 mA current, there are build-in protecting diodes in microcontrollers.

Is a voltage difference of -5V in series with a 10kOhm resistor (to limit the current) a trouble for the ADC?

I have a device that gives me the an AC voltage on a 50 Hz sinusoidal signal varying from -5V to 5V. What I want to do is to calculate its Vrms so I can measure the current across a 50 Ohm resistor connected to its terminals. After reading Magician post I was about to connect a 10kOhm in series with the circuit I described. Hence, I would like to know your opinion: is it dangerous for the ADC (considering the negative part of the signal 0V to -5V)?