{"id":1308,"date":"2012-08-20T05:37:20","date_gmt":"2012-08-20T05:37:20","guid":{"rendered":"http:\/\/funkboxing.com\/wordpress\/?p=1308"},"modified":"2021-01-03T18:08:26","modified_gmt":"2021-01-03T18:08:26","slug":"blender-arduino-led-control","status":"publish","type":"post","link":"http:\/\/funkboxing.com\/wordpress\/?p=1308","title":{"rendered":"Blender Arduino LED Control"},"content":{"rendered":"<p><a href=\"http:\/\/funkboxing.com\/wordpress\/wp-content\/uploads\/2012\/08\/2012-08-20_00-54-59_8442.jpg\"><img decoding=\"async\" loading=\"lazy\" title=\"2012-08-20_00-54-59_8442\" src=\"http:\/\/funkboxing.com\/wordpress\/wp-content\/uploads\/2012\/08\/2012-08-20_00-54-59_8442-300x243.jpg\" alt=\"\" width=\"380\" height=\"300\" \/><\/a><iframe loading=\"lazy\" src=\"http:\/\/www.youtube.com\/embed\/KXJB1St-L50\" frameborder=\"0\" width=\"420\" height=\"315\"><\/iframe><\/p>\n<p>I guess I&#8217;ve been using Blender for so much for so long that I tend to look for &#8216;Blender-like&#8217; controls in a\/v projects. So inevitably when I started working with LED strips I immediately tried to weasel out of having to think through functions and loops in arduino code to create effects I could do intuitively in Blender.<\/p>\n<p>So after a few bad UI attempts I thought &#8211; hey, wish I could just design a light sequence in Blender and run it with ALT-A. So that&#8217;s what I did.<\/p>\n<p>On the arduino side it&#8217;s using the FastSPI and CmdMessenger libraries for LED and serial communications.<\/p>\n<p>The Blender script just reads the diffuse color in r-g-b from each LED objects material and spits it out to the USB port. Getting the pyserial library hooked up in Blender wasn&#8217;t a breeze but the &#8220;sys.path.append&#8221; line should help anyone having the same issues I did.<\/p>\n<p>Here&#8217;s the <a title=\"BlenderArduinoLEDControl\" href=\"http:\/\/funkboxing.com\/wordpress\/wp-content\/_postfiles\/BlenderArduinoLEDControl.tar.gz\">arduino code and Blender file<\/a><\/p>\n<p>(Using Arduino Duemilanove 328 and LED strip with WS2801 chips)<\/p>\n<p>EDIT:<\/p>\n<p><a title=\"Blendernation article\" href=\"http:\/\/www.blendernation.com\/2012\/08\/21\/blender-arduino-led-control\/\">Blendernation article<\/a> (Thanks Bart!)<\/p>\n<p>I forgot to mention I&#8217;m using Ubuntu so the sys.path.append thing wont work for windows, you&#8217;ll have to find the pyserial library solution elsewhere (there&#8217;s plenty of reference out there)<\/p>\n<p>Also &#8211; the script runs on each frame change. Here&#8217;s how that works (WARNING: kinda hacky) <a href=\"http:\/\/funkboxing.com\/wordpress\/?p=236\">http:\/\/funkboxing.com\/wordpress\/?p=236<\/a><\/p>\n<p>QUESTION: For any API guru&#8217;s out there &#8211; currently this script opens and closes the serial port on each framechange. I know this is radically inefficient. Any ideas on how to keep the serial port open persistently but to close it when blender closes?<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I guess I&#8217;ve been using Blender for so much for so long that I tend to look for &#8216;Blender-like&#8217; controls in a\/v projects. So inevitably when I started working with LED strips I immediately tried to weasel out of having to think through functions and loops in arduino code to create effects I could do <a href='http:\/\/funkboxing.com\/wordpress\/?p=1308' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,5,53,47],"tags":[],"_links":{"self":[{"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1308"}],"collection":[{"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1308"}],"version-history":[{"count":11,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1308\/revisions"}],"predecessor-version":[{"id":1614,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1308\/revisions\/1614"}],"wp:attachment":[{"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1308"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}