Problem With Dual Polarity Signal

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

  1. Shear_Intelligence

    Shear_Intelligence Thread Starter New Member

    Joined:
    Jun 10, 2012
    Messages:
    29
    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.


    please help,
    thanks in advance
  2. John P

    John P Senior Member

    Joined:
    Oct 14, 2008
    Messages:
    1,325
    Location:
    Massachusetts
    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

    Shagas Active Member

    Joined:
    May 13, 2013
    Messages:
    760
    Location:
    Prague
    ITS*


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



    single to dual.png

    Should work ..
  4. ErnieM

    ErnieM AAC Fanatic!

    Joined:
    Apr 24, 2011
    Messages:
    5,588
    Location:
    Lon Guyland, Noo Yawk
    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

    Shagas Active Member

    Joined:
    May 13, 2013
    Messages:
    760
    Location:
    Prague
    Yes , forgot to add a voltage divider
    single to dual.png

    what about now?
  6. Shear_Intelligence

    Shear_Intelligence Thread Starter New Member

    Joined:
    Jun 10, 2012
    Messages:
    29
    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

    Shagas Active Member

    Joined:
    May 13, 2013
    Messages:
    760
    Location:
    Prague
    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

    Shear_Intelligence Thread Starter New Member

    Joined:
    Jun 10, 2012
    Messages:
    29
    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

    ErnieM AAC Fanatic!

    Joined:
    Apr 24, 2011
    Messages:
    5,588
    Location:
    Lon Guyland, Noo Yawk
    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

    Shear_Intelligence Thread Starter New Member

    Joined:
    Jun 10, 2012
    Messages:
    29
    no actually negative and positive cycles are different when motor is running under load, i believe!
  11. cupidsrose

    cupidsrose New Member

    Joined:
    Aug 2, 2013
    Messages:
    1
    Wait for me there are a lot of free time, I'll find the answer.
  12. Shear_Intelligence

    Shear_Intelligence Thread Starter New Member

    Joined:
    Jun 10, 2012
    Messages:
    29
    i managed to used summing amplifier to add dc biasing voltage hope its proper solution :)
Similar Threads
Forum Title Date
Embedded Systems and Microcontrollers VHDL signal assigment problem ? Friday at 1:40 PM
Embedded Systems and Microcontrollers X9C103P Digital Pot As Voltage Divider Problem (SOLVED) Wednesday at 12:12 PM
Embedded Systems and Microcontrollers seven segment output problem Wednesday at 7:09 AM
Embedded Systems and Microcontrollers PIC16F1503 ADC read problem while RC0 is 0 Nov 17, 2014
Embedded Systems and Microcontrollers C programming problem Nov 16, 2014

Share This Page