{"id":1442,"date":"2018-09-10T08:11:13","date_gmt":"2018-09-10T07:11:13","guid":{"rendered":"https:\/\/ofalcao.pt\/blog\/?p=1442"},"modified":"2018-09-10T12:12:52","modified_gmt":"2018-09-10T11:12:52","slug":"a-lego-relay","status":"publish","type":"post","link":"https:\/\/ofalcao.pt\/blog\/2018\/a-lego-relay","title":{"rendered":"A LEGO relay"},"content":{"rendered":"<p>I needed a LEGO mechanism that could turn ON or OFF an electrical circuit using an independent power source. This power source could be a regular LEGO battery but could also be a different type. So a LEGO <a href=\"https:\/\/en.wikipedia.org\/wiki\/Relay\">relay<\/a>.<\/p>\n<p>I remember seeing somewhere a few LEGO mechanisms with the same purpose, like moving the slider of a Power Functions battery box or rotating an axle inside of a Power Function switch&#8230; but could not find them.<\/p>\n<p>So this is my own implementation.<\/p>\n<p>I used a Power Functions switch. We can mechanical control the switch with a Technic axle inserted in two different ways &#8211; over the top or through it:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large\" src=\"https:\/\/sh-s7-live-s.legocdn.com\/is\/image\/LEGO\/8869?$PDPDefault$\" width=\"550\" height=\"450\" \/><\/p>\n<p>I decided to insert the axle through it. As the idea is using a MINDSTORMS to control the relay, I could have connected the axle directly to a motor and control the time or the angle. But I started with a Power Functions motor connected to a Power Functions battery and since the motor is too strong and fast I used a clutch gear to protect the switch when extreme position is reached.<\/p>\n<p>The switch has 3 working positions where the neutral (middle) is the OFF position and both left and right extremes are ON both with opposite polarities. As I just wanted ON and OFF I needed to limit the motion to just half.<\/p>\n<p>Perhaps not most the efficient mechanism or beautiful design but this works:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large\" src=\"https:\/\/lh3.googleusercontent.com\/p-8Kv4uDI0XNwoPjXUlmZrC8S0ajWoRRIMiE8cWpY6akw-Ja_KJ36HTllO3cjlwd0beDbbvt3F_jCZXVZcWQmq4sHkTngzIVNC77sio-qTHJov4i3UpuqiDRc1IhDfb8lUA7UM6Wtg=w1920-h1080\" width=\"1440\" height=\"1080\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large\" src=\"https:\/\/lh3.googleusercontent.com\/WihxByWKc7eqqW3AuiOBEQicicqhfSSMg6y-JzHCpmEqxArBlj-fhg2KgjGl7FybyeDDzvWV54yGE5rJQcd1fHtpX0n-hHbZeHLygmnD2akBeTD2qnCzhONi0387LkfEiYlf8UBuRw=w1920-h1080\" width=\"1440\" height=\"1080\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large\" src=\"https:\/\/lh3.googleusercontent.com\/eWhDlqRDqcWoqvKLySQgEysLBP6F-a73kcuhxHNJNy8Yj-xwCjzbZUmhSxDS1lWOONe8JPDkYFJ_J8S_CXsdvtKZVP3ne9fUzLumQa8KRprawB3v4dx5pFYOZYefkcwxu3gN9jjYSQ=w1920-h1080\" width=\"1440\" height=\"1080\" \/><\/p>\n<p>The cam gears were the first piece I found with the proper size &#8211; when the switch is off the cam gears touch the Technic grey brick so if the motor keeps rotating the clutch gear will slip and protect the switch axle.<\/p>\n<p>The relay works with power Functions cables so regular LEGO batteries and devices can be used. But I used a 2.1 mm female jack with a pair of crocodile cables to connect an old LEGO electric plate to a 12V\/1.5A wall power supply and a custom Power Functions cable with male headers soldered to it to connect to a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Kanthal_(alloy)\">kanthal<\/a> wire.<\/p>\n<p>I prefer to use kanthal wire instead of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Nichrome\">nichrome<\/a> wire for several reasons: it has a higher electrical resistence and also a higher melting temperature&#8230; and it is also widely available now that vaping is a trend (I don&#8217;t smoke but could not find a single nichrome supplier here in Portugal but have several online vaping stores selling dozens of variants of kanthal wires). Metal strings used with guitars also work and are easy to find but electrical resistance is too low.<\/p>\n<p>So I used a 20 cm piece of kanthal wire to make a coil with perhaps a dozen turns and test it several times:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large\" src=\"https:\/\/lh3.googleusercontent.com\/h_jT723OMLnzB9EtnPb_53_YVXtHYARdAT4Tp0oxxCeb7QvDzwnquUlKD9MdrCVZlg9uVs47riSIU9EMpekWcGauAWWlKW50B1ijgB78rTanPe7GT_JTfzhyV5q-LhAhKjOgeGLWZA=w1920-h1080\" width=\"1440\" height=\"1080\" \/><\/p>\n<p>Then connected the coil endpoints to 2 crimp pins and soldered it to the custom Power Functions wire (it&#8217;s not easy to solder kanthal wire so crimping is a better option)<\/p>\n<p>And now I have a MINDSTORMS controlled ignitor. Great for hobby rockets or party candles:<\/p>\n<div class=\"jetpack-video-wrapper\"><iframe loading=\"lazy\" title=\"Pyro - a MINDSTORMS EV3 ignitor\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/Rbi3v_pRV_o?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><strong>Remember<\/strong>: don&#8217;t try to do this if you don&#8217;t fully understand it. Also keep in mind that although party sparkles aren&#8217;t dangerous <em>per se<\/em> igniting one near flammable products can start a fire. Always take safety measures.<\/p>\n<p>Edit:<\/p>\n<p>And the bash script for the sparkle ignitor&#8217;s video (ev3dev):<\/p>\n<pre>#!\/usr\/bin\/env bash\r\n\r\nMTRTIME=1000   # 1 second\r\nMTRSPEEDON=-650\r\nMTRSPEEDOFF=650\r\nPAUSE=1 # MTRTIME \/ 1000\r\n\r\nIGNITION=10 # ignition time in seconds\r\n\r\nfunction Init {\r\n    echo \"Start\"\r\n    echo $MTRTIME &gt; \/sys\/class\/tacho-motor\/motor0\/time_sp\r\n}\r\n\r\nfunction SwitchON {\r\n    echo $MTRSPEEDON &gt; \/sys\/class\/tacho-motor\/motor0\/speed_sp\r\n    echo run-timed &gt; \/sys\/class\/tacho-motor\/motor0\/command\r\n    sleep $PAUSE\r\n}\r\n\r\nfunction SwitchOFF {\r\n    echo $MTRSPEEDOFF &gt; \/sys\/class\/tacho-motor\/motor0\/speed_sp\r\n    echo run-timed &gt; \/sys\/class\/tacho-motor\/motor0\/command\r\n    sleep $PAUSE\r\n}\r\n\r\nfunction SpeakCountdown {\r\n    espeak -a 200 -g 12 -p 70 \"Ten\"\r\n    espeak -a 200 -g 12 -p 70 \"Nine\"\r\n    espeak -a 200 -g 12 -p 70 \"Eight\"\r\n    espeak -a 200 -g 12 -p 70 \"Seven\"\r\n    espeak -a 200 -g 12 -p 70 \"Six\"\r\n    espeak -a 200 -g 12 -p 70 \"Five\"\r\n    espeak -a 200 -g 12 -p 70 \"Four\"\r\n    espeak -a 200 -g 12 -p 70 \"Three\"\r\n    espeak -a 200 -g 12 -p 70 \"Two\"\r\n    espeak -a 200 -g 12 -p 70 \"One\"\r\n    espeak -a 200 -g 12 -p 70 \"Zero\"\r\n}\r\n\r\nfunction SpeakHB {\r\n    espeak -a 200 -g 12 -p 70  \"Happy birthday!\"\r\n}\r\n\r\nfunction finish {\r\n    SwitchOFF\r\n    echo reset &gt; \/sys\/class\/tacho-motor\/motor0\/command\r\n    echo \"End\"\r\n}\r\n\r\ntrap finish EXIT\r\n\r\nInit\r\nSwitchOFF\r\nSpeakCountdown\r\nSwitchON\r\nsleep $IGNITION\r\nSpeakHB\r\nSwitchOFF\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I needed a LEGO mechanism that could turn ON or OFF an electrical circuit using an independent power source. This power source could be a regular LEGO battery but could also be a different type. So a LEGO relay. I remember seeing somewhere a few LEGO mechanisms with the same purpose, like moving the slider &hellip; <a href=\"https:\/\/ofalcao.pt\/blog\/2018\/a-lego-relay\" class=\"more-link\">Continuar a ler<span class=\"screen-reader-text\"> &#8220;A LEGO relay&#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":[],"class_list":["post-1442","post","type-post","status-publish","format-standard","hentry","category-sem-categoria"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2Mhyv-ng","_links":{"self":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1442","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=1442"}],"version-history":[{"count":0,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1442\/revisions"}],"wp:attachment":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/media?parent=1442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/categories?post=1442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/tags?post=1442"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/series?post=1442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}