Introduction: W6: a Drinking Game for the Indecisive
With Which Whiskey Will I Wet my Whistle?
For a couple years now, we've had a set of shelves in the "dining room" whose sole purpose is to display and make readily accessible a rotating, reasonably extensive selection of the world's greatest distilled beverage, whiskey. From the South to Denver to Ireland, Scotland, and even Japan, options abound - which raises the question, which one should I try today?
In the spirit of Holiday blinkenlights and festive drinks shared among friends, I set out to answer that question with a drinking game, wheel-of-fortune style but shinier.
In the spirit of not losing my shirt, and to make things a little more emotional, I've replaced most of the more expensive bottles with Jaegermeister, King Cobra, and Strongbow Golden Apple. Some gems remain, though. (For you Europeans, Golden Apple is not the Strongbow you get at home. It's an America-only export of simple syrup with a hint of artificial apple flavor. You'd rather land on Redbreast, I promise you.)
Step 1: Step 0: Have Some Shelves
Of course, the game doesn't have to be built with alcohol in mind. I suppose you could gamify an intense cereal collection, if you'd like. But for starters, you'll have to have shelves of SOMETHING to put the blinkenlights behind. Or over. Or under.
We happen to already have a collection of booze on prominent display, and this is a party trick at heart, so that's where I went with it.
Step 2: Step 1: Acquire Blinkenlights and Supporting Bits
This whole project revolves around WS2811/WS2812B "neopixel" LED strips, and Ben Hencke's PixelBlaze LED controller. You'll need those, a power supply, and a couple extra bits to connect it all.
Shopping List: (Note: none of these are affiliate links. Maybe I should try that, get that $$. Instead, they're Smile links.)
- LED strip ($37) White PCB or Black PCB
- Power Supply ($24) Link Note: This one is probably overkill, it's 15A. How much current you'll actually need depends on overall length. See the notes later on about power supply considerations. I generally over-buy anyway, because if you ever use it in a different project, then you have the overhead.
- Controller ($29) PixelBlaze. Ben sells these on Tindie. The hardware is not worth $30. The software is worth much more than $30.
- Button ($11) Link Obviously, you only need one of these, so you can probably find them cheaper on Ebay in smaller qty.
- Extra LED strip connectors ($10) Link
- ALTERNATELY ($8): you can buy pre-made extensions instead, which is probably cleaner and prettier
- Some wire, ideally 3-conductor, to make an extension for the controller
- Button housing (3D printed) $0.50 (If you don't have a 3D printer, make your own out of cardboard, or for extra credit, wood)
Personally, since I had some of these parts already, I spent about $70 on this project. The parts cost, all-in, is something like $95. If you have none of the parts already, $115.
You could make this a bit by:
- Use cheaper LEDs (fewer pixels/meter). The cheapest 5m strip I found is $20 on Amazon.
- Get the PixelBlaze on sale, or wait for Ben to make it open source and DIY the hardware. (But if he does, pitch him some money anyway, the firmware is incredible).
- Use a minimum-spec power supply. This project doesn't consume 75W, and you can reduce brightness with the PixelBlaze until the strip works with a cheaper supply.
If you did all that, rolling your own software to use an ESP8266 feather or something like that, the hardware BOM cost could be as cheap as $38 or so.
Step 3: Step 2: Size LED Strips Appropriately
Looking at my 5m strip, I realized it was made in .5m sections soldered together. With these strips, you can cut between any two LEDs. But since I tend to fixate on stupid things, and since my shelves are just about exactly 1.5m long, I cut the silicone jacket and desoldered my strip into even 1.5m increments, leaving off the last .5m section for a later project.
Step 4: Step 3: Add Jumper Connections
Since my shelves are 3x1.5m, I needed to add some wire between my sub-strips. Of course, you don't have to do this if you only want to light one continuous shelf.
In my case, I made ~1.5ft extensions with 20ga silicone wire for the power lines, and 22ga for the data line. The bigger the better for power, although these will drop less voltage than the strip itself, anyway.
I just soldered these directly to the strips, no connectors. Using connectors and crimped extensions would be a lot prettier.
A Note About Power
LED strips can be tricky because each LED consumes quite a bit of current. If you only power the start of the strip, the voltage can sag so substantially by the end of the strip that the blue and green don't have enough headroom to turn on fully, leading to color balance issues. This is mostly a problem when you're displaying full-white, both because each pixel is consuming maximum power (R=100%, G=100%, B=100%) AND because white is where you'll see any resulting color balance issue. For instance, if you were only displaying blue, that's only 1/3 maximum power, and if the blue at the end of the strip is slightly dimmer, it's not SO noticeable.
One typical solution is to wire power in at a few points along the strip. In our case, maybe at one end of each shelf.
Another possibility, using the PixelBlaze, is to simply dim the strip overall, since the PB supports a strip brightness control totally separate from the animation. Light isn't perceived linearly, so by cutting power in half, you only slightly dim the strip. I found, testing a full-white pattern, I could eliminate color balance issues by reducing the strip brightness to 25%, which only slightly reduced overall light output.
In this case, the animation means that the strip never consumes TOO much power, never consumes power evenly such that one end starves the other, and generally, I didn't notice it to be a problem testing the software on the continuous strip before installation. For the game, I only dimmed the strip because the idle animation was a little bright for my taste.
Something to think about for big installs, though, or if you change the animations you're using to be more power-intense.
Step 5: Step 4: Wire Up Power
My power supply, as many do, came with a 5.5x2.1mm barrel jack to screw terminal adapter for just this sort of application. What I actually used was a similar adapter, but with screwless quick connects instead of screw terminals.
The LED strips typically come terminated at the beginning and end with both a 3-pin JST SM connector and two bare wires to add power separately. We'll wire in power on these two separate wires, and use the JST SM connector to get data from, and feed 5V power to, the controller.
I could have just screwed the 3 pin JST into the PixelBlaze and called it a day, but I needed a little more freedom with the control box, so I also wired a JST SM male to female extension cable with some wire I had handy. Gauge doesn't really matter here since it's only supplying a few mA to the controller. Although it'd be prettier if I had a purpose-made extension cable with crimped connectors at each end, rather than pigtail-shrinkwrap-wire-shrinkwrap-pigtail.
Step 6: Step 5: Wire the Button
The last part of the circuit is to wire up the arcade button. I used the ADC pin, because there's only one digital GPIO on the convenient pin header and it's not available to a user pattern - a button on that pin serves the special purpose of cycling animation patterns.
You can get away without using an external pull-up resistor by using one of the digital pads on the bottom of the board, but I didn't want to solder directly to it. Nearly any value of resistor will work, but probably stick to >1Kohm and <0.5Mohm. I used a 47K pull up because that was the first resistor floating free in my box, looking for a home.
Step 7: Step 6: Make a Box
I actually had this box printed for a separate project already, even with a Christmas-y color scheme. But like I said before, a cardboard box with a cut out for the button would do just fine. Or no box at all, if you're confident in your solder joints.
This box didn't originally have a cable exit, so I trimmed the edges a bit to make space. The 3D model I attached here does have an exit, though. Print the back lid with the ridge up, and the case shell with the face down. You'll need pretty well dialed slicer settings, since the back lid just press-fits in place with a couple of detents.
Step 8: Step 7: Software
Setting up the PixelBlaze was, for me, the hardest part, but for you, the easiest. I wrote about 200 lines of code to get all the animations and mechanics working, but you can just load the animations I've attached! Visit PixelBlaze - Getting Started for instructions on how to set up your PixelBlaze and load patterns to it, then just load one of the patterns above. One of them is a classy white animation when the game isn't being played, while one is the tacky red and green pattern in the videos and images in this guide. Of course, you can modify to taste!
NOTE: you'll want to set up your strip length in settings, whatever that may be. For my strips at 4.5 meters total length, that's 270px.
How the pattern works
The code I wrote is a state machine. The states are all based around the idea of a "selector" scrolling through the pixel strip. The selector pattern is the rising first half of a sine wave, re-scaled from 0 to 1 and squared (or cubed) to make the edges fade, but sharply. The start of this pattern moves along the strip with some speed, and each animation frame draws pixels with intensity according to the selector wave (that is, the selector position isn't a discrete integer pixel boundary).
State 0 uses a wide "selector" and scrolls it through the strip at a constant speed. State 0 transitions to 1 with a press of the button.
State 1 narrows the selector to 5 pixels and sets the speed much faster. During the state 0>1 transition, a random delay is set between 3 and 7 seconds. State 1 lasts for this random delay, then transitions to state 2.
State 2 is the same as 1, but decays the speed exponentially and lasts only 2 seconds, before transitioning to state 3.
State 3 sets the selector width even narrower to clearly define a single bottle, changes the color to green to indicate the final selection, and remains focused at the same location for 15 seconds while drunk players quibble over whether they ACTUALLY have to drink a 40 of malt liquor. To that point, if the selector lands firmly between two bottles such that the selection isn't clear, a player can tap the button once more to randomly move forward or backward a couple LEDs to clarify the final position. Only one tap is allowed. After 15 seconds, the pattern moves back to state 0 waiting for the next spin.
Step 9: Step 8: Play!
- Approach the button
- Free your mind of any thoughts about the consequences of pressing the button
- Press the button
- Wait in anticipation
- Consider with apprehension the top-shelf scotch and the Goldschlager you've just landed squarely between.
- Press the button again to clarify which bottle fate wishes you to sample. Fate is not to be gamed or controlled.
- Watch in horror as the green glow moves firmly behind the Goldschlager
- Tap the button frantically hoping to jostle the selector just a little more
- Resign yourself to your fate and let your buddy gleefully pour a shot of the shimmering poison.
Participated in the
Make it Glow Contest 2018