{"id":1012,"date":"2017-02-10T17:38:50","date_gmt":"2017-02-10T17:38:50","guid":{"rendered":"http:\/\/ofalcao.pt\/blog\/?p=1012"},"modified":"2017-02-10T17:47:15","modified_gmt":"2017-02-10T17:47:15","slug":"using-ftdi-as-ir-5","status":"publish","type":"post","link":"https:\/\/ofalcao.pt\/blog\/2017\/using-ftdi-as-ir-5","title":{"rendered":"Using a FTDI adapter as an IR emitter &#8211; 5"},"content":{"rendered":"<div class=\"seriesmeta\">This post is part 5 of 5 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/using-a-ftdi-adapter-as-an-ir\" class=\"series-287\" title=\"Using a FTDI adapter as an IR\">Using a FTDI adapter as an IR<\/a><\/div><pre>sudo lircd -dserial=DN01DR29,output=3 -Hftdix<\/pre>\n<p>We gave lircd 3 parameters:<\/p>\n<ul>\n<li>&#8220;DN01DR29&#8221; is the serial number of my FTDI adapter reported by dmesg<\/li>\n<li>&#8220;output=3&#8243; is the CTS pin we use to control the LED (in the &#8216;hello-ftdi.c&#8221; test we see LED defined as 0x08, that&#8217;s because LIRC ftdix drivers calculates the pin by left-shifting, so 2&lt;&lt;3 = 2\u00b3 = 8)<\/li>\n<li>&#8220;ftdix&#8221; is the driver to use<\/li>\n<\/ul>\n<p>We should check if lircd is running. In Ubuntu it writes several messages at &#8220;\/var\/log\/messages&#8221; but this log doesn&#8217;t exist in ev3dev so<\/p>\n<pre>pgrep lircd\r\n5411<\/pre>\n<p>E also see in dmesg that the ttyUSB device was disconnected by libftdi:<\/p>\n<pre>[47897.512814] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0\r\n[47897.513393] ftdi_sio 1-1.2:1.0: device disconnected<\/pre>\n<p>We now use &#8216;irsend&#8217; to check for available transmitter:<\/p>\n<pre>sudo irsend -d\/var\/run\/lirc\/lircd LIST \"\" \"\"\r\n\r\nLEGO_Combo_Direct\r\nLEGO_Combo_PWM\r\nLEGO_Single_Output<\/pre>\n<p>We can also list all commands avaible for a particular transmitter:<\/p>\n<pre>sudo irsend -d\/var\/run\/lirc\/lircd LIST LEGO_Combo_Direct \"\"\r\n\r\n000000000000010e FLOAT_FLOAT\r\n000000000000011f FLOAT_FORWARD\r\n000000000000012c FLOAT_BACKWARD\r\n000000000000013d FLOAT_BRAKE\r\n000000000000014a FORWARD_FLOAT\r\n000000000000015b FORWARD_FORWARD\r\n0000000000000168 FORWARD_BACKWARD\r\n0000000000000179 FORWARD_BRAKE\r\n0000000000000186 BACKWARD_FLOAT\r\n0000000000000197 BACKWARD_FORWARD\r\n00000000000001a4 BACKWARD_BACKWARD\r\n00000000000001b5 BACKWARD_BRAKE\r\n00000000000001c2 BRAKE_FLOAT\r\n00000000000001d3 BRAKE_FORWARD\r\n00000000000001e0 BRAKE_BACKWARD\r\n00000000000001f1 BRAKE_BRAKE<\/pre>\n<p>For first test we&#8217;ll just use &#8220;FORWARD_FORWARD&#8221; command (move both motors, &#8220;Red&#8221; and &#8220;Blue&#8221;, forward):<\/p>\n<pre>sudo irsend -d \/var\/run\/lirc\/lircd SEND_ONCE LEGO_Combo_Direct FORWARD_FORWARD<\/pre>\n<p>And our motor do spin!<\/p>\n<p>So, after such a big post, whats the point?<\/p>\n<p>Well, since LIRC can handle several transmitter and for ftdix it uses the serial number of the FTDI adapter to identify each transmitter&#8230; we can have as much transmitters as we want as long as our system can handle it. On a laptop or a Raspberry Pi 3 that&#8217;s probably 127 (the max number of USB devices we can have). Most probably the Ev3 will gasp will all that USB devices but at least two I know it can handle:<\/p>\n<div class=\"jetpack-video-wrapper\"><iframe loading=\"lazy\" title=\"Using several FTDI adapters as LEGO compatible IR remotes\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/bmgmDILTcM4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<p>Will show how in a fourth post, later on.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"seriesmeta\">This post is part 5  of 5 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/using-a-ftdi-adapter-as-an-ir\" class=\"series-287\" title=\"Using a FTDI adapter as an IR\">Using a FTDI adapter as an IR<\/a><\/div><p>sudo lircd -dserial=DN01DR29,output=3 -Hftdix We gave lircd 3 parameters: &#8220;DN01DR29&#8221; is the serial number of my FTDI adapter reported by dmesg &#8220;output=3&#8243; is the CTS pin we use to control the LED (in the &#8216;hello-ftdi.c&#8221; test we see LED defined as 0x08, that&#8217;s because LIRC ftdix drivers calculates the pin by left-shifting, so 2&lt;&lt;3 = &hellip; <a href=\"https:\/\/ofalcao.pt\/blog\/2017\/using-ftdi-as-ir-5\" class=\"more-link\">Continuar a ler<span class=\"screen-reader-text\"> &#8220;Using a FTDI adapter as an IR emitter &#8211; 5&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[1],"tags":[],"series":[287],"class_list":["post-1012","post","type-post","status-publish","format-standard","hentry","category-sem-categoria","series-using-a-ftdi-adapter-as-an-ir"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2Mhyv-gk","_links":{"self":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/comments?post=1012"}],"version-history":[{"count":0,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1012\/revisions"}],"wp:attachment":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/media?parent=1012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/categories?post=1012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/tags?post=1012"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/series?post=1012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}