How do these IR receivers work internally ? - Page 1
Forum section: electronics / projects

author: MathWizard
author_rank: Super Contributor
timestamp: May 27, 2024, 01:00:44 am
content: I'm making a remote control, for a stereo that has a motorized volume control (but never had a remote it seems).And I'm trying some TSOP-1156 IR receiver modules, and I see that you have to have special timings to do anything. So I'll have to try it with an MCU. And I see the block diagram, but how do they do all that, and make it any good ?? Is it all digital circuits and timer's, and is there some really special purpose MCU in there ??I'm also playing around in LTSpice with making an RF remote, with BJT's, and Colpitts oscilators, for 2 different frequencies for volume up/down. And just with the basic circuits I'm trying, I'll probably want quite a frequency separation, like 3MHz and 30Mhz, just to get 2 nicely separated voltage levels.

author: Kim Christensen
author_rank: Super Contributor
timestamp: May 27, 2024, 05:23:00 am
content: Look into theRECS-80 protocolmentioned in the datasheet orothers.It explains how this is typically done with IR remotes.

author: moffy
author_rank: Super Contributor
timestamp: May 27, 2024, 05:50:38 am
content: Quote from: MathWizard on May 27, 2024, 01:00:44 amIt looks to be straight analog, just amplitude modulation/on/off keying of a carrier frequency.

author: soldar
author_rank: Super Contributor
timestamp: May 27, 2024, 06:56:33 am
content: I have played with these in the past. Be aware that they are designed for a certain carrier frequency (38 Khz?) so you have to stick to that. The receiver demodulates the signal from the carrier so you have a clean signal at the output.If all you need is two codes, up/down, then it should be extremely easy to do with just a little hardware, no need for MCU. I can think of several simple ways. By signal duty cycle, by signal frequency, etc. If you want something more complex then an MCU is the way to go. In that case you could use a remote sender from any other device. Note that the codes they send are complex. My TV remote sends 27 bits.I have a crate full of old remote controls and of devices with receivers waiting for projects to use them in.As an

author: soldar
author_rank: Super Contributor
timestamp: May 27, 2024, 11:45:34 am
content: Another thought to make it as simple as possible is to have a single signal, only on/off, and the receiver toggles each time up / down / up / down. You can have LEDs of different colors to show if it is going up or down. If you send and the receiver is going in the opposite direction to what you want you just stop and push again.

author: MathWizard
author_rank: Super Contributor
timestamp: May 27, 2024, 03:18:17 pm
content: Yeah I downloaded the RECS-80, I should try something without a MCU for now, like maybe some 555 timer circuits and binary counter/logic circuits.But for now I'm going to try a 2MHz and 10MHz RF signal, and see if I can get 1V and 4V from 1 detector diode circuit like in the sim. I could try adding amplitude modulation and just use 1 osc. frequency too.Quote from: moffy on May 27, 2024, 05:50:38 amSo what analog circuits would reliably count 6 cycles of the carrier ? I'm guessing they have their own internal clock source, are their logic gates tho, and then maybe they compare and count what comes in vs it's clock? Or do they use integrator's and some logic for that too ?

author: jpanhalt
author_rank: Super Contributor
timestamp: May 27, 2024, 03:42:18 pm
content: Easily done with a pair of 555's or a 556. One section for the carrier (56 kHz in your case?) and one for the on/off modulation. The pass band for the carrier is typically quite wide.

author: moffy
author_rank: Super Contributor
timestamp: May 27, 2024, 07:08:54 pm
content: Quote from: MathWizard on May 27, 2024, 03:18:17 pmThe AGC needs time to respond, just RC of some sort, and for the logic level to settle, just a delay, and the 6 cycles is just the worst case response time.

author: soldar
author_rank: Super Contributor
timestamp: May 27, 2024, 09:52:40 pm
content: Quote from: MathWizard on May 27, 2024, 03:18:17 pmEither I am misunderstanding you or .... I thought we were talking IR sender and IR receiver?An IR receiver is tuned to a certain carrier frequency, normally in the 38KHz vicinity and they will demodulate signals from the remote control sender which are in the range of 110 bits per second.If you just want to use radio you can save a lot of time and effort by just buying a commercial module and sender which you can get for very little.https://www.amazon.com/fushionsea-Universal-Wireless-Receiver-Transmitter/dp/B08BNJDFSM/ref=sr_1_5

