Good old, slightly tube IR control
I have long had plans to write an article on the topic of IR control. After reading https://habr.com/ru/companies/flipperdevices/articles/566148/ I collected the necessary material. In this article, I asked the developers of Flipper about the methods they use to copy and play IR messages with their device. I never received an answer to some questions, while others were close in information content to the Arduino-style description.
What is this article about? First of all, about two methods for copying and reproducing IR control commands. Therefore, I will not dwell on the description of the transmission protocols of various IR control panels, since they are quite well described. In one of the developed infrared control devices (hereinafter simply IR), they decided to use one infrequently used method of reading and generating IR control commands for various equipment. This is not to say that this is something completely unusual. This approach is used, for example, in Global Cash equipment for IR control.
In this article I would like to dwell in more detail on the principle of copying IR remote control commands for subsequent control in various “smart home” systems. In the current situation, the use of this device looks like an excellent replacement for Global Cash equipment due to maximum compatibility and the ability to use their extensive code base of IR remote controls.
At the beginning there is some general information that is already well known.
Infrared remote control (IR remote control) is used in almost all consumer electronic equipment. Although recently systems based on radio communications have appeared, which may in the future begin to prevail over IR systems, but at present IR control has proven to be the most reliable, and most importantly, the cheapest type of wireless one-way communication over short distances within one premises. After all, first of all, it began to be used in household televisions. IR is still widely used today. It's a big zoo – each company developed its own protocols and worked at different modulation frequencies. As a result, we have about 2 dozen (!) systems that are completely incompatible with each other, of which, fortunately, 6-7 are most widely used.
Like any light, IR light travels in a straight line, i.e. does not bend around objects, does not pass through opaque objects, but to one degree or another is reflected from them. Therefore, the distance at which a signal can be confidently received depends on the power of the source and the sensitivity of the receiver, plus several side factors.
IR LEDs operating in pulse mode are used for radiation, and photodiodes with amplifiers are used for reception. Recently, integrated IR receivers from various manufacturers have been increasingly used. IR receivers, as a rule, are covered in equipment with IR filters (in practice, red or smoky plastic) to reduce sensitivity to ordinary sunlight or light from lighting devices. Like any filter, it partially blocks useful IR radiation, so the operating range of the IR remote control also depends on the filter.
Now let’s begin to consider the essence of the method of copying IR messages and then reproducing them.
But first, let's see how most developers of such equipment do it. They use a simple approach – they measure the duration of IR diode flashes and pauses in milliseconds, similar to what is done in modern digital oscilloscopes, and then reproduce them at the same carrier frequency. Explanatory drawing.
Most IR receivers have an open collector output, so the signal is drawn inverted.
As you may have noticed, this method has the disadvantage that we are not exactly copying the command from the original remote. Although it is possible to adjust the frequency of the IR signal during transmission, this still does not completely eliminate the problems of this method of copying commands.
Instead, another method is to measure the carrier frequency of the IR radiation and then encode the durations of the flashes and pauses in the periods of the carrier frequency of the IR radiation. Why is this method more accurate? Because IR remote controls were initially built on simple microcircuits: logical elements, triggers and counters. All clocking was carried out by the carrier frequency, and then, using counters and logic, timing diagrams for sending an IR command were formed. Later, all this logic was placed in one specialized chip. Here is the block diagram of the SAA3010 IC.
Now let's move on to describing another method. To better understand the principle of operation, I will provide an explanatory timing diagram.
The IR signal is a sequence of ON and OFF states modulated by a carrier frequency (ƒ) during the ON state. Most IR remote control devices operate at frequencies around 40 kHz, most commonly at 36 kHz, and some devices operate at frequencies up to 500 kHz. The on and off times are measured in periods (τ) of the carrier frequency, where τ = 1/ƒ.
Agree, this method allows you to more accurately copy IR remote control commands. But here one problem arises – the need to use an IR receiver, which selects both the carrier frequency of the IR signal and the demodulated signal. This leads to a complication of the IR signal receiver circuit. That's why this method is not used in Flipper.
In principle, for offline use of a copied command, as is done in Flipper, the method of copying and reproducing commands is not very important. But if we begin to integrate different control systems, then the question of information exchange between different control systems arises. Typically, the LAN control module is used as an IR gateway for controlling various equipment. It converts commands received over the LAN network into IR commands, which are then received by equipment, such as a TV, and IR commands received from remote controls are converted into ASCII sequence and transmitted to the central control controller.
When we understand the essence of this method of copying IR commands, let’s move on to describing the coding of read IR commands. There is nothing complicated here, everything is extremely simple. The recording of the copied command in symbolic form is very concise, but, on the other hand, it very fully describes the IR command.
Here is an example of a command from one of the remote controls read by the developed device.
Commands are easy to edit. Knowing the features of a particular format of IR remote control commands, you can edit it purposefully. If anyone is in the know, they immediately noticed that the command given is for an IR remote control in NEC format.
Any system has both its positive and negative sides. The advantages of this system:
more accurate automatic determination of command parameters
a common method for copying and writing commands
large database of remote control codes, for example Global Cash
easy to convert to other formats
possibility of using both integrated and special IR receivers. When using widely used integrated IR receivers, the radiation frequency can be set manually.
Disadvantages:
Knowing this information, it will be easier for integrators to make decisions when selecting equipment for IR control. This automated control concept allows IR devices, such as remote controls, to act as digital input devices in a networked environment. By converting IR commands to serial ASCII text, IR can be considered an input method for digitally controlled equipment. And also by converting text commands back into IR sequences we can control equipment that is still controlled via IR.
Thank you for your attention.