I Like Big Buttons

The Premise

In early 2018, my friend Steve had an idea.  His church supports missionaries, and for fundraisers, they sell lunches to the congregation.  In the past, they had volunteers prepare and serve the food.  It was a lot of effort, and Steve thought that it could be improved.  He thought that having a restaurant make the food would allow them to charge a bit more for the food, and might draw more attention.  He was right of course, and now he wanted a way to engage the participants even more.  He wanted some kind of visual progress indicator.  something that would get people excited about participating in supporting the cause.

“What if we had a big button that people could push when they buy a lunch, and then have a big display of how many lunches we’ve sold?”

That sounded like a cool idea to me.  So, I set out to build just that.

The Architecture

button box setup
If this is a smart TV with a browser, the laptop can be eliminated

I tried to make this as simple as possible. No, really I did!  However, the constraints of the environment dictated otherwise.  I thought the simplest thing would be to have a button attached to a Raspberry Pi, which would be attached to a screen via an HDMI cable.  However, the display needed to be relatively far away from where people would be paying for lunch, and running a long HDMI cable was not acceptable.  Steve mentioned that they had an extra laptop that they could connect to the TV, so this seemed like a reasonable solution.

After some noodling, I decided that I’d have a big button box with a Raspberry Pi inside. The Pi would host a web server that publishes a page with the count on it.  The laptop connected to the TV would access the web page and display it on the TV.

Is this the simplest design?  Not by a long shot.  Would it be fun to build?  Absolutely!  I also like the idea that this solution is self-contained.  If the TV has a browser, then the laptop can be removed from the setup.

The Button Box Design

large button
That is one big button!
lit button
Ooh! Shiny!

The hardest and most interesting part of this project to me was the button box.  I’d been itching for a project to use the laser cutter at our makerspace, theLab.ms.  While I could have just used a tool to generate the dimensions of the box with appropriate notches for assembly, I decided it would be fun to figure it out on my own.  Here’s what I wound up with…

2D OpenSCAD layout
the 2D primitives in OpenSCAD were perfect for this project!

I made the first prototype with cardboard, which worked out perfectly!

Cardboard prototype
looks good so far!
cardboard prototype assembled
Everything fits with a reasonable amount of space for wiring

Happy with the results, I moved on to the 2nd prototype, which was made out of MDF scraps at the makerspace (I think I also got some hardboard in there, too).

MDF prototype bottom
All the holes lined up! The square plate on the lower left is the shutdown button.
detail on shutdown button
I mounted a momentary contact button upside down to serve as the shutdown button

Since this button box would be operated by non-technical folks, I decided I should add a shutdown feature to prevent damage to the SD card.  When the button is held for 2 seconds, a shutdown command is sent to the Pi.  Of course, nothing stops the user from just disconnecting power, but at least the capability is there.  Since the Pi doesn’t have any built-in capability to shutdown the OS, I added a momentary contact button to the bottom of the box to serve this purpose.

Everything was going great until I received my acrylic sheets.  I thought I was getting 3mm acrylic sheets, but I actually ordered 2mm acrylic sheets.  *sigh*.  But thankfully, I made the material thickness a variable in my OpenSCAD model, so I just needed to change that variable from a 3 to a 2, and adjust the placement of the power connector hole (that took a bunch of trial and error).

off my 1mm
PSA: 3mm does not equal 2mm

After the adjustments, I re-cut the box from the spare sheet of acrylic (always a good idea to get more than you absolutely need in case you make a mistake!).

final internal wiring
I really like the Perma-Proto hats from Adafruit!

To keep the wiring nice and clean, I used a Perma-Proto hat from Adafruit. I’ve used them in a few projects now and I’m hooked.  For the relatively small circuits I’m making, they’re perfect, and don’t add much to the footprint of the project.

finished box unlit
I like the way it turned out! Unfortunately, you can see along the top front edge where the acrylic cement leaked and marred the surface. A little acrylic cement goes a long way.
finished button box powered on and lit up
Who can resist a giant shiny button?

The RESTful Web App

