{"id":1029,"date":"2021-02-04T14:48:14","date_gmt":"2021-02-04T19:48:14","guid":{"rendered":"https:\/\/jbkuma.com\/workshoppe\/?p=1029"},"modified":"2021-02-04T14:50:32","modified_gmt":"2021-02-04T19:50:32","slug":"side-effects-of-neopixel-protocol-timing","status":"publish","type":"post","link":"https:\/\/jbkuma.com\/workshoppe\/1029\/side-effects-of-neopixel-protocol-timing\/","title":{"rendered":"Side Effects of NeoPixel Protocol Timing"},"content":{"rendered":"\n<p>I have a bunch of pi zeros that are no longer useful after I got them for a project that was supposed to go full open source, but to make a long story short, I&#8217;m just glad I only invested $20 in a few boards and not endless hours of my own time into the project.<\/p>\n\n\n\n<p>Anyway, I decided to use one to script some pixels for lighting my desk (which I first used in my livestream with Anthony last week).\u00a0 I was struggling to figure out why it was taking so long.\u00a0 Sure Python is slow as dirt, but still, just filling a solid array took a long time.\u00a0 I decided to try running it on a 3B+ and a 4 to see if what the difference would be.  For the 182 RGBW pixel array on my desk: 14ms just to fill it with a solid color and no other math at all.\u00a0 (10ms fastest time for just RGB)\u00a0 running on a Pi 4.\u00a0 (this took 50ms on the Zero and 20ms on a 3B+)<\/p>\n\n\n\n<p>Then I started thinking about the protocol.\u00a0 According to Adafruit, each RGB pixel takes 30us, plus 50us at the end of the array to signal the end of the update signal.\u00a0 That means for a 120 pixel blade the minimum possible time to send the update is 3.6 milliseconds.\u00a0 I also ran the numbers for the KR V1 strip, they require a whopping\u00a08ms just to fill the strip, my 1800 pixel board requires at least 54ms.\u00a0 To reiterate, that is the fastest theoretical time.\u00a0 My python script that only fills the array then prints the time takes 100ms to fill the 1800 RGB array with a solid color, the calculated time is 54ms.<\/p>\n\n\n\n<p>Depending on how everything is handled, that can have a pretty big impact on performance for the chip, the other logic required for your application, and even other peripherals.\u00a0 That number doesn&#8217;t include the math required to handle the animations or anything, just for the time to send the update.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a bunch of pi zeros that are no longer useful after I got them for a project that was supposed to go full open source, but to make a long story short, I&#8217;m just glad I only invested $20 in a few boards and not endless hours of my own time into the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1030,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[394],"tags":[315,312,405,406],"jetpack_featured_media_url":"https:\/\/jbkuma.com\/workshoppe\/wp-content\/uploads\/2021\/02\/pxeltiming.png","jetpack_shortlink":"https:\/\/wp.me\/p8hnad-gB","jetpack-related-posts":[{"id":307,"url":"https:\/\/jbkuma.com\/workshoppe\/307\/lsos1-5-2jb\/","url_meta":{"origin":1029,"position":0},"title":"LSOS 1.5.2jb Preview","date":"March 10, 2017","format":false,"excerpt":"https:\/\/youtu.be\/YYmetV5h9TE Latest tweaks to the LSOS 1.5 base code include: Quick mute Blade meter function for RGB LED, String Blade and Pixel Blade Battery meter Volume Meter Sound font color indicator & current font name on menu entry Demonstrated on my current work in progress which is a TCSS based\u2026","rel":"","context":"In &quot;Custom Electronics&quot;","img":{"alt_text":"","src":"https:\/\/i1.wp.com\/jbkuma.com\/workshoppe\/wp-content\/uploads\/2017\/03\/lsos152jb.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":483,"url":"https:\/\/jbkuma.com\/workshoppe\/483\/for-sale-pixel-blade-parts\/","url_meta":{"origin":1029,"position":1},"title":"For Sale: Pixel Blade Parts","date":"July 22, 2017","format":false,"excerpt":"By popular demand I've ordered a bunch of parts. Rather than put together predetermined kits like I have in the past, I'm offering these a la carte. The v2 Blade Adapater is a improvement over my original design. It's a base and two shells: The base holds the aviation plug,\u2026","rel":"","context":"In &quot;Lightsaber Kits &amp; Accessories&quot;","img":{"alt_text":"","src":"https:\/\/i1.wp.com\/jbkuma.com\/workshoppe\/wp-content\/uploads\/2017\/07\/dhUDGdk1.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":691,"url":"https:\/\/jbkuma.com\/workshoppe\/691\/burning-charge-saber-stand\/","url_meta":{"origin":1029,"position":2},"title":"Burning Charge Saber Stand","date":"August 18, 2018","format":false,"excerpt":"Saber display stand with app and home automation control.","rel":"","context":"In &quot;Lightsabers&quot;","img":{"alt_text":"","src":"https:\/\/i1.wp.com\/jbkuma.com\/workshoppe\/wp-content\/uploads\/2018\/08\/burningcharge2.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":642,"url":"https:\/\/jbkuma.com\/workshoppe\/642\/plan-b-the-gentleman\/","url_meta":{"origin":1029,"position":3},"title":"Plan B: The Gentleman","date":"May 4, 2018","format":false,"excerpt":"When plan A goes to to bantha dung, go to Plan B. Go to The Gentleman.","rel":"","context":"In &quot;Lightsabers&quot;","img":{"alt_text":"","src":"https:\/\/i1.wp.com\/jbkuma.com\/workshoppe\/wp-content\/uploads\/2018\/05\/ya2qutAh1.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":37,"url":"https:\/\/jbkuma.com\/workshoppe\/37\/lilbilly\/","url_meta":{"origin":1029,"position":4},"title":"Li'l Billy: A Yuleside Saber","date":"December 15, 2016","format":false,"excerpt":"Introducing Li'l Billy: A Yule Side Saber Li'l Billy is DIYino based lightsaber with a customized version of LSOS 1.3 I've dubbed DIYuletide.\u00a0 Custom effects include a candy cane striped neopixel blade with matching ignition and extinguish effects and sequentially triggered swing sounds to enable the playing of a tune.\u00a0\u2026","rel":"","context":"In &quot;Lightsabers&quot;","img":{"alt_text":"","src":"https:\/\/i1.wp.com\/jbkuma.com\/workshoppe\/wp-content\/uploads\/2016\/12\/yuleside.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":246,"url":"https:\/\/jbkuma.com\/workshoppe\/246\/wejack\/","url_meta":{"origin":1029,"position":5},"title":"Wejack - prototyping hilt","date":"January 15, 2017","format":false,"excerpt":"Wejack, Algonquian for the animal known in English as a fisher, is a prototyping and development hilt and a tribute to our recently depart princess Carrie Fisher.","rel":"","context":"In &quot;FX-SaberOS&quot;","img":{"alt_text":"","src":"https:\/\/i1.wp.com\/jbkuma.com\/workshoppe\/wp-content\/uploads\/2017\/01\/20170115_190715_HDR.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/posts\/1029"}],"collection":[{"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/comments?post=1029"}],"version-history":[{"count":2,"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/posts\/1029\/revisions"}],"predecessor-version":[{"id":1033,"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/posts\/1029\/revisions\/1033"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/media\/1030"}],"wp:attachment":[{"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/media?parent=1029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/categories?post=1029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jbkuma.com\/workshoppe\/wp-json\/wp\/v2\/tags?post=1029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}