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.

  • 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.

PWM Demodulator for infrared communications

Status
Not open for further replies.

srobertjames

New Member
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.
 

MikeMl

Well-Known Member
Most Helpful Member
You need a much more aggressive filter. The light green trace (n010) is yours. Compare that to mine....
 

Attachments

  • Draft28.gif
    Draft28.gif
    91.2 KB · Views: 1,942

srobertjames

New Member
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).
 

MikeMl

Well-Known Member
Most Helpful Member
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...
 

crutschow

Well-Known Member
Most Helpful Member
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.
 

srobertjames

New Member
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?)?
 

Nigel Goodwin

Super Moderator
Most Helpful Member
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.
 

MikeMl

Well-Known Member
Most Helpful Member
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.
 

Attachments

  • LPFrc.gif
    LPFrc.gif
    48 KB · Views: 656
Last edited:
Status
Not open for further replies.

EE World Online Articles

Loading
Top