I really enjoy projects that involve physical builds as well as software.  In the spirit of over-engineering things, I decided to make my counter a RESTful Web Service.  You can find the source code on bitbucket.  When the big button is pressed, python code sends an HTTP request to the web server, incrementing the stored count.  The web page showing the count updates every 1/2 second.  For the shutdown, holding the button on the bottom of the box sends another request that executes a graceful shutdown of the web server and the Raspberry Pi.

A Demonstration

Here is the whole thing in action!

Next Steps

  • Test it out in the target environment
  • I’d like to make the typeface fixed-width
  • There is code to set a target number.  I’d like to add some animation that is triggered when the goal is reached

The Rickrolling Toilet

The Idea

In 2015, my church decided to revive their Fun Fair event.  They encouraged folks to take a look at some of the old games and refurbish them if they were interested.  I found an old game called “Dunk It”.  It consisted of a toilet seat bolted to a green wooden frame.  The goal was to toss a roll of toilet paper through the hole of the toilet seat to win a prize.

My inner 5yo. thought this would be my game.  But, I couldn’t just leave it as is.  I needed to make some… improvements.  The premise of the game was simple, but it lacked something.  There was no feedback for the player.  So, I set out to give it a voice.

My first inclination was to use an Arduino with an audio shield.  However, I was trying to minimize the cost, so I thought I’d use something I  already had on hand, a Rapsberry Pi A+.  This would handle the audio, and the programming would be relatively simple.

Alpha/Beta Version

To prove the concept, I thought I would wire up a light sensor (Light-dependent Resistor) to the Raspberry Pi.  This was not as straightforward as I’d hoped, since LDRs are analog devices and the RPi only has digital I/O pins.  So, after a bit of searching, I found a technique to read analog values from a digital I/O pin using a simple circuit.

Once I got this wired up, I stole some code to make the LDR reading work.  I combined that with some code to play back audio and the alpha version was working…

Version 1.0

I foolishly ignored the advice to always put a resistor in series with an LED.  And it bit me in the behind.  An hour before the fun fair, the LED blew out, and I wasn’t able to leave and get a replacement.  Lesson learned.

Version 2.0

For Version 2.0, I wanted to make some significant improvements.  First, I wanted to make a more realistic “experience” for the players.  I was able to secure a toilet on freecycle (I love freecycle).  After sanitizing it, I set to work wiring up the LED in the bottom of the bowl.  This had the added benefit of making the code simpler.

I also wanted to improve the sound for the game, so I got an inexpensive power amp and car speakers.  I mounted the speakers on the snazzy new platform with locking casters.  This made the whole thing much easier to move around.

Version 3.0

For version 3.0, I wanted to clean things up significantly, and make it easier to assemble/disassemble.  I mounted the amp and Raspberry Pi on a board, that attaches to the inside of the tank with Velcro.  I also used a connector for the sensor instead of being wired to the board.

all components mounted to a single board
I wired up the circuit on a proto hat and added a connector for the LDR so that it was easier to connect/disconnect

Debug mode with monitor and keyboard
What toilet wouldn’t benefit from a debug monitor and keyboard?

Version 3.1

I added a shutdown button for the system so the SD card doesn’t get trashed, and the Pi shuts down gracefully. and covered the wires with some flexible split tubing.  I also added some code to avoid repeating the audio if the sensor detected darkness at the end of the previous audio playback.  Finally, I added some other… apropos sounds.

I bet this is the first time the words “graceful” and “toilet” appear in the same context.

Shutdown button on the Pi Hat
I added a shutdown button. This puts my mind at ease by gracefully shutting down the Pi.

Possible Improvements:

  • I’d like to use the flush handle to perform the shutdown/recalibration

Resources

the garden of nerdy delight

<This is an old draft I just finished. Oy!>
We just received a brand new Foundry FastIron Gigabit switch at work. It’s to be used in our new network-based editing configuration. I’m testing it out to see if it will handle 8 simultaneous video captures. Here’s the boot message from this bad boy:

