{"id":4452,"date":"2015-12-13T05:20:29","date_gmt":"2015-12-13T10:20:29","guid":{"rendered":"http:\/\/www.plastibots.com\/?p=4452"},"modified":"2017-05-27T06:36:38","modified_gmt":"2017-05-27T11:36:38","slug":"lulzbot-mini-led-lighting-controller","status":"publish","type":"post","link":"https:\/\/www.plastibots.com\/index.php\/2015\/12\/13\/lulzbot-mini-led-lighting-controller\/","title":{"rendered":"LulzBot Mini: LED Lighting Controller"},"content":{"rendered":"<p>Update: Check out the more recent mod &#8211; <a href=\"http:\/\/www.plastibots.com\/index.php\/2016\/01\/03\/lulzbot-ip-mini-cam-led-mount\/\" target=\"_blank\">camera mount and better lighting<\/a>.<\/p>\n<p>So, I just got my LulzBot Mini this week and have to say I love this thing. \u00a0It&#8217;s my 2nd 3D printer (I Kickstarted the M3D &#8211; but it was not a reliable machine). \u00a0Anyway, like any guy with a new toy, I had to do something to make it my own! \u00a0 ..and why not print some parts for it!<\/p>\n<p>The final resting spot for the Mini does not have very good lighting. \u00a0I wanted to build a flexible LED light that could be dimmed, and turned on\/off when necessary. \u00a0I also wanted to just turn it on, and leave it knowing it would go off after a pre-set period of time (e.g. 1 minute). \u00a0I had a spare <a href=\"https:\/\/www.sparkfun.com\/products\/12923\" target=\"_blank\">MicroView<\/a> laying around and thought it would be cool to be able to visualize the LED settings as well. \u00a0It will also allow for future features I have yet to dream up. \u00a0(details and parts below).<\/p>\n<p>&nbsp;<br \/>\n<center><a href=\"https:\/\/www.banggood.com\/collection-3401.html?utm_campaign=BN1534&#038;utm_content=Klaus&#038;p=R90804949020201412E4&#038;bid=34282&#038;utm_design=62\" target=\"_blank\"><img decoding=\"async\" src=\"http:\/\/img.banggood.com\/deals\/affiliate_member_banner\/274766460cea548fa1a55d476fbfc7ff56.jpg\" \/><\/a><\/center><\/p>\n<p><iframe loading=\"lazy\" title=\"LulzBot Mini With MicroView LED Mod\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/igel6a4Bf60?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><\/p>\n<p><a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-41.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4473\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-41-300x225.jpg\" alt=\"LulzBotMiniLEDMod (4)\" width=\"600\" height=\"450\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-41-300x225.jpg 300w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-41.jpg 1024w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-41-640x480.jpg 640w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4453\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-1-300x225.jpg\" alt=\"LulzBotMiniLEDMod (1)\" width=\"600\" height=\"450\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-1-300x225.jpg 300w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-1.jpg 1024w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-1-640x480.jpg 640w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4454\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-2-300x225.jpg\" alt=\"LulzBotMiniLEDMod (2)\" width=\"600\" height=\"450\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-2-300x225.jpg 300w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-2.jpg 1024w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-2-640x480.jpg 640w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4455\" src=\"http:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-3-300x225.jpg\" alt=\"LulzBotMiniLEDMod (3)\" width=\"600\" height=\"450\" srcset=\"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-3-300x225.jpg 300w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-3.jpg 1024w, https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-3-640x480.jpg 640w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Parts:<\/strong><\/p>\n<ul>\n<li>Sparkfun <a href=\"https:\/\/www.sparkfun.com\/products\/12923\" target=\"_blank\">MicroView<\/a>.<\/li>\n<li>2n2904 Transistor<\/li>\n<li>Push Button Switch<\/li>\n<li><a href=\"http:\/\/www.banggood.com\/LED-Driver-Charging-Constant-Current-Voltage-Step-Down-Buck-Module-p-939196.html?p=R90804949020201412E4\" target=\"_blank\">Adjustable Switching Regulator<\/a><\/li>\n<li><a href=\"http:\/\/www.banggood.com\/Wholesale-G4-1W-12V-60-Lumen-LED-Car-Light-Bulb-Turning-Bulbs-Warm-White-p-43949.html?p=R90804949020201412E4\" target=\"_blank\">G4 1W 12V 60 Lumen LED<\/a><\/li>\n<li>Switching Mode Variable Voltage Regulator (takes 24V down to 12V)<\/li>\n<li><a href=\"https:\/\/www.homedepot.ca\/en\/home\/p.14-in-flex-mist-adj-micro-sprinkler-wflexible-mem.1000157146.html\" target=\"_blank\">Flexible Micro Sprinkler<\/a> (has casing + copper to make a great flex arm)<\/li>\n<li>Printed casings \/ parts &#8211; PlastiBots on Thingiverse<\/li>\n<\/ul>\n<p><strong>The Details:<\/strong><\/p>\n<p>Power is sourced directly from the LulzBot 24V DC output. \u00a0I tapped off the +\/- that was connected to the heated bed input on the Mini Rambo board (but I don&#8217;t think it matters). \u00a0The regulator was set to 12V and was connected to both the MicroView (yup it can take 12V) and the LED (via the 2n2904). \u00a0A PWM pin on the MicroView triggers PWM output into the 2n2904\u00a0that then controls the brightness of the LED. \u00a0The switch is connected to Pin2 as an input and is used to control the LED levels. \u00a0I used the built-in MicroView graphic bar widget to show the light level.<\/p>\n<p><strong>Future Ideas:<\/strong><\/p>\n<p>I don&#8217;t yet know the RAMBO board but given it is Arduino-based, I would expect some sort of serial output. \u00a0Potentially being able to get a real-time output of status such as GCode line #, or temperature values etc.<\/p>\n<p><strong>The Code:<\/strong><\/p>\n<p>\/*<br \/>\nUsing a MicroView. Board should be Arduino Uno<\/p>\n<p>*\/<br \/>\n#include &lt;MicroView.h&gt;<\/p>\n<p>MicroViewWidget *widget[1]; \/\/ declaring an array of 4 MicroViewWidget<br \/>\nint pushBotton = 2;<br \/>\n\/\/PIN 6 will be Tip31 base output pin. PWM out AnalogWrite<br \/>\nint LEDpin = 5;<br \/>\n\/\/int iVal = 0; \/\/input value for pushbutton<br \/>\nint level = 0;<br \/>\nint buttonState; \/\/ the current reading from the input pin<br \/>\nint lastButtonState = LOW; \/\/ the previous reading from the input pin<br \/>\nlong lastDebounceTime = 0; \/\/ the last time the output pin was toggled<br \/>\nlong debounceDelay = 150; \/\/ the debounce time; increase if the output flickers<\/p>\n<p>void setup() {<br \/>\npinMode(LEDpin, OUTPUT);<br \/>\nuView.begin(); \/\/ init and start MicroView<br \/>\nwidget[0] = new MicroViewSlider(0,35,0,100); \/\/ declare widget0 as a Slider at x=0, y=0, min=0, max=100<br \/>\n\/\/widget[1] = new MicroViewGauge(32,24,0,255,WIDGETSTYLE0); \/\/ declare widget0 as a Slider at x=0, y=10, min=0, max=150<br \/>\nuView.clear(PAGE); \/\/ erase the memory buffer, when next uView.display() is called, the OLED will be cleared.<br \/>\nanalogWrite(LEDpin,255); \/\/ensure the LED is off at startup.<br \/>\n}<\/p>\n<p>void loop() {<br \/>\n\/\/analogWrite(LEDpin, 0);<br \/>\n\/\/delay(500);<br \/>\n\/\/analogWrite(LEDpin, 255);<br \/>\n\/\/delay(500);<\/p>\n<p>int reading = digitalRead(pushBotton);<br \/>\n\/\/ If the switch changed, due to noise or pressing:<br \/>\nif (buttonState != lastButtonState) {<br \/>\n\/\/ reset the debouncing timer<br \/>\nlastDebounceTime = millis();<br \/>\n}<\/p>\n<p>if ((millis() &#8211; lastDebounceTime) &gt; debounceDelay) {<br \/>\n\/\/ whatever the reading is at, it&#8217;s been there for longer<br \/>\n\/\/ than the debounce delay, so take it as the actual current state:<\/p>\n<p>\/\/ if the button state has changed:<br \/>\nif (reading != buttonState) {<br \/>\nbuttonState = reading;<\/p>\n<p>\/\/ only toggle the LED if the new button state is HIGH<br \/>\nif (buttonState == HIGH) {<br \/>\n\/\/ledState = !ledState;<br \/>\nchangeLevel();<br \/>\nanalogWrite(LEDpin, map(level, 0, 100, 255, 0));<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n<p>uView.setFontType(1);<br \/>\nuView.setCursor(0,0);<br \/>\nuView.print(&#8221; LED&#8221;);<br \/>\nuView.setCursor(0,15);<br \/>\nuView.print(&#8220;Level %&#8221;);<\/p>\n<p>widget[0]-&gt;setValue(level);<br \/>\nwidget[0]-&gt;reDraw();<br \/>\nuView.display();<br \/>\nuView.clear(PAGE);<br \/>\ndelay(100);<\/p>\n<p>lastButtonState = reading;<br \/>\n}<\/p>\n<p>void changeLevel()<br \/>\n{<br \/>\nif (level &lt;= 3)<br \/>\n{<br \/>\nlevel = 100;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nlevel-=33;<br \/>\nif (level &lt; 3) level = 0;<br \/>\n}<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: Check out the more recent mod &#8211; camera mount and better lighting. So, I just got my LulzBot Mini this week and have to say I love this thing. \u00a0It&#8217;s my 2nd 3D printer (I Kickstarted the M3D &#8211; but it was not a reliable machine). \u00a0Anyway, like any guy with a new toy, I had to do something to make it my own! \u00a0 ..and why not print some parts for it! The &hellip; <a href=\"https:\/\/www.plastibots.com\/index.php\/2015\/12\/13\/lulzbot-mini-led-lighting-controller\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":4,"featured_media":4473,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[65,6,57],"tags":[64,148,149],"class_list":["post-4452","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino-electronics","category-dyihacks","category-electronics","tag-arduino","tag-lulzbot","tag-microview","has_thumb"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/www.plastibots.com\/wordpress\/wp-content\/uploads\/2015\/12\/LulzBotMiniLEDMod-41.jpg","jetpack_shortlink":"https:\/\/wp.me\/pK41j-19O","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/posts\/4452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/comments?post=4452"}],"version-history":[{"count":0,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/posts\/4452\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/media\/4473"}],"wp:attachment":[{"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/media?parent=4452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/categories?post=4452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.plastibots.com\/index.php\/wp-json\/wp\/v2\/tags?post=4452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}