author: Buriedcode
author_rank: Super Contributor
timestamp: May 27, 2024, 10:00:12 pm
content: I'm not sure hat the confusion is here - those TSOP IR reciever modules are purely analog, but have restrictions on timing based on the time constants used in the AGC and to a lesser extent, filters. They're justy photo diodes with transimpedance amplifiers, filters, and an AGC.The actual protocol, and the data sent is all done on an ASIC or MCU - the common ones are NEC and Sony's RC-5 but you could roll your own. The downside of doing that is you're effectively doing your own bit coding, where-as the standards have libraries that'll work on any micro with a half decent timer module.The trouble with doing things with "dumb" circuits like the 555 is lack of versatility. Sure you could make one button with a fixed on/off rate, modulating the 36-40kHz IR carrier so the reciever can demodulate it, and the reciever just looks for a pulse train of a fixed frequency, but.. what happens when you want two buttons? or three? You end up with quite a large circuit woth lots of timers and logic, where-as a 6/8 pin MCU will allow for several buttons. And these IR modules are designed to work with the above standards, thus the min/max pulse widths (and also why the NEC protocol packet starts with a fixed mark space pattern).

author: soldar
author_rank: Super Contributor
timestamp: May 27, 2024, 10:33:01 pm
content: Quote from: Buriedcode on May 27, 2024, 10:00:12 pmThe confusion is that the OP is now talking MHz and the IR modules work at 38 KHz so I assume he's talking about radio and about IR simultaneously.

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 27, 2024, 10:36:43 pm
content: If the OP's idea is to use a carrier of a few MHz with an IR LED/photodiode pair, then for sure they'll have to forget about these standard remote receivers which are indeed made for a 38kHz carrier. Transmitting a signal with a few MHz of bandwidth over IR is going to be pretty challenging. Not a weekend project using ready-made modules.

author: shabaz
author_rank: Frequent Contributor
timestamp: May 28, 2024, 12:45:38 am
content: I gave it a shot with a Pi Pico a while back. Thesource codehas a C and MicroPython example:C example: Prints on the USB serial console the received button value. Requires Pi Pico C/C++ SDK to build the code.MicroPython example: Operates a servo using the left/right buttons. It is in a single file (main.py) that is installed in the normal method for MicroPython.It uses Sony SIRC 20-bit protocol, there are small remote controls (for instance camera remotes, either Sony brand or lower-cost clones) or normal TV/DVD remotes etc if they use Sony SIRC. The code is not heavily battle-tested so I can't guarantee it will work with all such remotes.The IR sensor connects to GPIO15.If OP doesn't mind using a microcontroller, then I've quicklymodified the MicroPython codeto approximately do what he wishes. It controls two LEDs, depending on what button is pressed. The code is crude, just proof-of-concept.I've noticed that Sony TV remotes allow buttons to be held down indefinitely, whereas the camera remotes seem to require pressing the button repeatedly.I don't know what microcontroller experience the OP has, but maybe it's a good opportunity to try the Pico if it's not been used before, because the steps to use MicroPython are written for newcomers on the raspberrypi website and needs no compiler (or use C if preferred, but that will require the Pi Pico C/C++ SDK to be installed).

author: soldar
author_rank: Super Contributor
timestamp: May 28, 2024, 07:08:39 am
content: Quote from: shabaz on May 28, 2024, 12:45:38 amIt is very common for remote control senders to toggle a bit or two each time you press a key. That way the receiver knows if you are holding the same key continuously or if you let go and pressed again. In my example above it was bits 4 and 5 IIRC.

author: jpanhalt
author_rank: Super Contributor
timestamp: May 28, 2024, 08:34:39 am
content: Small detail: The TSOP1156 is center tuned to 56 kHz, not 38 kHz. Typically, the last two digits of the TSOP part number are the frequency in kHz.