FGS Boot Code Version 02.4.00
Enter ‘b’ to stop at boot …
BOOT INFO: load monitor from primary, size = 84371
BOOT INFO: load image from primary…….
BOOT INFO: bootparam at 00049268, mp_flash_size = 001dc352
BOOT INFO: code decompression completed
BOOT INFO: branch to 00400100
Starting Main Task …
Parsing Config Data …

FSecure SSH is included in this product

SW: Version 02.4.00cT7e1 Copyright (c) 1996-2006 Foundry Networks, Inc.
Compiled on Sep 06 2006 at 16:40:46 labeled as FGS02400c
(1950546 bytes) from Primary fgs02400c.bin
BootROM: Version 02.4.00T7e5 (FEv2)
HW: Stackable FGS624P
=================================
Serial #: CH42060189
P-ASIC 0: type D804, rev 01
=================================
400 MHz Power PC processor 8245 (version 129/1014) 66 MHz bus
512 KB boot flash memory
8192 KB code flash memory
128 MB DRAM
The system uptime is 2 seconds
The system : started=cold start

FGS624P Switch>
Power supply 1 detected and up.
PowerPC, eh? Pretty slick. It must be one of those embedded jobbies from FreeScale. With 128 MB of RAM, this is a pretty serious switch.

<EOL>

in memoriam green iPod mini

Green iPod mini

After several months of searching high and low, I’ve given up. I’m beginning to accept the fact that my green iPod mini is lost. I’ve looked everywhere, and have racked my brain trying to remember where I last saw it or used it. The odd thing is that I still have the docking cable. I always took the cable with me if I was going to be away from home for more than a normal day.

I think the thing I’m saddest about is the sentimental value of greenie. A2C gave me greenie when we were dating. I remember it was just before we got engaged. She had just returned from a trip overseas. We were hanging out in her room, and were catching up and talking about things. I told her I loved her, and she replied as she always does with, “You do?”. Only this time, she continued, “Oh good, then I have something for you!”. She jumped up and began digging through her closet. In a few moments, she produced a new iPod mini and a protective case. I was floored, as it was a pretty extravagant gift (to me, anyway).

If I were to pick an iPod myself, it would have been green. It was so nice to have something I’d use all the time to remind me of A2C (not that I needed reminding or anything). I got lots of good years out of that iPod, and I must say, I think the minis are still my favorites. I’ve not tried out the nano (older or newer), and quite frankly, I’m not all that interested. Half due to the fact that I read more than listen on my daily commute these days, and half because I’m not so enamored of all things iPod as I once was. That being said, I’m slowly becoming more and more interested in the iPhone. Must… resist… temptation… shiny…

<EOL>

holy small form factor, batman…

Back in 2002 or so, I became fascinated with small form factor computers. Those of you (okay, *both* of you) who have followed my blog for any time have probably noted this fascination.

There’s something about the shrinking size of all that computing power that really appeals to my geek-ness. I think it’s the possibilities that are opened up for putting powerful computers into more and more everyday things, like toasters, cars, appliances, etc. Or, it could be that the shrinking size of my living space has necessitated replacing all those huge, power-guzzling, noisy boxen of yore with svelte, silent, cool-running machines of the future.

Of course, Apple’s Mac mini is on my wishlist of small computers to add to my collection of small powerhouses, but today I read an article about the new pico-itx form factor designed by VIA, the leader in small form factor design. Prior to the availability of the Mac mini, VIA were the ones to watch in the SFF arena. The mini brought more features, slightly smaller size, and impeccable style to the table. To be honest, the offerings in SFF with regards to visual impact are pretty sorely lacking. I have found that Casetronic has the most attractive cases in the market, aside from Apple.

comparison image shamelessly linked from mini-itx.comSo the new Pico-ITX form factor reference design is targeted to consume about 1Watt of power under normal usage! Pretty amazing. This combined with RoHS compliance, I believe, are helping to push the industry toward lower and lower power consumption and better environmental impact.
Anyway, enough of my rambling.

saying goodbye to an old friend…

