How to convert ac signal to dc?

Discussion in 'General Electronics Chat' started by tpny, Jan 1, 2013.

  1. tpny

    Thread Starter Member

    May 6, 2012
    216
    0
    Happy new year everyone!!

    I have a sensor that outputs an ac signal with dc offset. I want to feed this into an adc so I can get realtime reading from this. So I need to convert ac to dc. Do I just add a cap at the output of this sensor? What guideline should I use to choose the size of cap, etc. Or what other method can I use? Thank you!
     
  2. w2aew

    Member

    Jan 3, 2012
    219
    64
    It depends on how the information from the sensor is portrayed in the sensor output. What varies when the sensor senses what it senses? Does the DC value change? Does the AC amplitude change? Does the AC frequency change? The answer to this will help determine how to condition this signal for the ADC.
     
  3. tpny

    Thread Starter Member

    May 6, 2012
    216
    0
    frequency doesn't change - fixed at < 10 Hz. It's a gas compound sensor, as compound concentration changes, Vpp changes and dc offset shifts a little. For example, when no CO2 present sensor Vpp output = 1.2V to 2.5V. When CO2 present sensor Vpp output = 1.3V to 2.2V.
     
  4. w2aew

    Member

    Jan 3, 2012
    219
    64
    Ok, an easy way to do this would be to do a simple positive-peak detector. The simplest form would be a series diode like a 1N4148 or 1N914 connected between the sensor output and a capacitor to ground. The idea is that the positive peak of the sensor output will cause the capacitor to charge. The value of the capacitor will depend on the input impedance or input bias current of the ADC input. You may also need a bleeder resistor across the cap. If the sensor has a high output impedance then you may need a buffer between the sensor output and peak detector.
     
  5. tpny

    Thread Starter Member

    May 6, 2012
    216
    0
    will that give me something like 1.96V (root mean square for Vpp = 1.2V and 2.5V) on the output? (I'm looking to convert ac signal value into some kind of a mean dc value.
     
  6. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Use a 1N4004~4007 in series and add a 1000uf/10V or 16V connected to GND.
    The negtive pole of 1N4004~4007 is the DC output side.
    This is a half rectifier circuit.
     
    Last edited: Jan 2, 2013
  7. gootee

    Senior Member

    Apr 24, 2007
    447
    50
    You might want a fairly-large-value resistor in parallel with the cap, so that the value could be lowered a little more quickly. Otherwise, when the sensor output voltage went down, it might take a very long time before the cap leaked enough current to lower its voltage. And since lower voltages mean there is gas, you might miss a positive reading by not having a bleeder resistor.
     
  8. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Thanks for remind me.
    Sometimes the discharge resistor is needed, in this application that the capacitor is no need so big, because I treated the input signal as a power source, but it's not necessary, another reason is that I'm not sure how flat of the DC voltage does he want.

    Probably the capacitor can be use as 220uf/10V or 100uf/10V.
     
  9. w2aew

    Member

    Jan 3, 2012
    219
    64
    No - as others have pointed out, this is a half-wave rectifier circuit, also can be called a peak detector circuit. It will give an output that roughly follows the peak voltage minus the diode drop.
     
  10. Jaguarjoe

    Active Member

    Apr 7, 2010
    770
    90
    Analog Devices has (or had) true rms to dc converters AD536 or AD636.
     
  11. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I would use the ADC to measure AC itself, this is easy at 10Hz.

    1. AC couple the signal through a cap
    2. to a 2.5v voltage divider using 2 resistors on the ADC input pin
    3. the ac voltage will be centred around 2.5v (voltage is unimportant but gives lots of headroom to make sure the AC does not clip)
    4. take lots of ADC samples over the period, say 100 ADC samples over one full wave period.
    5. use math in the PIC to rectify the ADC samples (ie get distance from 2.5v) and average them.
     
  12. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    As your mentioned, is that like this:
    Vdc = (1V+2V+3V.....+100V)/100 = 50.5V
    Assuming the values of 100 samples are 1V,...,100V.
     
  13. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    No you need to measure all the DC voltages as AC, ie get each sample's difference from the middle (the average DC volts which would be 2.5v).
     
  14. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Thanks.
    I just want to know the calculation method, no matter the values, is that what you mean?

    About two years ago, I had a case that it was used the similar method, pc reading the values of voltage via a usb interface to a PIC ad/da I/O control card(bought it from Internet).
    If getting the datas 60 times each second from the PIC Card, then the V-zum will be the whole data adding together, and the V-average = Zum/60, but the math calculation is on the PC side with VB6, it's more easier than using in Mcu.
     
  15. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I probably didn't explain it very well, sorry about that.

    If you average all the samples you get the middle point of your sinewave, which is essentially the "zero volts AC" point.

    With a fixed voltage divider like my example that point is also already known, at 2.5v DC.

    Then if you measure the deviation of each sample away from that point, you get the AC voltage value of each sample.

    The deviations need to be "rectified" which means the - ones need to be made + so all deviations are +. Then add all the deviations to get your AC voltage value.
     
  16. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Thanks.
    In my measure method that it need to clamped the -Vpp of Vac to the Zero level, if using the rectifier then no need to clamping the voltage.

    Measuring in AC, or through rectifier, and adding filter capacitor, or using the special IC as rms to Vdc, the calculation method is difference, if calculating on PC side is more easier, but in Mcu is more trouble, specially with asm.
     
  17. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    If you go through an actual diode rectifier you get a huge error because of the 0.7v drop of the diodes. The diode voltage also cannot be relied upon as it changes with heat and current.

    If you want to calculate on the PC side you can feed the AC signal into the sound card input and get the PC to process the data based on that.

    Or write a very simple PIC asm code that just samples the ADC and sends each sample out the USART to the PC serial port.
     
Loading...