{"id":2026,"date":"2019-07-15T17:34:35","date_gmt":"2019-07-15T15:34:35","guid":{"rendered":"https:\/\/willem.aandewiel.nl\/?p=2026"},"modified":"2020-10-12T12:06:42","modified_gmt":"2020-10-12T10:06:42","slug":"universal-infrared-iot-learning-remote","status":"publish","type":"post","link":"https:\/\/willem.aandewiel.nl\/index.php\/2019\/07\/15\/universal-infrared-iot-learning-remote\/","title":{"rendered":"Universal InfraRed IoT Learning Remote"},"content":{"rendered":"\n<p>[ 22,293 keer bekeken \/ views ]<\/p>\n\n\n\n<p>In this post I will guide you through the process of building a device that can capture Infrared-messages from an Infrared remote controller (learning mode), and resend the captured Infrared-messages (sending mode). I will use the affordable and easy to use <strong><em><a href=\"https:\/\/willem.aandewiel.nl\/index.php\/2019\/02\/20\/1of-platform-for-developing-esp8266-devices\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"1of!-experimental (opens in a new tab)\">1of!<\/a><\/em><\/strong><a href=\"https:\/\/willem.aandewiel.nl\/index.php\/2019\/02\/20\/1of-platform-for-developing-esp8266-devices\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"1of!-experimental (opens in a new tab)\">-experimental<\/a> boards to prototype, setup and test the hardware. For the documentation of the schematics I will use the awesome open source <strong><em><a rel=\"noreferrer noopener\" aria-label=\"KiCAD (opens in a new tab)\" href=\"http:\/\/KiCAD-pcb.org\/\" target=\"_blank\">KiCAD<\/a><\/em><\/strong> EDA. Together we will build the complete hardware as a true \u2018<em>one of a kind<\/em>\u2019 device.<\/p>\n\n\n\n<p>After that I will show you the steps to make a Printed Circuit Board (PCB) from the schematics.&nbsp;<\/p>\n\n\n\n<p class=\"has-blue-color has-light-gray-background-color has-text-color has-background\">Een Nederlandse versie van deze post staat op de site van opencircuit.nl<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Principal of Infrared communication<\/strong><\/h2>\n\n\n\n<p>Infrared (IR) communication is a common, inexpensive, and easy to use wireless communication technology. IR light is undetectable to the human eye because it has a slightly longer wavelength (typically 950nm) than normal light (380-780nm) &#8211; perfect for wireless communication.&nbsp;An IR remote works by turning a LED on and off in a particular pattern. However, to prevent interference from IR sources such as sunlight or other lights, the LED is&nbsp;not turned on steadily, but is turned on and off at a modulation frequency (typically 36, 38, or 40kHz).&nbsp;<\/p>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IF_Modulated_Output.png\" alt=\"\" class=\"wp-image-2001\" width=\"589\" height=\"346\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IF_Modulated_Output.png 785w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IF_Modulated_Output-300x176.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IF_Modulated_Output-768x451.png 768w\" sizes=\"auto, (max-width: 589px) 100vw, 589px\" \/><\/figure><\/div>\n\n\n\n<p>The time when a modulated signal is being sent is called a mark, and when the LED is off is called a space. Most used IR-remotes use a modulation frequency of 38kHz which means that a mark is represented by a fast (38.000 times\/second) \u201con\/off\u201d switching of the IR LED.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR-message.png\" alt=\"\" class=\"wp-image-2004\" width=\"600\" height=\"360\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR-message.png 800w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR-message-300x180.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR-message-768x461.png 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption><strong> A typical IR-message <\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>An IR-message starts with a lead-in pulse that is much longer than the other pulses. Then there is a start-bit, then comes the actual data and then again a long pulse, to indicate the end of the IR-message (not shown on the image).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Design considerations<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>an <a rel=\"noreferrer noopener\" aria-label=\"IR-receiver-diode (opens in a new tab)\" href=\"https:\/\/opencircuit.nl\/Product\/10295\/VS1838-infrarood-sensor\" target=\"_blank\">IR-receiver-diode<\/a> to capture the IR-messages <\/li><li>an <a rel=\"noreferrer noopener\" aria-label=\"IR-transmitter (opens in a new tab)\" href=\"https:\/\/opencircuit.nl\/Product\/10463\/5mm-Led-infrarood-940nm\" target=\"_blank\">IR-transmitter<\/a>&nbsp; (IR LED\u2019s 950nm) to send IR-messages <\/li><li>some processing power<\/li><li>storage for saving the captured IR-messages<\/li><li>two status LED\u2019s<\/li><li>the device needs to work with all Infrared remotes that modulate the Infrared signal at 38kHz<\/li><li>it must be able to capture 400 pulse-long messages (I need to be able to capture from and send commands to my Airco\/Heater).<\/li><\/ul>\n\n\n\n<p>The obvious choice to interface with the device is by using a webserver and restAPI and consequently the device needs an internet connection. The ESP8266 with its builtin WiFi and flash filesystem storage is the logical processor for this project.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Project setup<\/strong><\/h2>\n\n\n\n<p>The best way to develop any project is by slicing it into small, logical parts and developing and testing these parts <em>one at the time<\/em>. For now I see three major parts:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>The IR-receiver circuit<\/li><li>The IR-sender circuit<\/li><li>The software to glue everything together<\/li><\/ol>\n\n\n\n<p>The development will be done with the <strong><em><a href=\"https:\/\/willem.aandewiel.nl\/index.php\/2019\/02\/20\/1of-platform-for-developing-esp8266-devices\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"1of!-boards (opens in a new tab)\">1of!-boards<\/a><\/em><\/strong> as they are cheap and easy to use. For the initial setup the <strong><em><a rel=\"noreferrer noopener\" aria-label=\"1of!-Wemos (opens in a new tab)\" href=\"https:\/\/opencircuit.nl\/Product\/14755\/1of-Wemos-D1-processor-bord-bouwpakket\" target=\"_blank\">1of!-Wemos<\/a><\/em><\/strong> processor board is the board of choice as it is easily programmed with a USB cable and for the rest of the circuity a <strong><em>1of!-Solderless bread board<\/em><\/strong> is used. If I\u2019m satisfied with the circuit on the <strong><em>1of!-Solderless board<\/em><\/strong> I will flash the firmware to a <strong><em><a rel=\"noreferrer noopener\" aria-label=\"1of!-ESP12  (opens in a new tab)\" href=\"https:\/\/opencircuit.nl\/Product\/14754\/1of-ESP12-processor-bord-bouwpakket\" target=\"_blank\">1of!-ESP12<\/a><\/em><\/strong><a rel=\"noreferrer noopener\" aria-label=\"1of!-ESP12  (opens in a new tab)\" href=\"https:\/\/opencircuit.nl\/Product\/14754\/1of-ESP12-processor-bord-bouwpakket\" target=\"_blank\"> <\/a>processor board and build the circuitry on a <strong><em><a rel=\"noreferrer noopener\" aria-label=\"1of!-Proto (opens in a new tab)\" href=\"https:\/\/opencircuit.nl\/Product\/14756\/1of-Proto-bord-60x60mm\" target=\"_blank\">1of!-Proto<\/a><\/em><\/strong> board.<\/p>\n\n\n\n<p>The IR signal processing is handled by a fantastic <a rel=\"noreferrer noopener\" aria-label=\"library (opens in a new tab)\" href=\"https:\/\/github.com\/markszabo\/IRremoteESP8266\" target=\"_blank\">library<\/a>&nbsp; [v2.6.2 (20190616)] written by <em>Ken Shirriff, David Conran<\/em> and others. For additional details on how the library works, see&nbsp;Ken Shirriff&#8217;s blog: <a rel=\"noreferrer noopener\" aria-label=\"A Multi-Protocol Infrared remote Library for the Arduino (opens in a new tab)\" href=\"http:\/\/www.righto.com\/2009\/08\/multi-protocol-infrared-remote-library.html\" target=\"_blank\">A Multi-Protocol Infrared remote Library for the Arduino<\/a>.<\/p>\n\n\n\n<!--nextpage-->\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The IR-receiver circuit<\/strong><\/h2>\n\n\n\n<p>For receiving IR-codes an IR-receiver-diode is used. I chose the <a rel=\"noreferrer noopener\" aria-label=\"VS1838B (opens in a new tab)\" href=\"https:\/\/opencircuit.nl\/Product\/10295\/VS1838-infrarood-sensor\" target=\"_blank\">VS1838B<\/a> which is a commonly used and available part that detects 950nm light at 38kHz.The VS1838B detects the 38kHz modulated IR-message and outputs a logic-pulse.<\/p>\n\n\n\n<p>The VS1838B detects the 38kHz modulated IR-message and outputs a logic-pulse.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_receiver_circuit.png\" alt=\"\" class=\"wp-image-2002\" width=\"486\" height=\"497\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_receiver_circuit.png 648w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_receiver_circuit-293x300.png 293w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_receiver_circuit-50x50.png 50w\" sizes=\"auto, (max-width: 486px) 100vw, 486px\" \/><figcaption> <br>  <strong>The IR receiver schematic <\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>The output of the VS1838B is send to GPIO12 of the ESP8266 that will analyse and decode and eventually store the IR-message to a file.&nbsp;<\/p>\n\n\n\n<p>On the <strong><em>1of!-Solderless<\/em><\/strong> board it looks like this. (mind you: The final design uses IO-14 for the green LED):<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-IR_Recv-1024x675.png\" alt=\"\" class=\"wp-image-2024\" width=\"512\" height=\"338\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-IR_Recv-1024x675.png 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-IR_Recv-300x198.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-IR_Recv-768x506.png 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-IR_Recv.png 1200w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure><\/div>\n\n\n\n<p>A green LED (D6) is connected to GPIO14 to give some visual indication the device is waiting for an IR-message to capture.<\/p>\n\n\n\n<p>You can find a program (<a href=\"https:\/\/github.com\/mrWheel\/IR_IoT_Remote\/tree\/master\/IR_receiver\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"IR_receiver (opens in a new tab)\">IR_receiver<\/a>) to test this setup on <a rel=\"noreferrer noopener\" aria-label=\"github (opens in a new tab)\" href=\"https:\/\/github.com\/mrWheel\/IR_IoT_Remote.git\" target=\"_blank\">github<\/a>.<\/p>\n\n\n\n<p>Compile and flash the IR-receiver sketch to the <strong><em>1of!-Wemos<\/em><\/strong> (or <strong><em>1of!-ESP12<\/em><\/strong>) board and open the Serial Monitor.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"false\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> IR_receiver is now running and waiting for IR input on Pin 12\n \n SPIFFS Mount successful\n \n Commands are:\n \n   *D - remove file from SPIFFS\n    L - List SPIFFS\n    H - Help (this message)\n    W - Write rawData to SPIFFS\n    S - System Status\n   *R - Reboot\n  \n Timestamp : 000030.031\n Encoding  : NEC\n Code      : FFA857 (32 bits)\n Library   : v2.6.2\n \n Raw Timing[71]:\n    +  9342, -  4392,    +   684, -   462,    +   658, -   488,\n    +   716, -   430,    +   656, -   488,    +   598, -   546,\n    +   684, -   460,    +   716, -   428, \n    . . . .\n    +   658, -  1624,    +   660, -   486,    +   714, -  1568,\n    +   744, -  1516,    +   708, -  1594,    +   718, - 39748,\n    +  9346, -  2124,    +   708\n \n uint16_t rawData[71] = {9342, 4392,  684, 462,  658, 488,  716,\n 430,  656, 488,  598, 546,  684, 460,  716, 428,  716, 428,  714,\n 1568,  686, 1596,  688, 1592,  658, 1624,  658, 1602,  738,\n 1564,  664, 1618,  \n  . . . \n 460,  658, 1624,  660, 486,  714, 1568,  744, 1516,  708, 1594,\n 718, 39748,  9346, 2124,  708};  \/\/ NEC FFA857\n uint32_t address = 0x0;\n uint32_t command = 0x15;\n uint64_t data = 0xFFA857;\n \n [Enter: \u2018w\u2019]\n Write rawData to SPIFFS\n save pulses as: [Enter: \u2018demo3\u2019]\n save pulses as [\/pls\/demo3.pls] (y\/N) [Enter: \u2018y\u2019]\n fileName is [\/pls\/demo3.pls]\n writeRawData(\/pls\/demo3.pls): number of pulses [71]\n 9342, 4392, 684, 462, 658, 488, 716, 430, 656, 488, 598, 546,\n 684, 460, 716, 428, 716, 428, 686, 460, 690, 1590, 688, 458, 688, \n 456, 688, 438, 680, 484, 660, 1622, 684, 460, 658,\n  . . .  \n 714, 1568, 744, 1516, 708, 1594, 718, 39748, 9346, 2124, 708, \n writeRawData(): saved [71] pulses\n \n [Enter \u2018L\u2019]\n \/pls\/pulse1.pls \/ 286\n \/pls\/demo1.pls \/ 306\n \/pls\/demo3.pls \/ 306 <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The IR-sender circuit<\/strong><\/h2>\n\n\n\n<p>To be able to send IR-messages we need one or more <a href=\"https:\/\/opencircuit.nl\/Product\/10463\/5mm-Led-infrarood-940nm\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"IR LED (opens in a new tab)\">IR LED<\/a>\u2019s. Using an IR LED is no different from using a \u201cnormal\u201d LED, except for the fact that to get some reach the IR LED\u2019s need far more current to do their job. Since the GPIO-pins of the ESP8266 are not capable of providing these high currents we need a driver circuit. Easiest is to use an opto-coupler like the 4N35 or 4N25 which doubles as a level-shifter from 3v3 (GPIO04) and 5 Volt to drive the Gate of the MOSFET switch.<\/p>\n\n\n\n<p>The voltage drop over the IR LED is ~1.6Volt and the maximum current is 60mA. As we are using two IR LED\u2019s in parallel and the duty cycle is 50%, the maximum current through R7 is 60*2*2=240mA. Therefor the value of R7 is (5-1.6)\/240 =&gt; ~15 Ohm.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_sender_circuit.png\" alt=\"\" class=\"wp-image-2003\" width=\"500\" height=\"361\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_sender_circuit.png 1000w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_sender_circuit-300x217.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_sender_circuit-768x554.png 768w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><figcaption><strong>The IR Sender circuit<\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>The pulses come from GPIO04. If GPIO04 is \u201chigh\u201d the led in the optocoupler will ignite and, in turn, sets the transistor to conduct (Pulls the Emitter to 5 Volt). The 5 volt on the Emitter makes the Gate of Q1 \u201chigh\u201d and the MOSFET now also conducts pulling the Drain to ground and so powering the two IR-LED\u2019s (switching them \u201con\u201d).<\/p>\n\n\n\n<p>A \u201clow\u201d on GPIO04 switches the led in the optocoupler \u201coff\u201d. The transistor opens (no current flows from Collector to Emitter) and R11 pulls the Gate of Q1 to ground. The MOSFET now also does not conduct and no current will flow true the IR-LED\u2019s (switching them \u201coff\u201d).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-IR_Send-1024x675.png\" alt=\"\" class=\"wp-image-2022\" width=\"512\" height=\"338\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-IR_Send-1024x675.png 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-IR_Send-300x198.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-IR_Send-768x506.png 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-IR_Send.png 1200w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><figcaption><strong>This is how it looks on the <\/strong><em><strong>1of!-Solderless<\/strong><\/em><strong> board <\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>Mind you: in stead of an IR LED a normal LED is used for testing and therefor the 10 ohm resister (R7) must be 220 ohm!<\/p>\n\n\n\n<p>You can find a program (<a href=\"https:\/\/github.com\/mrWheel\/IR_IoT_Remote\/tree\/master\/IR_sender\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"IR_sender (opens in a new tab)\">IR_sender<\/a>) to test this setup on <a rel=\"noreferrer noopener\" aria-label=\"github (opens in a new tab)\" href=\"https:\/\/github.com\/mrWheel\/IR_IoT_Remote.git\" target=\"_blank\">github<\/a>.<\/p>\n\n\n\n<p>Compile and flash the IR-sender sketch to the <strong><em>1of!-Wemos<\/em><\/strong> (or <strong><em>1of!-ESP12<\/em><\/strong>) board and open the Serial Monitor.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"false\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> \n \n IR_sender is now running and sending IR on pin 4\n \n SPIFFS Mount successful\n \n Commands are:\n \n   *D - remove file from SPIFFS\n    L - List SPIFFS\n    H - Help (this message)\n    T - Transmit rawData from SPIFFS\n   *R - Reboot\n \n [Enter: \u2018L\u2019]\n [01] [\/pls\/pulse5.pls]\n [02] [\/pls\/pulse1.pls]\n [03] [\/pls\/mutsiCool26.pls]\n [04] [\/pls\/demo1.pls]\n [05] [\/pls\/demo3.pls]\n \n [Enter: \u2018t\u2019]\n Transmit rawData from SPIFFS\n \n Pulse file number: [Enter: \u20183\u2019]\n \n fileName is [\/pls\/mutsiCool26.pls]\n readRawData(\/pls\/mutsiCool26.pls): \n readRawData(): read [307] pulses\n \n\n Sending [307] pulses .. (redled blinks) <\/pre>\n\n\n\n<p>As the basics are working we can solder the IR-sender and IR-receiver circuitry\u2019s to a <strong><em>1of!-Proto<\/em><\/strong> board. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Proto-Signal-Leds-1024x857.jpg\" alt=\"\" class=\"wp-image-1991\" width=\"512\" height=\"429\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Proto-Signal-Leds-1024x857.jpg 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Proto-Signal-Leds-300x251.jpg 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Proto-Signal-Leds-768x643.jpg 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Proto-Signal-Leds.jpg 1200w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><figcaption><strong> First the signal LED\u2019s <\/strong><\/figcaption><\/figure><\/div>\n\n\n\n<p>After confirming the signal-LED\u2019s blink solder the rest of the circuit:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Proto_Finished2-1024x715.png\" alt=\"\" class=\"wp-image-2023\" width=\"512\" height=\"358\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Proto_Finished2-1024x715.png 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Proto_Finished2-300x210.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Proto_Finished2-768x536.png 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Proto_Finished2.png 1200w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure><\/div>\n\n\n\n<p class=\"has-light-gray-background-color has-background\">I must say, the range of the IR-sender circuit is not as good as I expected. Why is my TV-remote capable of switching channels by pointing it to the opposite wall and does my IR-sender needs to be pointed exactly to my TV? So I reversed engineered two of my remotes and was surprised that they use (almost) the same circuit to drive the IR-LED&#8217;s only <em>they have both left out the serie resister<\/em> (R7)!! As I do not want to blow my IR-LED&#8217;s I have reduced R7 to only 1 ohm and that enlarged the range quite a bit!<\/p>\n\n\n\n<!--nextpage-->\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The Firmware to glue everything together<\/strong><\/h2>\n\n\n\n<p>The firmware uses Web Sockets to interface with the browser. When accessing the URL of the device a simple index.html page is loaded. This page uses Javascript to setup the WebSocket communication between the <em><strong>IR IoT Remote<\/strong><\/em> and the browser.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Control.png\" alt=\"\" class=\"wp-image-2056\" width=\"463\" height=\"260\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Control.png 925w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Control-300x168.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Control-768x431.png 768w\" sizes=\"auto, (max-width: 463px) 100vw, 463px\" \/><figcaption>Main Control Window<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"has-blue-color has-light-gray-background-color has-text-color has-background\">The firmware is still &#8216;<em>Work in Progress<\/em>&#8216;!<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Learn.png\" alt=\"\" class=\"wp-image-2055\" width=\"462\" height=\"190\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Learn.png 924w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Learn-300x123.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Learn-768x315.png 768w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><figcaption>Learn Window<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Edit.png\" alt=\"\" class=\"wp-image-2054\" width=\"461\" height=\"263\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Edit.png 922w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Edit-300x171.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_Edit-768x438.png 768w\" sizes=\"auto, (max-width: 461px) 100vw, 461px\" \/><figcaption>Edit Labels and Order<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_FSexplorer.png\" alt=\"\" class=\"wp-image-2053\" width=\"397\" height=\"405\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_FSexplorer.png 794w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_FSexplorer-294x300.png 294w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_FSexplorer-768x783.png 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/IR_IoT_Remote_FSexplorer-50x50.png 50w\" sizes=\"auto, (max-width: 397px) 100vw, 397px\" \/><figcaption>FS explorer<\/figcaption><\/figure><\/div>\n\n\n\n<p>You can find the firmware (IR_IoT_Remote) on <a rel=\"noreferrer noopener\" aria-label=\"github (opens in a new tab)\" href=\"https:\/\/github.com\/mrWheel\/IR_IoT_Remote.git\" target=\"_blank\">github<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Future Extentions<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">External Keyboard<\/h3>\n\n\n\n<p>For some people a web interface is not ideal. For those I added a keyboard interface (J7) that communicates with a keyboard like <a rel=\"noreferrer noopener\" aria-label=\"this (opens in a new tab)\" href=\"https:\/\/opencircuit.nl\/Product\/13619\/Button-Keypad-3x4-module\" target=\"_blank\">this<\/a>. The output is a voltage depending on the key pressed. The ADC pin of the ESP-12 can analyse this voltage to decide which key is pressed and send an IR-command depending on that key.<\/p>\n\n\n\n<p><em>Mind you, the firmware has no function for this. You have to make it yourself.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Temperature Sensor<\/h3>\n\n\n\n<p>It is fairly simple to implement an interface for a DS18B20 one-wire temperature sensor. You can connect a DS18B20 via port J5.<\/p>\n\n\n\n<!--nextpage-->\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Making the One of a Kind version<\/strong><\/h2>\n\n\n\n<p>Now everything is in place most of the work for making an <strong><em>One of a Kind<\/em><\/strong> device is done. Whats left is placing the <strong><em>1of!-Processor<\/em><\/strong> and <strong><em>1of!-Proto<\/em><\/strong> boards in  a project box like <a rel=\"noreferrer noopener\" aria-label=\"this (opens in a new tab)\" href=\"https:\/\/www.reichelt.nl\/hand-held-plastic-enclosure-140-x-66-5-x-28-mm-rnd-455-00899-p238832.html\" target=\"_blank\">this<\/a> one or <a rel=\"noreferrer noopener\" aria-label=\"this (opens in a new tab)\" href=\"https:\/\/www.reichelt.nl\/abs-behuizing-130-x-76-x-30-grijs-lichtgrijs-rnd-455-00119-p193333.html\" target=\"_blank\">this<\/a> one.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"620\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Enclosure-c-1024x620.jpg\" alt=\"\" data-id=\"1990\" data-link=\"https:\/\/willem.aandewiel.nl\/1of-enclosure-c\/\" class=\"wp-image-1990\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Enclosure-c-1024x620.jpg 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Enclosure-c-300x182.jpg 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Enclosure-c-768x465.jpg 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Enclosure-c.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Enclosure-b-1024x768.jpg\" alt=\"\" data-id=\"1989\" data-link=\"https:\/\/willem.aandewiel.nl\/1of-enclosure-b\/\" class=\"wp-image-1989\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Enclosure-b-1024x768.jpg 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Enclosure-b-300x225.jpg 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Enclosure-b-768x576.jpg 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/1of-Enclosure-b.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p>It makes a neat enclosure with the (IR) LED\u2019s on one end and an USB power connector at the other end. Of course I have swapped the <strong><em>1of!-Wemos<\/em><\/strong> board for a <strong><em>1of!-ESP12<\/em><\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Making a Printed Circuit Board (PCB)<\/strong><\/h2>\n\n\n\n<p>This is not a comprehensive guide on how to use KiCAD as there are tons of posts on the web and dozens of good <a rel=\"noreferrer noopener\" aria-label=\"books (opens in a new tab)\" href=\"https:\/\/techexplorations.com\/product\/kicad-like-a-pro-2nd-edition-book\/\" target=\"_blank\">books<\/a> for that. I just want to show you the steps involved in the hope you will give it a try! Although KiCAD has a very steep learning curve, for me it is one of the best tools you can use for designing your own PCB\u2019s.<\/p>\n\n\n\n<p>To be able to design a PCB for this device we need to combine the schematics of the <strong><em>1of!-ESP12<\/em><\/strong> processor board and the schematic of the IR-receiver and IR-sender.<\/p>\n\n\n\n<p>In KiCAD you can import an existing schematic sheet into the schematic you are working on.<\/p>\n\n\n\n<p>So, start with a new, empty sheet. In the File-menu select [Append Schematic Sheet]<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"460\" height=\"321\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/Append-Schematic-Sheet.png\" alt=\"\" class=\"wp-image-1994\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/Append-Schematic-Sheet.png 460w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/Append-Schematic-Sheet-300x209.png 300w\" sizes=\"auto, (max-width: 460px) 100vw, 460px\" \/><\/figure><\/div>\n\n\n\n<p>Then select the <a rel=\"noreferrer noopener\" aria-label=\"1of!-ESP12.sch (opens in a new tab)\" href=\"https:\/\/github.com\/mrWheel\/IR_IoT_Remote\/blob\/master\/KiCad\/1of!-ESP12.sch\" target=\"_blank\">1of!-ESP12.sch<\/a> file (it\u2019s in the map <em>KiCad<\/em> on the <a rel=\"noreferrer noopener\" aria-label=\"github (opens in a new tab)\" href=\"https:\/\/github.com\/mrWheel\/IR_IoT_Remote\" target=\"_blank\">github<\/a> repository).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"795\" height=\"443\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/Append_1of-ESP12.png\" alt=\"\" class=\"wp-image-1995\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/Append_1of-ESP12.png 795w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/Append_1of-ESP12-300x167.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/Append_1of-ESP12-768x428.png 768w\" sizes=\"auto, (max-width: 795px) 100vw, 795px\" \/><\/figure><\/div>\n\n\n\n<p>Remove the 20-pin connector. Select the remaining objects and move them outside the sheet.<\/p>\n\n\n\n<p>Now again select [Append Schematic Sheet] from the File-menu and select the Schematic for the <a rel=\"noreferrer noopener\" aria-label=\"IR-receiver and sender (opens in a new tab)\" href=\"https:\/\/github.com\/mrWheel\/IR_IoT_Remote\/blob\/master\/KiCad\/IR_Sender_Receiver.sch\" target=\"_blank\">IR-receiver and sender<\/a> (you can find it in the map <em>KiCad<\/em> on the <a rel=\"noreferrer noopener\" aria-label=\"github (opens in a new tab)\" href=\"https:\/\/github.com\/mrWheel\/IR_IoT_Remote.git\" target=\"_blank\">github<\/a> repository).<\/p>\n\n\n\n<p>Remove the connector and move everything around till you have something like this:<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/raw.githubusercontent.com\/mrWheel\/IR_IoT_Remote\/master\/KiCad\/IR_IoT_Remote.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/EeSchema_Combined-1024x702.png\" alt=\"\" class=\"wp-image-1999\" width=\"512\" height=\"351\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/EeSchema_Combined-1024x702.png 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/EeSchema_Combined-300x206.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/EeSchema_Combined-768x527.png 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/EeSchema_Combined.png 1200w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/figure>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignright\"><img loading=\"lazy\" decoding=\"async\" width=\"206\" height=\"66\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/Annotate-button.png\" alt=\"\" class=\"wp-image-1993\"\/><\/figure><\/div>\n\n\n\n<p>All field references have a question mark (?) so you need to press the annotate button.<\/p>\n\n\n\n<p>After that all fields have a unique reference. Don&#8217;t worry, if your references are different from the ones in this post!<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignright\"><img loading=\"lazy\" decoding=\"async\" width=\"293\" height=\"64\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/AssignFootprintsToSymbols.png\" alt=\"\" class=\"wp-image-1996\"\/><\/figure><\/div>\n\n\n\n<p>Next we need to associate physical parts to the parts in the schematic. This is done by assigning footprints to schematic symbols.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><a href=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Assign_Footprints.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Assign_Footprints-1024x674.png\" alt=\"\" class=\"wp-image-2006\" width=\"512\" height=\"337\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Assign_Footprints-1024x674.png 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Assign_Footprints-300x198.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Assign_Footprints-768x506.png 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Assign_Footprints.png 1200w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>A new window pops-up. Most symbols are already assigned a footprint. For those that are empty you need to select the correct footprint from the right part of the window. On the left part of the window you can select specific groups of footprints. You can also create your own footprints with the footprint-editor and place them in a container of your own.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignright\"><img loading=\"lazy\" decoding=\"async\" width=\"159\" height=\"59\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Netlist.png\" alt=\"\" class=\"wp-image-2011\"\/><\/figure><\/div>\n\n\n\n<p>Next step is to generate a netlist. A netlist is the translation of the schematic to the PCB design.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignright\"><img loading=\"lazy\" decoding=\"async\" width=\"312\" height=\"60\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_PCBnew.png\" alt=\"\" class=\"wp-image-2013\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_PCBnew.png 312w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_PCBnew-300x58.png 300w\" sizes=\"auto, (max-width: 312px) 100vw, 312px\" \/><\/figure><\/div>\n\n\n\n<p>Press the PCBnew icon ..<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignright\"><img loading=\"lazy\" decoding=\"async\" width=\"422\" height=\"184\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Confirm_New_PCB.png\" alt=\"\" class=\"wp-image-2009\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Confirm_New_PCB.png 422w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Confirm_New_PCB-300x131.png 300w\" sizes=\"auto, (max-width: 422px) 100vw, 422px\" \/><\/figure><\/div>\n\n\n\n<p>.. and a pop-up window will appear ..<\/p>\n\n\n\n<p>.. asking if it\u2019s OK to create a new PCB (this pop-up will only appear when there\u2019s not already a PCB design).<\/p>\n\n\n\n<p>Press [Yes] and an empty design window will open. In this window press the [Netlist] icon and select the [Read Current Netlist] to use the Netlist you created in the previous step and press [Close] to close this pop-up window.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Read_Netlist.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Read_Netlist.png\" alt=\"\" class=\"wp-image-2014\" width=\"426\" height=\"372\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Read_Netlist.png 852w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Read_Netlist-300x262.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Read_Netlist-768x670.png 768w\" sizes=\"auto, (max-width: 426px) 100vw, 426px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_InitialNetlist.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_InitialNetlist.png\" alt=\"\" class=\"wp-image-2010\" width=\"474\" height=\"306\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_InitialNetlist.png 948w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_InitialNetlist-300x193.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_InitialNetlist-768x495.png 768w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/a><figcaption><strong>Next you\u2019ll see the so called <\/strong><em><strong>rats nest<\/strong><\/em><strong> of components and wires that connects them.&nbsp; <\/strong><\/figcaption><\/figure>\n\n\n\n<p>The big challenge is to move all the components to a logical place and connect them with copper traces till all the white lines in the <em>rats nest<\/em> are gone..<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Parts_Placed.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Parts_Placed-1024x744.png\" alt=\"\" class=\"wp-image-2012\" width=\"512\" height=\"372\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Parts_Placed-1024x744.png 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Parts_Placed-300x218.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Parts_Placed-768x558.png 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Parts_Placed.png 1200w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/figure>\n\n\n\n<p>Time to lay the copper traces.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete-1024x624.png\" alt=\"\" class=\"wp-image-2008\" width=\"512\" height=\"312\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete-1024x624.png 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete-300x183.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete-768x468.png 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete.png 1200w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete_3D.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete_3D-1024x620.png\" alt=\"\" class=\"wp-image-2007\" width=\"512\" height=\"310\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete_3D-1024x620.png 1024w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete_3D-300x182.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete_3D-768x465.png 768w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/KiCAD_Complete_3D.png 1200w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/a><figcaption><strong>And then it will look like this in 3D <\/strong><\/figcaption><\/figure>\n\n\n\n<!--nextpage-->\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Basic Electronics<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Calculating the series-resistor for a LED<\/h3>\n\n\n\n<p>For every LED, in order to use it properly, we need to know its&nbsp;Forward Voltage. The Forward Voltage (<em>Vf<\/em>) is the voltage used by the LED when it\u2019s \u201con\u201d.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/ColeredLed_Vf_If.png\" alt=\"\" class=\"wp-image-1998\" width=\"423\" height=\"360\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/ColeredLed_Vf_If.png 564w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/ColeredLed_Vf_If-300x255.png 300w\" sizes=\"auto, (max-width: 423px) 100vw, 423px\" \/><\/figure><\/div>\n\n\n\n<p>As you can see from the image <em>Vf<\/em> depends on the color of the LED.&nbsp;<\/p>\n\n\n\n<p>The Forward Current (<em>If<\/em>) is the current at which the LED is at its brightest.&nbsp;<\/p>\n\n\n\n<p>According to <em>Kirchhoff&#8217;s Voltage Law<\/em>&nbsp;(KVL) the voltage used by a circuit, in this case the LED in series with the resistor (R), must be equal to the voltage applied (in the image 5.0 volt). If the (green) LED\u2019s <em>Vf<\/em> is 2.2 volt, the voltage over the resistor must be 5.0 &#8211; 2.2 = 2.8 volt. If the max. current is 20mA the value of the resistor must be 2.8 \/ 0.02 = 140&nbsp;\u03a9.<\/p>\n\n\n\n<p>That is, 140&nbsp;\u03a9 for the LED at its brightest but even with much less current, say 10mA, the LED will be bright enough. At 10mA the <em>Vf<\/em> is 2 volt which results in a resistor of 3 \/ 0.01 = 300&nbsp;\u03a9.<\/p>\n\n\n\n<p>As a rule of thumb a 220&nbsp;\u03a9 resistor is suitable for all red and green&nbsp; LED\u2019s in the range of 3v3 to 5 volt.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Calculating the series-resistor for the 4N35<\/h3>\n\n\n\n<p>According to the data-sheet of the 4N35 the <em>Vf<\/em> of the input diode is ~1 volt and <em>If<\/em> is 10mA. As we drive the 4N35 from one of the GPIO-pins of the ESP8266 the applied voltage is 3v3. The voltage over the resistor is 3v3 &#8211; 1 = 2.3 volt. This gives a value for the series resistor of 2.3 \/ 0.01 = 230&nbsp;\u03a9.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The VS1838<\/h3>\n\n\n\n<p>This component is called a IR-detector diode but it is far more than only a diode. It has all the circuitry to detect a modulated IR signal and convert the IR signal into a logic output.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"878\" height=\"177\" src=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/BlockDiagram-IR-receiver.png\" alt=\"\" class=\"wp-image-1997\" srcset=\"https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/BlockDiagram-IR-receiver.png 878w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/BlockDiagram-IR-receiver-300x60.png 300w, https:\/\/willem.aandewiel.nl\/wp-content\/uploads\/2019\/07\/BlockDiagram-IR-receiver-768x155.png 768w\" sizes=\"auto, (max-width: 878px) 100vw, 878px\" \/><figcaption> <strong>Block diagram VS1838 <\/strong><\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>[ ] In this post I will guide you through the process of building a device that can capture Infrared-messages from an Infrared remote controller (learning mode), and resend the captured Infrared-messages (sending mode). I will use the affordable and &hellip; <a href=\"https:\/\/willem.aandewiel.nl\/index.php\/2019\/07\/15\/universal-infrared-iot-learning-remote\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3,6,10,115,20],"tags":[],"class_list":["post-2026","post","type-post","status-publish","format-standard","hentry","category-arduino","category-computer","category-esp8266","category-hardware","category-kicad","category-wifi"],"views":22293,"_links":{"self":[{"href":"https:\/\/willem.aandewiel.nl\/index.php\/wp-json\/wp\/v2\/posts\/2026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/willem.aandewiel.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/willem.aandewiel.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/willem.aandewiel.nl\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/willem.aandewiel.nl\/index.php\/wp-json\/wp\/v2\/comments?post=2026"}],"version-history":[{"count":62,"href":"https:\/\/willem.aandewiel.nl\/index.php\/wp-json\/wp\/v2\/posts\/2026\/revisions"}],"predecessor-version":[{"id":6180,"href":"https:\/\/willem.aandewiel.nl\/index.php\/wp-json\/wp\/v2\/posts\/2026\/revisions\/6180"}],"wp:attachment":[{"href":"https:\/\/willem.aandewiel.nl\/index.php\/wp-json\/wp\/v2\/media?parent=2026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/willem.aandewiel.nl\/index.php\/wp-json\/wp\/v2\/categories?post=2026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/willem.aandewiel.nl\/index.php\/wp-json\/wp\/v2\/tags?post=2026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}