{"id":9624,"date":"2020-11-17T17:08:53","date_gmt":"2020-11-17T17:08:53","guid":{"rendered":"https:\/\/wolles-elektronikkiste.de\/ir-remote-controls"},"modified":"2022-08-14T12:38:02","modified_gmt":"2022-08-14T12:38:02","slug":"ir-remote-controls","status":"publish","type":"post","link":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls","title":{"rendered":"IR remote controls"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">About the post<\/h2>\n\n<p>In my <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/ir-proximity-sensor-how-to-build-it-yourself\" target=\"_blank\" rel=\"noopener noreferrer\">last post<\/a>, I dealt with infrared (IR) proximity sensors. In this post, I would like to stick to the topic of infrared, but this time it is about IR remote controls. At first, I will go into the transmission technique via IR in detail. Then I will explain how to build IR remote controls yourself. Finally, I would like to show you how you can remotely control your projects with an IR remote control using a suitable library. Of course, you can also go straight to the last chapter if you are less interested in the background or if you don&#8217;t have time.<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/remote-control-564462_1920.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"535\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/remote-control-564462_1920-1024x535.jpg\" alt=\"Collection of old IR remote controls\" class=\"wp-image-8254\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/remote-control-564462_1920-1024x535.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/remote-control-564462_1920-300x157.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/remote-control-564462_1920-768x401.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/remote-control-564462_1920-1320x689.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/remote-control-564462_1920.jpg 1500w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Do you still have old IR remote controls? Don&#8217;t throw it away! (Source: see Thanksgiving)<\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\">IR data transmission<\/h2>\n\n<p>As most people surely know, infrared radiation is invisible light. The infrared spectrum joins the visible spectrum in the longer wavelength range. Infrared radiation is also known as heat radiation. You can find out more about infrared radiation in general, e.g., <a href=\"https:\/\/de.wikipedia.org\/wiki\/Infrarotstrahlung\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> on Wikipedia.<\/p>\r\n<p>Since every warm body emits more or less infrared light depending on its temperature, IR radiation is omnipresent. This can affect targeted signal transmissions. IR remote controls use a trick by sending pulsed signals. As a result, the signals differ significantly from the ambient radiation, which can be filtered out accordingly. Most often, IR remote controls use a pulse rate of 38 kilohertz.<\/p>\r\n\n<h3 class=\"wp-block-heading\">Infrared receivers<\/h3>\n\n<p>Infrared radiation can be detected using IR-sensitive photodiodes. I described this type of IR sensors in my last post. You may have seen them as &#8220;flame sensors&#8221; on corresponding modules.<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/20191123_150652.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"244\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/20191123_150652-1024x244.jpg\" alt=\"IR photodiode: looks like a black LED\" class=\"wp-image-8255\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/20191123_150652-1024x244.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/20191123_150652-300x72.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/20191123_150652-768x183.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/20191123_150652-1536x366.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/20191123_150652-1320x315.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/20191123_150652.jpg 1800w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>IR photodiode: looks like a black LED<\/figcaption><\/figure>\n<p>With such photodiodes, however, one captures the entire IR radiation, whether pulsed or non-pulsed. If you only want to fish the pulsed radiation out of the &#8220;soup&#8221; of infrared light, you must use such three-pin ones:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Dreibeiner_Empf&#xE4;nger.jpg\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Dreibeiner_Empf&#xE4;nger-1024x634.jpg\" alt=\"Infrared receiver for pulsed light\" class=\"wp-image-4162\"\/><\/a><figcaption>Infrared receiver for pulsed light<\/figcaption><\/figure>\n<p>You can find these receivers under the designation VS1838B or TSOPxx38 with xx = z.B. 18, 22, 24, 48. If the designations do not end with 38, as e.g. TSOP2256, then the pulse frequency is not 38 kHz, but in this example 56 kHz. An overview of the nomenclature of IR receivers can be found <a href=\"https:\/\/www.mouser.de\/datasheet\/2\/427\/introductionpartnumbers-537189.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\r\n\n<p>Also, a receiver for pulsed signals contains a normal IR photodiode (see diagram below). The AGC unit (automatic gain control) amplifies the signal. The bandpass filter cleans it and finally the demodulator converts it into a continuous signal (continuously relating to the 38 kHz). At the end there is a transistor, which switches to Ground in case of an incoming signal. This means that pin 1 of the receiver changes from HIGH to LOW. <em>Note: not all IR receivers have the same pin assignment &#8211; look at the data sheet. Also in the Fritzing schematic below I have a different assignment (because I only found this one).<\/em><\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/11\/Schaltplan_IR_Receiver.png\"><img loading=\"lazy\" decoding=\"async\" width=\"841\" height=\"433\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/11\/Schaltplan_IR_Receiver.png\" alt=\"Diagram of an infrared receiver for pulsed signals\" class=\"wp-image-8247\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/11\/Schaltplan_IR_Receiver.png 841w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/11\/Schaltplan_IR_Receiver-300x154.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/11\/Schaltplan_IR_Receiver-768x395.png 768w\" sizes=\"auto, (max-width: 841px) 100vw, 841px\" \/><\/a><figcaption>Diagram of an infrared receiver for pulsed signals<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\">IR remote controls: analysis of signals<\/h3>\n\n<p>I would now like to show how you can analyze an IR signal. Further down, I use a more comfortable library. But I find it quite exciting to do it &#8220;manually&#8221;.<\/p>\r\n<p>But first the wiring. First we will concentrate on the receiver part (at pin 2), the transmitter part (at pin 5) will be discussed later.<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/circuit_decoder_and_zapper.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/circuit_decoder_and_zapper-1024x642.png\" alt=\"Arduino wiring for sending and receiving IR signals\" class=\"wp-image-15753\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/circuit_decoder_and_zapper-1024x642.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/circuit_decoder_and_zapper-300x188.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/circuit_decoder_and_zapper-768x481.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/circuit_decoder_and_zapper-542x340.png 542w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/circuit_decoder_and_zapper-1320x827.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/circuit_decoder_and_zapper.png 1417w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Arduino wiring for sending and receiving IR signals<\/figcaption><\/figure>\n<p>GND of the receiver is connected to GND, VCC to 5 volts and DATA to an I\/O pin (I chose pin 2). The receiver can also be attached directly to the 5V supply of the Arduino because it draws less than 1 mA of electricity.<\/p>\r\n\n<h4 class=\"wp-block-heading\">Structure of IR remote control signals<\/h4>\n\n<p>Signals from IR remote controls are double pulsed, so to speak. A signal consists of a sequence of pulses, each pulse having a width of several hundred microseconds to a few milliseconds. I call these pulses main pulses because I couldn&#8217;t think of anything better. So, that is not a technical term. Different lengths of pauses are between the main pulses. The main pulses in turn consist of many 38 kHz pulses.<\/p>\r\n<p>Here is a typical example of an IR signal:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal.png\"><img loading=\"lazy\" decoding=\"async\" width=\"808\" height=\"515\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal.png\" alt=\"IR transmitting signal on the oscilloscope\" class=\"wp-image-8259\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal.png 808w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal-300x191.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal-768x490.png 768w\" sizes=\"auto, (max-width: 808px) 100vw, 808px\" \/><\/a><figcaption>IR transmitting signal on the oscilloscope<\/figcaption><\/figure>\n<p>The main pulses are easily recognizable. You also see that the signal basically consists of two identical main pulse sequences separated by a longer pause. This is not uncommon with IR remote controls.<\/p>\r\n<p>At higher resolution, the 38 kHz pulses within main pulses are then revealed. Here is an example of a magnified main pulse:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal_lupe.png\"><img loading=\"lazy\" decoding=\"async\" width=\"806\" height=\"511\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal_lupe.png\" alt=\"A magnified main pulse - you recognize the 38 kHz pulses\" class=\"wp-image-8260\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal_lupe.png 806w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal_lupe-300x190.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal_lupe-768x487.png 768w\" sizes=\"auto, (max-width: 806px) 100vw, 806px\" \/><\/a><figcaption>A magnified main pulse &#8211; you recognize the 38 kHz pulses<\/figcaption><\/figure>\n<p>On the receiver side, the 38 kHz pulses are demodulated. In addition, the signal is reversed due to the set-up of the receivers described above. That is, LOW becomes HIGH and vice versa. Here you can see again the signal from the penultimate picture, but at the receiver:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal_receiver.png\"><img loading=\"lazy\" decoding=\"async\" width=\"805\" height=\"515\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal_receiver.png\" alt=\"The demodulated signal on the receiver side - the 38 kHz pulses are gone\" class=\"wp-image-8261\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal_receiver.png 805w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal_receiver-300x192.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/fernbedienung_signal_receiver-768x491.png 768w\" sizes=\"auto, (max-width: 805px) 100vw, 805px\" \/><\/a><figcaption>The demodulated signal on the receiver side &#8211; the 38 kHz pulses are gone<\/figcaption><\/figure>\n<h4 class=\"wp-block-heading\">The evaluation sketch for signals on the receiver<\/h4>\n\n<p>The evaluation is about measuring the pulse and pause widths. The best way to do this is to first define a suitable unit of time (&#8220;timeSegment&#8221;) that represents the resolution. In the following sketch, the Arduino checks whether the data pin on the IR receiver is HIGH or LOW after each time unit expires. The time units are added until a HIGH\/LOW or LOW\/HIGH change takes place. This is how you move through the signal piece by piece.<\/p>\r\n<p>The counter for the pulse width (or pause width) is defined as pulseWidthCounter in the sketch. The pulse pause pairs are stored as an array (irSignal). The pairs are counted by the pulseCounter. The end of a signal is reached when there is no pulse for a long time (maxCount is reached).<\/p>\r\n<p>There are two things to consider in this procedure:<\/p>\r\n<ol>\r\n<li>Checking the pin status using digitalRead is quite slow with about three microseconds (at least using the Arduino UNO). The direct query of the input register via (PIND &amp; (1&lt;&lt;PD2)) is much faster.<\/li>\r\n<li>If timeSegment is too small, the pin status must be queried very often. The time required for reading the pin status, even with the fast method, then adds up to a significant error. If timeSegment is too large, beginning and end of the pulses become correspondingly blurred. Twenty microseconds have proven themselves.<\/li>\r\n<\/ol>\r\n<p>If a signal is fully transmitted, it is output once on the serial monitor in pairs and once as an array. You can copy the latter directly into the transmitter sketch that we are discussing in a moment. The last measured value is maxCount. We do not need this because it is no longer part of the signal. Accordingly, I omit it in the array output.<\/p>\r\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-title=\"IR_Decoder.ino\" data-enlighter-group=\"IR_Decoder.ino\">unsigned\u00a0int\u00a0pulseWidthCounter,\u00a0pulseCounter;\r\nunsigned\u00a0int\u00a0maxCount\u00a0=\u00a060000;\r\nconst\u00a0int\u00a0timeSegment\u00a0=\u00a020;\r\nbool\u00a0completed;\r\nunsigned\u00a0int\u00a0irSignal[100][2];\r\n\r\nvoid\u00a0setup()\u00a0{\r\n\u00a0\u00a0Serial.begin(9600);\r\n\u00a0\u00a0Serial.println(\"IR\u00a0Decoder\u00a0Sketch\u00a0-\u00a0ready\");\r\n}\r\n\r\nvoid\u00a0loop()\u00a0{\r\n\u00a0\u00a0pulseCounter\u00a0=\u00a00;\r\n\u00a0\u00a0if(!(PIND\u00a0&amp;\u00a0(1&lt;&lt;PD2))){\r\n\u00a0\u00a0\u00a0\u00a0completed\u00a0=\u00a0false;\r\n\u00a0\u00a0\u00a0\u00a0\r\n\u00a0\u00a0\u00a0\u00a0while(!completed){\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pulseWidthCounter\u00a0=\u00a00;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0while(!(PIND\u00a0&amp;\u00a0(1&lt;&lt;PD2))){\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pulseWidthCounter++;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0delayMicroseconds(timeSegment);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0irSignal[pulseCounter][0]\u00a0=\u00a0pulseWidthCounter;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pulseWidthCounter\u00a0=\u00a00;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0while((PIND\u00a0&amp;\u00a0(1&lt;&lt;PD2))\u00a0&amp;&amp;\u00a0(pulseWidthCounter\u00a0&lt;\u00a0maxCount)){\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pulseWidthCounter++;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0delayMicroseconds(timeSegment);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0irSignal[pulseCounter][1]\u00a0=\u00a0pulseWidthCounter;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if(pulseWidthCounter\u00a0&gt;=\u00a0maxCount){\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0completed\u00a0=\u00a0true;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0pulseCounter++;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if(pulseWidthCounter\u00a0&gt;=\u00a0maxCount){\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0completed\u00a0=\u00a0true;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\r\n\u00a0\u00a0\u00a0\u00a0Serial.println(\"IR\u00a0Signal\u00a0erhalten:\");\r\n\u00a0\u00a0\u00a0\u00a0for(int\u00a0i=0;\u00a0i&lt;pulseCounter;\u00a0i++){\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.print(irSignal[i][0]);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.print(\"\u00a0|\u00a0\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.println(irSignal[i][1]);\r\n\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0Serial.println();\r\n\u00a0\u00a0\u00a0\u00a0Serial.print(\"{\");\r\n\u00a0\u00a0\u00a0\u00a0for(int\u00a0i=0;\u00a0i&lt;(pulseCounter-1);\u00a0i++){\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.print(irSignal[i][0]);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.print(\",\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.print(irSignal[i][1]);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.print(\",\");\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if(i==(pulseCounter-2)){\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Serial.print(irSignal[i+1][0]);\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\r\n\u00a0\u00a0\u00a0\u00a0}\u00a0\u00a0\r\n\u00a0\u00a0\u00a0\u00a0Serial.println(\"}\");\r\n\u00a0\u00a0}\r\n}<\/pre>\r\n&nbsp;\r\n\r\n<\/div>\n\n<h4 class=\"wp-block-heading\">The output on a concrete example<\/h4>\n\n<p>For testing, I have selected the remote control of my satellite receiver. In fact, the &#8220;Channel+&#8221; button. Incidentally, I also used this signal for the oscilloscope measurements above. To calculate the pulse widths in microseconds from the numbers, you must of course multiply them by twenty. But I found it easier to work with the smaller numbers.<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Ausgabe_IR_Decode.png\"><img loading=\"lazy\" decoding=\"async\" width=\"734\" height=\"613\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Ausgabe_IR_Decode.png\" alt=\"Output of the IR decoder sketch\" class=\"wp-image-8262\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Ausgabe_IR_Decode.png 734w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Ausgabe_IR_Decode-300x251.png 300w\" sizes=\"auto, (max-width: 734px) 100vw, 734px\" \/><\/a><figcaption>Output of the IR decoder sketch<\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\">Build your own IR remote controls<\/h2>\n\n<p>And now we can take the signal that has just been analyzed and send it with an IR LED. We build our own remote control or simulate the existing remote control. But first I have to explain how to generate a 38 kHz signal.<\/p>\r\n\n<h3 class=\"wp-block-heading\">Generating a 38 kHz pulse signal<\/h3>\n\n<h4 class=\"wp-block-heading\">IR LEDs<\/h4>\n\n<p>As an infrared source, you best use an IR LED. It basically works like an LED for visible light. IR LEDs are also available in different &#8220;colors&#8221;, i.e. in different wavelengths. 850 or 940 nm are the common wavelengths. According to my research, 940 nm seems to fit better to most receivers. Otherwise, the IR LEDs differ mainly in their maximum current. The IR LEDs I use have a current of 100 mA at 1.2 to 1.5 volts. When selecting resistors, it should be noted that for pulsed signals effectively only half the current is needed. In addition, the IR signals are very short. Nevertheless, you should consider using an external power source and switching it on with a transistor like in my circuit above. As a series resistor I used 15 ohms.<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/IR_LED.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"227\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/IR_LED-1024x227.jpg\" alt=\"IR LED\" class=\"wp-image-8268\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/IR_LED-1024x227.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/IR_LED-300x67.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/IR_LED-768x170.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/IR_LED-1536x341.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/IR_LED-1320x293.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/IR_LED.jpg 2000w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>An IR LED<\/figcaption><\/figure>\n<h4 class=\"wp-block-heading\">Generating pulse signals with IR LEDs<\/h4>\n\n<p>To let the IR LED pulse with 38 kHz, one can theoretically use the function tone(pin, frequency) or noTone(). More information about this feature can be found <a href=\"https:\/\/www.arduino.cc\/reference\/en\/language\/functions\/advanced-io\/tone\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>. For tone() you have to choose a PWM-enabled pin. In fact, with tone(5, 38000) I could generate beautiful pulses of the correct width at pin 5:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/tone_38000Hz.png\"><img loading=\"lazy\" decoding=\"async\" width=\"805\" height=\"514\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/tone_38000Hz.png\" alt=\"38 kHz pulse for IR remote controls with the tone() function\" class=\"wp-image-8263\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/tone_38000Hz.png 805w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/tone_38000Hz-300x192.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/tone_38000Hz-768x490.png 768w\" sizes=\"auto, (max-width: 805px) 100vw, 805px\" \/><\/a><figcaption>38 kHz pulse with the tone() function<\/figcaption><\/figure>\n<p>I had already been able to use the tone() function successfully in <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/ir-proximity-sensor-how-to-build-it-yourself\" target=\"_blank\" rel=\"noopener noreferrer\">my last article<\/a> about self-built proximity sensors. So, I wanted to generate my signal with a construction like: tone &#8211; delay &#8211; noTone &#8211; delay. But for reasons that I am obscure, it did not work. Does anyone have an idea? Do the tone\/ noTone commands take too much time? By the way, the variant tone(<em>pin, frequency, length<\/em>), i.e. without delay and noTone does not work either because <em>length<\/em> is given in milliseconds, which is too rough for this purpose.<\/p>\r\n<p>However, there are still two alternatives that work. Either you create the signals via the digitalWrite function or via the faster variant of direct port access. Here&#8217;s the sketch:<\/p>\r\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"ir_signal_creator.ino\" data-enlighter-title=\"ir_signal_creator.ino\">const\u00a0int\u00a0irLEDPin\u00a0=\u00a05;\r\n\r\nvoid\u00a0setup()\u00a0{\r\n\u00a0\u00a0pinMode(irLEDPin,\u00a0OUTPUT);\r\n}\r\n\r\nvoid\u00a0loop()\u00a0{\u00a0\r\n\u00a0\u00a0\/\/PORTD\u00a0|=\u00a0(1&lt;&lt;PD5);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u00a0much\u00a0faster\u00a0than\u00a0digitalWrite\r\n\u00a0\u00a0digitalWrite(irLEDPin,\u00a0HIGH);\u00a0\u00a0\u00a0\/\/\u00a0too\u00a0slow:\u00a03\u00a0microseconds\u00a0(Arduino\u00a0UNO\u00a0\/\u00a0Atmega\u00a0328P)\r\n\u00a0\u00a0delayMicroseconds(13);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u00a0does\u00a0not\u00a0work\u00a0-\u00a0switch\u00a0to\u00a010\u00a0or\u00a09\u00a0\u00b5s\r\n\u00a0\u00a0\/\/PORTD\u00a0&amp;=\u00a0~(1&lt;&lt;PD5);\r\n\u00a0\u00a0digitalWrite(irLEDPin,\u00a0LOW);\u00a0\u00a0\u00a0\u00a0\/\/\u00a0again\u00a03\u00a0microseconds\r\n\u00a0\u00a0delayMicroseconds(13);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/\u00a0does\u00a0not\u00a0work\u00a0-\u00a0switch\u00a0to\u00a010\u00a0or\u00a09\u00a0\u00b5s\r\n}<\/pre>\r\n&nbsp;\n\n<p>If you opt for digitalWrite, you&#8217;ll have to reduce the delays from 13 microseconds to 10 microseconds, as the digitalWrite function requires about 3 seconds (at least on the Arduino UNO). Otherwise, this happens:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/manuell_38kHz_konv.png\"><img loading=\"lazy\" decoding=\"async\" width=\"808\" height=\"514\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/manuell_38kHz_konv.png\" alt=\"Signal generation for IR remote controls with digitalWrite and 13's delay - the pulse width becomes too large \" class=\"wp-image-8265\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/manuell_38kHz_konv.png 808w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/manuell_38kHz_konv-300x191.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/manuell_38kHz_konv-768x489.png 768w\" sizes=\"auto, (max-width: 808px) 100vw, 808px\" \/><\/a><figcaption>Signal generation with digitalWrite and 13&#8217;s delay &#8211; the pulse width becomes too large<\/figcaption><\/figure>\n<p>If you choose the variant with direct access, you can stay at 13 \u00b5s. The results of the measurements would even suggest taking 14 \u00b5s (see next picture). Interestingly, a microsecond seems to be swallowed somewhere!? Can anyone explain this to me? No matter, I left it at 13 microseconds and it worked. <\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/manuell_38kHz_PM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"807\" height=\"515\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/manuell_38kHz_PM.png\" alt=\"Signal generation for IR remote controls via direct port access and 13 &#xB5;s delay - a little too short\" class=\"wp-image-8264\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/manuell_38kHz_PM.png 807w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/manuell_38kHz_PM-300x191.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/manuell_38kHz_PM-768x490.png 768w\" sizes=\"auto, (max-width: 807px) 100vw, 807px\" \/><\/a><figcaption>Signal generation via direct port access and 13&#8217;s delay &#8211; a little too short<\/figcaption><\/figure>\n<p>There are other methods to generate fast PWM signal (via the internal timers of the AVR MCUs), but this would lead too far here. <\/p>\r\n\n<h3 class=\"wp-block-heading\">The transmitter sketch<\/h3>\n\n<p>The following sketch simulates the &#8220;Channel +&#8221; button of my remote control. The circuit still corresponds to the Fritzing scheme from above. The channel is incremented every ten seconds. An automatic zapper, so to speak. Pretty simple, but I would just like to showcase the principle. If you implement more signals and then assign them to buttons, you can recreate an entire remote control in this way.<\/p>\r\n<p>The sketch should not be difficult to understand. The previously decoded signal is used. The length of the array is determined by its size in bytes. I borrowed and modified the pulseIR function from an <a href=\"https:\/\/learn.adafruit.com\/ir-sensor\/making-an-intervalometer\" target=\"_blank\" rel=\"noopener noreferrer\">Adafruit tutorial.<\/a><\/p>\r\n<p>I&#8217;ve tried it all and it works.<\/p>\r\n\n<div class=\"scroll-paragraph-long\">\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-title=\"Auto_Zapper.ino\" data-enlighter-group=\"Auto_Zapper.ino\">const int timeSegment = 20;\r\nconst int irLEDPin = 5;\r\nint irSignal[] = {48,42,47,43,92,87,92,43,47,42,47,87,92,43,47,43,47,42,47,43,46,4538,47,43,47,42,93,87,92,42,47,43,47,87,92,42,47,43,47,42,48,42,47};\r\n\r\nint irSignalLength;\r\nunsigned long phase;\r\n\r\nvoid setup() {\r\n  irSignalLength = sizeof(irSignal)\/2; \/\/ One int = Two bytes\r\n  pinMode(irLEDPin, OUTPUT);\r\n}\r\n\r\nvoid loop() {\r\n  int i = 0;\r\n  \r\n  phase = 20*irSignal[i];\r\n    pulseIR(phase);\r\n    i++;\r\n  do{\r\n    phase = 20*irSignal[i];\r\n    delayMicroseconds(phase);\r\n    i++;\r\n    phase = 20*irSignal[i];\r\n    pulseIR(phase);\r\n    i++;\r\n  }while(i&lt;irSignalLength);\r\n\r\n  delay(10000);\r\n}\r\n\r\nvoid pulseIR(long microsecs) {\r\n  cli();  \/\/ interrupts switched off\r\n  \r\n  while (microsecs &gt; 0) {\r\n  \/\/ 38 kHz is about 13 microseconds high and 13 microseconds low\r\n  PORTD |= (1&lt;&lt;PD5);                \/\/ much faster than \r\n  \/\/digitalWrite(irLEDPin, HIGH);   \/\/ too slow: 3 microseconds (Arduino UNO \/ Atmega 328P)\r\n  delayMicroseconds(13);            \/\/ 10 microseconds, if you chose digitalWrite\r\n  \/\/digitalWrite(irLEDPin, LOW);    \/\/ again 3 microseconds\r\n  PORTD &amp;= ~(1&lt;&lt;PD5);\r\n  delayMicroseconds(13);            \/\/ 10 microseconds, if you chose digitalWrite\r\n  microsecs -= 26;\r\n  }\r\n  \r\n  sei();  \/\/ interrupts switched on\r\n}<\/pre>\r\n&nbsp;\r\n\r\n<\/div>\n\n<h2 class=\"wp-block-heading\">IR remote controls with the IRLib2 library<\/h2>\n\n<p>Most of you will want to use IR remote controls to remotely control projects. The procedure explained so far is a little complex. There is also the question of how to judge whether a signal matches a reference. Because if you record a signal several times, you will see that the measured length of the individual pulses varies somewhat.<\/p>\r\n<p>Smart people have developed libraries for the detection and coding of signals from IR remote controls. These are based on the fact that the signals of IR remote controls can be assigned to specific protocols, such as NEC, Sony, Panasonic, etc. These have certain patterns and allow the signal sequences to be represented in a compact value instead of an unwieldy array. <\/p>\r\n<p>There are a number of good libraries. The classic is <a href=\"https:\/\/github.com\/z3t0\/Arduino-IRremote\" target=\"_blank\" rel=\"noopener noreferrer\">IRRemote<\/a> by Ken Shirriff. Personally, however, I recommend the <a href=\"https:\/\/github.com\/cyborg5\/IRLib2\" target=\"_blank\" rel=\"noopener noreferrer\">LIBRARY IRLib2<\/a>, as it is compatible with a variety of boards. When installing, it should be noted that the library is actually a collection of libraries. Therefore, if you download the zip file, you must not unzip it directly in the library folder. Instead, you unzip the zip file somewhere and then copy the main folders to the Arduino library directory. The library cannot be installed via the convenient Arduino library manager.<\/p>\r\n<p>A good tutorial about the library can be found <a href=\"https:\/\/learn.adafruit.com\/using-an-infrared-library\/about-ir-libraries\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> on the Adafruit learning web pages. I would just like to give a brief introduction in this post.<\/p>\r\n\n<h3 class=\"wp-block-heading\">IR remote controls: decode signals with IRLib2<\/h3>\n\n<p>After installing the library, take the example sketch dump.ino without further adjustment. The circuit needed for the sketch is still the same as at the beginning of this article.<\/p>\r\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"dump.ino\" data-enlighter-title=\"dump.ino\">\/*\u00a0dump.ino\u00a0Example\u00a0sketch\u00a0for\u00a0IRLib2\r\n\u00a0\u00a0\u00a0Illustrates\u00a0how\u00a0to\u00a0receive\u00a0an\u00a0IR\u00a0signal,\u00a0decode\u00a0it\u00a0and\u00a0print\r\n\u00a0\u00a0\u00a0information\u00a0about\u00a0it\u00a0to\u00a0the\u00a0serial\u00a0monitor.\r\n*\/\r\n\/\/This\u00a0includes\u00a0everything.\u00a0Not\u00a0generally\u00a0recommended.\r\n\/\/It's\u00a0better\u00a0to\u00a0include\u00a0only\u00a0the\u00a0parts\u00a0of\u00a0library\u00a0you\u00a0really\u00a0need.\r\n\/\/But\u00a0for\u00a0this\u00a0example\u00a0it's\u00a0quick\u00a0and\u00a0easy.\u00a0See\u00a0\"comboDump\"\u00a0example\r\n\/\/for\u00a0a\u00a0more\u00a0efficient\u00a0way.\r\n#include\u00a0\"IRLibAll.h\"\r\n\r\nIRrecvPCI\u00a0myReceiver(2);\u00a0\/\/create\u00a0receiver\u00a0and\u00a0pass\u00a0pin\u00a0number\r\nIRdecode\u00a0myDecoder;\u00a0\u00a0\u00a0\/\/create\u00a0decoder\r\n\r\nvoid\u00a0setup()\u00a0{\r\n\u00a0\u00a0Serial.begin(9600);\r\n\u00a0\u00a0delay(2000);\u00a0while\u00a0(!Serial);\u00a0\/\/delay\u00a0for\u00a0Leonardo\r\n\u00a0\u00a0myReceiver.enableIRIn();\u00a0\/\/\u00a0Start\u00a0the\u00a0receiver\r\n\u00a0\u00a0Serial.println(F(\"Ready\u00a0to\u00a0receive\u00a0IR\u00a0signals\"));\r\n}\r\n\r\nvoid\u00a0loop()\u00a0{\r\n\u00a0\u00a0\/\/Continue\u00a0looping\u00a0until\u00a0you\u00a0get\u00a0a\u00a0complete\u00a0signal\u00a0received\r\n\u00a0\u00a0if\u00a0(myReceiver.getResults())\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0myDecoder.decode();\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Decode\u00a0it\r\n\u00a0\u00a0\u00a0\u00a0myDecoder.dumpResults(true);\u00a0\u00a0\/\/Now\u00a0print\u00a0results.\u00a0Use\u00a0false\u00a0for\u00a0less\u00a0detail\r\n\u00a0\u00a0\u00a0\u00a0myReceiver.enableIRIn();\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/Restart\u00a0receiver\r\n\u00a0\u00a0}\r\n}\r\n<\/pre>\r\n&nbsp;\n\n<p>As a remote control I have chosen a very handy and cheap model. Such remote controls are available in a wide selection on Amazon or eBay:<\/p>\r\n\n<div class=\"wp-block-image\">\r\n<figure class=\"aligncenter size-large is-resized\">\r\n<figure><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/billig_fernbedienung-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4213 aligncenter\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/billig_fernbedienung-556x1024.jpg\" alt=\"\" width=\"139\" height=\"256\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/billig_fernbedienung-556x1024.jpg 556w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/billig_fernbedienung-163x300.jpg 163w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/billig_fernbedienung-768x1416.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/billig_fernbedienung-833x1536.jpg 833w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/billig_fernbedienung-1111x2048.jpg 1111w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/billig_fernbedienung-1320x2433.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/billig_fernbedienung-scaled.jpg 1389w\" sizes=\"auto, (max-width: 139px) 100vw, 139px\" \/><\/a><\/figure>\r\n<figcaption>IR Remote Control<\/figcaption>\r\n<\/figure>\r\n<\/div>\r\n\n<p>Then I decoded the signals of keys 1, 2 and 3. Here is the output of the dump.ino sketch for the key 1:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/irlib2_dec.png\"><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"449\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/irlib2_dec.png\" alt=\"Decode IR remote controls with IRLib2\" class=\"wp-image-8253\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/irlib2_dec.png 735w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/irlib2_dec-300x183.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/a><figcaption>Decode IR remote controls with IRLib2<\/figcaption><\/figure>\n<p>The relevant output is the &#8220;Value&#8221; (marked in red), in this case FD08F7. That&#8217;s a bit more affable than the long series of numbers before, isn&#8217;t it?<\/p>\r\n\n<h3 class=\"wp-block-heading\">A simple application example<\/h3>\n\n<p>With the appropriate codes you can then remotely control everything controllable, be it lamps, cars, music or whatever. Here is a minimal example where one of three LEDs is switched on with my remote control, an LED zapper, so to speak.<\/p>\r\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-group=\"remote_simple_example.ino\" data-enlighter-title=\"remote_simple_example.ino\">#include \"IRLibAll.h\"\r\n\r\nIRrecvPCI myReceiver(2); \r\nIRdecode myDecoder;   \r\nconst int led1 = 10;\r\nconst int led2 = 11;\r\nconst int led3 = 12;\r\n\r\nvoid setup() {\r\n  pinMode(led1,OUTPUT);\r\n  pinMode(led2,OUTPUT);\r\n  pinMode(led3,OUTPUT);\r\n  myReceiver.enableIRIn(); \/\/ Start the receiver\r\n}\r\n\r\nvoid loop() {\r\n  if (myReceiver.getResults()) {\r\n    myDecoder.decode();           \/\/Decode it\r\n    switch(myDecoder.value){\r\n      case 0xFD08F7:\r\n        switchOnLed(led1);    \r\n        break;\r\n      case 0xFD8877:\r\n         switchOnLed(led2);  \r\n        break;\r\n      case 0xFD48B7:\r\n         switchOnLed(led3);     \r\n        break;\r\n    }           \r\n  }\r\n  myReceiver.enableIRIn();      \/\/Restart receiver\r\n}\r\n\r\nvoid switchOnLed(int pin){\r\n  digitalWrite(led1, LOW);\r\n  digitalWrite(led2, LOW);\r\n  digitalWrite(led3, LOW);\r\n  digitalWrite(pin, HIGH);\r\n}<\/pre>\r\n&nbsp;\n\n<p>And here is the corresponding circuit:<\/p>\r\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Wiring_simple_example.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"710\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Wiring_simple_example-1024x710.png\" alt=\"Remote controlled LED zapper\" class=\"wp-image-8267\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Wiring_simple_example-1024x710.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Wiring_simple_example-300x208.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Wiring_simple_example-768x532.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Wiring_simple_example-1320x915.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Wiring_simple_example.png 1324w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Remote controlled LED zapper<\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\">Another suggestion<\/h2>\n\n<p>Some time ago I wrote a post entitled &#8220;<a href=\"https:\/\/wolles-elektronikkiste.de\/en\/own-radio-protocols\" target=\"_blank\" rel=\"noopener noreferrer\">Own radio protocols<\/a>&#8220;. This involved communication with 433 MHz modules using specially developed protocols. The methodologies presented there can be transferred to infrared technology. So, you can then send e.g. text, measurement results or the like. Have a look if you are interested.<\/p>\r\n\n<h2 class=\"wp-block-heading\">Acknowledgement<\/h2>\n\n<p>The remote control in the post image is from <a href=\"https:\/\/pixabay.com\/de\/users\/kang_hojun-4677467\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2116231\" target=\"_blank\" rel=\"noopener noreferrer\">hojun Kang<\/a> on <a href=\"https:\/\/pixabay.com\/de\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2116231\" target=\"_blank\" rel=\"noopener noreferrer\">Pixabay<\/a>. The Arduino in the background of the post image is from <a href=\"https:\/\/pixabay.com\/de\/users\/Seven_au-4857820\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2168193\" target=\"_blank\" rel=\"noopener noreferrer\">Seven_au<\/a>, also <a href=\"https:\/\/pixabay.com\/de\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2168193\" target=\"_blank\" rel=\"noopener noreferrer\">Pixabay<\/a>. However, I still blurred the picture. I owe the remote control collection to <a href=\"https:\/\/pixabay.com\/de\/users\/maitopia-642513\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=564462%22&gt;Mirko%20Maibach&lt;\/a&gt;%20auf%20&lt;a%20href=%22https:\/\/pixabay.com\/de\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=564462\" target=\"_blank\" rel=\"noopener noreferrer\">Mirko Maibach<\/a> on <a href=\"https:\/\/pixabay.com\/de\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=564462\" target=\"_blank\" rel=\"noopener noreferrer\">Pixabay.<\/a><\/p>\r\n<p>I thank Chris Young (cyborg5) for his <a href=\"https:\/\/github.com\/cyborg5\/IRLib2\" target=\"_blank\" rel=\"noopener noreferrer\">library<\/a> and <a href=\"https:\/\/learn.adafruit.com\/using-an-infrared-library\/overview\" target=\"_blank\" rel=\"noopener noreferrer\">tutorial<\/a>.<\/p>\r\n<p> <\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>I explain how IR remote controls transmit signals and how to build a remote control yourself. I also present the IRLib2 library.<\/p>\n","protected":false},"author":1,"featured_media":8257,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[569,548],"tags":[946,556,941,940,947,951,934,955,952,943,939,949,933],"class_list":["post-9624","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-infrared","category-wireless","tag-38-khz-en-2","tag-arduino-en-2","tag-build-a-remote-control","tag-infrared","tag-infrared-receiver","tag-ir-led-en-2","tag-ir-receiver","tag-irlib2-en-2","tag-notone-en","tag-remote-control-en-2","tag-remote-control-en","tag-tone-en-2","tag-vs1838b-en-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>IR remote controls &#8226; Wolles Elektronikkiste<\/title>\n<meta name=\"description\" content=\"I explain how IR remote controls transmit signals and how to build a remote control yourself. I also present the IRLib2 library.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"IR remote controls &#8226; Wolles Elektronikkiste\" \/>\n<meta property=\"og:description\" content=\"I explain how IR remote controls transmit signals and how to build a remote control yourself. I also present the IRLib2 library.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls\" \/>\n<meta property=\"og:site_name\" content=\"Wolles Elektronikkiste\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-17T17:08:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-14T12:38:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Beitragsbild_IR_klein.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1090\" \/>\n\t<meta property=\"og:image:height\" content=\"1090\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Wolfgang Ewald\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Wolfgang Ewald\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls\"},\"author\":{\"name\":\"Wolfgang Ewald\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"headline\":\"IR remote controls\",\"datePublished\":\"2020-11-17T17:08:53+00:00\",\"dateModified\":\"2022-08-14T12:38:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls\"},\"wordCount\":2333,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/Beitragsbild_IR_klein.jpg\",\"keywords\":[\"38 kHz\",\"Arduino\",\"build a remote control\",\"infrared\",\"infrared receiver\",\"IR LED\",\"IR receiver\",\"IRLib2\",\"noTone\",\"remote control\",\"remote control\",\"tone\",\"VS1838B\"],\"articleSection\":[\"Infrared\",\"Wireless\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls\",\"name\":\"IR remote controls &#8226; Wolles Elektronikkiste\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/Beitragsbild_IR_klein.jpg\",\"datePublished\":\"2020-11-17T17:08:53+00:00\",\"dateModified\":\"2022-08-14T12:38:02+00:00\",\"description\":\"I explain how IR remote controls transmit signals and how to build a remote control yourself. I also present the IRLib2 library.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls#primaryimage\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/Beitragsbild_IR_klein.jpg\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/12\\\/Beitragsbild_IR_klein.jpg\",\"width\":1090,\"height\":1090},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ir-remote-controls#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"IR remote controls\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\",\"name\":\"Wolles Elektronikkiste\",\"description\":\"Die wunderbare Welt der Elektronik\",\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\",\"name\":\"Wolfgang Ewald\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"width\":512,\"height\":512,\"caption\":\"Wolfgang Ewald\"},\"logo\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"IR remote controls &#8226; Wolles Elektronikkiste","description":"I explain how IR remote controls transmit signals and how to build a remote control yourself. I also present the IRLib2 library.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls","og_locale":"en_US","og_type":"article","og_title":"IR remote controls &#8226; Wolles Elektronikkiste","og_description":"I explain how IR remote controls transmit signals and how to build a remote control yourself. I also present the IRLib2 library.","og_url":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls","og_site_name":"Wolles Elektronikkiste","article_published_time":"2020-11-17T17:08:53+00:00","article_modified_time":"2022-08-14T12:38:02+00:00","og_image":[{"width":1090,"height":1090,"url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Beitragsbild_IR_klein.jpg","type":"image\/jpeg"}],"author":"Wolfgang Ewald","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Wolfgang Ewald","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls#article","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls"},"author":{"name":"Wolfgang Ewald","@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"headline":"IR remote controls","datePublished":"2020-11-17T17:08:53+00:00","dateModified":"2022-08-14T12:38:02+00:00","mainEntityOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls"},"wordCount":2333,"commentCount":4,"publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Beitragsbild_IR_klein.jpg","keywords":["38 kHz","Arduino","build a remote control","infrared","infrared receiver","IR LED","IR receiver","IRLib2","noTone","remote control","remote control","tone","VS1838B"],"articleSection":["Infrared","Wireless"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls","url":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls","name":"IR remote controls &#8226; Wolles Elektronikkiste","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#website"},"primaryImageOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls#primaryimage"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Beitragsbild_IR_klein.jpg","datePublished":"2020-11-17T17:08:53+00:00","dateModified":"2022-08-14T12:38:02+00:00","description":"I explain how IR remote controls transmit signals and how to build a remote control yourself. I also present the IRLib2 library.","breadcrumb":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls#primaryimage","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Beitragsbild_IR_klein.jpg","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/12\/Beitragsbild_IR_klein.jpg","width":1090,"height":1090},{"@type":"BreadcrumbList","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ir-remote-controls#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/wolles-elektronikkiste.de\/en"},{"@type":"ListItem","position":2,"name":"IR remote controls"}]},{"@type":"WebSite","@id":"https:\/\/wolles-elektronikkiste.de\/en#website","url":"https:\/\/wolles-elektronikkiste.de\/en","name":"Wolles Elektronikkiste","description":"Die wunderbare Welt der Elektronik","publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wolles-elektronikkiste.de\/en?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46","name":"Wolfgang Ewald","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","width":512,"height":512,"caption":"Wolfgang Ewald"},"logo":{"@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png"}}]}},"_links":{"self":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/9624","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/comments?post=9624"}],"version-history":[{"count":0,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/9624\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media\/8257"}],"wp:attachment":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media?parent=9624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/categories?post=9624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/tags?post=9624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}