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

PWM to Analog converter

Discussion in 'Microcontrollers' started by Thein Zaw Htun, Dec 6, 2017.

  1. Thein Zaw Htun

    Thein Zaw Htun New Member

    Joined:
    Dec 6, 2017
    Messages:
    3
    Likes:
    0
    Could someone please help me how to convert PWM signals to analog voltage using pic16F676 ? I'd like to take constant analog voltage output from PWM.
     
  2. JimB

    JimB Super Moderator Most Helpful Member

    Joined:
    Sep 11, 2004
    Messages:
    6,392
    Likes:
    593
    Location:
    Peterhead, Scotland
    The quick answer is that to convert a PWM signal to a DC analogue signal, you just need a low pass filter which has a time constant which is long compared with the period of the PWM.
    A simple RC network will do the job. You don't need a PIC to do the conversion.

    However, the devil is in the detail.
    Where does the PWM signal come from?
    What does the PWM signal represent?
    What does the analogue signal feed into?

    Some more information would be useful.

    JimB
     
  3. Thein Zaw Htun

    Thein Zaw Htun New Member

    Joined:
    Dec 6, 2017
    Messages:
    3
    Likes:
    0
    Thanks for your attention Sir, I'm planning to get analog voltage value from a PWM type fuel sensors. The vehicle's Body Control Module send PWM with 10 Hz frequency to vehicle's fuel sender unit (which actually was a rheostat). I want to convert this PWM signals to analog voltage which will change by the fuel level. I draw a sketch and uploaded.
     

    Attached Files:

  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. alec_t

    alec_t Well-Known Member Most Helpful Member

    Joined:
    Jul 10, 2011
    Messages:
    9,325
    Likes:
    1,231
    Location:
    Cardiff, Wales

    Are you sure it's PWM, not just fixed-width pulses at 10Hz? I'm struggling to understand why PWM would be needed for a fuel sender.
     
  6. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    ONLINE
    Old car 'electronics' used a crude electro/mechanical 'regulator' to provide a regulated voltage for the instrument panel - but this is only the power supply for the instruments, and not an actual data signal. To add any actual electronics to the instrument panel you need to replace the crude pulsed 'regulator' with a proper DC electronic one.
     
  7. JimB

    JimB Super Moderator Most Helpful Member

    Joined:
    Sep 11, 2004
    Messages:
    6,392
    Likes:
    593
    Location:
    Peterhead, Scotland
    If they are fixed width pulses at a fixed frequency, what is changing?
    What can change the reading on the meter?

    JimB
     
  8. JimB

    JimB Super Moderator Most Helpful Member

    Joined:
    Sep 11, 2004
    Messages:
    6,392
    Likes:
    593
    Location:
    Peterhead, Scotland
    As I said earlier, more information needed.

    It looks as though the "PWM" may be just a crude stabilised supply for the traditional crude vehicle instrumentation.
    What sort of car is this?
    How old is it?

    JimB
     
  9. alec_t

    alec_t Well-Known Member Most Helpful Member

    Joined:
    Jul 10, 2011
    Messages:
    9,325
    Likes:
    1,231
    Location:
    Cardiff, Wales
    Current change, as a consequence of resistance change.
     
  10. JimB

    JimB Super Moderator Most Helpful Member

    Joined:
    Sep 11, 2004
    Messages:
    6,392
    Likes:
    593
    Location:
    Peterhead, Scotland
    Agreed.
    I was thinking that this thing was more sophisticated than it may actually be.

    JimB
     
  11. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    Here easier to look at and think about
    Screenshot from 2017-12-06 15-05-15.png
     
  12. Thein Zaw Htun

    Thein Zaw Htun New Member

    Joined:
    Dec 6, 2017
    Messages:
    3
    Likes:
    0
    Thanks you all for your times and attention, it's was a Suzuki , Ertiga 2017 model. As I already posted, this car take the fuel sender unit status using a pulse with 10 Hz which comes from Body Control Unit. I haven't enough knowledge to manipulate the BCM to get the fuel status and so , I tried to convert this pulse signals to analog voltage and then , calibrate fuel amount with converted analog voltage. I've to admit that I have tested it wrongly and one of my colleagues messed some wiring and the result was built-in fuel gauge gone!
     

Share This Page