Saturday 11 January 2014

TriviaBox - Trivia Game for RaspberryPi

Just before the holidays, my wife said "We should host a trivia night, it'll be fun!" ... of course, I turned this into a crazy project with custom buzzers and software. Some day I'll learn.

I settled on using my Raspberry Pi with the PiFace GPIO shield for inputs. Initially I was going to use the Pi for the GUI and an Arduino for the input processing. My thinking was the Arduino could constantly monitor the inputs while the RPi did other things. But it turns out the RPi was fast enough to do both, so the end result was much easier to deploy.

The wiring is pretty darn simple. Dry contact switches to the PiFace digital inputs. I used cheap speaker wire for the runs.

The switches all share a common ground. I had an old terminal block lying around that made this a piece of cake.
It didn't look like my bike handles were going to arrive from China in time, so I grabbed some plastic glasses from the Dollar Store for a stop-gap solution. They worked out pretty good actually.
But, as luck would have it, the bike grips showed up two days before game night. The switchover was pretty easy since the hard work of soldering and tinning the wire ends was already done. Got these off eBay from China for about $0.50 each. Perfect trivia grips.
A little knot in the wire was sufficient as a strain relief. No large currents or anything to worry about. The excess wire was just stuffed into the grip.
The completed, and final, buzzers (yes, I know what it looks like). 
The coding was a different matter, but fortunately I could work on this before the buzzers were all completed. I wrote the game in Python and used PyGame to handle all the graphics and input handling. The game is written such that the buzzers could be simulated with 1-4/5-8 for inputs so I didn't need a PiFace for local testing.

The source for the game is available here: https://github.com/SandyWalsh/trivia-box/tree/master/pi
It's a hack, so please excuse the mess. Patches welcome. There is so much more we can do with it. I have a YouTube video of the game play further down.

Then I set up for game night. Two teams of four players battle at any one time. Forty questions per game. Double elimination ladder for the full tournament. We had 8 couples (4 teams) which took about 3hrs to play through.


I asked the questions, so I was stationed at the end of the table. The RPi was plugged into a projector, then I had amplified speakers for sound and a keyboard for controlling the flow of questions. It's a console app, so no mouse needed.


My wife took care of all the other hosting duties ... here is the sugar cookie tray :)

Here's a demo of the TriviaBox software in action. The rules, flow and keyboard shortcuts are all explained in the source README file.

It was a great night. Everyone had a ball and the software/hardware worked perfectly. There is a lot more I could do with it. I'd especially like to do more around the tournament management ... controlling the win/lose status and the double elimination ladder.

Friday 13 December 2013

Portable Electronics Workbench

For years I've tried to do my electronics projects in the garage. It never works. Not enough light. Not enough power. Too cold. No access to my desktop PC for interfacing work. Just bad.

In fact, it was so bad the hobby suffered for it. I didn't want to get into my projects because it was so much work to break out the storage containers, dig around for what I needed and get started. I couldn't use the kitchen counter for any longer than a few hours without my wife wanting to strangle me. There had to be a different solution.

I wanted something I could wheel into my office, use and then wheel back into the laundry room when I was done. Completely self-contained and with a small overall footprint. But it needed to have ample power, light and storage.

I doodled out many different designs in OpenSCAD, but the idea of making a large wooden box just seemed too unwieldy. Then I noticed the wire-frame kitchen shelving we had in the pantry ... it might be perfect.
So, I measured out where the work height needed to be and added a shelf above for frequently accessed tools and I was ready to start filling it out. 

The first thing I added was a fold down shelf. This is a sturdy piece of plywood wrapped in some heavy vinyl and attached to the columns with screws. 

Here's the shelf folded down for storage ...
A side view of the desk folded up ... note the heat gun conveniently mounted on the side.
And the desk folded down for storage. 
Then I wrapped the whole middle section with painted peg board. Zip ties are perfect for this. It's a great storage area for the most frequently used tools like wire, screwdrivers, etc. Also the most frequently used test equipment: scope, multimeter, adjustable power supply. I also bring out +5 volts in a variety of forms: micro-USB, Arduino plug, etc. 

A really great prototyping board for doing analog and digital breadboard work. The killer Hakko soldering iron is there too. That thing can ramp up to 450F in about 10 seconds. So handy. 
On the back of the unit, I have a full size power bar mounted with zip ties. Plenty of power for everything ... although a second one would be nice. 
I have a permanently attached extension cord which stores on the back of the unit as well. 
Finally, some LED undercounter lighting and I have a great workspace. 
In the main storage area there are two sets of drawers with the common components.  
 Like Arduino's, shields, RaspberryPi's, etc.
