{"id":1200,"date":"2013-03-16T00:28:21","date_gmt":"2013-03-15T16:28:21","guid":{"rendered":"http:\/\/www.freemindworld.com\/blog\/?p=1200"},"modified":"2013-03-16T00:28:21","modified_gmt":"2013-03-15T16:28:21","slug":"130316_raspberry_pi_with_remote_control","status":"publish","type":"post","link":"https:\/\/www.freemindworld.com\/blog\/2013\/130316_raspberry_pi_with_remote_control.shtml","title":{"rendered":"\u6253\u9020\u589e\u5f3a\u578bRaspberry Pi-\u7ea2\u5916\u9065\u63a7\u7bc7"},"content":{"rendered":"<p><a title=\"\u6253\u9020\u589e\u5f3a\u578bRaspberry Pi-\u6db2\u6676\u5c4f\u7bc7\" href=\"http:\/\/www.freemindworld.com\/blog\/2013\/130310_raspberry_pi_with_lcd.shtml\">\u4e0a\u4e00\u671f<\/a>\u4ecb\u7ecd\u4e86\u600e\u4e48\u7ed9Raspberry Pi\u52a0\u4e0a\u4e00\u4e2a\u6db2\u6676\u5c4f\uff0c\u8fd9\u671f\u8be5\u4ecb\u7ecd\u7ea2\u5916\u9065\u63a7\u4e86\u3002<\/p>\n<p><strong>\u9700\u8981\u7684\u786c\u4ef6\uff1a<\/strong><\/p>\n<ul>\n<li>\u4e00\u4e2a\u7ea2\u5916\u63a5\u6536\u7ba1\uff0c\u578b\u53f7\u53ef\u4ee5\u662fTSOP1238\/TSOP2238\u7b49\u53ef\u4ee53.3V\u7535\u538b\u4e0b\u5de5\u4f5c\u768438KHz\u7ea2\u5916\u63a5\u6536\u7ba1\u3002<\/li>\n<li>\u4e00\u4e2a\u7ea2\u5916\u9065\u63a7\u5668\uff0c\u53ef\u4ee5\u662f\u7535\u89c6\u673a\u3001\u673a\u9876\u76d2\u7b49\u7684\u9065\u63a7\u5668\u3002\u4f46\u522b\u62ff\u7a7a\u8c03\u9065\u63a7\u5668\u8fd9\u79cd\u81ea\u5e26\u72b6\u6001\u903b\u8f91\u7684\u9065\u63a7\u5668\u6765\u6298\u78e8\u81ea\u5df1\u3002<\/li>\n<\/ul>\n<p><strong>\u8fde\u63a5\u7ea2\u5916\u63a5\u6536\u7ba1\uff1a<\/strong><\/p>\n<p>\u4e0d\u540c\u7684\u7ea2\u5916\u63a5\u6536\u7ba1\u8fde\u7ebf\u53ef\u80fd\u4e0d\u592a\u4e00\u6837\uff0c\u9700\u8981\u53c2\u8003\u76f8\u5e94\u7684Datasheet\u3002\u4ee5TSOP 1238\u4e3a\u4f8b\u7684\u8bdd\uff0c\u5f53\u7ea2\u5916\u7ebf\u63a5\u6536\u7a97\u671d\u5411\u81ea\u5df1\u65f6\uff0c\u4ece\u5de6\u5230\u53f3\u4e09\u4e2a\u5f15\u811a\u5206\u522b\u4e3a\uff1a<\/p>\n<p style=\"padding-left: 30px; text-indent: 0em;\">1. GND\uff0c\u63a5\u5730\uff0cRPi PIN 6<br \/>\n2. VS\uff0c\u7535\u6e90\uff0c\u63a53.3V\u7535\u6e90\uff0cRPi PIN 17<br \/>\n3. OUT\uff0c\u6570\u636e\u8f93\u51fa\uff0c\u63a5GPIO 24\uff0cRPi PIN 18<\/p>\n<p>\u7531\u4e8eRaspberry Pi\u7684GPIO\u53ea\u80fd\u63a5\u65363.3V\u7684\u8f93\u5165\uff0c\u6240\u4ee5\u7ea2\u5916\u63a5\u6536\u7ba1\u7684\u7535\u6e90\u52a1\u5fc5\u8981\u63a53.3V\u7684\u4f9b\u7535\u3002\u6211\u81ea\u5df1\u7528\u7684\u7ea2\u5916\u63a5\u6536\u7ba1\u7684\u578b\u53f7\u662fTSOP 1838\uff08\u5f15\u811a\u987a\u5e8f\u662fOUT, GND, VS\uff09\uff0c\u6309<a title=\"lirc_rpi\" href=\"http:\/\/aron.ws\/projects\/lirc_rpi\/\" target=\"_blank\">lirc_rpi<\/a>\u9879\u76ee\u9875\u9762\u7684\u8bf4\u6cd5\uff0c\u8fd9\u4e2a\u7ba1\u5b50\u5e94\u8be5\u57285V\u4f9b\u7535\u4e0b\u624d\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u4e0d\u8fc7\u6211\u8fd8\u662f\u53ea\u63a5\u4e863.3V\uff0c\u53d1\u73b0\u4e5f\u80fd\u7528\u3002<\/p>\n<p><strong>\u7cfb\u7edf\u8f6f\u4ef6\u5b89\u88c5\uff1a<\/strong><\/p>\n<p><a title=\"lirc_rpi\" href=\"http:\/\/aron.ws\/projects\/lirc_rpi\/\" target=\"_blank\">lirc_rpi<\/a>\u9879\u76ee\u4e3aLinux\u5185\u6838\u63d0\u4f9b\u4e86\u652f\u6301GPIO\u53e3\u7684\u7ea2\u5916\u63a5\u6536\u7ba1\u7684\u9a71\u52a8\uff0c\u5728\u6700\u65b0\u7684<a title=\"Raspbian\" href=\"http:\/\/www.raspbian.org\/\" target=\"_blank\">Raspbian<\/a>\u7cfb\u7edf\u4e2d\u5e94\u8be5\u5df2\u7ecf\u5305\u542b\u3002\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u4e2d\u6ca1\u6709\u8fd9\u4e2a\u6a21\u5757\uff0c\u4e5f\u8bb8\u9700\u8981\u81ea\u5df1\u91cd\u65b0\u7f16\u8bd1\u5185\u6838\u3002\u5177\u4f53\u53ef\u4ee5\u53c2\u8003lirc_rpi\u9879\u76ee\u4e3b\u9875\u3002<\/p>\n<p>\u7136\u540e\u9700\u8981\u5b89\u88c5\u7528\u6237\u6001\u7684\u670d\u52a1\u8fdb\u7a0b\uff1a<\/p>\n<p><code>sudo apt-get install lirc<\/code><\/p>\n<p>\u52a0\u8f7dlirc_rpi\u5185\u6838\u6a21\u5757\uff1a<\/p>\n<p><code>sudo modprobe lirc_rpi gpio_in_pin=24 gpio_out_pin=23<\/code><\/p>\n<p>\u6ce8\u610f\uff0c\u5728\u52a0\u8f7dlirc_rpi\u65f6\u5fc5\u987b\u6307\u5b9a\u8f93\u5165\u7aef\u53e3\u662fGPIO 24\uff0c\u8ddf\u5b9e\u9645\u63a5\u7ebf\u4e00\u81f4\u3002\u8f93\u51fa\u7aef\u53e3\u8bbe\u4e3aGPIO 23\uff0c\u662f\u56e0\u4e3a\u6211\u4e0d\u9700\u8981\u8fd9\u4e2a\u8f93\u51fa\u7aef\u53e3\uff0c\u800c\u76ee\u524d\u6211\u4eecGPIO 23\u53e3\u662f\u7a7a\u7740\u7684\u3002<\/p>\n<p><strong>\u6d4b\u8bd5\u7ea2\u5916\u63a5\u6536\u662f\u5426\u6b63\u5e38\uff1a<\/strong><\/p>\n<p><code>sudo mode2 -d \/dev\/lirc0<\/code><\/p>\n<p>\u5982\u679c\u6309\u9065\u63a7\u5668\u4e0a\u7684\u952e\uff0c\u5c4f\u5e55\u4e0a\u80fd\u663e\u793a\u51fa\u4e00\u4e32pluse\u548cspace\u503c\u7684\u8bdd\uff0c\u591a\u534a\u5c31\u662f\u6b63\u5e38\u4e86\u3002<\/p>\n<p>\u914d\u7f6e\u4e0b\/etc\/lirc\/hardware.conf\uff1a<\/p>\n<p><code>...<br \/>\nLIRCD_ARGS=\"--uinput\"<br \/>\n...<br \/>\nDRIVER=\"default\"<br \/>\n...<br \/>\nDEVICE=\"\/dev\/lirc0\"<\/code><\/p>\n<p>\u8ba9lirc\u5b66\u4e60\u4e00\u4e0b\u4f60\u9065\u63a7\u5668\u4e0a\u7684\u6309\u952e\uff0c\u5728\u6211\u7684\u4f8b\u5b50\u4e2d\uff0c\u8bf7\u81f3\u5c11\u5b66\u4e605\u4e2a\u6309\u952e\uff0c\u5206\u522b\u505a\u4e3a\u4e0a(up)\u3001\u4e0b(down)\u3001\u5de6(left)\u3001\u53f3(right)\u3001\u9009\u62e9(sel)\uff1a<\/p>\n<p><code>sudo \/etc\/init.d\/lirc stop<br \/>\n#\u5b66\u4e60\u6309\u952e<br \/>\nirrecord -n -d \/dev\/lirc0 ~\/lircd.conf<br \/>\n#\u628a\u5b66\u4e60\u540e\u751f\u6210\u7684\u914d\u7f6e\u6587\u4ef6\u4f5c\u4e3alircd\u7684\u914d\u7f6e\u6587\u4ef6<br \/>\nsudo mv ~\/lircd.conf \/etc\/lirc\/lircd.conf<br \/>\nsudo \/etc\/init.d.\/lirc start<\/code><\/p>\n<p>\u914d\u7f6e\u5b8c\u540e\uff0c\u53ef\u4ee5\u7528irw\u547d\u4ee4\u6d4b\u8bd5\u9065\u63a7\u5668\u662f\u5426\u5de5\u4f5c\u6b63\u5e38\u3002<\/p>\n<p>\u914d\u7f6e~\/.lircrc.conf\u6587\u4ef6\uff0c\u628a\u6309\u952e\u4e0e\u9700\u8981\u89e6\u53d1\u7684\u884c\u4e3a\u8fdb\u884c\u5173\u8054\uff1a<\/p>\n<pre><code>begin\r\n    prog = lcdmenu \r\n    button = up\r\n    config = up\r\nend\r\nbegin\r\n    prog = lcdmenu\r\n    button = right\r\n    config = right\r\nend\r\nbegin\r\n    prog = lcdmenu\r\n    button = left\r\n    config = left\r\nend\r\nbegin\r\n    prog = lcdmenu\r\n    button = down\r\n    config = down\r\nend\r\nbegin\r\n    prog = lcdmenu\r\n    button = sel\r\n    config = sel\r\nend<\/code><\/pre>\n<p>\u4e3aRaspberry Pi\u6dfb\u52a0\u6db2\u6676\u5c4f\u63a7\u5236\u83dc\u5355\uff0c\u6211\u53c2\u8003\u4e86Github\u4e0a\u7684<a title=\"RaspberryPiLcdMenu\" href=\"https:\/\/github.com\/aufder\/RaspberryPiLcdMenu\" target=\"_blank\">RaspberryPiLcdMenu<\/a>\uff0c\u8fd9\u4e2a\u9879\u76ee\u5b9e\u73b0\u4e86\u4f7f\u7528\u4e00\u4e2a\u5e26\u4e94\u4e2a\u5c0f\u6309\u94ae\u7684\u6db2\u6676\u5c4f<a title=\"Adafruit RGB Positive 16x2 LCD+Keypad Kit for Raspberry Pi\" href=\"https:\/\/www.adafruit.com\/products\/1109\" target=\"_blank\">\u5957\u4ef6<\/a>\u4f5c\u4e3a\u786c\u4ef6\u57fa\u7840\u6765\u663e\u793a\u4e0e\u64cd\u4f5c\u4e00\u4e2a\u83dc\u5355\u7684\u7cfb\u7edf\uff0c\u6211\u6ca1\u6709\u8fd9\u4e2a\u5957\u4ef6\uff0c\u800c\u4e14\u6211\u662f\u7528\u7ea2\u5916\u9065\u63a7\u5668\u800c\u4e0d\u662f\u5c0f\u6309\u94ae\u6765\u64cd\u4f5c\uff0c\u6240\u4ee5\u9700\u8981\u91cd\u5199\u8ddf\u6309\u94ae\u6709\u5173\u7684\u4ee3\u7801\uff0c\u901a\u8fc7lirc\u63d0\u4f9b\u7684\u63a5\u53e3\u53bb\u83b7\u53d6\u9065\u63a7\u5668\u7684\u6309\u952e\u4fe1\u606f\uff0c\u5f88\u5bb9\u6613\uff0c\u53ef\u4ee5\u53c2\u8003\u6211\u5df2\u7ecf\u5b9e\u73b0\u597d\u7684\u4ee3\u7801\uff0c\u5728Buttons.py\u4e2d\uff1a<\/p>\n<p><code>git clone https:\/\/github.com\/lifanxi\/rpimenu.git<\/code><\/p>\n<p>RaspberryPiLcdMenu\u9879\u76ee\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f88\u7075\u6d3b\u7684\u83dc\u5355\u914d\u7f6e\u7cfb\u7edf\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u6dfb\u52a0\u65b0\u7684\u83dc\u5355\u9879\uff0c\u6211\u7ed9\u5b83\u6dfb\u52a0\u4e86\u9065\u63a7fmd\u64ad\u653e\u8c46\u74e3FM\u7684\u83dc\u5355\u529f\u80fd\u9879\uff08\u53c2\u8003lcdmenu.xml\uff09\u3002<\/p>\n<p>\u4e00\u5207\u5c31\u7eea\uff0c\u542f\u52a8lcdmenu.py\u7a0b\u5e8f\uff1a<\/p>\n<p><code>sudo python lcdmenu.py<\/code><\/p>\n<p>\u5982\u679c\u4f60\u7684\u914d\u7f6e\u6ca1\u6709\u95ee\u9898\uff0c\u8fd9\u65f6\u5c31\u53ef\u4ee5\u5728\u6db2\u6676\u5c4f\u4e0a\u770b\u5230\u5b9a\u5236\u540e\u7684\u83dc\u5355\uff0c\u5e76\u53ef\u4ee5\u7528\u9065\u63a7\u5668\u6765\u9065\u63a7\u64cd\u4f5c\u4e86\uff0c\u6309\u4e0a\u4e0b\u952e\u9009\u9879\u4e0d\u540c\u7684\u83dc\u5355\u9879\uff0c\u5411\u53f3\u952e\u8fdb\u5165\u5b50\u83dc\u5355\uff0c\u5411\u5de6\u9000\u56de\u4e0a\u4e00\u7ea7\u83dc\u5355\uff0c\u9009\u62e9\u952e\u7528\u4e8e\u6839\u636e\u5c4f\u5e55\u63d0\u793a\u786e\u5b9a\u67d0\u4e9b\u7279\u5b9a\u7684\u64cd\u4f5c\u3002<\/p>\n<div id=\"attachment_1212\" style=\"width: 810px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.freemindworld.com\/blog\/wp-content\/uploads\/2013\/03\/130316a.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1212\" class=\"size-full wp-image-1212\" alt=\"\u6dfb\u52a0\u4e86Douban.fm\u7684\u83dc\u5355\" src=\"\/\/www.freemindworld.com\/blog\/wp-content\/uploads\/2013\/03\/130316a.jpg\" width=\"800\" height=\"533\" srcset=\"https:\/\/www.freemindworld.com\/blog\/wp-content\/uploads\/2013\/03\/130316a.jpg 800w, https:\/\/www.freemindworld.com\/blog\/wp-content\/uploads\/2013\/03\/130316a-300x199.jpg 300w, https:\/\/www.freemindworld.com\/blog\/wp-content\/uploads\/2013\/03\/130316a-450x300.jpg 450w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><p id=\"caption-attachment-1212\" class=\"wp-caption-text\">\u6dfb\u52a0\u4e86Douban.fm\u7684\u83dc\u5355<\/p><\/div>\n<div id=\"attachment_1213\" style=\"width: 810px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.freemindworld.com\/blog\/wp-content\/uploads\/2013\/03\/130316b.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1213\" class=\"size-full wp-image-1213\" alt=\"\u8c46\u74e3FM\u64ad\u653e\u4e2d\uff0c\u53ef\u4ee5\u663e\u793a\u66f2\u540d\u548c\u64ad\u653e\u8fdb\u5ea6\" src=\"\/\/www.freemindworld.com\/blog\/wp-content\/uploads\/2013\/03\/130316b.jpg\" width=\"800\" height=\"414\" srcset=\"https:\/\/www.freemindworld.com\/blog\/wp-content\/uploads\/2013\/03\/130316b.jpg 800w, https:\/\/www.freemindworld.com\/blog\/wp-content\/uploads\/2013\/03\/130316b-300x155.jpg 300w, https:\/\/www.freemindworld.com\/blog\/wp-content\/uploads\/2013\/03\/130316b-500x258.jpg 500w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><p id=\"caption-attachment-1213\" class=\"wp-caption-text\">\u8c46\u74e3FM\u64ad\u653e\u4e2d\uff0c\u53ef\u4ee5\u6eda\u52a8\u663e\u793a\u66f2\u540d\u548c\u64ad\u653e\u8fdb\u5ea6<\/p><\/div>\n<p>\u4e00\u5207\u8c03\u8bd5\u5b8c\u6210\u540e\uff0c\u60a8\u8fd8\u53ef\u4ee5\u628a\u52a0\u8f7dlirc_rpi\u6a21\u5757\u548c\u542f\u52a8lcdmenu.py\u7684\u547d\u4ee4\u52a0\u5230Raspberry Pi\u7684\u542f\u52a8\u811a\u672c\u4e2d\uff0c\u8fd9\u6837\u7cfb\u7edf\u4e00\u542f\u52a8\u5c31\u53ef\u4ee5\u8ba9\u6db2\u6676\u663e\u793a\u548c\u83dc\u5355\u81ea\u52a8\u751f\u6548\uff0c\u83dc\u5355\u64cd\u4f5c\u4e2d\u5df2\u7ecf\u9884\u8bbe\u4e86\u5173\u673a\u3001\u91cd\u542f\u3001\u8bbe\u7f6eIP\u5730\u5740\u7b49\u529f\u80fd\uff0c\u8fd9\u5bf9\u4e8e<a title=\"Headless System\" href=\"http:\/\/en.wikipedia.org\/wiki\/Headless_system\" target=\"_blank\">headless<\/a>\u4f7f\u7528Raspberry Pi\u7684\u540c\u5b66\u6765\u8bf4\uff0c\u662f\u4e00\u4ef6\u975e\u5e38\u65b9\u4fbf\u7684\u4e8b\u60c5\u3002<\/p>\n<p><strong>\u53c2\u8003\u8d44\u6599\uff1a<\/strong><\/p>\n<ol>\n<li><a title=\"Very simple Raspberry Pi Radio\" href=\"http:\/\/mightyohm.com\/forum\/viewtopic.php?f=2&amp;t=3420#p5621\" target=\"_blank\">\u7ea2\u5916\u9065\u63a7\u5668lirc\u914d\u7f6e<\/a><\/li>\n<li><a title=\"RaspberryPiLcdMenu\" href=\"https:\/\/github.com\/aufder\/RaspberryPiLcdMenu#readme\" target=\"_blank\">RaspberryPiLcdMenu<\/a><\/li>\n<li><a title=\"lirc_rpi\" href=\"http:\/\/aron.ws\/projects\/lirc_rpi\/\" target=\"_blank\">lirc_rpi\u9879\u76ee<\/a><\/li>\n<li><a title=\"\u7528Raspberry Pi\u6253\u9020\u771f\u6b63\u7684\u201c\u8c46\u74e3FM\u201d\" href=\"http:\/\/www.freemindworld.com\/blog\/2013\/130218_douban_fm_with_raspberry_pi.shtml\">\u7528Raspberry Pi\u6253\u9020\u771f\u6b63\u7684\u201c\u8c46\u74e3FM\u201d<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u4e00\u671f\u4ecb\u7ecd\u4e86\u600e\u4e48\u7ed9Raspberry Pi\u52a0\u4e0a\u4e00\u4e2a\u6db2\u6676\u5c4f\uff0c\u8fd9\u671f\u8be5\u4ecb\u7ecd\u7ea2\u5916\u9065\u63a7\u4e86\u3002 &hellip; <a href=\"https:\/\/www.freemindworld.com\/blog\/2013\/130316_raspberry_pi_with_remote_control.shtml\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[53,54,46,52,43,49,48,50,45,51],"class_list":["post-1200","post","type-post","status-publish","format-standard","hentry","category-9","tag-gpio","tag-lirc","tag-raspberry-pi","tag-tsop1838","tag-43","tag-49","tag-48","tag-50","tag-45","tag-51"],"_links":{"self":[{"href":"https:\/\/www.freemindworld.com\/blog\/wp-json\/wp\/v2\/posts\/1200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freemindworld.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freemindworld.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freemindworld.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freemindworld.com\/blog\/wp-json\/wp\/v2\/comments?post=1200"}],"version-history":[{"count":15,"href":"https:\/\/www.freemindworld.com\/blog\/wp-json\/wp\/v2\/posts\/1200\/revisions"}],"predecessor-version":[{"id":1217,"href":"https:\/\/www.freemindworld.com\/blog\/wp-json\/wp\/v2\/posts\/1200\/revisions\/1217"}],"wp:attachment":[{"href":"https:\/\/www.freemindworld.com\/blog\/wp-json\/wp\/v2\/media?parent=1200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freemindworld.com\/blog\/wp-json\/wp\/v2\/categories?post=1200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freemindworld.com\/blog\/wp-json\/wp\/v2\/tags?post=1200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}