right side viewBack in my college days (seems like ages ago now), I assembled my first PC. Ah, the memories. I hand-picked my components, trying to achieve the perfect balance of cheap, good, and fast. I had selected a motherboard and CPU combo with a 486 DX2-66MHZ processor, and 2 VLB slots and 6 ISA slots. I put in my 4 MB RAM from my first computer and lived with that for a while until I bit the bullet and added 4 MB and then another 4MB, eventually having 12MB RAM. I got a SoundBlaster AWE-32 which, at the time, was *the* top-of-the-line sound card. I also got a 2X Sony CDROM drive so I could play Myst. For the graphics card, I selected a 1MB VRAM STB Powergraph 24. 640×480@24-bit color, baby (my 14″ IBM monitor couldn’t handle resolutions above 640×480). For the communications (had to get on the ‘net!) I chose a Zoltrix 14400 model. This was a *huge* step up from my measly 2400baud modem that came with my PS/1.

I also purchased a 1GB Seagate ST31220A Enhanced IDE hard drive. A mere 3 months before, it debuted at $1000. I picked up that bad-boy for a mere $500 and change. What a deal! With it, I had to get a VLB disk controller, since the mobo didn’t have a built-in HDD controller. The last piece I needed was a case to stuff all these totally ‘leet components into.

On the way home from a somewhat long night of revelling, I stumbled past the local computer shop and beheld the most interesting case I’d seen to date. The design was interesting, but not overdone, and it seemed large enough to house the many upgrades I envisioned for my perfect machine.

3/4 front view

This case lasted me several years and many fun upgrades. And, many sleepless nights fearing that I’d completely screwed something up. I remember playing Doom with an audio CD playing in the background (Usually Smashing Pumpkins). This required a TSR (terminate and stay resident) driver for the CDROM drive. Oh yes, did I mention the not-so-leet Labtec speakers? “Tiny and Tinny” was their claim to fame but for the college dorm, they were enough.

Its first rejuvenation was the move to a Pentium 100 on an Asus P/I-P55TP4XE with upgradeable pipeline burst cache (which I bumped from 256KB to 512KB). This beast had 24MB of RAM, an MPEG-1 Decoder card (the docs were all in Korean, but hey, it was free). I also splurged on a 17″ Sony CPD-17SF-II Trinitron monitor which was driven by the amazing, all-powerful Number9 Imagine 128 4MB VRAM PCI graphics engine. 24-bit color at 1152×864. I also decided to get into digital artwork and purchased a Wacom 4″x5″ tablet. Sweet. I decided to upgrade the mouse to a Logitech Mouseman Serial 3-button mouse. Count ’em and weep! I also bumped up my keyboard to a Microsoft Natural (the big honkin’ original, not the Elite). It was on this machine that I first installed Solaris x86 and Linux (Redhat, then Slackware).

left side viewEventually, I upgraded, as the case had the worst arrangement for the drive cage. Any maintenance required disassembling the entire drive subsystem, which was a lot of work back in those days. I kept the old case lying around, and eventually revived it with old parts salvaged from discarded PCs (I believe it was a Pentium in the 150MHz range), and finally, I purchased overstock components and it lived out its last days as a 1GHz Celeron with 256MB RAM on an Epox baby AT motherboard (they actually made baby AT motherboards after the turn of the century!) The mobo/CPU/RAM live on in my current linux box, but that’s another story. As you can see, it also acquired a mass of stickers. The kana on the left side is the hiragana for my english name. I lovingly glued, X-acto knife’d out the excess, and taped over it with clear packing tape to preserve it for all time.

So, It is with misty eyes and a heart swelling with emotion that I bid a fond farewell to a trusty but finicky old friend. You will be missed.

the last place you’d think to look…

Way back in tha halcyon days of the late 90’s when USB was young, and the women were glad of it, I decided to go all USB for my peripherals. At the time, it was hard to find a BIOS that would use a USB keyboard to boot from. Over the years, I’ve chewed through a few USB hubs, and several mice, keyboards, scanners and printers.

Recently, I decided I wanted a full-time Linux box around, and I wanted to share my monitor, keyboard and mouse between it and my Windows box. Now, you may be thinking, “why, oh why would you not just buy one of those cheap-as-dirt KVM switches that are on the market today, that even include cables?”.

