So... I might have gone a bit quiet over Hammer Pong recently, but that doesn't mean it hasn't taken over my life these last couple of months!
I've never been much of a handyman - so the most stressful part of this build for me was putting together
the structure of the thing; Things started going wrong from the start when I bought a couple of large MDF sheets from the local DIY store - before realising they wouldn't fit in the back of the car (OK, they were totally bigger than the car). They wouldn't fit in the taxi minibus I called either - so I had to gingerly wheel them back up to the counter for a refund and then order them online, d'Oh!
I was still having my DIY nightmares a few weeks later trying to paint it all in the back garden (flies, leaves, fur from the pet rabbits getting stuck on everything) as well as trying to find some place to store such the thing in my house without it getting scuffed, scratched and generally messed up (I can see why proper artists have proper studios!)
Anyway, finally it all came together and after a couple of days getting it installed and operational at Woking Lightbox gallery I can finally breathe a long sigh of relief and let my big clunky baby fly the nest!
So if you are really interested in how it all works, read on, we have a lot of catching up to do...
First off I moved all the game code to an Arduino Due since it had the clout (memory space and instruction clock speed) to drive six WS2812 LED strips in parallel without resorting to assembly language or programmable logic. Although I am not sure it was entirely essential, I also buffered the data lines to the strips through 74HCT541s to get nice solid 5V edges for the WS2812's
The large fairground style LED assemblies are all driven from a 24V supply using power transistors to switch on the low side. The transistors are driven by 74HC595 shift registers. I used TIP120's on the large 7 segment display (each transistor switches 3 LED assemblies) but for the single yellow LED assemblies I simplified things by using ULN2803A arrays instead of the TIP120's (At 24V the current is pretty low)
I also decided to add sound - first off I experimented with the fascinating Mozzi synth library (running on a separate Teensy 2 board that I planned to send MIDI to from the Due). After blowing up one amp module (I don't think class-D amps cope well with unfiltered PWM input signals :\) I tried a different amp and was getting a lot of static (eventually I found out this was because my Mozzi output was very low due to a code issue, and upping the gain on the amp added horrible levels of noise).
Anyway, I had to give up on Mozzi (a reflection on my lack of time, not the library itself which looks amazing) and did some very basic sounds using the Tone library. These still run on a separate Teensy, since the Due spends so much time updating the strips (with interrupts disabled) it can't generate Audio at the same time. With hindsight, basic bleeps and bloops do fit with the feel of the game. The winner even gets rewarded with a very crude couple of bars of "If I had a Hammer"!
So all was looking good - I had several components which all tested fine individually and all I had to do was hook them up. Simple!
Well... first issue - my lovely "audio hit to MIDI" converter worked wonderfully, but when hooked up to the serial input of the Due (yes the one that spends all its time bit banging LED strips with the interrupts suspended) about half the MIDI bytes got dropped at the serial input (since the interrupt to buffer them didn't fire before the next byte came in). Quelle suprise! Well, since I wasn't using the hit velocity anyway (I decided it was a bad idea to encourage any additional violence) I swapped the serial connection for a couple of simple HIGH/LOW data lines.
Except... my PIC that reads the audio input runs at 5V but the Due runs at 3.3V and it's inputs are not 5V
tolerant. So, I decided to configure the PIC output lines as inputs (high impedence) allowing the lines to
float high to 3V3 on the Due's pull-up's and just drive them LOW to signal a hit. Great idea! ...but I managed to mess it up.. when I went to install the piece I hadn't got the latest firmware on the PIC (thats fine I thought, I could flash it from my laptop when I got there)... But the older version of SourceBoost C on my laptop did not support the PIC16F1825 and I didn't have the license key to upgrade it (as it was on my desktop back home) Aaaarghh!!!
I kludged it in the end. At least I had the foresight to take the soldering iron with me and I moved the signal lines to the indicator LED lines (the LEDs were all working fine). By attaching the Due input to the point where the 1.5K series resistor connects to the LED I believe/hope/pray that the voltage at this point when the high side of the resistor is pulled to 5V is going to be something like 2V and well within the safe limits of the Due inputs. Anyway it works...
With those dropped character serial problems in mind, I changed the Teensy sound generation code to expect single character messages to trigger sounds, rather than MIDI messages. I struggled a bit with the Teensy Serial.read (yes now I know that Serial1 is the hardware port and Serial is USB!) but eventually I have sounds, inputs and it all seems to be working. Woop!
Hammer Pong will be showing (among loads of other cool things!) as part of the Giant Electronic Art Show at the LightBox gallery (http://www.thelightbox.org.uk/events1/july2014/15july2novgiantelectronicartshow) in Woking, Surrey UK
Project source code is available here: https://github.com/hotchk155/HammerPong
|Planning the digits layout (started with a drawing from a data sheet!)|
|Back board with digits laid out|
|With base, struts and cylinders|
|Adding the additional panels|
|The big day, in the back of the van|
|Backplane wiring and LED drivers|
|Power supplies, Due, Teensy, Buffer/Level Shifters, Input Board and Audio Amp|