# how to separate a analog sine wave to positive and negative using ADC and DAC? [closed]

I have an AC signal which is 20V peak to peak and has a frequency of 200kHz. I am interested in reading this into an ADC.

I am not familiar with how this is done and would like some tips. How do I deal with reading the negative signal into an ADC? Do I need to scale the voltage? If this is possible, what kind of error can I expect?

## closed as too broad by Neil_UK, PeterJ, Daniel Grillo, nidhin, AutisticFeb 14 '16 at 7:14

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• You can do the same thing with a couple of diodes, or opamps if you need better accuracy. – Jon Feb 9 '16 at 18:22
• It doesn't make any sense to do just a rectifier in the digital domain if you want the result in the analog domain. There are plenty of opamp-based "precision rectifier" circuits (just Google that phrase, or search for it here on EE.SE) that will do a better job purely in the analog domain. And in any case, your question can't be answered unless you provide some details about the voltages, frequencies, etc. that you're actually working with. – Dave Tweed Feb 9 '16 at 18:23
• If you are going to try this beyond 50kHz, you are going to have trouble. – laptop2d Feb 9 '16 at 18:27
• What you want to do is possible, but you did not specify any conditions. We can't design your circuit for you and it makes it difficult to answer such a broad question. – laptop2d Feb 9 '16 at 18:30
• @laptop2d Agreed. I took a stab, but we need to know what kind of signal is being sampled. What's the voltage and frequency you are referring to? – mcmiln Feb 9 '16 at 18:34

I will assume you want to read in a sinusoidal signal and leave it at that. This can be done with an ADC.

First, you need to know your resolution. If you get an X bit ADC then you have 2^X bits to work with. If your micro is being powered off a 5V supply, then 5V/(2^x) = V resolution. Essentially you are binning it and the more bits, the better resolution.

Once you have that, you look at that operating voltage again. If you have a 5V supply, then you need to supply from 0 to 5V to the ADC. You can't supply negative or over 5V. You will get peaking and/or damage your circuitry. So if you are supplying 0 to 5V of a sinusoidal wave, then you want to be centered around 2.5V with positive and negative peaks of 2.5V from center. This is a full 5V peak to peak voltage within your bounds.

If the voltage is small, then you would amplify it to reach this peak to peak, cut any DC offset, and add your known offset using a voltage divider between power and ground. This is just an example, but I have attached a sample circuit to show you the signal in and the voltage divider for offset.

Your main problem comes with the sampling of high frequency as has been pointed out. This is not going to be possible with most micros, but I don't know what frequency you are referring to.

EDIT: Based on more info given - Rather than sit here and spout a ton of info, because this is abroad topic, I will give you an overview. You need to shrink your signal. The best way to do this is with a buffer opamp. This will waste less power than other methods. See the below documentation and related question... http://www.ti.com/lit/an/sloa098/sloa098.pdf

How to read high voltages on microcontroller?

The stack exchange question shows you a method for diminishing your voltage, but you still need to get your voltage over 0. I gave one method for shifting up above, but there are others. You will have no problem finding the parts if you search buffer opamp, and then just match the input voltage to the opamp, the input resistance from the opamp to the ADC, and make sure not to exceed your micro's max input voltage.

• For an example of a high frequency ADC, check ADS5474 – mcmiln Feb 9 '16 at 18:33
• Thank you so much, my signal is not high amplitude signal but it has negative side as you mentioned i should use divider as you showed in the picture. in terms of frequency maximum frequency for my signal is around 200 kHz. is it possible to do it by high accuracy? – Diana Feb 9 '16 at 19:27
• Phrases like "not high amplitude" and "by high accuracy" tell us absolutely NOTHING about your requirements. Something that seems "high" or "low" to you could be completely different to someone else. Use numbers! Just as an example, I work with high-definition video signals at 148.5 MHz, which get serialized into a 3 GHz data stream, so your 200 kHz seems glacially slow to me! – Dave Tweed Feb 9 '16 at 20:27
• @DaveTweed Absolutely true. What we really need is a Vpp and your required accuracy so we can tell you if this needs an external ADC, if it exists with your speeds, etc. – mcmiln Feb 9 '16 at 21:12
• i got your point and i can say that vpp is maximum 20. which frequency is up to 200 KHz. – Diana Feb 9 '16 at 21:14