{"id":37,"date":"2013-12-15T19:30:20","date_gmt":"2013-12-15T18:30:20","guid":{"rendered":"http:\/\/npham.dk\/?p=37"},"modified":"2014-01-03T11:43:27","modified_gmt":"2014-01-03T10:43:27","slug":"raspberry-pi-ir-remote","status":"publish","type":"post","link":"https:\/\/npham.dk\/?p=37","title":{"rendered":"Raspberry Pi IR remote"},"content":{"rendered":"<p>I wanted to use the Raspberry Pi as a remote control for my TV, so I searched the internet and found a pretty good guide by <a href=\"http:\/\/alexba.in\/\" target=\"_blank\">Alex Bain.<\/a><br \/>\nSo all credits goes to him!<\/p>\n<p>I then created a TV-guide webapp, where I could click on a channel to switch to that channel on the TV.<br \/>\nIt&#8217;s webbased but I haven&#8217;t exposed it to the internet, so it only works when I&#8217;m home \ud83d\ude42<\/p>\n<h3>Images of the final assembly<\/h3>\n<p><a title=\"The final assembly\" href=\"http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0867.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-63\" alt=\"IMG_0867\" src=\"http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0867-300x225.jpg\" width=\"300\" height=\"225\" srcset=\"https:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0867-300x225.jpg 300w, https:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0867.jpg 640w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><a title=\"Overview\" href=\"http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0868.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-64\" alt=\"IMG_0868\" src=\"http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0868-300x225.jpg\" width=\"300\" height=\"225\" srcset=\"https:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0868-300x225.jpg 300w, https:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0868.jpg 640w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<a title=\"IR Led at the left and a RF transmitter at the right\" href=\"http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0869.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-65\" alt=\"IMG_0869\" src=\"http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0869-300x225.jpg\" width=\"300\" height=\"225\" srcset=\"https:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0869-300x225.jpg 300w, https:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0869.jpg 640w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><a title=\"Closeup of the stripboard\" href=\"http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0870.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-66\" alt=\"IMG_0870\" src=\"http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0870-300x225.jpg\" width=\"300\" height=\"225\" srcset=\"https:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0870-300x225.jpg 300w, https:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/IMG_0870.jpg 640w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<em>(Ignore the circuit connected with the green and red wire, its a RF tranmitter, which I will post about later)<\/em><\/p>\n<h3>Video demo<\/h3>\n<div style=\"width: 256px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-37-1\" width=\"256\" height=\"454\" preload=\"none\" controls=\"controls\"><source type=\"video\/mp4\" src=\"http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/RPI-IR-Demo1.mp4?_=1\" \/><a href=\"http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/RPI-IR-Demo1.mp4\">http:\/\/npham.dk\/wp-content\/uploads\/2013\/12\/RPI-IR-Demo1.mp4<\/a><\/video><\/div>\n<h3>Installing the distro<\/h3>\n<p>I had a old spare 1GB SD card laying around, so first thing I did was install\u00a0<a href=\"http:\/\/moebiuslinux.sourceforge.net\/\">Moebius<\/a>\u00a0which is a very small Raspberry Pi distro, that fits the 1GB nicely \ud83d\ude42<br \/>\nI don&#8217;t know what class the card is, but I don&#8217;t think it really matter, as performance is not a issue here.<\/p>\n<p>To install the image to a SD-card, I followed the guide from <a href=\"http:\/\/elinux.org\/RPi_Easy_SD_Card_Setup\">RPi Easy SD Card Setup<\/a>. (I used the program Pi-Writer.)<\/p>\n<h3>Creating IR transmitter<\/h3>\n<p>I made the electronic from Alex&#8217; <a href=\"http:\/\/alexba.in\/blog\/2013\/06\/08\/open-source-universal-remote-parts-and-pictures\/\" target=\"_blank\">schematic<\/a>, and soldered the components on a stripboard.<br \/>\nI bought my parts from my local electronics store:<br \/>\n2 x <a href=\"https:\/\/www.elfaelektronik.dk\/elfa3~dk_da\/elfa\/init.do?item=10-443-44\" target=\"_blank\">IR-LED<br \/>\n<\/a>2 x <a href=\"https:\/\/www.elfaelektronik.dk\/elfa3~dk_da\/elfa\/init.do?item=75-075-15\" target=\"_blank\">LED holder<br \/>\n<\/a>1 x <a href=\"https:\/\/www.elfaelektronik.dk\/elfa3~dk_da\/elfa\/init.do?item=75-205-96\" target=\"_blank\">IR receiver<\/a><br \/>\n1 x <a href=\"https:\/\/www.elfaelektronik.dk\/elfa3~dk_da\/elfa\/init.do?item=71-027-75\" target=\"_blank\">NPN transistor<br \/>\n<\/a>1 x <a href=\"https:\/\/www.elfaelektronik.dk\/elfa3~dk_da\/elfa\/init.do?item=60-126-11\" target=\"_blank\">10 k\u03a9\u00a0resistor<br \/>\n<\/a>1 x <a href=\"https:\/\/www.elfaelektronik.dk\/elfa3~dk_da\/elfa\/init.do?item=43-782-12\" target=\"_blank\">2&#215;13 pin connector<br \/>\n<\/a>1 x <a href=\"https:\/\/www.elfaelektronik.dk\/elfa3~dk_da\/elfa\/init.do?item=48-329-82\" target=\"_blank\">stripboard<\/a><\/p>\n<h3>Installing LIRC<\/h3>\n<p>Follow the guide <a href=\"http:\/\/alexba.in\/blog\/2013\/01\/06\/setting-up-lirc-on-the-raspberrypi\/\" target=\"_blank\">here<\/a>.<\/p>\n<h3>Installing a web server<\/h3>\n<p>Just for good measure reboot the Raspberry Pi<\/p>\n<pre>sudo reboot<\/pre>\n<p>When it&#8217;s back up and running, we now install the webserver and PHP<\/p>\n<pre>sudo apt-get -y install lighttpd\r\nsudo apt-get -y install php5-common php5-cgi php5\r\n\r\n#enable fastcgi module included with lighttpd\r\nsudo lighttpd-enable-mod fastcgi fastcgi-php\r\n\r\n#The following restarts the webserver\r\nsudo service lighttpd force-reload<\/pre>\n<p>Now we need to setup some permissions for the webserver.<\/p>\n<pre>#change the owner of \/var\/www to www-data (user and group)\r\nsudo chown www-data:www-data \/var\/www\r\n\r\n#gives user and group read\/write\/execute rights to \/var\/www\r\nsudo chmod 775 \/var\/www\r\n\r\n#adds the user pi to the group www-data\r\nsudo usermod -a -G www-data pi<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to use the Raspberry Pi as a remote control for my TV, so I searched the internet and found a pretty good guide by Alex Bain. So all credits goes to him! I then created a TV-guide webapp, where I could click on a channel to switch to that channel on the TV. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[7,6,9],"_links":{"self":[{"href":"https:\/\/npham.dk\/index.php?rest_route=\/wp\/v2\/posts\/37"}],"collection":[{"href":"https:\/\/npham.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/npham.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/npham.dk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/npham.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=37"}],"version-history":[{"count":44,"href":"https:\/\/npham.dk\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":107,"href":"https:\/\/npham.dk\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions\/107"}],"wp:attachment":[{"href":"https:\/\/npham.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/npham.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/npham.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}