LED Beer Pong Table

^ That was with the old code, here is the new code that isn’t finished yet:

This page is incomplete, more info to be added soon…

If you see any errors on this page whether spelling, technical, or other please let me know in the comments. Thanks!

You can view the code on Github

Inspiration

The inspiration for this project comes from a post I saw on the Adafruit blog last April: https://blog.adafruit.com/2015/04/14/wicked-awesome-led-beer-pong-table-2-0-arttuesday/

Since I seem to really like glowy projects (see Finished Projects…) I was hooked by the table Jeff Nybo of Chexal Technologies had created and thought it would make a fun summer project while I was away from University.

As a quick note: The table created by Jeff Nybo of Chexal.com is licensed under a CC BY-NC-SA license and therefore this project is released under the same license. If you want to buy something like this I recommend buying it from Chexal.com as a kit or fully assembled. They have great instructions up on Instructables.

Some more inspiration was from Vicious Computers YouTube video of his table. I attach the acrylic to the table using his method.

I also used a lot of the information from the LED curtain Philip Burgess of Adafruit created.

Overview

This project ended up taking much longer than I was anticipating and had a lot of problems that took some time to figure out. For me I view this project as a learning experience instead of just a table to play beer pong on. If you just want a table to play on I would recommend saving a lot of money and buying a folding aluminum table from Amazon 😛

Things I learned about/improved on during this project:

  • Woodworking
  • Staining/finishing wood
  • 3D Printing
  • IR detectors
  • Using an Oscilloscope
  • Raspberry Pi
  • Programming in Processing with networking
  • Programming my first Windows Phone App

Hardware

The Physical Table

Image

One of the main differences between my table and Chexal’s is that mine can fold in half to make it a little easier to store. To start off the physical side I decided to make the table regulation size according to The World Series of Beer Pong: 8ft by 2ft. Who would’ve thought there’s a world series of beer pong?

Woodworking

Apparently I didn’t take many pictures during this part, but I hope it’s still easy to follow along.

WP_20150425_19_39_13_Pro

I started off by cutting some ¾” birch plywood down to two pieces that were 46.5” by 22.5”. These make up the top surface that everything will be mounted to. They are slightly under 4ft by 2ft to accommodate a 1×4 skirt around the plywood, excluding the skirt around the hinge area. Unfortunately, we don’t have a table saw so I just clamped some 1×4 to the plywood as a guide and used a circular saw to make the cuts.

WP_20150428_16_21_05_Pro

I bought the 1×4’s pre-cut from Rona so they would be easier to transport and so I wouldn’t completely screw up the measurements and cutting. That didn’t save me though and I still managed to screw up some of the measurements by a little bit…

Next up are the parts for the piano hinge to mount to. I’m not super happy with how I did this so if anyone has a suggestion on how to do this hinge area better next time, please let me know! I used some of the extra plywood from the last step to make some risers for the piano hinge.

IMG_3926

I used a router to make the channels for the LEDs (more on the LEDs later).

IMG_3910

To make my life easier I 3D printed some spacers so I wouldn’t have to measure each time.

IMG_3914

This step took quite a while, probably between 4-6 hours for both sides for a total of 30 channels. My router bit wasn’t quite wide enough so I had to tap the fence with a hammer to get another millimeter or two of width with another pass of the router.

WP_20150523_15_01_06_Pro

IMG_3908

I also used the router to make holes that the LEDs for each cup and its sensor would sit in. Again, I made a custom 3D printed router jig to make things much easier. My router has a plate on the bottom that can be unscrewed, so I took it off and replaced it with this:

IMG_3900

IMG_3920

The best way to show how this works is with a quick video:

[vid of router]

IMG_3916

[template for holes]

IMG_3918

IMG_3919

IMG_3924

IMG_3925

Wood Finishing

I originally wanted to stain the wood black and have some of the grain show through; I thought it would be kinda funny to have this classier looking piece of wood surrounded by obnoxious LEDs everywhere. I got through staining and decided to leave it at a nice dark brown. It was then sealed with some polyurethane.

IMG_3929

WP_20150524_15_27_10_Pro

I painted the 1×4 skirt in matte black paint that was left over from painting some trim in my parents house:

WP_20150525_14_56_33_Pro

The cutouts for the cups were painted white so they would reflect more of the light from the LEDs:

IMG_3947

Physical Assembly

The 1×4 skirt was attached with l-brackets and corner brackets. I had to use quite a few due to a lot of warping from the plywood.

IMG_3965

IMG_3963

IMG_3962

IMG_3961

As you can see, my measuring and cuttings skills are not perfect…

IMG_3969

The hinge risers were attached with L-brackets on the inside, screws going in from the outside of the 1×4’s and with screws from the top of the plywood going into them.

IMG_3978

IMG_3981

I also 3D printed some risers for my IR detector boards that detect if a cup is present.

IMG_3972

IMG_3973

IMG_3974

Installing the folding legs was a HUGE pain. The legs I bought from Lowes are the discount Chinese special coming in at a whopping $25 Canadian. Either they didn’t come with instructions or I misplaced them, but luckily there is a youtube video! Unfortunately, they were still very difficult for me to install. I had to practice installing them a few times to get the hang of it so that the legs would open smoothly and in the right direction.

