{"id":114,"date":"2020-03-21T17:29:15","date_gmt":"2020-03-21T21:29:15","guid":{"rendered":"http:\/\/www.i-tinker.net\/?p=114"},"modified":"2020-03-23T22:38:46","modified_gmt":"2020-03-24T02:38:46","slug":"adding-leds-to-my-anet-a8-plus-with-octopi-control","status":"publish","type":"post","link":"https:\/\/www.i-tinker.net\/?p=114","title":{"rendered":"Adding LEDs to my Anet A8 Plus with Octopi Control"},"content":{"rendered":"\n<p>To add dimmable LEDs to my 3d printer, I bought some 24v LEDs strips from Amazon.  Along with the strips I bought a <a href=\"https:\/\/smile.amazon.com\/gp\/product\/B07NWD8W26\/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1\">high power dual mosfet driver board<\/a> to be able to control the power going to the LEDs.<\/p>\n\n\n\n<p class=\"has-text-align-left\">The following is the basic wiring diagram of the driver board:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><br><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"353\" class=\"wp-image-115\" style=\"width: 500px;\" src=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/mosfet_wiring.jpg\" alt=\"\" srcset=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/mosfet_wiring.jpg 512w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/mosfet_wiring-300x212.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><br>Image by <a href=\"http:\/\/www.icstation.com\/high-power-dual-tube-transistor-mosfet-trigger-switch-driver-module-adjustable-regulator-switch-control-400w-p-10536.html\">icstation.com<\/a><\/p>\n\n\n\n<p class=\"has-text-align-left\">The load is the LED strip and the power comes straight from the 3d printer PSU 24v terminals.  the PWM signal that switches the MOSFETs comes from PWM pins on the rpasberry PI.  I have the GPIO pins here below:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><br><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"411\" class=\"wp-image-116\" style=\"width: 500px;\" src=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/introduction-to-raspberry-pi-3-b-plus-2.png\" alt=\"\" srcset=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/introduction-to-raspberry-pi-3-b-plus-2.png 572w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/introduction-to-raspberry-pi-3-b-plus-2-300x247.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><br>When I built mine I chose to use PINS 32 and 34 as they were the easiest to get to. However any PWM pin is fine as long as you know what it&#8217;s called in the software.  Here it&#8217;s GPIO 12.<\/p>\n\n\n\n<p>Here&#8217;s a picture of the PINs on my board:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><br><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"281\" class=\"wp-image-112\" style=\"width: 500px;\" src=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155103-scaled.jpg\" alt=\"\" srcset=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155103-scaled.jpg 2560w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155103-300x169.jpg 300w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155103-768x432.jpg 768w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155103-1536x864.jpg 1536w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155103-2048x1152.jpg 2048w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155103-1200x675.jpg 1200w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n\n\n\n<p class=\"has-text-align-left\"><br>And here&#8217;s the other end connected to the MOSFET board:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><br><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"532\" class=\"wp-image-113\" style=\"width: 500px;\" src=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155032-scaled-e1584825055165.jpg\" alt=\"\" srcset=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155032-scaled-e1584825055165.jpg 985w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155032-scaled-e1584825055165-282x300.jpg 282w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200321_155032-scaled-e1584825055165-768x818.jpg 768w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n\n\n\n<p>Next was to install plugins in Octopi to be able to control the GPIO and in turn, the LED brightness.  Below is a screen shot of the plugins and their configurations.  The plugins I used were Enclosure and Custom Control Editor.  First setup Enclosure plugin to control the GPIO port as below:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><br><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"398\" class=\"wp-image-121\" style=\"width: 500px;\" src=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/Enclosure_1.png\" alt=\"\" srcset=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/Enclosure_1.png 974w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/Enclosure_1-300x239.png 300w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/Enclosure_1-768x611.png 768w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><br><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"402\" class=\"wp-image-122\" style=\"width: 500px;\" src=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/Enclosure_2.png\" alt=\"\" srcset=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/Enclosure_2.png 972w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/Enclosure_2-300x241.png 300w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/Enclosure_2-768x617.png 768w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n\n\n\n<p class=\"has-text-align-left\"><br>I used 100Hz to prevent flicker of the LEDs.  You can try different values based on your preferences.<\/p>\n\n\n\n<p>Once the port was defined, you can access it by issuing the gcode command ENC O1 S0 where ENC is for enclosure, O is for the outputs logical number as defined in the previous step, and S is the value in percentage.  So S0 is off and S100 is full on.<\/p>\n\n\n\n<p>Next I created buttons to control this from the Octoprint web interface.  This uses the Custom Control Editor plugin.  This plugin is great for commanding things like go to center of bed etc.  Here I created buttons with the command above behind it to control the LEDs:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><br><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"400\" class=\"wp-image-119\" style=\"width: 500px;\" src=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/CCE_1.png\" alt=\"\" srcset=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/CCE_1.png 978w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/CCE_1-300x240.png 300w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/CCE_1-768x614.png 768w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><br><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"369\" class=\"wp-image-120\" style=\"width: 500px;\" src=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/CCE_2.png\" alt=\"\" srcset=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/CCE_2.png 570w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/CCE_2-300x222.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"281\" class=\"wp-image-123\" style=\"width: 500px;\" src=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200315_194103-scaled.jpg\" alt=\"\" srcset=\"https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200315_194103-scaled.jpg 2560w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200315_194103-300x169.jpg 300w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200315_194103-768x432.jpg 768w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200315_194103-1536x864.jpg 1536w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200315_194103-2048x1152.jpg 2048w, https:\/\/www.i-tinker.net\/wp-content\/uploads\/2020\/03\/IMG_20200315_194103-1200x675.jpg 1200w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n\n\n\n<p class=\"has-text-align-center\">And that&#8217;s it!<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To add dimmable LEDs to my 3d printer, I bought some 24v LEDs strips from Amazon. Along with the strips I bought a high power dual mosfet driver board to be able to control the power going to the LEDs. The following is the basic wiring diagram of the driver board: Image by icstation.com The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-114","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.i-tinker.net\/index.php?rest_route=\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.i-tinker.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.i-tinker.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.i-tinker.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.i-tinker.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=114"}],"version-history":[{"count":5,"href":"https:\/\/www.i-tinker.net\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":126,"href":"https:\/\/www.i-tinker.net\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions\/126"}],"wp:attachment":[{"href":"https:\/\/www.i-tinker.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.i-tinker.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.i-tinker.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}