Sunday, December 29, 2013

LED CUBE

I have been playing with many WS8211 RGB LED. Thanks to the Teensy3 which is programmed exactly like an Arduino and the OctoWS2811 library it is very easy to control strips of LEDs and display any kind of animation in realtime. Since Paul Stoffregen (maker of the Teensy, thanks again) and others have already built many wonderful projects with these LEDs I had to come-up with something a bit original.

Few month ago I decided to build a cube made of hand-built 8x8 LED panels (Adafruit did not sell their panels yet). I ordered from AliExpress 500 LEDs and spent a few evenings with my soldering iron, a bit repetitive task but its a hobby so I can't complain. A 5V 60W power supply was also purchased from the same vendor, the cube can use around 6 Amperes when fully white.
Note: I paid 0.12$ per LED at the time, now it seems the price almost doubled! 



Here is the cube almost finished. It was first assembled with hot glue which melt after 5 minutes of use! This think can get very hot. Everything is now assembled with transparent Silicon caulk, so far so good and it is easy to dismount for maintenance.

My first animation test was to play Space Invaders; the faces are animated like in the game. Each face is an array of 64 binary values, and there are eight arrays for the scrolling motion of each alien.

It's hard to evaluate on the picture but these LED are very bright, almost painful to watch, certainly too bright for kids eyes.

To reduce brightness and give a nice blurred effect I covered the faces with a white somehow opaque film supported by a simple frame. My idea was to give a Japanese lantern style of light. 



I decided to complete this project before Christmas, indeed the cube is a nice addition to the Christmas tree. A simple loop of random colors switches the lights every second, finally my kid was amazed... a little.



Programming the Cube 

Since my kid is a fan of Minecraft, I thought that he would be happy to paint cubes like in the game; so to make the device more interactive and interesting, my intent was to build a realtime "pixel paint" application for 3D objects. 

I coded a small application with Processing to represent the cube as a map. One can choose a color and just paint the faces. The LEDs are lighted in realtime, by Serial communication. I added a cheap bluetooth module for remote programming, et voila! 










Here is the code I wrote (in part) for this project. There is a Sketch for the Teensy 3, it needs the OctoWS8211 library. The sketch is a simple adaptation of an example given with the library.
The wiring of the Teensy 3 follows the recommendation to use a 74HCT245 to convert 3.3v signal to 5v for the LEDs and 100Ohm resistors close to each pin. 
The sketch for the Teensy 3 CubePaint.ino

Then the Processing project to send colors by Serial communication to the Teensy 3. The color wheel was copied from an example by Ira Greenberg This sketch shall work with any micro controller connected to Serial. Should be re-wrote with objects for clarity and easy update.
The Processing project CubeCross

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Nice idea to use heroes from Minecraft for design of led cube.
    I buy led cube for my club here!
    http://hannoufmediagroup.com

    ReplyDelete
  3. Thanks to share this post its all information is really very nice and useful for cords and adapters.

    Transfer Switch Power Cord

    ReplyDelete
  4. I am really impressed to this post because that's really helpful for electrical products.

    Welding Power Adapter

    ReplyDelete
  5. Wow, it looks really cool, need to get it for my room. From where I can get it? as I am sure I can't make it at home by myself.

    ReplyDelete