{"id":104,"date":"2015-10-30T00:14:49","date_gmt":"2015-10-30T00:14:49","guid":{"rendered":"https:\/\/zhutarduino.wordpress.com\/?page_id=104"},"modified":"2015-10-30T00:14:49","modified_gmt":"2015-10-30T00:14:49","slug":"use-any-old-infrared-remote-control-with-your-arduino","status":"publish","type":"page","link":"https:\/\/thezhut.com\/?page_id=104","title":{"rendered":"Use any OLD Infrared Remote control With Your arduino"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-106\" src=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fjo4w22ieqxtudw_medium.jpg?w=300\" alt=\"FJO4W22IEQXTUDW_MEDIUM\" width=\"300\" height=\"240\" srcset=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fjo4w22ieqxtudw_medium.jpg 620w, https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fjo4w22ieqxtudw_medium-300x240.jpg 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>The first thing you will need to do is get the Arduino IRremote library from this link <a href=\"https:\/\/github.com\/z3t0\/Arduino-IRremote\" rel=\"nofollow\"><span style=\"color:#0066cc;\">IRremote library download<\/span><\/a>..<br \/>\nThe site has the instructions on how to download and install the library.<br \/>\nThe installation of the library is easy, just follow all the instructions to make sure it will run properly.<br \/>\nAfter you get the library installed the next step is to find a remote to use and test it to see if it works. If you are not sure if your remote works testing it is simple, if you look at it when you push a button you wont see anything. To see if it is working all you will need is a digital camera, The camera on your phone will work fine. Turn the camera on and point the remote at your camera, when you push one of the buttons on the remote you will see it light up on your camera screen. You can&#8217;t see IR light but your camera can.<\/p>\n<p><a href=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fcf4vmgieqxtsxe_medium.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-107\" src=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fcf4vmgieqxtsxe_medium.jpg?w=300\" alt=\"FCF4VMGIEQXTSXE_MEDIUM\" width=\"300\" height=\"279\" srcset=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fcf4vmgieqxtsxe_medium.jpg 620w, https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fcf4vmgieqxtsxe_medium-300x279.jpg 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong><em><u>The parts you will need<br \/>\n<\/u><\/em><\/strong>IR Sensor (got mine out of a junk DVD player).<br \/>\n100uF capacitor.<br \/>\nResistor to bring the voltage to the right level for your IR sensor if needed.<br \/>\nBreadboard.<br \/>\nJumper wires.<br \/>\nAny Arduino board.<br \/>\n<strong><em><u>The Circuit<\/u><\/em><\/strong><\/p>\n<p><strong><em><u><br \/>\n<\/u><\/em><\/strong>The picture above show the simple bread board lay out of the\u00a0circuit you will need to build, The pin configuration of your IR sensor may be different so please look up the data sheet and modify the construction as needed&#8230;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/f5s1t9uieqxtsxd_medium.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-108\" src=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/f5s1t9uieqxtsxd_medium.jpg?w=300\" alt=\"F5S1T9UIEQXTSXD_MEDIUM\" width=\"300\" height=\"200\" srcset=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/f5s1t9uieqxtsxd_medium.jpg 620w, https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/f5s1t9uieqxtsxd_medium-300x200.jpg 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Now that you have the circuit built its time to map your remote. The first thing to do is open the arduino IDE and then go to examples and open IRrecvDemo. After you have it open go down the code till you find the line that is circled in the picture\u00a0below and delete the ( , HEX), the reason to do this is because it will be easer to work with when you are writing your code. Using HEX numbers will complicate things unless you really under stand how to use them when writing your arduino sketch.<\/p>\n<p>Next its time to get your remote codes, All you have to do is open the serial monitor then point your remote at the IR sensor and push a button. When you push a button a number will come up on the serial monitor, write that number down so you can use it when writing your sketch. If you hold down a button you will notice that a different number will show up and it will be the same for any button you hold down, write this number down two it will be useful if you want to have values change in your sketch if you hold down a button.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fr13uopiestte5c_medium.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-109\" src=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fr13uopiestte5c_medium.jpg?w=300\" alt=\"FR13UOPIESTTE5C_MEDIUM\" width=\"300\" height=\"169\" srcset=\"https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fr13uopiestte5c_medium.jpg 620w, https:\/\/thezhut.com\/wp-content\/uploads\/2015\/10\/fr13uopiestte5c_medium-300x169.jpg 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Now that you have mapped your remote its time to use the codes to control something, the following sketch will show you how to control the speed of a old computer cooling fan with your remote.<br \/>\nThe following code I wrote to control a 12v fan, you will need to use a transistor and a 12v power supply for this to work. The code is pretty straight forward so I&#8217;m not going to explain it, just put your IR codes in where it says too be placed and your good to go..<\/p>\n<p>#include &lt;IRremote.h&gt;<br \/>\nint RECV_PIN = 11;\u00a0\u00a0 \/\/conect IR receiver output to pin 11<br \/>\nIRrecv irrecv(RECV_PIN);<br \/>\ndecode_results i;<br \/>\nint fan = 9;\u00a0 \u00a0\/\/conect fan to pin 9<br \/>\nint dir =0 ;<br \/>\nint val = 0;<br \/>\nvoid setup()<br \/>\n{<br \/>\nSerial.begin(9600);<br \/>\nirrecv.enableIRIn();\u00a0\u00a0 \/\/ Start the receiver<br \/>\npinMode(fan, OUTPUT);<br \/>\n}<br \/>\nvoid loop() {<br \/>\nanalogWrite(fan, val);<br \/>\nif (irrecv.decode(&amp;i))<br \/>\n{<br \/>\nif (i.value == put your code here &amp;&amp; dir == 0)\u00a0\u00a0 \/\/ put the ir code for fan speed + here<br \/>\n{<br \/>\nval = val + 10;<br \/>\ndir = 1;<br \/>\n}<br \/>\nelse if (i.value == put your code here &amp;&amp; dir == 1)\u00a0\u00a0 \/\/ this is where you put your hold down button code<br \/>\n{<br \/>\nval = val + 10;<br \/>\ndir = 1;<br \/>\n}<br \/>\nelse if (i.value == put your code here &amp;&amp; dir == 1)\u00a0\u00a0 \/\/ put the ir code for fan speed &#8211; here<br \/>\n{<br \/>\nval = val &#8211; 10;<br \/>\ndir = 0;<br \/>\n}<br \/>\nelse if (i.value == put your code here &amp;&amp; dir == 0)\u00a0 \u00a0\/\/ this is where you put your hold down button code<br \/>\n{<br \/>\nval = val &#8211; 10;<br \/>\ndir = 0;<br \/>\n}<br \/>\nirrecv.resume();\u00a0\u00a0 \/\/ Receive the next value<br \/>\n}<br \/>\nval = constrain(val, 0, 255);<br \/>\nSerial.println(val);<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p>I put this together fast and had a few beers when doing it so if anything is not working right please let me know. send message to <a href=\"mailto:kc0dnt@mail.com\">kc0dnt@mail.com<\/a> .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The first thing you will need to do is get the Arduino IRremote library from this link IRremote library download.. The site has the instructions on how to download and install the library. The installation of the library is easy, &hellip; <a href=\"https:\/\/thezhut.com\/?page_id=104\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":10,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-104","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=104"}],"version-history":[{"count":0,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/104\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/thezhut.com\/index.php?rest_route=\/wp\/v2\/pages\/10"}],"wp:attachment":[{"href":"https:\/\/thezhut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}