# Problem With Dual Polarity Signal

Discussion in 'Embedded Systems and Microcontrollers' started by Shear_Intelligence, Jul 22, 2013.

1. ### Shear_Intelligence Thread Starter New Member

Jun 10, 2012
29
0
Hi There,,

Well for my project i need to convert non-pure sine wave from analog to digital i'm quite okay with converting single polarity signals e.g from sensors, but i'm confused how do i convert dual polarity signal.

PS: i'm using AVR atmega16A, i have to use it's internal ADC.

2. ### John P Senior Member

Oct 14, 2008
1,601
213
The quick and dirty method is to set up a voltage divider with two resistors, one driven by your sine wave and the other connected to the processor's power supply, and the A/D input taken from the junction point between the resistors. You have to choose the ratio of the resistors so that the A/D always sees a positive level, and you have to allow for the fact that the average level of the signal will be based on the resistors and the actual voltage level of the power supply.

The more elegant way to do it is use an op amp circuit, which would let you place the incoming signal so it's centered at half the A/D converter's range, and the amplitude could be set to give you best accuracy.

3. ### Shagas Active Member

May 13, 2013
802
74
ITS*

----------------------

Should work ..

4. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,279
1,559
I doubt that. (With vin = vout why would you expect anything else?)

If you have your A2D voltage source handy, make a voltage divider of equal values to ground. Connect the signal thru a cap to the junction and that becomes the offset signal point.

Resistor value should be at leat ten times the source resistance, and the cap value large enough to pass the lowest frequency.

5. ### Shagas Active Member

May 13, 2013
802
74
Yes , forgot to add a voltage divider

6. ### Shear_Intelligence Thread Starter New Member

Jun 10, 2012
29
0
okay i will simulate it and practise for it, but how do i program it? because A2D of avr will always find +ve voltages so how would i program it?

7. ### Shagas Active Member

May 13, 2013
802
74
Well what are you even planning of doing with your sin wave conversion?
What is the range of the sin wave? You might want to amplify it so it has a range of 0 to 5 volts (NOT more than that! and assuming that you are using 5v for your micro)
Otherwise you can give the adc a diffrent Vref. There is a special pin for that.

I haven't tried the circuit that I drew on the breadboard but I think it should work fine and you should get a 0 to x voltage which you can feed to your adc . But again .. you should note the range that your sin wave is at

8. ### Shear_Intelligence Thread Starter New Member

Jun 10, 2012
29
0
i need to plot the current drawn by an induction motor on my pc for this i used current transformer now problem is that sinewave is dual polarity.

9. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,279
1,559
Ah ha... isn't the polarity of the negative half the same as the positive half?

Just clip the signal and measure the positive peak. Or peak detect it.

Easy Peazy.

10. ### Shear_Intelligence Thread Starter New Member

Jun 10, 2012
29
0
no actually negative and positive cycles are different when motor is running under load, i believe!

11. ### cupidsrose New Member

Aug 2, 2013
1
0
Wait for me there are a lot of free time, I'll find the answer.

12. ### Shear_Intelligence Thread Starter New Member

Jun 10, 2012
29
0
i managed to used summing amplifier to add dc biasing voltage hope its proper solution