Science and technology

Create a vacation gentle show along with your Raspberry Pi and ping pong balls

I like Christmas decorations and lights, and I’d been eager to do an programmable LED challenge for a very long time. Recently, I constructed a lightweight array made from LED lights, ping pong balls, and a Raspberry Pi Zero. I believed it was value sharing, as a result of it ended up being comparatively simple but additionally instructional.

It’s largely my very own design, with some inspiration from YouTube movies. You can discover the supply code and construct directions in my Git repository.

  • Raspberry Pi Zero
  • Pibow Case
  • 5v 2A USB energy provide
  • Poster body
  • 255 ping pong balls
  • Hot glue gun and LOTS of scorching glue sticks
  • Soldering iron
  • Solder
  • 22 AWG 0.35mm strong core wiring
  • 10 meters of WS2812(B) LED strip lights (30 pixels per meter)
  • Multimeter
  • Wire cutters
  • Wire strippers

Design the Raspberry Pi gentle show

My design was pushed by the scale of the poster body I occurred to have accessible. I acquired 30 pixel per meter tape from Ali Express, which reduce properly into 0.5m sections, in order that gave me 15 LEDs throughout. Ping pong balls are 40mm, so I measured and positioned the traces 40mm aside, with the LED Strip in the course of every 40mm part. This gave me 17 traces down in complete. My array was due to this fact 15×17. If you do that your self, yours generally is a completely different measurement.

To get energy to the array and the Raspberry Pi, I positioned the open connections for each information and energy on the backside of the board. I did not have that many LEDs needing energy, so I used to be in a position to make use of the 5v out GPIO from the Raspberry Pi Zero to energy them. I run them at 50% brightness, which is definitely brilliant sufficient to see within the day and at evening via my window.

Wiring

In my design, I began on the backside of the board and wired up in an S-curve. This made soldering simpler as a result of loops on the finish of every row did not should return all the way in which again to the beginning of every line. The WS2812 information traces do require you to wire the information the right approach: energy could be fed from both aspect of the strip, however information have to be fed from the aspect with the arrows pointing away.

My wiring appears to be like like this (that is abbreviated for readability, in actual life it is 17 traces deep):

<---------------
                |
/---------------/
|
---------------< # Pi linked right here

Build the show along with your Raspberry Pi

Once the design and wiring plan was sorted, it was time to get began on the construct.

I measured and drew my traces in pencil on the poster backboard. The WS2812 strips I acquired got here with sticky tape on the again, so I simply eliminated the backing and hooked up that on to the backboard. I used to be certain to place every strip in order that the information arrows went a technique, then again the opposite, to make sure that the lights may very well be daisy-chained accurately for the Pi’s directions.

Once all gentle strips have been hooked up, I reduce three comparable lengths of wire and linked the 5v, information, and floor traces from the top of every gentle part to the one above it.

(Brian McCafferty, CC BY-SA 4.0)

After finishing every row, I checked continuity between the 5v and floor traces between every strip to make sure my joins have been appropriate. I additionally checked that I had not by chance bridged any connections, so I verified that there was no continuity between the 5v and floor traces (in different phrases, a 5v wire on one line did not bridge to the bottom on the subsequent line.) I additionally ran some checks to make sure every thing was lighting up accurately (see the code part for my strand checks.)

Once this was full, I began to chop holes within the ping pong balls by stabbing scissors into the underside of them, and slicing a small gap for the LED to shine into. There was no precise science to this, and each was completely different, however the impact actually labored. I used to be working with 30 pixels per meter, so my lighting had about 30mm between every LED. A ping pong ball is 40mm throughout, however I wasn’t about to begin soldering every LED individually! First of all, I’m not that good at soldering (as my pictures present), and anyway, I believed “Well, they’re ping pong balls. I can just squash them together!”

And that is what I did.

I positioned a scorching glue blob round every LED after which positioned a ping pong ball onto the LED, held it for about 5 seconds, and moved on to the subsequent one. I held onto the earlier ping pong ball as I slid the subsequent one in, pushing it towards the primary earlier than “folding” it into its neighbor. The impact labored rather well. I used to be pleased with what it was wanting like immediately. It additionally had the great bonus of hiding my unhealthy soldering job 😉

(Brian McCafferty, CC BY-SA 4.0)

I continued doing this for 255 LEDs and ping pong balls. There have been a number of crushed ping pong balls within the course of, however ultimately, I acquired there.

(Brian McCafferty, CC BY-SA 4.0)

Test the code

For the check code to make sure that every thing was working, I used this Adafruit guide which lights every LED in purple, inexperienced, and blue, after which does a rainbow cycle. I used this once I was constructing to make sure my connections have been appropriate and that every thing was soldered accurately.

After that, I designed a grid in a spreadsheet to map every pixel to a grid place. This helped to make constructing the pictures simpler. Since my pixel numbers run in a zig-zag sample, it will have been onerous to maintain observe of every LED (e.g. LED A1 was 256 and B1 was 226). 

Once this was all set, it was time to design some pictures on paper and within the spreadsheet. Then it was time to code! It acquired a bit addictive and I began including some animation (utilizing loops and turning pixels onto one coloration after which one other coloration). 

The finish end result was every thing I’d hoped it will be.

(Brian McCafferty, CC BY-SA 4.0)

(Brian McCafferty, CC BY-SA 4.0)

(Brian McCafferty, CC BY-SA 4.0)

A Raspberry Pi gentle show all yr

I’m not certain this can ever be actually completed. Nearly each evening since it has been up within the window, I’ve added some new pictures and animations. I’m already enthusiastic about what to do for New Year’s Eve. I additionally will not be placing this again in storage with my Christmas decorations in January. I simply want to think about different issues to attract on it to make it a year-round challenge! A good friend of mine advised a pixel Mario and I like that concept!

My code additionally wants slightly work. For instance, I do some scrolling textual content, however I redraw the entire board for every place of the textual content, so it took fairly a little bit of time to do. I feel I can do one thing with loops, or maybe the picture library can assist scroll the letters simpler, and make it simpler so as to add textual content slightly than turning every pixel on and off at each step.

I’ve acquired a photograph report of my progress from begin to end: LED Ping Pong Wall.

You may see a video of it in motion right here: XMas light display.

I’m actually happy with how this turned out, and I feel it appears to be like wonderful. I’m very excited to strive another LED initiatives sooner or later. I encourage you to strive a lightweight array of your personal whilst your first challenge. It’s simpler than it appears to be like!

Most Popular

To Top