author: shabaz
author_rank: Frequent Contributor
timestamp: May 28, 2024, 01:34:21 pm
content: Quote from: soldar on May 28, 2024, 07:08:39 amYou're correct, the code does detect that.I mean that some Sony SIRC remotes (or maybe some buttons not all on some SIRC remotes) do not appear to send the 'repeat' code forever (whereas with a TV SIRC remote volume buttons, it's a long indefinite stream of 'repeat' codes as expected). I didn't observe in any detail so perhaps I'm wrong, but just wanted to mention it as a possible thing to watch out for if it affects the use-case (e.g. holding down a button while the motor continuously advances the potentiometer, versus repeatedly pressing the button to advance in increments).

author: soldar
author_rank: Super Contributor
timestamp: May 28, 2024, 04:02:46 pm
content: With the info we have so far I would say:If you just want to solve the problem in the simplest, cheapest and most practical way then get a wireless thingy from eBay or wherever. Simple, fast, cheap.If you want to tinker with IR in the very simplest way you can get some old device and use that. It would be extremely simple to send a modulated 38 KHz carrier modulated with two different duty cycles, say 25 and 75 %. That would be very easy to detect with simple hardware and activate one of the two outputs. I would say this is very simple, almost trivial.The most complex way is to use MCU and you can use as many different codes as you like.

author: tooki
author_rank: Super Contributor
timestamp: May 28, 2024, 06:10:46 pm
content: Quote from: MathWizard on May 27, 2024, 01:00:44 amWhat stereo? Maybe it has an unpopulated IR receiver footprint which you can simply install the correct receiver into. Then use a universal remote with it, or build a tiny one using an Arduino Pro or Nano, or even something smaller like one of the Beetle series of boards.Quote from: MathWizard on May 27, 2024, 01:00:44 amThat’s a very old part. I’d recommend using a modern part, since newer ones have been designed to reject interference from Wi-Fi, Bluetooth, and PWM-dimmed LED lighting, giving more reliable results. Note that Vishay has a dizzying array of receiver modules, each optimized for different situations (environments) and IR codes. (Yes, they optimize the filtering for the actual code formats.) But they also have excellent documentation to help you choose. They have a number of white papers and overviews as well as info on the mechanical aspects (e.g. IR window design).Quote from: MathWizard on May 27, 2024, 01:00:44 amIsn't this risky, in terms of regulatory compliance?Also, what’s to stop spurious signals within your detector bandwidths from triggering unwanted commands? There’s a reason remote controls (both IR and RF) use both carrier frequenciesanddigital codes with redundancy and/or checksums, and won’t act on a code until it’s been repeated a few times.

author: MathWizard
author_rank: Super Contributor
timestamp: May 29, 2024, 06:56:11 pm
content: Ok so inside the TSOP11xx device, is just analog circuits, no MCU. Yeah I would just like to see the internal circuit, thats all. So it does have clocks and counters though right, and not just some passive or active filter trying to tell if 6 or 7 pulses came in right? But then again, maybe with good parts on a chip, it's not as hard I think.I have some in my junk box, so I'll use one for making an IR remote control receiver.I think this stereo is a 1980's Sansui R-7, I mapped the whole circuit, there's just the up/down push button volume control, controlling an H-bridge for the motor/volume pots.For fun, I'm trying to make a suitable IR TX, using a 555 clock signal, 3x 7-bit binary counters, some S-R latches made from BJT's. I almost have it working in LTSpice. For lower part count I should try mainly with 555 timers.Yes for fun I am also trying to make an RF remote RX/TX. For just up/down volume, I shouldn't waste an MCU on the stereo.

