+ Reply to Thread
Results 1 to 10 of 10

Thread: PWM Demodulator for infrared communications

  1. #1
    srobertjames Newbie
    Join Date
    Nov 2009
    Posts
    29

    Question PWM Demodulator for infrared communications

    I'm prototyping an Infrared audio communications system. I'm having trouble demodulating PWM, and was hoping one of you pros could help.

    The system is designed to convert a 20Hz-3kHz signal into PWM, by modifying the duty cycle of a 35 kHz square wave. The square wave is sent via Infrared.

    What's working:
    * Transmitter modulates duty cycle based on input voltage.
    * Receiver receives an IR, uses I-to-V and comparator to restore the square wave. I clearly see the square wave, with the fluctuating duty cycle, on my scope.

    What's not working:
    * Demodulating the PWM back into the signal. I thought sending it through a simple Low Pass Filter (f3db about 10kHz) would do it - but my scope only shows noise.

    So, my question is, how can I demodulate the PWM properly? Why won't a simple LPF work?

    The only other idea I have is to use an op amp based integrator, resetting it at every falling edge of the pulse, and then put it through an LPF. But that's a bit on the edge of my complexity level, and I'm not even sure it will work.

    Anyone who can help this analog beginner design & build this circuit is greatly appreciated.


  2. #2
    MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent
    Join Date
    Mar 2009
    Location
    Utah
    Posts
    2,867

    Default

    You need a much more aggressive filter. The light green trace (n010) is yours. Compare that to mine....
    Attached Images
    Mike ML.

  3. #3
    srobertjames Newbie
    Join Date
    Nov 2009
    Posts
    29

    Default

    Thank you, Mike.

    I'm only a beginner: Can you explain how to read your graph?

    More importantly: What happens when I hook up my simple RC Low Pass Filter? What does it do the signal that just turns it into noise? As a beginner, is there a simple solution I could do on my own (that is, I don't want to just copy someone else's circuit).

  4. #4
    MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent
    Join Date
    Mar 2009
    Location
    Utah
    Posts
    2,867

    Default

    Ok, the circuit I simulated I just threw together to create a PWM. Note V(in) red trace is a 0.8Vp-p 1Khz sine wave fed to one input of a comparator. A 37KHz trapezoid wave V(n003) lightblue is fed to the other input. The comparator creates the PWM signal V(pwm) purple trace.

    The PWM signal is attenuated a bit {just to match the amplitude of V(in)}, buffered, and fed to your simple RC filter consisting of R9 and C5. V(n010) lightgreen trace is the output of this simple filter. Note the tremendous amount of carrier feed thru because this filter does not provide enough attenuation at 37kHz. This is your "noise".

    I also take the PWM signal and pass it through a filter that has much, much more attenuation at 37kHz. The output of that filter is shown as V(out) blue trace, overlaid on V(in) red trace. Except for a little phase shift, note that they compare very nicely.

    Basically, the low pass filter must have many tens of db of attenuation at the carrier frequency, while passing your audio range, which your simple RC filter does not...
    Mike ML.

  5. #5
    crutschow Excellent crutschow Excellent crutschow Excellent crutschow Excellent crutschow Excellent crutschow Excellent
    Join Date
    Mar 2008
    Location
    USA
    Posts
    3,026

    Default

    A simple 1-pole 10kHz filter has less than 12db of attenuation at 35kHz, thus attenuating the carrier frequency by less than a factor of 1/4 (each filter pole gives 6dB/octave of attenuation). For a reasonable minimum signal to noise ratio of 40dB you need a factor of 100, requiring at least a 4-pole filter, which is what Mike simulated.
    Carl
    Curmudgeon Elektroniker

  6. #6
    k7elp60 Excellent k7elp60 Excellent k7elp60 Excellent k7elp60 Excellent k7elp60 Excellent
    Join Date
    Oct 2003
    Location
    Utah
    Posts
    926

    Default

    In case you are interested here is a complete assembled system on ebay

    IR RECEIVER, TRANSMITTER & EXTRA PARTS - eBay (item 200404678158 end time Nov-17-09 17:23:02 PST)
    The great thing about electronics is unlimited ways to do the job. The only limit is one\'s imagination. I generally think my way is best.
    Show me a different way. I have an open mind.

  7. #7
    srobertjames Newbie
    Join Date
    Nov 2009
    Posts
    29

    Default

    Thanks again for the detailed responses. So, I need to attenuate the carrier voltage by a factor of 100... What if I made the f3db at 5KHz or even 2 KHz, and accepted the attenuation of the signal? Would that be enough attenuation of the carrier?

    The reason I ask is that I'd like to do this myself - and I believe that a circuit like this is within my reach - yet the only filters I know are simple RC and LC 1-pole filters.

    Also: Other than a LPF, is there any other simple way to demodulate the PWM? Perhaps some type of integrator combined with a sample and hold? Or should I just learn how to make a better filter (where's a good place to learn that?)?

  8. #8
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,794

    Default

    Quote Originally Posted by srobertjames View Post
    The reason I ask is that I'd like to do this myself - and I believe that a circuit like this is within my reach - yet the only filters I know are simple RC and LC 1-pole filters.
    Use opamp active filters, single pole passive ones are useless.

    Don't forget, you also need a similar filter on the transmitter as well.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  9. #9
    MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent
    Join Date
    Mar 2009
    Location
    Utah
    Posts
    2,867

    Default

    Quote Originally Posted by srobertjames View Post
    Thanks again for the detailed responses. So, I need to attenuate the carrier voltage by a factor of 100... What if I made the f3db at 5KHz or even 2 KHz, and accepted the attenuation of the signal? Would that be enough attenuation of the carrier?

    The reason I ask is that I'd like to do this myself - and I believe that a circuit like this is within my reach - yet the only filters I know are simple RC and LC 1-pole filters.

    Also: Other than a LPF, is there any other simple way to demodulate the PWM? Perhaps some type of integrator combined with a sample and hold? Or should I just learn how to make a better filter (where's a good place to learn that?)?
    There is a lot of information out there on the subject of filters. To create the active filter used in the simulation, I used the free cad program called FilterPro, downloadable from TI's website.

    You can run it and put in various filter configurations. It even plots the attenuation and phase shift through the proposed filter. For example, I just ran a simple 1 pole RC filter like you just proposed. Note that if you move the cutoff freq to 2kHz, the attenuation at 37kHz is only about 25db (slightly more than a factor of 10), so it would still have 10% carrier feed through...

    Note that in the simulation I posted, I used FilterPro to come up with the values for the 4pole filter, and then I moved them to LTSpice. I was able to explore the filter requirements without building your circuit. Now if I was trying to come up with the entire IR communications system, I would eventually build a breadboard circuit, but only after simulating/optimizing it first.
    Attached Images
    Last edited by MikeMl; 15th November 2009 at 12:47 PM.
    Mike ML.

  10. #10
    srobertjames Newbie
    Join Date
    Nov 2009
    Posts
    29

    Default

    Thank you!

+ Reply to Thread

Similar Threads

  1. Help: mic amplifier transmitted via infrared, modulated in PWM
    By cze_guevarra in forum General Electronics Chat
    Replies: 4
    Latest: 16th March 2009, 05:33 PM
  2. Infrared Demodulator Circuit
    By ghaun in forum Electronic Projects Design/Ideas/Reviews
    Replies: 0
    Latest: 16th January 2009, 05:59 PM
  3. cOMMUNICATIONS OPTIONS?
    By daybrown in forum Alternative Energy
    Replies: 18
    Latest: 3rd May 2008, 08:03 PM
  4. Power or Communications
    By Haidy in forum General Electronics Chat
    Replies: 7
    Latest: 27th September 2006, 12:34 PM
  5. PWM Demodulator
    By Kamal Singh in forum Electronic Projects Design/Ideas/Reviews
    Replies: 1
    Latest: 29th December 2005, 06:52 AM

Tags for this Thread