1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Square wave signal with ADC converter

Discussion in 'General Electronics Chat' started by tonytnnelectrotech, Mar 1, 2018.

  1. tonytnnelectrotech

    tonytnnelectrotech New Member

    Joined:
    Dec 18, 2014
    Messages:
    5
    Likes:
    0
    Hi,
    I have a 7Hz 5Vpp square wave signal, you give me an advice on an easy way, to turn that signal into the corresponding DC voltage, so I can read it through the microprocessor's ADC converter?

    Thank you.
     
  2. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,983
    Likes:
    1,079
    Location:
    Loveland, CO USA
    Do you want to measure P-P voltage? or peak or average or RMS.
    What does the 5Vpp look like? Is it oV to 5V or is it -2.5 to +2.5 ? Is it AC coupled through a capacitor?
    I assume the 5Vpp signal must change in value. Why measure some that you know to be 5Vpp? So when the signal changes what happens? Will it change to 0 to 4.8V? or does it change like this (0.1 to 4.9V)?
    It is safe to assume it is 50% on 50% off. (0/5V)

    I think it is 0 to 5V and DC coupled. I think you ADC reads form 0 to 5V but don't know.
     
  3. tonytnnelectrotech

    tonytnnelectrotech New Member

    Joined:
    Dec 18, 2014
    Messages:
    5
    Likes:
    0
    the request is:
    take a square wave signal with a fixed width of 0-5V and a variable frequency (3Hz to 10Hz, approximately) and convert it into a continuous signal ...
    I hope I was clear...
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  5. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,983
    Likes:
    1,079
    Location:
    Loveland, CO USA
    In the schematic:
    Signal source; 0V 5V 10hz
    The diode catches the peak signal. The capacitor stores the energy.
    There will be some voltage loss because the diode. Vout is 4.7 volts. This is how a volt meter measures AC voltage.
    Green trace is the 5Vpp signal. Blue trace is output.
    upload_2018-3-1_9-41-14.png
     
    • Like Like x 1
  6. alec_t

    alec_t Well-Known Member Most Helpful Member

    Joined:
    Jul 10, 2011
    Messages:
    9,730
    Likes:
    1,277
    Location:
    Cardiff, Wales
    Why do you have to convert the signal to a DC voltage before reading it with the ADC?
     
    • Like Like x 1
  7. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,626
    Likes:
    697
    Location:
    Derbyshire, UK
    Nope, you're still making little sense.
     
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  9. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,641
    Likes:
    145
    Location:
    Seattle, WA
    ONLINE
  10. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,983
    Likes:
    1,079
    Location:
    Loveland, CO USA
    This method will read 2.5 volts because it takes the average. And any change in duty cycle will effect the readings. But because we don't really know what you want to do we are just giving ideas.
     
    • Like Like x 1
  11. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,641
    Likes:
    145
    Location:
    Seattle, WA
    ONLINE
    I believe "any change in duty cycle" is exactly what he wants to see. He has not stated the duty cycle being fixed.
     
  12. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,198
    Likes:
    159
    Location:
    morristown,tn
    Why is it so hard to show what one is doing LOL 5 volts p to p is that 10 volts or is that 5 volts total was it made with a uC running at five volts.

    If so just stick a cap on it and read that put a high ohm resistor across it Like post4 without diode tho.
    If it's AC use post 4

    If it's more then 5 volt total come back a tell us what it is and what's making it you'll need a voltage divider added to the mix.
     
  13. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,423
    Likes:
    600
    Location:
    AZ 86334
    tonytnnelectrotech: How long are you willing to wait for the dc level to accurately represent the average value of (pulse width/pulse period) before sampling it with the ADC? (This has to do with how aggressive the filtering has to be.)

    How accurate is the 5V peak value of the pulse train? (Does it need to be normalized to the the ADC's Vdd supply in order to make the reading accurate.)
     
  14. ronsimpson

    ronsimpson Well-Known Member Most Helpful Member

    Joined:
    Apr 17, 2007
    Messages:
    7,983
    Likes:
    1,079
    Location:
    Loveland, CO USA
    As long as every one had a different idea as what is wanted:
    "square wave" usually = 50% low, 50% high

    "fixed width" = on for 0.05 seconds and off for a variable amount of time so the frequency can be from 3hz to 10hz. Example: fixed on time, variable off time. (not 50%, 50%)

    "continuous signal" A square wave is continuous if it is never turned off. A triangle wave is also continuous if it goes forever. I am certain that who ever made up this assignment wants a output that never changes voltage; that is not stated.

    What is almost clear is that Tony has given up on us and gone away.
     
  15. schmitt trigger

    schmitt trigger Well-Known Member

    Joined:
    May 24, 2009
    Messages:
    1,077
    Likes:
    99
    As the saying goes :
    Describe the problem correctly, and you have the problem halfway solved.

    Unfortunately on this and most of the technical forums I lurk, stating or describing a problem incorrectly is commonplace.

    And I am not talking about members whose mother tongue is not English. Those I can understand if they have a poorly translated sentence.
    No, I am talking about individuals which do not understand what they want to accomplish or why they want to do it a particular way.
     
  16. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    5,198
    Likes:
    159
    Location:
    morristown,tn
    Youll never know
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice