Archives for posts tagged ‘arduino mega’

mustache-themed Hi-Striker

histriker

So Crushtoberfest is approaching again, and the party plans are in full swing. In case you missed it, Crushtoberfest ’08 was the house party that capped off a six week mustache growing contest among BDC employees and their friends and families. Last year’s feat-of-strength competition featuring the Captains of Crush grippers was a huge success, so we decided to step it up this year.

We liked the idea of a Hi-Striker, the classic carnival game where you swing an oversized hammer and try to ring the bell. But renting a Hi-Striker is not cheap, and we saw the opportunity to build something awesome. So going with the vague carnival theme (and the overt mustache theme) I generated this concept sketch for an electronic Hi-Striker, featuring a larger-than-life Tom Selleck head with light up eyes and fireballs shooting from his ears.

Here’s the plan: The contestant will strike the rubber pad with the hammer, compressing the sealed rubber hose under it. An air pressure sensor attached to one end of the hose will generate an analog voltage (up to 5v), the Arduino Mega will read the voltage and light up the LEDs according to a predefined scale. If the hit is a “ringer” then the LEDs will light all the way to the top, Tom Selleck’s eyes will light up, and fireballs will shoot from his ears. BTW the fireball effect is a flash paper/model rocket ignitor thing we worked out for last year’s party but never used. We also plan to have sound effects go with the LEDs, using the Adafruit Wave Shield for Arduino.

Stay tuned for more.

LED wiring

The Arduino Mega has 54 digital I/O pins, 50 of which are each driving an LED on the Hi-Striker. Each pin can drive up to 40mA, so the only additional components needed are one 100k current-limiting resistor per LED.

For testing, a simple cascading loop runs through the (first 16) LEDs one at a time:

const int ledCount = 16;    // the number of LEDs in the bar graph
int ledPins[] = { 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 };   // an array of pin numbers to which LEDs are attached

void setup() {
  // loop over the pin array and set them all to output:
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    pinMode(ledPins[thisLed], OUTPUT);
  }
}

void loop() {
  // loop over the LED array:
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    digitalWrite(ledPins[thisLed], HIGH);  // turn on the LED
    delay(20);                             // wait
    digitalWrite(ledPins[thisLed], LOW);   // turn off the LED
  }
}

Hi-Striker control panel

Yesterday I finished the control panel for the Selleck Striker and started hooking it up:

controlPanel

reset button – Before a new contestant hits the striker, the reset button clears the LEDs, then checks the difficulty setting and applies any changes. It’s a SPST, switching 5V from the Arduino to one of its analog input pins. High on the pin = reset.

play/demo switch – Demo Mode plays a scrolling LED effect, Play Mode waits for a change in the pressure (like a hammer strike!). This is a SPDT (though I could have just used a SPST) switching 5V from Arduino to one of its analog input pins. High on the pin = Demo Mode, low on the pin = Play Mode.

analog_inputdifficulty knob – Just a 100K potentiometer that sends 0 to 5V to one of the analog input pins. This will allow us to adjust how much force is needed to get to the top.

score display – This 3-digit numeric LED display will show the “score” of the strike. I’m still not sure how I’ll calibrate it, but the idea is that you get a finer resolution score than the 0-50 LEDs in front. I’m thinking of having this also display the “difficulty” setting when you twist the knob.

striker connector – This is an RJ-45 connection for the striker portion, so that the two halves aren’t permanently tethered to each other. I’m only using three of the eight conductors.

audio out – This 1/4″ mono jack will send sound effects and other audio to the sound system.

Also note the the three Arduinos in the bottom of the photo. The Mega on the right will handle the LEDs and input elements, the NG in the middle drives the 3-digit LED display, and the Duemilanove with the wave shield on the left plays the sound effects. They’ll be communicating via their serial ports.