Looking for simple way to demodulate a 40Khz signal

In a project I'm working on, one of the signals coming on to my board is a serial bitstream modulated with a 40 kHz square wave.

Where presence of 40 kHz = '1' and no signal = '0'.

So basically a switched 40 kHz square wave.

What are my options for decoding this to 3.3v CMOS level '1' and '0's ?

The average bit time is about 1 mS, but there is a 10 mS 'start' bit.

Reply to
lighthouseman
Loading thread data ...

A retriggerable multivibrator. If you're not familiar with 'em, it sounds scary but essentially it's a gizmo that emits an output pulse in response to a trigger (i.e., an edge from your modulating 40 KHz) and that can be "re-triggered" while the original output pulse is still going on.

Take a look at the data sheet for a 74HC123, for example:

formatting link
and you'll see that the output pulse width can be set with a simple resistor + capacitor pair. Aiming for about 50 usec might be a place to start, which would be a 10K resistor and a 5 nF cap.

--
Rich Webb     Norfolk, VA
Reply to
Rich Webb

So basically the data rate is about 1khz?

Why not just use a comparator that turns on when there is a signal and off when not? Use a LP filter to keep it on when the wave is on it's negative half cycle. This is basically what you are asking for and should work if you choose the appropriate time constant. Too much and you'll read high when it is not and too low you'll read lows. Since your bit rate is 40x slower it should be fairly easy to get the time constant...

e.g., the period of your 40khz single is 25uS. This mean's that the signal is off for 12.5uS and your time constant needs to be about 12.5uS which will mean that it will drop to about 63% of V. Or if you build in an appropriate amount of hysteresis then even something lower will work.

Reply to
Jon Slaughter

How big is the 40kHz square wave? You could just rectify the signal and add a bit of low pass filtering to take care of the swithing transients from the rectifier.

George H.

Reply to
George Herold

A good old AM detector. Add a lowpass to roughly match that 1msec so noise has less of a chance to trigger a "1" when there was none.

If you want to be extra good you could instead use a 40kHz bandpass filter up front.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

Add a Schmitt behind that, or a line receiver with some hysteresis. Avoids grief (rapid 1-0 changes) when there is noise on the signal.

--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

It just so happens that I was toying with a circuit for a similar purpose recently. This circuit here may be what you need.

formatting link

The upper trace is expanded to show the ripple. The inverting buffer serves two purposes: It generates a clean square wave, and also inverts the signal back to the original polarity.

Note that there's a slight delay to the output pulse. This is due to the finite time constant of C1 and R4 on discharge.

Reply to
pimpom

With modern OpAmps with great GBW, an active filter at 40kHz is trivial. ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  |
| E-mail Icon at http://www.analog-innovations.com |    1962     |
             
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

I didn't actually build the circuit as it wasn't what I needed, and I was just tinkering on-screen. It was for processing the output from an IR remote control receiver module. You can adapt it to suit your application. E.g., You can drop the 5V output to

3.3V with a resistive voltage divider. If you don't want to invert the pulse polarity but still want a clean square wave, you can either use a non-inverting buffer or add another inverter.
Reply to
pimpom

Is the signal already clean digital levels (1=light sensed, 0=dark) or is it analog? If it's digital, any simple lowpass/schmitt thing is fine.

If it's analog, it's a more interesting problem, the ASK decode threshold issue. The long "start" bit is probably there to allow a receiver to establish a 50%-of-max amplitude threshold, where 'max' could vary over a huge range for something like an IR remote.

John

Reply to
John Larkin

Am 26.02.2010 19:16, schrieb lighthouseman:

What is the maximum time for identical bits? In other words: what is the lowest possible frequency?

Falk

Reply to
Falk Willberg

Is '1' a 0V to 3.3V digital signal and a '0' is just zero volts?

If so, just use a _retriggerable_ one-shot with tau > 25us as a pulse stretcher. ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  |
| E-mail Icon at http://www.analog-innovations.com |    1962     |
             
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

See my recent DC-restorer posts for sample circuits that work O:-) ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  |
| E-mail Icon at http://www.analog-innovations.com |    1962     |
             
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

LM567 Tone decoder (if they still exsist)

formatting link

Reply to
Joe G (Home)

An IR Receiver for 40khz? Has all the demodulating filters etc. You just need to convert your signal to IR.

Cheers

Reply to
Martin Riddle

Thanks everyone, some great ideas there. I like the idea of putting an IR led and IR Receiver back to back - also the retriggerable multivibrator.

Thanks.

Reply to
lighthouseman

Use something like a UART provided you can recover the clock - which is not a big hassle.

Reply to
Robert Baer

If your goal is to understand and build your own demodulator, you've had -- as you say -- lots of good suggestions. If you simply want to decode a TV remote control, there are a lot of one-chip and inexpensive solutions out there from Sharp, Vishay, Siemens (Infineon?), and others.

You can get a good idea of what they look like by grabbing a datasheet from (say) Digi-Key:

http:/

formatting link

On Digi-Key, these TV remote control receiver/demodulator chips are filed under "Sensors - Optical - Photo Detectors - Remote Receiver", like this one:

$1.31 Vishay TSOP321xx, 323xx series

They are avalilable to respond to various IR "carrier frequencies", e.g. the Vishay TSOP32140 expects a modulated 40kHz carrier. To learn about their performance and how they work, review a datasheet or three.

You mentioned 40kHz. If you are generating the LED signal, then that will be under your control. If not, be sure to match the transmitter frequency with the IR Receiver module; while you _can_ pick up a

36kHz transmission with a 40kHz IR Receiver, you'll have to have the two closer or put out a "louder" signal to do it.

Enjoy...

Frank McKenney

-- Satisfaction of one's curiosity is one of the greatest sources of happiness in life. -- Linus Pauling

-- Frank McKenney, McKenney Associates Richmond, Virginia / (804) 320-4887 Munged E-mail: frank uscore mckenney ayut mined spring dawt cahm (y'all)

Reply to
Frnak McKenney

Then there's some exotic remotes out there. The highest frequency I have come across was just shy of 60kHz. So if a reader of this thread has the goal of checking remotes for repair purposes a wideband solution may be better.

[...]
--
Regards, Joerg

http://www.analogconsultants.com/

"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
Reply to
Joerg

Something I'm considering for a home IR repeater that's independent of remote modulation frequency...

formatting link
...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  |
| E-mail Icon at http://www.analog-innovations.com |    1962     |
             
I love to cook with wine.     Sometimes I even put it in the food.
Reply to
Jim Thompson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.