{"id":3811,"date":"2024-01-12T07:32:15","date_gmt":"2024-01-12T15:32:15","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3811"},"modified":"2024-01-12T07:32:15","modified_gmt":"2024-01-12T15:32:15","slug":"project-05-lamps-neopixels-mk02","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3811","title":{"rendered":"Project #05: Lamps &#8211; NeoPixels &#8211; Mk02"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3811-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #Lamps #NeoPixels #Keyboard #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01a.png\" alt=\"NeoPixels\" width=\"720\" height=\"532\" class=\"alignnone size-full wp-image-3813\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01a-300x222.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01b.png\" alt=\"NeoPixels\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3814\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01b-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01c.png\" alt=\"NeoPixels\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3815\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01d.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01d.png\" alt=\"NeoPixels\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3816\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01d.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2024\/01\/DL2401Mk01d-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>NeoPixels<\/strong><\/p>\n<p>The WS2812 Integrated Light Source, or NeoPixel in Adafruit parlance, is the latest advance in the quest for a simple, scalable and affordable full-color LED. Red, green and blue LEDs are integrated alongside a driver chip into a tiny surface-mount package controlled through a single wire. They can be used individually, chained into longer strings or assembled into still more interesting form-factors.<\/p>\n<p>NeoPixels don\u2019t just light up on their own; they require a microcontroller, such as Arduino, and some programming. We provide some sample code to get you started. To create your own effects and animation, you\u2019ll need some programming practice. If this is a new experience, work through some of the beginning Arduino tutorials to get a feel for the language.<\/p>\n<p><strong>NeoPixel Stick &#8211; 8 x 5050 RGB LED<\/strong><\/p>\n<p>Make your own little LED strip arrangement with this stick of NeoPixel LEDs. We crammed 8 of the tiny 5050 smart RGB LEDs onto a PCB with mounting holes and a chainable design. Use only one microcontroller pin to control as many as you can chain together. Each LED is addressable as the driver chip is inside the LED. Each one has constant current drive so the color will be very consistent even if the voltage varies, and no external choke resistors are required making the design slim. Power the whole thing with 5VDC and you&#8217;re ready to rock. The LEDs are &#8220;Chainable&#8221; by connecting the output of one stick into the input of another. There is a single data line with a very timing-specific protocol.<\/p>\n<p><strong>DL2401Mk01<\/strong><\/p>\n<p>1 x Arduino Pro Mini 328 &#8211; 3.3V\/8MHz<br \/>\n2 x NeoPixel Stick &#8211; 8 x 5050 RGB LED<br \/>\n2 x Rotary Potentiometer &#8211; 10k Ohm<br \/>\n1 x Potentiometer Knob &#8211; Soft Touch T18 &#8211; Blue<br \/>\n1 x Potentiometer Knob &#8211; Soft Touch T18 &#8211; Red<br \/>\n1 x Mountable Slide Switch<br \/>\n1 x SparkFun USB Mini-B Breakout<br \/>\n1 x Enclosure<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>Arduino Pro Mini 328 &#8211; 3.3V\/8MHz<\/strong><\/p>\n<p>NPX &#8211; Digital 8<br \/>\nBRI &#8211; Analog A0<br \/>\nCOL &#8211; Analog A3<br \/>\nVIN &#8211; +3.3V<br \/>\nVIN &#8211; +5V<br \/>\nGND &#8211; GND<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2401Mk01p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/****** Don Luc Electronics \u00a9 ******\r\nSoftware Version Information\r\nProject #05: Lamps - NeoPixels - Mk02\r\n05-02\r\nDL2401Mk01p.ino\r\n1 x Arduino Pro Mini 328 - 3.3V\/8MHz\r\n2 x NeoPixel Stick - 8 x 5050 RGB LED\r\n2 x Rotary Potentiometer - 10k Ohm\r\n1 x Potentiometer Knob - Soft Touch T18 - Blue\r\n1 x Potentiometer Knob - Soft Touch T18 - Red\r\n1 x Mountable Slide Switch\r\n1 x SparkFun USB Mini-B Breakout\r\n1 x Enclosure\r\n1 x SparkFun Cerberus USB Cable\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\/\/ NeoPixel\r\n#include &lt;Adafruit_NeoPixel.h&gt;\r\n\r\n\/\/ NeoPixels\r\n#define PIN 8\r\n\/\/ How many NeoPixels are attached to the Arduino =&gt; 16\r\n#define NUMPIXELS 16\r\nAdafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\r\n\r\n\/\/ Color\r\n\/\/ Red\r\nint red = 0;\r\n\/\/ Green\r\nint green = 0;\r\n\/\/ Blue\r\nint blue = 0;\r\n\r\n\/\/ 2 x Panel Mount 1K potentiometer\r\n\/\/ Brighten\r\nconst int iSensorBrighten = A0;\r\nint BrightenValue = 0;\r\nint sensorMin = 1023;        \/\/ minimum sensor value\r\nint sensorMax = 0;           \/\/ maximum sensor value\r\n\r\n\/\/ Color\r\nconst int iSensorColor = A3;\r\nint y = 0;\r\nint ColorVal = 0;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;05-02&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Color\r\n  isRangeColor();\r\n\r\n  \/\/ Brighten\r\n  isNeopix();\r\n\r\n}\r\n<\/pre>\n<p><strong>getNeopix.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Neopix\r\nvoid isNeopix() {\r\n  \r\n  for(int i=0; i&lt;NUMPIXELS; i++){\r\n\r\n    \/\/ Neopix\r\n    BrightenValue = analogRead( iSensorBrighten );\r\n\r\n    \/\/ Apply the calibration to the sensor reading\r\n    BrightenValue = map(BrightenValue, sensorMin, sensorMax, 0, 255);\r\n\r\n    \/\/ In case the sensor value is outside the range seen during calibration\r\n    BrightenValue = constrain(BrightenValue, 0, 255); \r\n    \r\n    pixels.setBrightness( BrightenValue );\r\n\r\n    \/\/ The pixels.Color takes RGB values, from 0,0,0 up to 255,255,255\r\n    pixels.setPixelColor(i, pixels.Color(red,green,blue));\r\n    \r\n    \/\/ This sends the updated pixel color to the hardware\r\n    pixels.show();\r\n \r\n  }\r\n  \r\n}\r\n\/\/ Range Color\r\nvoid isRangeColor() {\r\n\r\n  \/\/ Range Color\r\n  ColorVal = analogRead( iSensorColor );\r\n  y = (ColorVal \/ 127);\r\n  \r\n  switch ( y ) {\r\n    case  0:\r\n      \/\/ White\r\n      red = 255;\r\n      green = 255;\r\n      blue = 255; \r\n      break;\r\n    case 1:\r\n      \/\/ Yellow\r\n      red = 255;\r\n      green = 255;\r\n      blue = 0;        \r\n      isNeopix();\r\n      break;\r\n    case 2:\r\n      \/\/ Pink\r\n      red = 255;\r\n      green = 153;\r\n      blue = 203;        \r\n      isNeopix();\r\n      break;\r\n    case 3:\r\n      \/\/ Blue\r\n      red = 0;\r\n      green = 102;\r\n      blue = 204;        \r\n      isNeopix();       \r\n      isNeopix();\r\n      break;  \r\n    case 4:\r\n      \/\/ Green\r\n      red = 0;\r\n      green = 255;\r\n      blue = 0;        \r\n      isNeopix();\r\n      break;\r\n    case 5:\r\n      \/\/ Orange\r\n      red = 255;\r\n      green = 102;\r\n      blue = 0;        \r\n      isNeopix();\r\n      break;\r\n    case 6:\r\n      \/\/ Violet\r\n      red = 204;\r\n      green = 102;\r\n      blue = 204;        \r\n      isNeopix();\r\n      break;     \r\n    case 7:\r\n      \/\/ Red\r\n      red = 255;\r\n      green = 0;\r\n      blue = 0;        \r\n      isNeopix();\r\n      break; \r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Setup\r\nvoid setup()\r\n{\r\n\r\n  \/\/ This initializes the NeoPixel library\r\n  pixels.begin();\r\n  delay(50);\r\n\r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>People can contact us:<\/strong> https:\/\/www.donluc.com\/?page_id=1927<\/p>\n<p><strong>Teacher, Instructor, E-Mentor, R&#038;D and Consulting<\/strong><\/p>\n<ul>\n<li>Programming Language<\/li>\n<li>Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc&#8230;)<\/li>\n<li>IoT<\/li>\n<li>Wireless (Radio Frequency, Bluetooth, WiFi, Etc&#8230;)<\/li>\n<li>Robotics<\/li>\n<li>Automation<\/li>\n<li>Camera and Video Capture Receiver Stationary, Wheel\/Tank and Underwater Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial and Marine<\/li>\n<li>Machine Learning<\/li>\n<li>Artificial Intelligence (AI)<\/li>\n<li>RTOS<\/li>\n<li>eHealth Sensors, Biosensor, and Biometric<\/li>\n<li>Research &#038; Development (R &#038; D)<\/li>\n<li>Consulting<\/li>\n<\/ul>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>Luc Paquin \u2013 Curriculum Vitae &#8211; 2024<\/strong><br \/>\nhttps:\/\/www.donluc.com\/luc\/<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/@thesass2063<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; #DonLucElectronics #DonLuc #Lamps #NeoPixels #Keyboard #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; NeoPixels The WS2812 Integrated Light Source, or NeoPixel in Adafruit parlance, is the latest advance in the quest for a simple, scalable and affordable full-color LED. Red, green and blue LEDs are integrated alongside a &#8230; <a title=\"Project #05: Lamps &#8211; NeoPixels &#8211; Mk02\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3811\" aria-label=\"Read more about Project #05: Lamps &#8211; NeoPixels &#8211; Mk02\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68,47,50,49,38,59,115,5,287,58,10,43],"tags":[86,6,4,19,85,316,24,315,9,27,109,33,34,108],"class_list":["post-3811","post","type-post","status-publish","format-standard","hentry","category-lamps","category-adafruit","category-arduino","category-consultant","category-digitalelectronics","category-fritzing","category-e-mentor","category-microcontrollers","category-program","category-arduino-programming","category-projects","category-sparkfun","tag-adafruit","tag-arduino","tag-consultant","tag-electronics","tag-fritzing","tag-lamps","tag-microcontroller","tag-neopixels","tag-programming","tag-projects-2","tag-sparkfun","tag-technology","tag-video-blog","tag-vlog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3811","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3811"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3811\/revisions"}],"predecessor-version":[{"id":3817,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3811\/revisions\/3817"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}