Turns out they were too wide to even fit under the table, so time for some customization! I cut them with a chop saw to take off some of the width, got some help from my brother to weld them back together, and painted:

IMG_3953

IMG_3958

WP_20150531_14_20_52_Pro

IMG_3983

LEDs

IMG_3863

The leds I used are strips of WS2812b’s sometimes known as Neopixels. I bought them off of Aliexpress in 30 led/m to save a bit of money and since they are a lower pixel density less power is needed. These LEDs are individually controllable, meaning that each pixel in the strip can be a different colour. They use a single data line and can sometimes be tricky to control, so I’m using some Fadecandy boards made by Micah Elizabeth Scott to control them.

The Fadecandy board supports 8 strips of up to 64 leds in length. In this project I use two: one for the main grid in the center of the table, and another for all the leds under the cups. The main grid uses all of the output channels but the second one only uses two so more LEDs could be added if needed. With all of the LEDs on full brightness we could expect them to use about 170W.

Cup Detectors

Again taking inspiration from Chexal, the cup detectors use Reflective Photointerrupters, each connected to a microcontroller by using multiplexors. I decided to use some cheap surface mount sensors, which in the end would come back to haunt me. The sensing distance is around 1.2mm for the optimum, but the sensors are about 3mm away from the bottoms of the cups which means the sensor has to operate on the very edge of its spec. This means a (comparatively) small signal change indicates a cup. In the future I may switch the boards out for a sensor that has a sense range of 5mm which would work much more reliably. As of right now I have to do a lot of averaging and other things to the signal to try and detect the small change.

I got 21 small boards made at http://oshpark.com to mount some Sharp GP2S60 sensors on with a couple resistors. I accidentally used 0603 resistors instead of 0805 which made soldering a bit more difficult, in the next revision I will probably go up to 1210 resistors in case the leds in the photo interrupter need more current. You can see more on these detectors here.

From before, these detectors were mounted on 3D printed risers and glued in place with hot glue.

Control Electronics

What makes this thing tick…

Reading the cup detectors

IMG_4033

This part is pretty much directly copied from what Chexal did. Whenever a cup is placed on top of the detector the voltage on the output pin dips a little bit. An Adafruit Pro Trinket is wired up to 3 4051 mux chips. The detectors outputs are wired to the muxes and the Arduino reads all of the voltage levels of the detectors and sees if there is a cup present.

Raspberry Pi

The Raspberry Pi 2 is connected to the Arduino via UART serial via the GPIO header through a level shifter. The two Fadecandy boards are connected over USB. A wifi adapter is also connected over USB, with plans to add a USB DAC for a speaker to be plugged into in the future. The Pi is powered off of the same 5V power supply which is used by all of the other electronics.

Switch Board

IMG_4035

This is a simple board with 3 switches and a potentiometer. They are again connected to the Arduino so the Pi can worry about other things instead of polling buttons. The Arduino then sends out if a button was held or just tapped over serial to the Pi.

Power Delivery

IMG_4019

The whole table is powered by a 5V 200W MeanWell supply. With our LEDs having a theoretical max of 170W, that leaves lots of headroom for the Pi to run.

The power is distributed over 12 gauge ‘rails’ that are split off into 18 gauge wire to the strips. Every 60 LEDs more power is injected via those 18 gauge wires to prevent voltage sag. Each half of the main grid gets its own 12 gauge rail and the rest of the electronics are powered off of another 12 gauge wire for a total of three 12 gauge wires off of the MeanWell Supply. Each of these outputs is independently fused.

Software

The brains of the operation

Processing

Processing is a language based off of Java that makes it easier to code graphics. The Fadecandy boards also have a lot of example code that uses Processing, so that’s why I went with it.

One of the major problems I had when I was writing the code was that it wouldn’t run on the Pi! The Processing sketch had to be run on a separate computer and then the pixel data would be streamed to the Fadecandy server running on the Pi. This caused a bunch of lag if the wi-fi connection to the Pi was weak. However, Processing was updated not too long ago to support Arm processors! I could now run the sketch on the Pi with a bit of wrangling to get it to run without a monitor which you can read more about here.

I still haven’t been able to get Minim (the audio processing class) from Processing to work on the Pi yet, so no sound reactive modes until I get that fixed.

Ser2net

I use ser2net to link the serial port connected to the Arduino to a socket. This lets me receive the serial port data on another computer. Since I can get the button data through that socket I can run the Processing sketch on any computer and still be able to read the buttons and cup detectors.

Windows Phone App

I programmed the Processing sketch to be controlled over TCP messages, so I could eventually write a simple app or web page to remotely control the mode or colour of the table. I basically made the windows phone app by slightly modifying the sockets example.

Conclusion

So in the end was it worth it?

If it was just to have a table to play beer pong on then no, it isn’t worth it; you can get a folding table from Amazon for something like $60 which is way smaller and portable. The way I see this table as worth it is from all the stuff I learned about from making it. And all the LEDs. I really like LEDs :]

B.O.M

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s