Of course the answer to that is that I’m cheap. I already have the video switching capability in my monitor, so I just need a solution for the K and M portions. I hooked up the keyboard and mouse to the USB hub, and then have 2 wires that rest near the hub. One connects the hub to the Windows box, the other to the Linux box. This way, I need only reach a few inches, pull a plug, and push in another. Pretty decent solution, right? right?

Well, for some reason, having the mouse connected via the hub causes it to lose communication with the computer to which it is attached. This was not news to me, I had observed this behavior many times in the past. At the time, the solution was to connect the mouse directly to the PC. This is no good in this scenario for obvious reasons. The mouse is a basic Logitech First Mouse with a wheel. The keyboard is the Microsoft Natural Elite (though I have nothing nice to say about their software, their hardware is pretty decent. Not that they actually make the stuff.) Anyway, I noticed that after a few moments of inactivity, the mouse would no longer move. If I reinserted the mouse’s USB connector, all was good until another period of inactivity. This is absolutely unlivable. No way this is flying. What’s the deal? Maybe the hub sucks? It’s an unpowered hub, but it can be plugged in if the power requirements so dictate.

Of course, I googled the problem. I noticed a lot of posts regarding bad mouse drivers for various mice, and a lot of similar inquiries regarding the hub. Then it dawned on me. Could it be the mouse itself? To test the theory, I turned to my trusty Drawer of Many Things™ From its depths, I pulled a Microsoft USB mouse. I plugged it in, and there were no issues with loss of communication via the hub. Odd. All these years, I never knew, and just suffered with the crappy mouse. I don’t prefer the MS mouse, but in this case, I’ll just have to deal. I’d rather have a system that works reliably, than have a nice mouse that doesn’t work so well. *sigh*

<EOL>

cable guy

So a few weeks or so after the wedding, I walk into the computer room at home, and notice that my Windows machine (which had been running for a few months with no issuues) is at the BIOS screen. “okay”, I think, “something small has happened and I’ll just reboot.” Uh-uh. The SCSI controller is complaining that it can’t make its wide negotiation with one of my drives (the 80GB 10,000RPM guy). Well, it says to check the cables, but I hope that’s really the problem. So, I never get around to fixing it because I’m so busy getting the rest of the house in order, living the married life, and working.

So finally, last night, I decide to take a look and see what the problem really is. I disconnect the cables from both hard drives and the adapter doesn’t complain. Good. At least that somewhat eliminates the adapter as the problem. Now, I hope it isn’t the drives. So, I reconnect the drive that wasn’t having issues, and the controller complains that there’s a termiation problem and that I should check the cable. Great, this is pointing more and more to actually being a cable issue. so, I replace the cable with another SCSI cable (happen to have 3-4 68-pin SCSI cables lying around) and voila! It works! no complaints from the controller, so I think that was the issue. A huge sigh of relief 🙂

<EOL>

iPod mini annoyance: fixed

I love my iPod mini. The one annoyance I had with it was that when it wakes from a deep sleep (not used for 36 hrs), it loses some settings. Primarily, the one that annoyed me was the cliker settings. I generally set it to off, to save power, and so it doesn’t, well…, click. There were also issues about the main menu items and all that, but it didn’t bother me so much.

As of the newest firmware (1.4), they have fixed this issue. Thank goodness! Unfortunately, they broke the Smart Playlist feature. You see, the Smart Playlists on the iPod would update if you changed some attribute (typically the rating) of a song on the iPod. Now the feature only works while you’re in iTunes. This is supposed to be fixed.

John Gruber has some interesting views on the podcasting phenomenon, and why Apple had to release new firmware and iTunes.

<EOL>

Nerd Badge of Courage

So, I just signed up for an account on an OpenPower Project machine in Germany. Power as in PowerPC – the chips that have been powering Macs for the last decade+. It’s sponsored by IBM.

You are allowed to develop and run code on this platform pretty much as you like. They’re trying to get interesting development projects happening in an atmosphere of sharing and innovation. Pretty cool if you ask me.

What am I going to do with it? Who knows. Mostly just play with some test code and benchmark it with other platforms. Plus, it gives me a +5 in geek cred 🙂 Should be fun!

<EOL>