Introduction: Interactive LED Beer Pong Table 2.0 (BPT X5)
Due to popular demand, I have created a new and improved version of my original Interactive LED Beer Pong Table!
These tables are one-of-a-kind projects that are quite rewarding to create! The original table won the grand prize in the FSL Contest here on Instructables, it won a second place prize in the Radioshack Sensors Contest and it's appeared on Discovery Channel's Daily Planet show. On top of that, it's been featured on numerous websites and has over 200000 views on Instructables.
Since I posted the write-up for the first table, I have had many requests to create a new version which would be able to withstand shipping, or at the very least, offer a kit so that other users could build their own table. This write-up is for the new version of the beer pong table and contains all of the steps to assemble your own, whether you do it completely from scratch or with a kit from my website, Chexal Technologies.
So strap in and lets get to making the coolest beer pong table that the world has ever seen!
CBC did a short segment of this beer pong table and it's garnered 29Million+ views on Facebook.
Check out the video here: https://www.facebook.com/cbcnews/videos/101532663...
Step 1: Intro: Gallery & Downloadable Files
The nice thing about building one of these tables from a kit is that the more difficult parts of the project have been completed (Electronic Design, PCBs made, etc.) but more importantly, you can fully customize the table to your liking. The photos that I posted above are of the version that I created, but you can completely change the layout of your table. Add more LEDs to the unused PWM channels, maybe you'll switch out the LED rings for small LED signs/logos, completely omit the LED grid and just add LED strips, etc etc. There are a lot of extra PWM channels that aren't aren't in use on the master PCB and can be put to use!
If you do plan to swap out certain LED modules (like the LED rings), you must take care not to exceed the maximum ratings of the transistors that are driving those devices. This is all listed in detail later in the Instructable. For now, just take a moment to come up with a new layout for the wickedest beer pong table this world has ever seen. Once you're done that, continue through the Instructable and assemble it!
The source code, CAD files, schematics and bill of materials are all included in the downloadable zip file in this step.
Step 2: Preparation: Project Overview
Version 2.0 of the beer pong table has many added features that the original table never had. On top of that, this Instructable will show how to build a 2'x8' table instead of the 3'x8' size of the first table (I did this as I wanted to create a table with a smaller footprint. I.e. less space needed for it and cheaper to ship). You will also notice that the PCBs and wiring is completely encased inside of the table, whereas the other table just had an open bottom.
This new table has 1122 total LEDs on it, it is capable of controlling up to 608 individual channels (96 of which are capable of 16-bit PWM), it only has one master PCB and the 20 RGB pod PCBs, it can read and write to an SD card, it has a 16x2 LCD display, an IR receiver built into the table so that it can be controlled with a remote, a breakout connector for VU meter capabilities, a bluetooth module and a couple more features. The breakdown of the features are listed below.
In the center of the table we can create any animation that will fit into a 32x12 pixel grid. We are able to display scrolling text across it, watch a pong animation, display a sine wave, display the score of the game, etc. There is a huge amount of possibilities! Since we are able to detect when a cup is removed from the table we can make specific animations that trigger exactly when that happens. We'll get more in-depth with that later. The table actually supports a maximum display size of 32x16, however I have made it only 32x12 to span further across the table.
20x RGB Pods w/ Infrared Sensors
At each end of the table you will see 10 pods. The 16oz cups that are used for beer pong are placed over top of these pods. Each pod contains 6 RGB LEDs and 1 infrared sensor and we are able to light up the pods with any color that we would like. The infrared sensor will detect whether or not a cup is over top of the pod, so if a cup is removed we can change the color of the pod, begin an animation on the LED grid, run an animation on the RGB pods, etc.
There is an air bath on each side of the table. The purpose of the air bathes are to blow any debris off of the ping pong balls, thus cleaning them. When a player drops a ball to their left into the "IN" hole of the air bath, it detects the ball and starts a fan. This fan will move the ball down a pipe, removing debris and blowing it out the "OUT" hole to the right of the player. The player then grabs the ball and the air bath shuts off. Players can also dunk the ping pong balls in a cup of water before putting them into the air bath to get a better clean.
There are a total of 12 LED rings on the beer pong table. The outer edges of the table contain 4 LED rings each and the air baths make up the other 4. Much like the 32x12 LED grid, the LED rings are just used for animations. They can be set to go in accordance with music (VU Meter feature must be turned on), fade in and out, flash rapidly or any other cool animation that you can think of. Beer cups can be set inside of the LED rings on the railing which provides a cool effect on the upper lip of the cup. This table can support up to 16 LED rings on the specified PWM channels and the LED rings can be swapped out for many other LED circuits, such as small LED logos.
A user can add a VU meter module to the master PCB and set up the table to dance to different frequencies in the music around it. One can use the AUX input to feed the audio directly into the microcontroller or opt to use the built-in microphone to detect audio around it. The VU Meter can be set up to activate any LED lights to any of the 7 available frequencies that the microcontroller can detect. This is a really neat feature and the animation possibilities with it are endless.
This beer pong table contains a bluetooth module which allows it to communicate wirelessly with PCs or mobile devices. This is still in the alpha stage, but in the future it will allow the beer pong tables firmware to be updated wirelessly. This is a huge plus as it allows even greater hackability for users. On top of that, we can use it to send the score of the game or control individual features on the table.
"Why would a beer pong table ever need an SD card", you ask? It's simple. I want users to be able to design animations on their PC with custom built software, save it to a file, load that file onto an SD card then insert it into the table where they can display their own custom animations! More than anything, this is storage space for custom user animation files. I plan to make it so that the SD card doesn't need to be pulled out of the table and that files can be copied to it over the bluetooth link from a PC. This feature is also in an alpha stage.
We have so many lights on top of the table, why not put some on the bottom too! This table has three dedicated 16-bit PWM channels solely for the use of RGB underlighting. I mean, with all of the other lights in the room, we may as well change the color of the floor too.
16x2 LCD Display
A small 16x2 LCD display has been added to the new table so that we have a quick way of changing table settings, viewing score or accessing menu options.
IR Receiver w/ Remote
Sometimes it is just too much of a hassle to control the table over bluetooth with a PC or mobile device and we want a faster way to do it. Enter the 24 button infrared remote. Want to display a different animation? Dim the brightness of the RGB pods? No problem, grab the remote and do it instantly. You can also use the 16x2 LCD display to change menu settings in conjunction with the remote.
The master PCB does contain an EEPROM chip which has not been implemented quite yet (I still have to write the code for it). This chip is used to save any user settings between power cycles and may hold the button codes for future IR remotes.
Extra PWM Channels
Now if all of the LED features listed above aren't enough and you yearn for more lights, you're in luck. With a small breakout PCB, you can control up to twelve more 16-bit PWM channels. That means more fading animations, more LEDs and more excitement! In all reality, you may be hard-pressed to find enough room on the table for all of the LED features! ;)
Step 3: Preparation: Fully Assembled Kit Walkthrough
This kit contains all of the electronic components that the "Unassembled Kit" contains and has them already soldered on the PCBs. The LED grid does not come pre-assembled seeing as it has to be built into the table itself, but all of the LEDs and wiring for it are included in this kit and can be assembled when the table is built.
All of the PCBs are fully operational and tested before being shipped out and the microcontroller is pre-programmed with the bootloader so that the firmware can be updated over bluetooth. All of the connectors and wiring harnesses are assembled and have been tested with their respective parts. With this kit you don't need a lot of technical know-how as it is pretty much plug and play except for the LED grid which has to be soldered together. If you can wield a soldering iron to make the LED grid and have the skills to build the table, this kit might be a good choice for you.
Step 4: Preparation: Unassembled Kit Walkthrough
This kit contains all of the parts that are included in the "PCB Only" kit as well as all of the electronic parts and components needed to assemble the PCBs and LED features. As the name of the kit states, the PCBs and connectors come unassembled and have to be put together by the backer. This kit requires advanced soldering skills for the various types of SMD components that have to be populated on the PCBs. You will also need a PIC programmer to get the initial bootloader programmed into the microcontroller, after that initial programming, you can then program over bluetooth.
Each component has to be soldered onto each PCB, meaning that this kit requires good soldering skills and a decent soldering iron. There are some really small SMD parts that only have 0.28mm between pins, so you need a steady hand. I do provide video instructions later in the Instructable that shows how to solder some of these small components.
Step 5: Preparation: PCB Only Kit Walkthrough
This kit comes with all of the PCBs that are required to create your own Interactive LED Beer Pong Table. It contains 1x Master PCB, 20x RGB pods, 1x 50-Pin Breakout Header for the LED grid and 1x LCD Display Breakout PCB which makes it easier to connect up the LCD to the X5 board. It also includes an IR remote along with the custom air bath motor mounts and sensor brackets.
This is the most advanced kit, as none of the electronic components are included in this kit and they have to be purchased separately. The bill of materials and other information for this kit can be downloaded from the main zip file in step #1.
Each component has to be soldered onto each PCB, meaning that this kit requires good soldering skills and a decent soldering iron. There are some really small SMD parts that only have 0.28mm between pins, so you need a steady hand. I do provide video instructions later in the Instructable that shows how to solder some of these small components.
Step 6: Preparation: Skills and Software Required
If you look at this project as a whole it may seem very intimidating. The trick is to break each part down into 'mini' projects and integrate them together. You don't build the whole project, wire everything together and then turn it on hoping that it will all work because chances are that it won't. Instead, we take baby steps and separate the project into smaller sub-projects, testing the workings of each sub-project before moving on to the next one. By doing it this way you can work out any issues one at a time as you progress.
If you plan to use a fully assembled kit where you only have to do minimal soldering (LED grid), hook up the RGB pods to the main PCB and if you are using a table that you purchased from somewhere, you will only need the following skills to be able to build your own table:
- Basic soldering skills (soldering a wire to an LED)
- Ability to operate power tools (Mostly a drill to secure parts to the table)
- Ability to follow basic instructions
If you plan to use a PCB Only kit or a kit where you have to assemble the PCBs/connectors and you're building your own table, you should possess the following skills:
- Advanced soldering skills (SMD parts)
- Ability to operate power tools (Drill, table saw, mitre saw, jigsaw, etc.)
- Ability to program PIC microcontrollers
- How to crimp ends and create cables (Molex, RJ45 and IDC connectors)
- Ability to follow instructions
Basic understanding of C Programming & digital electronics (not absolutely needed, but will help)
If you order a PCB only or an unassembled kit and are bad at soldering, you may want to get
somebody who is good at it to help you. Some parts only have a 0.28mm space between pins.
All of the software for the beer pong table has been written in C. You will need to download the MPLAB IDE and install it, as well as the C30 or XC16 compiler to go with it. This project has been set up with the free versions of those compilers and either compiler will work. The XC16 compiler is the newer one of the two and is the one that I use. The MPLAB IDE can be downloaded here, while the XC16 compiler can be downloaded here. You can see a large portion of Microchips software downloads here.
Step 7: Preparation: Electronic Components
There are 21 PCBs that are required to create this project. Now, 20 of those PCBs are actually single RGB Pods that are placed under the cups (10 on each side). The other PCB is the main control board and is the brains of the operation. There is also a small 50-pin breakout PCB that is included with each kit. That PCB is used when creating the LED grid and connects the LED grid to the main PCB (more instructions on that later).
I have added a component list for each of the PCBs, as well as a list for the cables/connectors. The majority of these components can be found on eBay but there are a select few which may prove more difficult to find. I have added a BOM to the zip file in step #1 which has each component, the required quantity, the price and the vendor where the component(s) can be purchased.
Step 8: Preparation: Required Materials
Now we need to acquire the materials that go along with the electronics. Here is a list of the materials needed to complete this project. Where I'm from, stock measurements on materials are still in imperial units so I do switch back and forth between metric and imperial units in this instructable. When I cut the material for the table I use imperial units, when I am modifying the table and drilling holes I use metric (as you will see on my CAD drawings).
I bought all of my plywood from Home Depot and had them do the large cuts for me for $1 per cut. Use a combination of a table saw and a mitre saw to cut the rest of the pieces down to the sizes that you need if you choose to do it yourself. As for the acrylic sheet, just find a local plastics supplier and get a quote from them. My 24"x96"x1/8" acrylic sheet cost me $60, which was $23 cheaper than the Lexan sheet that I put on my original table.
Step 9: Preparation: Tools Needed
We're almost ready to start building! The last thing that we need to do is gather up some tools. If you don't feel comfortable using a table saw, talk to a local carpenter and have them cut the wooden rail pieces for you. They are really basic cuts so I would imagine that it would be a relatively cheap price. Below is a list of tools that we will use to construct the table and the PCBs (if you are not building your own table, you will not need the majority of these tools).
- Table Saw
- Mitre Saw
- Hole Saw
- Soldering Iron
- #2 Robertson Screwdriver
- #1 Robertson Screwdriver
- Wire Cutters
- Wire Strippers
- Molex Crimpers
- IDC Crimpers
- RJ45 Crimpers
- Glue Gun
- Rotary Tool
- Router (Optional)
Those are the tools that I had used to complete this project. You may be able to get away without some of the tools there, but it gives you a rough idea of what kind of work is involved.
Step 10: Construction: Assembling the Master PCB
Doesn't Apply To
Fully Assembled Kit (This step is already done for you)
Before we begin constructing the physical table, lets get the electronic aspect of this project in order. There are a total of 163 parts that need to be soldered onto the Master PCB, 661 SMD pads that need to be soldered and 355 through-hole pads. It may seem daunting, but just remember, you only have to do this once! Even if it takes you three hours to complete, it's a one time deal.
The biggest caveats on this PCB are the small SMD components. In particular, the PIC, the two TLC5955's,the 74LVC2G125DCUR and the twelve 0603 network resistors. You will need to perform one extra step for the TLC5955's in order to solder the heatsink pads underneath them to the PCBs. The best way to explain how to do it is with a video, so watch away!
I do have a reflow station on hand and that is what I use, but I wanted to show in the video that it can be done with a heat gun or a hairdryer for those who don't have reflow stations (It can also be soldered by heating up the thermal vias with a soldering iron. See the last two photos in this step). As for soldering the 64-pin PIC microcontroller, that's even easier than the TLC5955's. The soldering process of the video below has been sped up 2x but you'll get the idea. Lots of flux, a small soldering iron tip and thin soldering wire are pretty crucial though.
The schematics, bill of materials and the parts list are all located in the zip file in step #1.
Step 11: Construction: Assembling the RGB Pods
Doesn't Apply To
Fully Assembled Kit (This step is already done for you)
The RGB pods are quite simple to assemble, whether you assemble them with the reflow method or by hand soldering, they aren't difficult. There are twenty of them to do though, so it may take you an hour or two. The PCBs that I have used in the photos above were the first production run of the new RGB pods, I have since changed the PCB color of the RGB pods to black which you can see in the last few photos.
Parts List For All 20 Pods
- 120x - RGB 5050 SMD LEDs
- 100x - 270Ω SMD 0805 Resistors
- 60x - MMBT2907A Transistors
- 40x - 330 SMD 0805 Resistors
- 20x - 18k SMD 0805 Resistors
- 20x - TCRT5000 IR Sensors
- 20x - IDC 2x4 Shrouded Headers
There are a total of 19 components per RGB pod, 17 of those components being surface mount packages. They are quite simple to assemble whether you use the reflow method or do each pod by hand. The reflow method is really only necessary if you are assembling a large amount of RGB pods or have access to cheap solder stencils. After you're done assembling the RGB pods, we'll start on the IDC cables to connect them up to the Master PCB!
Step 12: Construction: Assembling the 2x4 IDC Cables
PCB Only Kit
Doesn't Apply To
Fully Assembled Kit (This step is already done for you)
Now that we have the PCBs assembled, we need to assemble the cables to connect the RGB pods to the Master PCB. When I designed this kit, I specifically decided to use 2x4 IDC cables because of the simplicity to crimp the connectors to the cable. With these cables, we can crimp all 8 connections in the connector at once, instead of doing it one by one for each wire like many other connectors. This saves an enormous amount of time as there are 40 connectors that need to be crimped for all 20 RGB pods.
The crimping tool that I use for my IDC connectors can be bought here on eBay for around $20. If you don't want to buy the proper tool, one can get away with using a pair of vice grips or an actual vice itself to crimp the connector to the cable.
Crimping IDC Connectors
- Get all three parts of the connector. Piece #1 is the main connector with the crimp tabs sticking out of it, piece #2 is the middle part with grooves on the inside to hold the ribbon cable in place and piece #3 is the strain relief.
- Sandwich the 8P ribbon cable between piece #1 and piece #2. Take note of which wire is connected to pin #1 on the connector (Pin #1 is denoted by an arrow on top of the connector).
- Once the cable is lined up between the two pieces, insert the connector into your crimping tool and apply steady pressure to the connector until the two pieces snap together.
- Fold the cable down the back of the connector, pulling it tight.
- Insert piece #3 into piece #2 and snap them together with your thumb. This will create a strain relief for the connector.
- Now repeat the exact same process for the connector on the other end of the cable, making sure that pin #1 connects to the same wire on each connector.
Step 13: Construction: Assembling the LED Rings
PCB Only Kit
Doesn't Apply To
Fully Assembled Kit (This step is already done for you)
We're going to make the LED rings right now as we need to use them in the next few steps (for the layout of the table). First, cut out a 71mm diameter wooden cutout for each LED ring that you will be installing on the edge of the table (not counting the ball washers). For this table that number is eight.
Now grab your 24 LED strip and go to the end of it where the wire is sticking out. Remove a small piece of silicone just below the wire and route the wire through that channel so that it is sticking out the bottom of the strip. Form the LED strip around one of the wooden cut-outs and tighten a zip-tie around it, creating a LED ring.
If you don't like the look of the ring with a zip-tie around it (even though it will be hidden under a diffuser on the finished table), put superglue on each end of the strip and form it into a ring (use a heatgun or hair-dryer if it gives you trouble forming it. Heating up the silicone allows it to form easier). Once it dries in place, fit it over top of one of the wooden cutouts and glue the underside of the LED ring to the cutout, ensuring that they are one piece right now. Whichever option you choose to do, repeat it for the other 7 LED rings.
I sprayed a diffuser over top of each of my LED rings, but that may not be needed as I decided to put a diffuser over top of the whole table anyways. So it's completely optional.
For the ball washer LED rings, cut off 3 LEDs from the end of each strip. There are 4 LED rings which are used with the ball washers. The LEDs in the LED strips are wired in threes, if you cut off just one LED then the other two LEDs that are wired in series with it won't work anyways.
Don't add a wood cutout to each ball washer LED ring as they will be fitting around a small piece of ABS pipe used with the ball washer. Just set them to side once you have them made.
Step 14: Construction: Building the Table
If you are just going to modify a table that you purchased somewhere else, you can skip these instructions. These are just the instructions for how I built my table, one could actually just buy a plastic table from Wal-Mart and modify that to suit their needs.
I don't have a lot of pictures showing my table build so I will resort to using my Sketchup CAD drawings to better explain how the table goes together. The Sketchup drawing does not show where each screw hole is, but I'm going to assume that if you're building this table that you can handle that (otherwise just ask and I'll draw up a quick sketch!). Make sure to drill pilot holes before threading in each screw or you will probably end up cracking the wood! I used a 1/8" drill bit for a pilot hole with #8 1.5" Robertson screws.
It's a pretty basic table, the overall size of it will come out to 24"x96"x4" without the legs, railing and acrylic sheet. Here is a list of the following parts that are needed:
Parts (Imperial Measurements)
- 2x - 24"x96"x1/2" Pieces of plywood
- 2x - 3"x96"x1/2" Pieces of plywood
- 5x - 3"x23"x1/2" Pieces of plywood
- 1x - 72" Hinge
Parts (Metric Measurements)
- 2x - 609.6mm x 2438.4mm x 12.7mm Pieces of plywood
- 2x - 76.2mm x 2438.4mm x 12.7mm Pieces of plywood
- 5x - 76.2mm x 584.2mm x 12.7mm Pieces of plywood
- 1x - 1828mm Hinge
Following the photos above, attach all 4 sides to the 24"x96" bottom base of the plywood.Secure each piece with multiple screws from the bottom of the table up into each side piece of the table. Make sure to drill pilot holes or you will crack the side pieces. After drilling the pilot hole and before putting the screw in, use a countersink bit (or just a large drill bit) and countersink the hole so that the head of the screw is not sticking above the surface of the wood.
Now add the braces. Take the remaining three 3"x23"x1/2" pieces and put three 1" holes into each brace. We will use these holes for routing the cabling. Install these braces inside of the table at 609.6mm intervals from end to end. Put a strip of weatherproof tape on each piece of wood that makes up the top of the base.
Once you've got the base of the table built, you need to attach the 72" long hinge across the top and bottom of the table. I recommend drilling out the ball washer holes on the lid prior to installing the hinge but it can be done either way. Measure 12" in from one end of the table, line up the hinge with the lid and base of the table, drill a pilot hole for each screw and then thread each screw in and secure the hinge. Once the hinge is on, open the lid up to a point just before it is perpendicular to the base, then secure a strong piece of wire (I used silicone tubing so that it has give) between the base of the table and the lid. This ensures that the table lid won't over extend and fall to the other side, possibly causing damage.
I plan to swap out the hinge with some cupboard like hinges that will be hidden on the inside of the table and still allow it to open up. This hinge is an eyesore but it gets the job done for now.
Step 15: Construction: Adding the Supports
Parts (Imperial Measurements)
- 2x - 1"x96"x½" Plywood Pieces
- 2x - 1"x22"x½" Plywood Pieces
- 4x - 1"x19¾"x½" Plywood Pieces (These have to be angled)
Parts (Metric Measurements)
- 2x - 25.4mm x 2438.4mm x 12.7mm Plywood Pieces
- 2x - 25.4mm x 558.8mm x 12.7mm Plywood Pieces
- 4x - 25.4mm x 492mm x 12.7mm Plywood Pieces (These have to be angled)
In this step we will be adding supports for the acrylic sheet. This ensures that the sheet does not bend or bow on the table. We also have to cut out four notches on each side rail to accommodate the size of the LED rings. The photos above are pretty much crucial to this step and will explain how to do this much better than I can through text. Use the CAD drawings above and measure out four LED rings, marking all four spots on one side of the table.
Attach the rail to the table (temporarily) and then take one LED ring and go over top of each location. Trace around the portion of the ring that intersects with the rail with a pencil. Do this for all four LEDs on the rail and then take the rail over to your drill press. Use an 89mm (3.5") hole saw bit in the drill and line the notches of the rail up with the bit. Put a piece of scrap wood underneath the rail and clamp the rail to it once the first notch is lined up. Proceed to cut out the notch. Do this for the other three notches on the rail, taking care to keep the rail supported as it will get weaker with each notch cut out.
To save time on the second rail, take the one you just completed and set it on top of the uncompleted rail. Line them up together, clamp them together and trace each notch onto unfinished piece. Then repeat the process at the drill press to cut out the rest of the notches on the second piece. Once finished, attach each side rail and end rail to the table. Install each LED ring, drilling a small hole to fit the connector and wire underneath the lid. Now we just have to finish the supports on the inside of the table.
Use the CAD drawing above and cut out four pieces for the RGB pod supports. If you are painting your table, now is a good time to paint the supports. Measure in 17.51mm from one egde of the table, put the support in place, then put the mirrored support up against it. Measure the mirrored support to the edge and ensure that it is centered. Secure each support to the table and countersink each hole. I ended up adding these supports when I finished my table which you will see in the photos above.
Step 16: Construction: Creating the LED Grid
PCB Only Kit
Fully Assembled Kit (This is the only electronic assembly required from this kit as it has to be built into the table)
I will be updating this step with more information soon. I provide many options to lay out the LED grid but I will cut down on some of the photos and make things more clear.
I have added a 3rd option in regards to wiring up the LED grid. It is similar to option #1 where you have to mount each LED into the tables lid but it also utilizes the capabilities of a router. Instead of spending a ton of time wire wrapping each LED lead, you can just cut out straight tracks in a grid-like formation and lay copper tape in each track. The row tracks are cut deeper into the table than the column tracks, allowing us to separate the copper tape from each column/row intersection and prevent shorting. I found this to be the fastest way for me to create this painstaking LED grid. Use the last of the photos to get a clearer understanding of option #3.
Wiring Up the LED Grid
In my opinion, this is the most tedious part of the table. The 32x12 LED grid consists of 384 LEDs (the circuit can control up to a 32x16 LED grid actually) that can be individually controlled. It is, arguably, the coolest feature of the table but also the most boring to build.
In this step, I will show three options to build the LED grid. The first option requires drilling a hole into the table for each LED, setting it into the table and gluing it in place. Then underneath the lid of the table, we have to solder each row and column connection for each LED. We then finish off the grid by connecting the grid to the 50-pin breakout PCB so that it can be interfaced with the master PCB. This is by far the cheapest way to do in terms of parts, as it costs less than $15 worth of LEDs and wire to create. However, it will take you a few hours to complete (less time than option #2 though).
The second option is what I chose to use with this particular table. This step is similar to the first option except we create a jig to hold the LED grid instead of actually attaching the LEDs to the table. We then wire up the whole grid in the jig, attach the connector and then pour liquid silicone around the connections to completely encase the wiring of the LED grid. This allows us to be able to remove the LED grid from the table or fold up the LED grid so that it has a smaller footprint and can be shipped easier. This way is more expensive and more difficult as one has to purchase the liquid silicone from a supplier (I found mine on AliExpress), have the required equipment to degas the silicone and then spend the extra time prepping and pouring the silicone. I used about 3Kg of liquid silicone which comes out to $60 with shipping included. This option can be done for around $70 and it makes the LED grid portable and shock-resistant.
In this step I will explain how to do the second option but if you choose to use the first option, just copy the following instructions except instead of mounting your LEDs in a jig, drill out the grid on the lid of your table and superglue or hot-glue the LEDs in place on the lid. Then flip the table over and do the exact same wiring as I explain in this step. Complete the wiring and connector and then you're done. You obviously will stop short of pouring any silicone.
You need the following pieces to make the jig:
- 2x - 1116.67x25x12.7mm Pieces of plywood
- 2x - 163.5x25x12.7mm Pieces of plywood
- 1x - 400x25x12.7mm Piece of plywood
- 1x - 1116.67x400x12.7mm Piece of plywood
Pick one corner of the bottom piece of plywood and measure in 41.67mm from each side. Mark the location and then measure straight across from that mark 33.33mm and make another mark. Keep going at 33.33mm intervals for the rest of the 30 columns. Repeat the same process for the rows and you'll have your grid drawn out. Take a 5mm drill bit and make a hole for each LED in the jig. Take each 25mm border and arrange them flush along the outer edge of the jig. One end will have a space in the middle for the 50-pin PCB connector. The jig is now made.
Next, place the first column of LEDs in the jig and take care to ensure that they are all placed in the jig with the same orientation. Bend down each anode lead one each of the 12 LEDs and then take some solderable enamel coated wire and wrap it around the anode of the first LED two times (a wire wrap tool works great for this). Leave some slack in between each LED and continue doing this for each LED. Repeat the process for each column and then do the same for the twelve rows (connecting cathodes on the rows). It is critical that you put a bit of slack in the wire between each LED, otherwise the wires can break if the silicone LED grid is rolled up. With about a 1/2" of slack wire between each LED it allows the wire to stretch inside of the grid without breaking.
Once the grid is completely wired, we will need to get some wire to hook up the 50-pin breakout PCB to the grid. I used 3-pair phone cable but any wire will do. Solder a piece of wire to each column and route the wire to the opening on the front of the jig where we will mount the breakout connector. Repeat the same process for the columns. Once all of the wires are there, connect the grid to the breakout PCB as follows: 1234
PCB -> Signal
1 -> COL0
2 -> COL1
3 -> COL2
32 -> COL31
33 -> ROW0
34 -> ROW1
43 -> ROW10
44 -> ROW11
Wiring up the grid with the 2x25 LED grid cable
The last 6 connections on the breakout PCB are left blank as we are only using a 32x12 LED grid. Next we will assemble the Master PCB so that we can test out the LED grid. After verifying that all of the LEDs in the grid are working, we will encase it in silicone.
Step 17: Construction: Pouring the Silicone Into the Grid
None, unless you choose to create the LED grid this way instead of building it into the table. This is just here for general knowledge.
This step is only applicable to you if you are using option #2 to make your LED grid. I don't recommend this method as it is far more expensive, time consuming and messier than option #1. In fact, the only reason that I tried it was to see if I would be able to make a portable LED grid that I could ship with the kits.
I eventually decided against making these and selling them for the following reasons:
- It is very time consuming
- It is expensive to get the raw material shipped here
- It is expensive to ship out each finished LED grid (~3Kg)
- It is difficult to hide all of the wires in the thin mat of silicone; It looks kind of archaic
As with most products, cost is the limiting factor for this LED grid that is encased in silicone. However, I still wanted to post the process and results in case anybody does choose to do it this way and just for general knowledge.
The silicone was purchased on AliExpress and is labeled as an RTV Silicone for those who are interested. The photos above explain the process to create your own silicone LED grid.
Degassing Liquid Silicone
Pouring The Liquid Silicone
Step 18: Construction: Installing the RGB Pods
In this step we will secure each RGB pod to the table, but first we have to mark the placement of each pod as well as drill out a hole that is large enough to fit the 2x4 IDC connector through to the bottom of the table. Use the photos in this step and measure out the center location of each RGB pod on the table. Make a small 1 - 2mm pilot hole at each location so that it will be easier to thread a screw into place to secure the pod once we are finished.
There are two ways that once can use to measure out the location of each 2x4 connector in reference to the center of its respective pod. First, you can just use the CAD drawings above to measure out the location of each connector hole and then drill them out with a 11/16" (18mm) spade bit, or second, you can use the attached PDF file and print a pod stencil which contains the exact locations of both the center and connector holes. If you use the template, you must make sure that you set it to print out at "Actual Size" and don't use the scale to fit option in the Adobe Reader print section. Once you have the template printed out, you line up the center hole on the template with the pod location on the table and then make a mark where the connector hole should go and the pilot hole should go. Then drill out the connector hole first followed by the 2mm pilot hole.
Once you have all of the holes drilled out, insert each pod into its location and use #1 1/2" screws to secure them to the table. Now you're ready to connect them up!
Step 19: Construction: How to Crimp Various Connectors
In this step, I will show you how to use a crimping tool for the various connectors on the Master PCB. The crimper that I find most useful can be purchased here (Model: PA-09) for around $40. Although it is more expensive than some other crimpers, I would definitely recommend it as I have used some other cheaper ones and they don't do as nice of a job when crimping (or crimp as wide of a variety of connectors as this one does). As with most of this Instructable, follow the photos above to get a good understanding of the process.
If you didn't get a fully assembled kit, you will have to crimp all of the pins for the XH_2.54 connectors on the LED rings. Not a big deal, just follow the instructions above as the instructions are the same for that type of connector.
Step 20: Construction: Building the Ball Washer Sensors
To make two ball washer sensor assemblies for your table, you will need the following:
4x - TCRT5000 IR Sensors
8x - 2-conductor CAT5 Wire Sections (6' - 8' length)
16x - 1" Lengths of heatshrink (2mm diameter)
2x - RJ45 Connectors
First, bend over each lead of the TCRT5000 and trim them. Use the diagram in the photos and connect up each lead on the sensor to its respective wire. You will have to do this for both the entry and the exit sensor. Once you have wires connected up to each sensor, align the eight CAT5 wires in the correct order and crimp an RJ45 connector on to them. Repeat the same process to make the sensor assembly for the second ball washer.
As you will see with lots of parts in this Instructable, I tend to use CAT5 wire for longer wire runs as it is very common and cheap to purchase. Just strip away the outer PVC sheath to expose the four pairs of wires inside.
Step 21: Construction: Installing the Ball Washers
The ball washers (air baths) are quite easy to install. You need a total of 5 pieces of ABS pipe/couplers, the fan motor and the sensor assembly for each ball washer. I have made custom laser cut motor mounts and sensor brackets that are included in every kit sold, but if you need to make your own you can use the part template located in the main zip file or simply modify a few blocks of wood with a drill and a jigsaw (Or just glue the sensor in place where the hole is. Just don't poke it too far into the pipe where it will obstruct the ball).
The propellers for the ball washers come in a 75mm length which is too big to fit inside of the pipe. Take some snips and cut off the tip on each end of the propeller, ensuring that it can spin inside of the pipe. If the propeller cannot spin and you activate the ball washer, it will damage the transistor (too much current) that is driving the motor and may render the ball washer inoperable until that part is replaced on the Master PCB.
Also, the radius of the ABS couplers may be too tight for 40mm ping pong balls, so you might have to grind/sand out the inside of it until you can drop a ball through without it getting caught in the coupler. If you just use 38mm ping pong balls, they will fall through just fine. I use a Dremel 134 High Speed Cutter in my rotary tool to shave off the excess plastic in the coupler.
The photos above provide a pretty straightforward demonstration in regards to installing the ball washers. There are 3 things to look out for when assembling the ballwashers:
- Make sure that the fan motor inside of the T-coupler can spin freely. If the motor/propeller is pushed too far into the coupler it will hit the side wall and won't spin.
- If you assembled the connectors for your motor and it's spinning the wrong way, pop the crimp tabs out of the connector and switch the pins. This will reverse the direction of the motor and solve your problem (make sure to have the propeller installed the right way too).
- When you install the infrared sensors, it is crucial that they have a clear opening into the coupler. They are optical sensors so if anything is blocking them they may not detect a ball dropped in the air baths.
And that's it! We're almost ready to plug everything into the Master PCB and test it all out!
Step 22: Construction: Installing the Acrylic Sheet
If you don't already have the ball washer holes drilled out int the 1/8" acrylic sheet, do it now. Beware that the holes in the acrylic sheet are only 50mm in diameter whereas the holes on the table are 58mm (due to the lip of the couplers). I have tested 3 sheets of varying translucency, one being clear, one being slightly frosted and the last one being heavily diffused. Each sheet worked fine, with my favorite being the most diffused one as it provides a really cool effect on the table. The more diffused the sheet, the more prone it is to false detections because more of the IR light reflects back into the sensors. That being said, out of all 3 sheets that I used, none were causing any false detections on the table.
Next, align the acrylic sheet over top of the table lid and ensure that it is flush to the table on all 4 sides. Then measure 12.7mm (1/2") in from each end and that's where you will place your screws. Seeing as the rail underneath is 25.4mm (1"), we want to put each screw into the middle of each rail.
On my table, I installed eleven #8 3/4" Robertson screws along the perimeter of the sheet (see photos above). To secure the table to the base, we use five 2.5" screws around the end and front perimeters of the acrylic sheet. Don't add the 2.5" screws yet until you have all of the electronics installed inside of the base. Just secure the acrylic sheet to the lid of the table for now as we need access to the inside of the table.
As for the ball washer entry and exit points, there are two options. The quickest option is to leave the ABS pipe in the entry and exit holes flush with the acrylic sheet. Just add silicone inside of the gap between the pipe and the acrylic sheet to waterproof it and it's done.
The second option is to get a small shallow funnel, hot glue a short piece of 1-1/2" ABS pipe directly into the center of it and pour silicone into the mold (or squeeze it from a caulking gun, whichever). You then increase the length of the ABS pipe for the entry and exit couplers so that it sticks up above the acrylic sheet and you can insert the cured silicone mound over top of the extended pieces of pipe. Make sure to waterproof the tiny gap between the ABS pipe and the acrylic sheet too. You can also 3D print a mold if you have access to a 3D printer. There are photos of both options.
Now we're ready to start hooking everything up!
Step 23: Electrical: Installing the Master PCB & Connecting Up the Pods
The first thing that we will connect up to the Master PCB, even before the power, is the infrared receiver. I have set up the BPT X5 table to use a bootloader (Bully Bootloader) so that code can be programmed into the microcontroller wirelessly from a PC with a bluetooth connection. The only catch is that the IR receiver is the hardware that activates the bootloader or tells it to go to the main code.
If you don't have the infrared receiver plugged into the PCB, you don't know if the microcontroller will read a low or a high signal on startup. If it reads a high signal, it will go into the main code. A low signal, it will go into the bootloader and continuously loop until code is loaded into it or the PCB is reset. Once the receiver is plugged into the board, it will only read a low if somebody is pointing the remote at it and pressing a button in the first second that the table boots up (which is how you activate the bootloader mode). The IR receiver connects up to the 3-pin connector on the PCB (JP3).
I ran the power supply (PSU) line up one of the folding legs and into the table (making sure that the leg could still fold). I then sealed up the entry point with some silicone and routed the rest of the cable to the same compartment with the Master PCB in it and secured it to the base of the table so that it wasn't able to shake free. Place the Master PCB as close to the center of the support as possible. There are 3 holes in the PCB that you can place screws into in order to secure it to the table. Make sure that the screws are snug, but not so tight that it cracks the PCB.
After that doing as I stated above, you just have to follow the "RGB Pods" legend on the PCB and connect up the pods to their respective connectors. The 3rd photo shows the layout of the RGB pods on the table.
Step 24: Electrical: Connecting Up the Rest of the Parts
It's clear sailing now! Congratulations on getting as far as you have gotten. Let's finish connecting up the remaining parts of the table and then we can finally get to the software side of things and testing it out!
This is a pretty basic step here. Make sure that you have routed all of the cables for the LED rings, RGB pods, etc. underneath the lid and into the base of the table. Connect up each LED ring to its respective spot on the Master PCB, plug the bluetooth module into JP2 (it may already be soldered in for you), plug the IR receiver into JP4 and connect up the wiring harness for the LCD display to CON3.
Next, cut out a small section on the front side of the table for the 16x2 LCD display and drill a 3/8" hole beside the display for the IR receiver. Connect up the LED grid with the 50P wiring harness and you're ready to go!
As for the ON/OFF switch used in the kit, I drilled out a hole on the bottom of the table near the LCD display and mounted it there so it was out of sight. To turn it on, just walk up to the LCD display, reach underneath it and press the button to turn the table on or off.
Step 25: Electrical: Assembling the RGB Underlighting
Follow the photos in this step to assemble the RGB LED underlighting.
The RGB underlighting assembly no longer ships soldered together. Many customers who purchased the fully assembled kit have told me that the RGB underlighting parts were faulty upon arrival or needed solder touch-ups to work properly. I looked into this and found out that this was happening because the whole assembly was being folded together to fit in the kit before being shipped out and then unfolded and fitted to the table by the customer. The soldered connections and T-Shape connectors can't handle this and were breaking. Now, all of the parts are shipped together (with pre-made connectors) and the 24 solder joints should only be completed when it is ready to be installed in the table.
Step 26: Software: an Introduction to the Software
This is all for general knowledge. You do not need to know or understand any of this to get a beer pong table working. You simply can use the standard code from the zip file in step #1. Fully assembled kits come pre-programmed and are ready to operate out of the box. They are programmed with the latest firmware at the time of shipment (they are fully tested before shipping).
Now that we have finished all of the construction, we can begin learning how everything works! This is where it gets really fun as there are so many animations and effects that one can make with this table. Before we move on to making our own animations, it is beneficial to learn how data is sent amongst the different chips, how the interrupt routines have been set up, certain time constraints, etc.
There is a fair share of source code to sift through, whether its code for controlling the RGB pods, running animations on the grid or controlling the ball washers. In every C file I have ordered all of the functions alphabetically so that one can find the piece of code that they need quicker. I could have split the code up into smaller files but I chose to keep the feature controls and the main animations grouped together, most of which are contained in the LED_Control.h and LED_Graphics.c files.
As stated in earlier steps, all of the source code and documentation files are located in the downloadable zip file in step #1. Now, it's time to step through each function of the table one by one, completely understanding one feature before moving on to the next. It is the same thing that we just did in the last 35 steps with construction, only this time we are doing it with software.
To keep the length of this Instructable shorter, I will only be touching on the core software features for this beer pong table. If you wish to learn about the interrupt time delays or how the IR sensors on the pods work, please refer back to step #48, step #54, step #55 and step #56 in the previous Instructable.
Step 27: Programming: How to Program the MCU Wirelessly
If you have a PCB only kit or an unassembled kit, you will have to connect up a programmer to the ICSP pins designated by JP3 to initially program the bootloader into the MCU. Follow the instructions to upload the bootloader hex file into MPLAB and program it into the PIC (If you have purchased a Fully Assembled Kit, this has already been done for you and you can skip to "Programming the MCU with a Bluetooth Connection").
Programming the Bootloader into the MCU (Fully Assembled Kits can skip this part)
- Open up the zip file from step #1 and navigate to the "Bootloader->MPLAB Bootloader Project" folder. Open up "Bootloader.mcw".
- In the open project, click on "Programmer->Select Programmer" on the toolbar and select the programmer that you will be using to program the PIC24EP256MC206. I have it set to the PICKit 3 by default.
- Select "File->Import..." on the toolbar and navigate to this projects folder and import the file "BTLDR&Program_v2.02.hex". This will program the bootloader into the PIC as well as the most recent BPT X5 software.
- Connect up your programmer to the ICSP pins, turn the Master PCB on and program the bootloader data into the MCU.
- You can now program the Master PCB with a PC that has a bluetooth connection.
Programming the MCU with a Bluetooth Connection
- Plug the PSU into the 2.1mm jack on the Master PCB. Before you turn it on, point the remote at the IR receiver and hold any button down, then switch the Master PCB on. The HC-06 bluetooth module may begin blinking but the RGB pods or any other features shouldn't turn on. This means that we are in bootloader mode.
- Navigate to the PC Settings on your computer, or whatever application you use to control bluetooth pairing and pair the PC to the HC-06 module (It might be renamed to BPT_X5). The default password for pairing is "1234" without the quotation marks.
I use a great piece of software called "Bluesoleil" that only costs $30 for a full license. I originally was using the default windows metro app (Windows 8.1) but I hate using metro apps seeing as they take up the full screen so I switched to Bluesoleil to handle the bluetooth functions on my PC. Any bluetooth manager should work though, including the default manager included with Windows.
- Once you pair your PC to the module, a Bluetooth Serial Port COM driver will be installed on your PC (Windows installs this automatically). Take note of the COM port number.
- With the main zip file extracted, navigate to the "Bootloader" folder and open up "winbootldr.exe".
- Right under the main window of the application, there will be a drop-down menu which contains the amount of COM ports/drivers on your computer. Click on the one that is paired with your bluetooth module.
- The drop-down to the right of your COM port contains the baudrate at which we will be transferring data at. Select a speed of "115200" bps.
- Check the box that says "OpenCom" and give it a couple of seconds to connect to the Master PCB. The LED on the bluetooth module should light up and stop blinking (or on some versions, it may just change the blinking pattern).
- Select the "HexFile" button and navigate to wherever you have the hex file stored that you want to program into the MCU. For this example, it is located in the "Source Code v2.02" folder in the main zip file.
- Hit the program button and you should see the application start programming addresses starting from 0x1000. It usually takes around 20 seconds to program the MCU and verify its contents.
- Once programmed, the Master PCB will restart itself and the newly programmed code should start running.
If you get an error from the PIC24 Bully Bootloader application that says:
"Reading Target Device ID
Exception during serial port read: The operation has timed out. Unable to connect to device, giving up."
This means one of two things. Either there is no connection being made between your PC and the bluetooth module on the Master PCB or you are failing to put the Master PCB into bootloader mode. Double check that you are paired with the bluetooth module properly and that you have the "OpenCom" checkbox activated.
Here is a video detailing how to use the bootloader with the X5 Master PCB. Normally the bluetooth modules red LED will go completely solid when it has a stable connection, but you will see in the video that it still blinks. This is because I was using an HC-05 bluetooth module at the time of the video and not an HC-06 module. The HC-06 modules go completely solid when they have made a connection and it is the HC-06 modules that are in the BOM.
You can also reset the MCU by navigating to the settings on the LCD and then clicking on "Update Firmware?". The LCD will then perform a countdown indicating when it will reset. Once it hits the end of the countdown, just hold one of the buttons on the remote, point it at the IR receiver and the Master PCB will restart in bootloader mode. The infrared remote control button functions are detailed in the next step.
Step 28: Software: How the LED Grid Is Updated
On this version of the Interactive LED Beer Pong Table, the MCU now controls the display and refresh rate of the LED grid. By doing it this way and not using dedicated drivers, I save space on the main PCB, cut the amount of wiring for LED grid by 40% and also make the LED grid much simpler to wire up.
The trade-off is that we need to use more resources on the microcontroller to maintain a constant refresh rate on the grid or else we will get flickering across the display. Seeing as this MCU has an execution speed that it is 75% faster than the previous MCU, this doesn't cause an issue. On top of that, we now use a different chip to control the RGB pods which refreshes itself, meaning that it frees up more resources on the MCU.
The MCU does use a few serial-parallel logic chips to compensate for the larger number of outputs needed to drive a LED grid with a maximum size of 32x16 pixels. To reduce the total number of outputs needed, we use a technique called 'multiplexing' to control a maximum of 512 LEDs with only 48 outputs.
Listed below are some of the functions that are used to control the LED grid. After calling any of these functions, if we want to update the grid and enable the newly selected pixels, we need to call UPDATE_FRAME() which will then send the new grid data to the shift registers. This prevents flickering on the LED grid because it won't allow the grid to update while the MCU is in the middle of modifying the LED grid data.
void LED_Pixel(UINT8 px, UINT8 py, UINT8 state)
This function takes an (x,y) coordinate and modifies the bit that the pixel represents. If 'state' is equal to 1, the LED that the pixel represents will be turned on, if state is equal to 0, the LED will be turned off. In photo #3 we modify the LED grid data to turn on 3 pixels on the grid. If we were to use this function to turn on these specific pixels we would write:
All of the pixels are then updated at the same time that we call UPDATE_FRAME(). We are assuming that the LED grid is already blank with all of the LEDs off. If not, you would have to clear the old LED grid data from the grid, then write these pixels
This function will set every bit in the LED data array to 1. If the grid is updated after calling this then all of the LED pixels will turn on.
Fill_Grid(); //Turn all pixels on
This function will clear every bit in the LED data array to 0. If the grid is updated after calling this then all of the LED pixels will turn off. This function is useful when we want to draw a new frame on the LED grid, we can reset all of the grid_row[x] bits and start modifying the data knowing that each bit has been reset to 0 (OFF) and we have a blank grid.
Clear_Grid(); //Turn all pixels off
voidDraw_Circle(UINT8 px, UINT8 py, UINT8 radius)
This function will modify the LED data and create a circle around the center point of (px,py). The 3rd parameter will set the radius of the circle. Photo #5 shows an example for the following code:
void Draw_Rect(UINT8 px, UINT8 py, UINT8 sx, UINT8 sy)
This function is used to draw a rectangle starting at point (px,py). The size of the rectangle is specified in pixels by sx and sy. Photo #4 shows an example of how the rectangle is drawn (a square can also be created with this function).
This function will simply invert each of the LED data bits. If you run this function right before you run UPDATE_FRAME(), it will display the exact opposite of what it was going to display before running this function. (i.e. the LEDs that were on will be off and the LEDs that were off will be on).
//Other code setting LED bits here
That is just a few of the standard functions used to modify the LED grid. Now lets check out the RGB pods!
Step 29: Software: Controlling the RGB Pods
The RGB pods, LED rings, motor drivers, underlighting and the extra PWM outputs are all controlled by the two TLC5955 16-bit PWM driver chips. Each chip is capable of providing up to 48 separate PWM channels, giving us a total of 96 channels to use.
The first 60 channels are used for the 20 RGB pods and each pod uses 3 channels for its red, green and blue colors. After those channels, I have dedicated the next 16 channels to the LED ring connectors, followed by the 4 motor channels, IR transmitter channel, 12 extra PWM drivers and the last 3 channels make up the red, green and blue channels for the underlighting.
Instead of having to control each RED, GREEN and BLUE channel separately for the RGB pods, I have created a couple of functions that will handle the low-level stuff for us and modify all three channels at once. They are as follows:
void RGB_Pod(UINT8 pod, UINT16 red, UINT16 green, UINT16 blue)
This function will take the parameter 'pod' and set the corresponding red, green and blue values to the respective channels of that pod. There is no fading in this function, it will simply change the pod to whichever color you wish.
//Change pod #5's color to RED
void Pod_Set_Color(UINT8 pod, RGB pod_color)
This function is the exact same as RGB_Pod(p,r,g,b), only it uses an RGB struct to set the color of the pod. This is nice if you quickly want to to set the pod to one of the default 10 colors.
//Change pod #5's color to RED
void Fade_Pod(UINT8 pod, RGB NEW, UINT16 delay);
This function is by far my favorite as it allows the user to fade in and out of colors. This provides a nice smooth transition from the color that it is currently set at to the new color that you want it to be faded to. The speed of the transition is controlled by adjusting 'delay'.
//Fade the pod to blue from whatever color that it is currently set at
Now if you look into the code for the RGB pods, you may notice that there is actually 21 pods in the RGB_Pod(p,r,g,b) routine. The 21st pod isn't actually a pod, it is just the RGB underlighting for the bottom of the table and will set the color of the underlighting in the same way that you would set the color of the RGB pod. You can either set the underlighting color with any of the above functions, or else the following one:
void RGB_Underlighting(RGB underlight)
This function will set the color of the underlighting to the colors that are defined in the RGB struct. One can create their own RGB struct or simply use one of the 10 default colors. An example is below.
//Set the underlighting color to PINK
If you choose to use a default color (defined in Globals.h), you only have to add 'COLOR[x]' to the function where the RGB struct variable should be placed. 'x' should be one of the default colors listed below.
10 Default Colors (11 Colors if you count BLACK (Off) as a color)
Step 30: Software: Controlling the LED Ring Channels
There are sixteen channels on the X5 board that can be used to control LED rings, LED signs, etc. Each channel supports 16-bit PWM and can handle up to 500mA of current. I recommend keeping the current level less than 300mA as it may start to heat up at its maximum rating.
For the table in this Instructable, I only used 12 out of the 16 available channels and they make up the LED rings on the beer pong table. They are updated in the same fashion that the RGB pods are, except for we only need to modify one channel for each LED ring, as opposed to three channels for each RGB pod. Listed below are some of the functions to update the LED rings:
void Update_Ring(UINT8 ring, UINT16 duty_cycle)
The first parameter 'ring' will take an input value of 1 - 16 and determine which OUTx pin on the TLC5955 that we are controlling. The second parameter, 'duty_cycle', will set the PWM value between 0 - 65535 for that output. This function is used to control the rail LED rings as well as the ball washer LED rings. To turn on LED ring #8 with a PWM value of 3230, we would write:
//Turn on LED ring #8 with a duty cycle of 3230
void Fade_Ring(UINT8 LED, float new, UINT16 delay)
This function uses the exact same format to fade the LED rings that Fade_Pod() uses to fade the RGB pods. Once the user calls this fade function, the interrupt routine will automatically update the LED ring one more fade step per interrupt until the ring has completely faded to the brightness level specified. Here is an example of fading an LED ring to its max brightness over the course of 80ms:
//Begin fading LED Ring #3
Fade_Ring(3, 65535, 80);
There is also another function that can be used to adjust any channel on either of the TLC5955's manually. The function 'Update_Channel(a,b)' can be used to change the duty cycle on any of the 96 PWM channels. An example is below.
void Update_Channel(UINT16 channel, UINT16 duty_cycle)
The parameter 'channel' will contain a value from 0 - 95, which will be one of the 96 total channels. The 2nd parameter sets the duty cycle of the PWM channel. This function would be used to control the twelve extra PWM outputs, the IR transmitter output or any other channel for that matter. For this example, lets set the EXTRA_PWM7 channel to have a duty cycle of 55322.
//EXTRA_PWM7 is on channel 87. Set a duty cycle of 55322
Instead of just using the channel number and typing in 87 as the first parameter, one should use the code definitions for the channels. For the example above, we could replace the integer '87' with 'EXTRA_PWM7' as that is already defined as channel 87 in my code. The code definitions are listed in 'LED_Control.h'.
Step 31: Software: Using the ADC Module
The X5 PCB uses 4 analog inputs on the PIC microcontroller. The first three inputs connect to the three 74HC4051 outputs and the 4th input is connected to the VU Meter 'IN' line. Each 74HC4051 multiplexer handles 8 inputs, giving us a total of 24 analog inputs. All of these analog inputs are used for the 20 sensors on the RGB pods and the 4 sensors for the ball washer entry and exit holes. The connections are as follows:
Pod #1 - Pod #8 sensors -> AN0
Pod #9 - Pod #16 sensors -> AN1
Pod #17 - Pod #20 Sensors -> AN2
Four Ball Washer Sensors -> AN2
VU Meter 'IN' Line -> AN3
Just ignore the VU meter line as we are only going to concentrate on the IR sensors in this step. Normally, we would need to read each analog input one at a time for a total of 24 times to get each sensors analog reading. Seeing that we are using the PIC24EP256MC206, we can read the first 4 analog inputs (AN0 - AN3) all at once which saves us quite a bit of time! So instead of having to read each input on each 74HC4051 one at a time, we only have to read each input on all three 74HC4051's at once (did that make sense?).
Along with reading the 3 analog inputs connected to the 74HC4051's, we will also get a reading from AN3 which is connected to the VU meter 'IN' line. We can either use this value later in the code or just simply discard it. The IR sensors are polled in the main loop and updated periodically. The sensor readings are packed into a 32-bit integer where a '1' means that a detection has been made and a '0' means that no object has been detected by the IR sensor. This is how the IR sensors are updated in the main code:
//Save the IR sensor readings data and pack them into a DWORD
IR_sensors = Update_All_Sensors();
If you want to get a better understanding of how these multiplexers work, refer to steps #54 - #56 in the original Instructable. The wiring is set up a little differently for this version of the beer pong table but it still has a good amount of info that I didn't address here in regards to controlling the 74HC4051.
Step 32: Software: Controlling the Ball Washers
Each ball washer assembly consists of a fan, two IR sensors (entry & exit) and two LED rings. There are four connections that must be made to the PCB to complete the ball washer. The connections and their respective locations are in the diagram in photo #1 of this step.
The ball washer IR sensors are connected to the 3rd 74HC4051 multiplexer, meaning that every time we poll through all of the RGB pod sensors we actually get the readings for the ball washer sensors too. We have to mask off the RGB pod sensor bits and move the ball washer sensor bits to bit locations #0 - #3.
//Save the IR sensor readings data and pack them into a DWORD
IR_sensors = Update_All_Sensors();
//Shift the last 4 IR sensor bits (BW sensor bits) to the bit locations #0 - #3
bw_bits = (IR_sensors >> 20);
//If ball washers are enabled, check to see if a ball has been dropped into either BW
if (ball_washers == ON)
The ball washers also have a fail-safe built into them in case something goes wrong. For example, if somebody drops a ball into the ball washer and doesn't grab it from the other side, it will fall back down into the ball washer when it shuts off. This sets a flag in the system and will disable the ball washer until somebody resets the flag. This ensures that the ball washer doesn't run indefinitely if somebody doesn't grab the ball out of it or if it gets jammed up with more then one ball in it. The way to reset the ball washer after it times out is to put your fingers into the entry and exit hole of the ball washer tripping each IR sensor.
The ball washer motors are controlled by the FAN1 and FAN2 channels on the X5 PCB and are rated for a maximum of 500mA. Again, I would recommend using a motor that draws much less current than that to keep the heat of the transistors down. The motors that are in the BOM are the ones I used and work perfect for this application.
If you would like to add a water pump to your ball washers, no problem! You can use the PUMP1 and PUMP2 channels on the X5 board to accommodate this.
Step 33: Software: 24-Key Infrared Remote
The 24-Key infrared remote is used to adjust the modes, settings and operation of the interactive LED beer pong table. Currently, I am just using a stock remote and I have mapped certain buttons to perform certain functions. In time, I would like to purchase some of these remotes with custom skins that have icons which pertain to the functionality of the selected button. For now, users just have to use the chart above which has a diagram that shows what button is mapped to which operation.
The IR remote controls the LCD display on the beer pong table which allows users to see what settings and modes are available to be changed. As development continues, more options and features will be added to the menus but for the time being, the menu tree is pictured in the last photo of this step.
This remote uses the NEC protocol to communicate with the IR receiver. Each command from the remote is received by the MCU, packed into a 32-bit integer and then compared against the default codes for the buttons on this remote. Be aware that they are many identical versions of these remotes floating around, but the codes mapped to each button might be switched around.
Here is an Instructable which describes how these type of remotes function. As everything is open source with this project, the code can be changed to work with most remotes.
Step 34: Software: 16x2 LCD Display
The 16x2 LCD display is used in conjunction with the 24-key infrared remote. The display is used to allow the players to adjust certain settings on the beer pong table. I have added 7 default menus that range from setting the brightness of the table to disabling the ball washers. The UP (A1) and down (A2) arrow keys will cycle through the main menus, ENTER (C1) will enter a menu and CANCEL (C2) will revert back to the default menu which I have called the screensaver. The LEFT (B1) and RIGHT (B2) arrow keys are used to adjust values, such as the ones in the brightness menus.
The 16x2 LCD display uses the very common HD44780 controller which has a large amount of example code floating around the net. I have written some basic routines (LCD_Setup.c) to control the operation of the LCD display and they are as follows:
This function is used at the start of the code and initializes the operation of the LCD display. The LCD settings are defined inside of the function in LCD_Setup.c.
void LCD_CMD(UINT8 cmd)
This function will take a command parameter and send it to the LCD display. The command definitions are listed in LCD_Setup.h.
LCD_Cursor_Pos(UINT8 x, UINT8 y)
This will set the cursor at the specified address of P(x,y). Being a 16x2 LCD display, the visible range of 'x' on the screen is 0 - 15 and the visible range of the y parameter on the LCD is 0 - 1.
LCD_Text(UINT8 x, UINT8 y, char text)
This function will write text to the screen at the location of P(x,y). The text is limited to 32 characters and must contain a NULL operator '\0' which indicates the end of a string.
There are a couple of other functions for the LCD display but the majority that I use in the table are listed above. Take a look at photo #2 which shows the hierarchy of the menus.
Step 35: Software: UART Menu
The UART menu allows a user to test out certain features of the table wirelessly from a PC. Seeing as it uses the same bluetooth module that we use to program the table with the bootloader, you will connect up to it the same way (Step #23 if you missed it).
Once you've paired up to the bluetooth module, open up a terminal program such as TeraTerm. Go to 'File->New Connection' and select the current COM port that your bluetooth module is using to communicate with the X5. Then go to 'Setup->Serial Port' and select a baudrate of 115200.
Type "BT" without the quotes and hit enter. You should receive an acknowledge from the Master PCB. This proves that you have a working link.
Now send any of the commands that are listed in photo #1 to the Master PCB. A good place to start is to type "BT+MENU" to get a list of the various commands that you can use to turn on/off specific features. If you don't understand how to use the commands with variables (n & x), just type in "BT+HELP" to find specific info for each variable command.
You can actually do all of this over a mobile phone too, although it is somewhat cumbersome. Download a bluetooth terminal program on your phone (I use BlueTerm) and pair it to the Master PCB and set the proper baudrate settings. Now you can send commands to it from your phone just as you would on your PC.
This feature isn't super useful and it's more of a proof-of-concept at the moment. I plan to learn mobile programming (or find someone who already knows it) and design an easy to use app for this project. The UART menu just shows that all of the hardware is already in place for when the time comes to design an app.
If you plan to test out certain parts through the UART menu, make sure to run the "BT+STANDBY" command first to halt the normal operation of the beer pong table. Otherwise, if you modify a part, like a pixel on the LED grid, it may be changed in a few milliseconds on the next grid refresh. By putting everything into standby, it halts all animation operations. To resume normal operation, just send the command "BT+ACTIVE".
Step 36: Software: EEPROM
The EEPROM memory is used to store various settings and data and is the 25LC256 EEPROM IC from Microchip. This particular EEPROM chip separates data banks into 64 byte pages and can store up to 32768 bytes of data (256 Kbits). I am still programming this part of the project and it is still in an alpha stage, meaning certain features of it are up and running but there is still a fair bit more to do. I still have to implement the file structure and allow users to store table settings, which I will get time to do within the next two weeks.
When writing to this EEPROM chip you can only write 64 byte blocks at a time before you need to re-send the write command. My EEPROM driver file already takes care of the page boundaries so that the user doesn't have to spend time dealing with them. I have simplified things as much as possible and made it so that the user only needs two commands to control the EEPROM. They are as follows:
void EEPROM_Read(UINT16 addr, UINT8 *buf, UINT16 len)
This function will take a specified address and read each successive byte up until it reaches the value of 'len'. Each byte is stored in the pointer-array '*buf'. If we wanted to read 12 bytes starting at the address of 0x40, we would write:
//Read each data byte stored from 0x40 to 0x4B and store them in the pointer-array buf_variable
UINT8 EEPROM_Write(UINT16 addr, UINT8 *buf, UINT16 len)
This function will write the specified amount of data in a buffer to the specified address and any consecutive locations that follow it. The amount of data in bytes that is to be written is defined by the variable 'len'. If the operation is successful it will return a 0. Otherwise, it will return a non-zero integer which pertains to a specific error code. If we wanted to write three bytes of data to the addresses of 0x80, 0x81 and 0x82, we would write:
//For examples sake, we will just assign random data to write to the EEPROM
data = 124;
data = 99;
data = 232;
//Write the 3 bytes in the variables of data[0..2] to locations 0x80, 0x81 and 0x82
It is very simple to utilize the EEPROM on the X5 board. One thing to keep in mind is that the EEPROM shares the same SPI bus as the SD card and the TLC5955's (RGB Pod controllers & LED rings). Therefore, any interrupts that use the SPI2 bus when an EEPROM function is called are temporarily disabled until the EEPROM operation has completed.
Step 37: Software: VU Meter
The X5 board has a 5-pin connector (JP5) which allows the beer pong table to detect frequencies around it. The VU module that has been created for the X5 has been designed around the MSGEQ7 graphic equalizer display filter. This allows the X5 to detect seven different frequencies quite well. One can plug a 3.5mm auxiliary cable into the module to get the best sound detection or simply use the built-in electret microphone to detect the audio around it.
The only downside to using the electret mic is that the music needs to be quite loud for it to be able to pick it up. As time goes on, I will upgrade the electret mic part of the circuit, but I know from experience that they usually pick up bass and low frequencies best.
Either way, one can modify the code to suit their needs and can choose which of the seven frequencies that they want the features on the table to react too. There is working code for the VU meter, however, it is still a work-in-progress. There are a few simple VU animations right now but over time I will add more and clean up the code in the existing ones.
VU Meter Demonstration
Step 38: Software: WS2812B Add-On
This is in a testing phase and is not fully developed. Seeing as the monochrome LED grid is such a pain to wire up, I started exploring more options for the LED grid. A plausible alternative is the WS2812B RGB LED strips which can be chained together and individually controller by using a 1-wire protocol. This would mean no wiring up columns, rows or having to use the 50P breakout header.
Each 32 LED row will connect into the row below it with the 3 main connections, +5V, DATA and GND. Seems to good to be true, right? It's definitely true, but there is a slight downside to these LED strips. The 1-wire protocol used operates at a high frequency and doesn't leave much room for error. On top of that, the LED strips are relatively expensive and need a high current power supply to provide enough amperage to all of the LEDs.
I will continue to update this add-on in the coming days, but you can see a video of it in action below.
Step 39: Conclusion: References
Here are the links to the datasheets for the major components in the beer pong table circuit as well as some links for other documentation. There is plenty of information and projects available when searching Google for each of these components. If you are having trouble understanding a component, cross reference my code with the code of other projects to get a better understanding.
HC-06 Bluetooth Module
BPT X5 Website
Step 40: Conclusion: Project Review
That's it for this Instructable! I will continually be developing this project, so check back now and again as I will keep everything updated. I will be adding a step for the micro-SD card feature, mobile/PC apps and anything else that enhances the table.
Overall, I am very happy that I was able to condense the crazy amount of wiring in v1.0 into the kit that it is now. Don't get me wrong, there is still a fair share of wires with this kit, but it's still way nicer than the original! If you choose to create an Interactive LED Beer Pong Table, be sure to click the 'I Made It' button and post a photo in the comments!
Thanks for checking out this Instructable and feel free to comment or PM me if you have any questions. Cheers!
2 People Made This Project!
We have a be nice policy.
Please be positive and constructive.