Breadboarding wires and more breadboards ...
Larger, bulkier tools go in the toolbox. The magnifying visor (which these failing eyes need badly) is always handy.
Underneath storage is for less frequently used stuff and for all the electronic components. Power supplies. Specialty cables, etc. And then a large, 8-unit component cabinet.
 This is where the electronic components: resistors, transistors, chips, etc all go.

 I also store stuff on top, but may do something better with this (at least get it in a nice box)
On the left hand side I have an ethernet router so I can connect to the home network easily. 

And here's the final result ... now, bring on the projects!




Wednesday 31 October 2012

BBQ Smoker Follow Up

Been meaning to do this for a while, but the BBQ Smoker has been working great. Here's some pics of the final, painted and placed table. I have plans for automating the moisture and smoke in the chamber, but that will have to be on a followup post.

Here's the primed table. A final coat that matched the deck followed.
 Next my wife decreed that the terracotta pots had to be painted to look at little less DIY.
I used high temperature BBQ paint.
Turned out pretty well ... I kept the patterns in the pot, but my wife preferred I painted them over too.
Fits perfect.
Our nice little cooking corner is ready.
 And the first brisket goes in!

Monday 22 October 2012

My Travel Kit

I don't nearly travel as much as I used to, but many years of being Super Elite teaches you a few tricks. I'm constantly refining my travel kit for durability, size, weight and function. I thought I'd do a post to share my latest ensemble.

Rule One of travel: Don't Check Bags ... everything here is with that rule front and center.

The Suitcase

The cornerstone of every good travel kit is the suitcase. I've settled on the Zuca Pro, which is a beautiful carry-on bag (watch the video ... you'll be sold). It has organizer bags and a metal frame that has a built in seat. Since I'm a programmer, I'm always on the lookout for electrical outlets in airports. There are always outlets in the hallways, but never any chairs next to them. With the Zuca Pro, I've always got a seat. Don't confuse this with the Zuca Sport, favored by figure skaters. Note: the Zuca is 10" width vs. the regulation 9" width, but I've never been called on it.

The benefit of being a geek is jeans, tshirts and a nice shirt or two are usually all I need. I can get a week of travel in this bag and not have to do laundry.



Also, being a Zuca Pro owner is like being a Harley owner. Whenever you see someone else with one, you're obligated to go over and talk with them and congratulate them on their great taste. Yeah, sad but true.






Pro Tip #1: Don't get the colored versions. I've seen a few in the wild and they appear to chip quite easily.

Pro Tip #2: Don't carry the cover unless you think you're going to be checking the bag. The only valid reason to check the bag is if you're bringing home booze. The cover is nice and protects the zipper pulls, but takes a lot of room.

The Carry-On Bag

I've always been a Targus Backpack man. They make great bags that are incredibly durable. But recently I was given an Ogio Hip Hop Messenger Bag (thank OpenStack) ... and I'm kind of digging it. I much prefer two shoulder straps, but this one has a suitcase slip for going over the carrying handle of the Zuca, which is quite nice.

Suitcase + Carry-On Bag

These two things have to fit together well. They're going to be spending a lot of time together. As I mentioned, the Ogio slips over the carrying handle of the Zuca which is great, but it's top heavy. It can get tiring when you are lugging the two bags for a long trek. I much prefer the front hook on the suitcase where the carry-on rider in front. This keeps the center of gravity low and the two bags nearly balance themselves. Sadly, the Zuca has no provisions for a front hook and most laptop bags are too deep to permit this any more.

Don't do this when you're travelling. It's sad.

Inside The Carry-On Bag

Here's the magic really starts. Only bring what you need, and make sure you bring everything you'll likely need. A tremendous balancing act.


