Coding In Color: Boston’s Light Blades Change Color via Twilio SMS

light-bladesThe Light Blades may resemble ships’ masts but they act much differently. The six gigantic steel structures, designed by artist Dennis Carmichael, overlook the Boston Harbor glowing different colors at night. Tourists and townies alike came to watch the display. Now, they’re doing more than just watch the sculptures change colors.

One engineer and a team of artists has put the Light Blades’ color display into the palm of your hand, quite literally. Thanks to engineer and Massachusetts native Brandon Stafford and New American Public Art, you can make the Light Blades change color via Twilio SMS.

The Launch

Just 60 seconds after the interactive feature launched, Light Blades received 300 text messages. A few days later, they had logged over 25,000 text messages. Word of mouth spread quickly. Despite receiving thousands of texts to display hundreds of different colors, Light Blades responded within one second from receiving a request.

Each night, more people showed up to text in their favorite color. A few users discovered how to unlock secret light shows by texting in “USA” or “RedSox.” One user even printed out Brandon’s open source code and brought it to Light Blades to try out different light shows.

The Code, The Brains, The Nitty Gritty

Let’s get to nuts and bolts what Brandon calls “the chain.”

Say you want to test Light Blades’ color palette and you text “crimson” to Light Blades’ Twilio powered number. The Twilio server then executes that request, and pushes it to the Rascal, a small Linux based open source computer. The Rascal parses through this code to search for the string “crimson” and interfaces with the RS232 Shield on the Rascal. The RS232 then commands the light player to display the color crimson.

Brandon’s Rascal, which he makes himself, allows him to host his own code editor and web framework based around CodeMirror and Flask. The backbone of his Light Blades feature is just 12 lines of code, included below. You can find the rest of the code, including the hundreds and hundreds of lines of color strings here. Brandon is currently working on new public hardware hacks with Rascal.

To check out Brandon’s original post on Light Blades visit his blog here, for more information on Rascal check out the website here.