Skip to content
Øyvind Berntsen edited this page Jan 16, 2017 · 15 revisions

Backstory

This was a project I did way back in 2014, and later programmed summer 2015. Since then pictures and videos of the bookshelf playing snake and tetris has gone viral a number of times. Finally I've taken the time to write up some words on how I made the thing, and made the simple code I wrote available to anyone interested. Sorry for the lack of descriptive pictures. I didn't anticipate there being so much interest in the project, so i neglected to document the process at the time.

It started with a delivery van from IKEA. Shipment from IKEA with medium girlfriend added for scale

The bookshelf

The bookshelf itself was made using IKEAs Expedit bookshelf series, now defunct and replaced by the Kallax series, which would work equally well. I used four 5x5 and two custom made 4x5 shelves and assembled them all to make one continuous bookshelf 14x10. Each "cell" measures about 30x30 cm, so the full bookshelf is about 3.8m heigh and 5m wide. I used a white bookshelf which works very well with the LEDs, as I only need three or four neopixels in each "cell" to make it light up completely.

The bookshelf running rainbow.js

LEDs

I used neopixel strips from Adafruit, like these: https://www.adafruit.com/products/2949

I chose to use white neopixel strips with maximum spacing between the LEDs (i.e. 30 LEDs pr. meter). This helps spread the light throughout each "cell". This setup worked even better than I had hoped. Each cell lights up nicely and the colour is very obvious. There is some bleed through of colour between cells, but very little.

Wiring

Wiring all the pixels together was by far the most time consuming exercise of this whole project, even considering time coding the games. Using only neopixel strips and no extra wiring would require an exorbitant amount of pixels, which would consume excessive power. Therefore I cut each neopixel strip into strips of four neopixels, one for each cell. Three would probably suffice, but I had bought some extra. I chose to use neopixel strips with only one signal pin, to minimise the amount of cabling. Still, there is about 30cm of wiring between each cell, three wires, pluss extra wiring when connecting each "column" to the Fadecandy controllers. All in all, I cut, stripped, soldered and shrinkwrapped about 80 meters of wiring.

I used 22awg solid core wiring, like this: https://www.adafruit.com/products/1311

It is essential to use wire that can handle a lot of current. I'll get back to that under the power heading. The problem with strong solid core wiring is that it makes the soldering even more of a hassle.

To minimise the amount of wire I needed, and reduce the complexity of mounting the neopixels in each cell, I chose to cable them in columns and mount the neopixels vertically, with double sided tape, inside their plastic protection. This means I have to power and signal 14 columns of 4x9 neopixels. Here is a picture of a strip of four pixels in a cell:

Once cell in the bookshelf

I've chosen to add neopixels to only the top nine rows, since I use the bottom row for storage boxes, which would hide the light anyway. The advantage is that these boxes also hide all the wiring going from each column to the Fadecandy controllers. Since I constructed the bookshelf first, then thought to add the neopixels later (not recommended), the wiring was a bit messy.

Powering

Each of the neopixels I used uses only about 60mA maximum (white) at 5V. Still, there are 500+ neopixels in total. This means that the whole grid can consume 30A+ at 5V. That's no joke! 30 amps is serious business. We're talking real chance of fire here, if you're not careful. To minimise the load on any one wire, I power each column separately. This means that no wire needs to take more than about 2A. Even this is a bit excessive, but during normal use, the actual amperage rarely goes above 1A, and is usually much less, since i never use full white and never 100% brightness. In fact I chose to limit the brightness to 80% in the Fadecandy server. This prevents me from using too much amperage by mistake. While running the rainbow.js gradual fade program, which is the most power intensive of these programs, the bookshelf uses less than 50W.

For power I use three separate 10A 5V switching DC power supplies, like these: https://www.adafruit.com/products/658

Again, use quality power supplies! I could use one 30A 5V DC power supply of course, but those are not easily available. Also the necessary wire to take 30A all at once would need to be huge. Much safer to use three separate 10A supplies. I distribute power to 5 or 4 columns from each power supply. The weak point in this setup is the distribution point where all the wires from each column meets the power supply. Make sure to use something that can handle the full 10 amps. A regular barrel adapter will rarely be rated to handle 10 amps.

Fadecandy and Raspberry Pi

I use two Fadecandy controllers to communicate with the neopixels, for convenience. This enables me to use Open Pixel Protocol and Javascript to program the pixels, and it also provides some other neat features. https://www.adafruit.com/products/1689

Take a look at the Fadecandy github project or this nice tutorial from Adafruit: https://learn.adafruit.com/1500-neopixel-led-curtain-with-raspberry-pi-fadecandy

I use two controllers even though one would suffice, since it makes it easier to wire each column separately.

A Raspberry Pi is used to control the two Fadecandy controllers. Any Raspberry Pi should do, but one with four USB ports will make things easier, since I use two ports for the controllers and one for the joystick.

There are a ton of ways in which you could program these neopixels. I chose one that seemed easy for me, but take a look at the excellent tutorials over at Adafruit to consider the options.

Programming

I chose to use Javascript because I had some experience with it, and it seemed convenient. Tetris ended up looking like this:

Tetris played on the bookshelf

Both bookworm (snake clone) and the Tetris clone work nicely even on the relatively tiny grid, and are quite playable. I chose to use a wireless Xbox360 controller, but there are tons of options.

Extra credit

I've connected the three DC power supplies to a computer controlled relay (D-Link DSP-W215) and I use a PIR sensor and IFTTTs Maker channel web hooks to switch the bookshelf off automatically after about 30 minutes of inactivity in the living room. This way I don't have to remember to turn the bookshelf off when I leave the house and so on. At this point the bookshelf has been lit up every day for over two years, but I still don't like to leave it on when I'm not home.

Clone this wiki locally