The contents:

  1. Audio stuff ... see below
  2. Travel papers wallet
    I've had this wallet for a long time. It holds my passport, Nexus card and hotel/car membership cards as well as a stock of customs declaration cards, etc. I'm sure I can get rid of much of this stuff, but I love having it all in one place.
  3. Nexus 7 tablet
    Now I can save my laptop battery for programming. Movies and reading is all done on this. The 7" screen is the perfect form factor. Note: I don't use phone/tablet cases, the only thing I carry is #8, the plexiglass stand (see below)
  4. Business cards, in a nice professional carrying case (thanks again OpenStack)
  5. Small power brick for laptop. One nice thing about ultrabooks, even the power supplies are smaller.
  6. Samsung Series 9 ultrabook. Best bang-for-the-buck currently. The matte screen is beautiful even if the clickpad and keyboard take a little getting used to. Looking forward to Ubuntu 12.10 to make full use of all the features like the backlit keyboard.
  7. the Ogio bag
  8. Targus tablet/phone stand. This thing is great. Nice solid feel. No need for cases and it sits on your leg nicely. 
  9. 2 amp USB chargers. 2 amp chargers aren't just for tablets, they also charge your phone faster. It's the way to go. 
  10. USB to USB mini cables. Everything I have is USB/USB mini ... nothing proprietary.
  11. Belkin power bar. This thing will make you friends anywhere. It has 2 USB chargers and 3 power sockets. If you're in a coffee shop or airport it's easy to jump in on any available plug. Even better, it has a rotating plug, so it can fit in anywhere (like that crappy outlet under your desk in the hotel room). Magic. It has a surge protector, but I don't care about that. 
  12. Lens/screen cleaners. I wear glasses, this is better than carrying a large bottle of liquid that can spill. Individually wrapped. 
  13. SIM cards. No more roaming charges. When I'm in the US or Europe, just slip in a different SIM card to get unlimited data and voice. Simple Mobile offers $40 unlimited for 30 days. Perfect. Of course, you'll need to unlock your phone for this (or buy a Google Nexus ... all Google phones are unlocked by default).
  14. Gum. 
  15. 10BaseT adapter. The ultrabook saves space by using this dongle.
  16. Bluetooth mouse. I prefer a full sized mouse. Bluetooth is great.
  17. Neck brace. FORGET THE HORSESHOE NECK PILLOWS! This $14 5" medical neck brace will keep you head from falling all over the place or your mouth gaping open like John Cusack acting. It's soft enough to compress small too. Best $14 ever invested. Sleep like a baby.
  18. Wallet. Custom made by some guy in Turkey so it would fit my Nexus phone and hold a few cards. Yes, it's larger, but it's my protection on my phone. I've gone the "minimalist wallet" approach before, but the sum total is about the same this way, and it protects my phone.
  19. mini HDMI to VGA adapter. If you're presenting, you need to support VGA ... most AV infrastructure still runs on it. 
  20. Cat5 crossover cable adapter. If I need to connect to another laptop/pc without a switch, this crossover adapter makes it easy. No need to carry two cables.
  21. RSA key for VPN
  22. Notebook and Stylus pen. I need paper for brain storming. The pen is a Targus 3-in-1 stylus/laser pointer for presentations.

Some other pictures of the items above:

Audio

I'm sure this will cause the most contention of anything written so far. Audio buffs are a funny lot.


I love music and need to have it around me nearly all the time. I've spent a lot of time refining my music bag-of-tricks.

  1. The carry bag. This stuff needs to be all in one place.
  2. Sub-mini to Sub-mini cable. For cars, boomboxes, whatever. If it doesn't have bluetooth, it should have this.
  3. Sony Ericsson MW600 Hi-Fi Bluetooth Stereo Headset with FM Radio. Wires are the enemy. This allows me to use whatever headphones I like with my laptop, tablet or phone. 
  4. For years I've gone with the large noise-cancelling headphones, but recently turned them in for something smaller. On those noisy flights, I find the in-ear headphones are just as good. However, for activity I've settled on the Sennheiser Adidas PMX 680 back-of-the-neck headphones. Love 'em. They stay in place when I'm scrambling to get off the plane (aisle seats ftw!)
  5. Griffin headphone adapter. Most headphones don't have a mike or click-to-talk buttons. This little adapter provides that functionality. Now I can get the best headphone for me and use it with any smart device (when I'm not using #3)
  6. Splitters and airplane adapters. For sharing and older planes. 
That's it ... I'm ready for action. I'll try to edit this post as things change.

Please share your travel tips!

Saturday 23 June 2012

The Quest for the Golden Banana

The Girl (10yo) invented a board game out of The Boy's Lego set. Turns out it's pretty fun, so I thought I'd share it here. 

Simple square board, first one to do a full lap around it wins The Golden Banana. But there are hazards!
The game supports up to four players. To start everyone picks a minifig token.

And everyone rolls a die to determine their starting position behind to flag. For some reason there is only room for three minifigs here, but I'm sure that's easily remedied. 
The lead player starts by rolling a single die and moves that many spaces. If they land on a green square, on their next turn they move backwards the die roll. Otherwise they move forwards.
If they land on a slippery square they miss their next turn.
If they land on this particular red square they face The Brothers. You roll a die a on an even roll you get The Wheel. On an odd roll you get The Dynamite. 
The Wheel attaches to the bottom of your minifig and you move 2x the die roll. If another player faces The Brothers and rolls an even they take your wheel from you. 
But if roll an odd and get the dynamite your head catches on fire and you miss 3 turns. The Brothers can be nasty.

Another hurdle is The Silly Spinner. If you land on this blue square you get to pick another player and stick them to the Silly Spinner. They get so dizzy they get lost and need to start at the beginning again. A terrible fate since there are so many green squares near the start.
If you make it all the way around, you win The Golden Banana and have full bragging rights.
I was pretty impressed. It's a quick, fun game. I'm sure there be revisions to come. The Boy says he likes it better than any of the real Lego board games.