{"id":1568,"date":"2015-01-08T00:37:02","date_gmt":"2015-01-07T23:37:02","guid":{"rendered":"http:\/\/majek.mamy.to\/?p=1568"},"modified":"2015-02-09T01:07:49","modified_gmt":"2015-02-09T00:07:49","slug":"christmas-tree-lamps-with-arduino-and-ws2811-leds","status":"publish","type":"post","link":"https:\/\/majek.sh\/en\/christmas-tree-lamps-with-arduino-and-ws2811-leds\/","title":{"rendered":"Christmas tree lamps with Arduino and WS2811 leds :-)"},"content":{"rendered":"<p>Somewhere at the beginning of November I discovered RGB LEDs with embedded controller: WS2812 and others. Idea was so cool for me that I had to own one to play with it \ud83d\ude42<br \/>\nThese chips became so common, that there are even put inside LEDs, like on this WS2812 diode:<\/p>\n<p><a href=\"https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2812led2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2812led2-600x480.jpg\" alt=\"WS2812 RGB LED\" width=\"600\" height=\"480\" class=\"alignnone size-medium wp-image-1573\" srcset=\"https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2812led2-600x480.jpg 600w, https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2812led2-150x120.jpg 150w, https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2812led2-1024x819.jpg 1024w, https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2812led2.jpg 1280w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>Considering time of the year, it was obvious to me to make whole string of lamps for Christmas tree. Then I found on Aliexpress ready made chains of such LEDs. \ud83d\ude42<br \/>\nSo, my LEDs aren&#8217;t with chips inside, but with small PCBs sealed with some kind of hard silicone &#8211; maybe not so elegant as chip integrated inside LED, but cheaper &#8211; which counts if you buy 50 of them :-):<\/p>\n<p><a href=\"https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2811leds.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2811leds-640x440.jpg\" alt=\"WS2811 RGB LEDs on Christmas tree\" width=\"640\" height=\"440\" class=\"alignnone size-medium wp-image-1570\" srcset=\"https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2811leds-640x440.jpg 640w, https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2811leds-150x103.jpg 150w, https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2811leds-1024x704.jpg 1024w, https:\/\/majek.sh\/wp-content\/uploads\/2015\/01\/ws2811leds.jpg 1280w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Day before Christmas I still haven&#8217;t done anything with these light, so it was last chance to do something useful with it.<\/p>\n<p>Connecting everything was quite easy as there are only 3 components: 5V power supply, Arduino Pro Mini board and LED chain.<\/p>\n<p>Programming protocol for WS2811 was more challenging &#8211; generated waveform must be very accurate, with some time intervals taking only 8 cpu Atmega328 clocks (at 16MHz). So, I chose assembler to do it (as usual \ud83d\ude42 ).<br \/>\nTo be more hardcore, it was 3am when I started debugging \ud83d\ude42 Honestly, without my new oscilloscope, finding these 3 mistakes I&#8217;ve made, could&#8217;ve took hours. Especially that Chinese guy who sells these LEDs described them as <em>&#8216;we sent WS2811. Or we may sent UCS1903&#8217;<\/em> &#8211; two different possible chips (!) with two different protocols and no one knows which version I&#8217;ve got.<br \/>\nLuckily for me. it was WS2811, so first guess and code worked.<\/p>\n<p>I added few simple routines to move light across whole chain of LEDs and put everything on Christmas tree.<\/p>\n<p>All code for this &#8216;one night project&#8217; you could find on my Github page: <a href=\"https:\/\/github.com\/majekw\/wsled\" target=\"_blank\">https:\/\/github.com\/majekw\/wsled<\/a><\/p>\n<p>This is how it looks like on my Christmas tree:<br \/>\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"\/\/www.youtube.com\/embed\/b-g9DUUR0TE\" frameborder=\"0\" allowfullscreen><\/iframe><br \/>\n<\/p>","protected":false},"excerpt":{"rendered":"<p>Somewhere at the beginning of November I discovered RGB LEDs with embedded controller: WS2812 and others. Idea was so cool for me that I had to own one to play with it \ud83d\ude42 These chips became so common, that there <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/majek.sh\/en\/christmas-tree-lamps-with-arduino-and-ws2811-leds\/\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[38,50,24,32],"_links":{"self":[{"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/posts\/1568"}],"collection":[{"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/comments?post=1568"}],"version-history":[{"count":17,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/posts\/1568\/revisions"}],"predecessor-version":[{"id":1595,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/posts\/1568\/revisions\/1595"}],"wp:attachment":[{"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/media?parent=1568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/categories?post=1568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/tags?post=1568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}