author: shabaz
author_rank: Frequent Contributor
timestamp: May 29, 2024, 08:08:14 pm
content: Quote from: MathWizard on May 29, 2024, 06:56:11 pmThe internal circuit can be assumed to be an AC-coupled light amplifier, followed by a diode and capacitor performing demodulation like a simple AM receiver, and an output transistor with on-off output. There is a filtering action, so that extremely short bursts will not be output, but even if some slightly longer bursts make it through, the external circuitry (e.g. logic, microcontroller) can usually clean further since in a system, usually a protocol like RC-5, SIRC, etc is used.There's more to it in terms of sophistication, as can be seen in the datasheet block diagram, but in a nutshell, even a black-box assumption is sufficient to work with it, namely, that it simply removes the carrier frequency from the infra-red signal, and isn't so fast-responding that it will output the shortest of bursts . No other logic, state-machine or otherwise, is inside there.The easiest way to see what is going on, is simply apply power to it, and look at the output using an LED (connect the LED cathode to the output, and the anode to +ve), if not a 'scope. You may rarely see the occasional flicker on the LED, that's some ambient burst of flickering light level (or, possibly more likely, some electrical noise very close by) making it's way through the AC-coupled amplifier, but you won't see the LED turn on much unless a real burst is sent (from a remote control, or a 555 attached to an LED, etc).In a normal home environment, you probably won't see the LED visually flicker at all, the output is very clean. You'll only see the LED turn on in a sustained way when using the 555+LED or normal remote control.

author: Buriedcode
author_rank: Super Contributor
timestamp: May 30, 2024, 01:43:40 am
content: Quote from: MathWizard on May 29, 2024, 06:56:11 pmNo, no counters, as has been stated a couple of times - the number of pulses it needs to stabilise are somewhat irrelevant - there are no counters, no logic, all it does is pass a demodulated carrier - in your case 56kHz. Because of the AGC it requires a certain period of carrier to train the AGC, if that periods happens to be 6-7 cycles of the 56kHz carrier then so be it - its for how long the carrier is present, not how many pulses/clocks/cycles it counts. The whole part is purely analogue, and digital decoding is done elsewhere.For a two channel IR remote transmitter you would need to generate the carrier - 56kHz for that module - and modulate it (logical AND in your case) with a bit stream, or at least two different signals that your reciever circuit can differentiate between. For just two channels could be an interesting exercise - perhaps some kind of low frequency tone decoder? But if you're just making this for convenience, throw a micro at it.

author: Kleinstein
author_rank: Super Contributor
timestamp: May 30, 2024, 09:33:57 am
content: The simple of the receivers have no counters, just analog filtering and AGC. The 6 cycles for the min pulse length are just limits for the performance of the analog circuit, e.g. reflecting RC time constants or similar. The numbers are also no strict limit, more the limits when the performce gets worse and different chips may be different in the details ( some can handle longer pulses a little better than others).The details of the protocol are decoded in a separate chip / µC. The part would likely be the one to build, typical with a µC.For the sender side, one probably has some old remote around anyway that one could reuse. The sender than may determine what code to use.

author: soldar
author_rank: Super Contributor
timestamp: May 30, 2024, 10:27:20 am
content: Quote from: MathWizard on May 29, 2024, 06:56:11 pmThe block diagram is posted in the OP by you.

author: kevin.gibbs
author_rank: Regular Contributor
timestamp: August 26, 2024, 01:26:20 pm
content: If you want to make your own remote control for several commands, you can apply specialized chips, such as SM6135-SM6136. This will be easiest and require no additional microcontrollers.

author: tooki
author_rank: Super Contributor
timestamp: August 28, 2024, 07:43:56 pm
content: Quote from: kevin.gibbs on August 26, 2024, 01:26:20 pmAre you certain?Since those chips can be used with RF or IR (or directly wired!), I don’t think they integrate any kind of carrier modulator, which is necessary for IR.Looking at typical SM6135/SM6136 circuits, I don’t think they’re as simple as an Arduino nano and an IR LED with driver. And infinitely less flexible.

author: shabaz
author_rank: Frequent Contributor
timestamp: August 28, 2024, 07:53:35 pm
content: Agree, way easier to use an Arduino etc and a ready-made remote control.And example code shared in reply #12 that should approximately do what the OP asked for in MicroPython; doesn't even require an IDE or compiler, if one is averse to that. And can be adjusted, since it's almost guaranteed that the original requirement may be refined when it comes to actually doing it, and that won't be as flexible to modify, if a microcontroller is not used.