Part 1: How I got started with Arduino.

See also: Part 1, Part 1b, Part 2, and Part 3.

I remember hearing about some open-source hardware platform with a weird name a few years ago, but at the time I had little interest. I thought my hardware days were behind me, and even when they weren’t, I was never really in to hardware that much beyond soldering cables and making simple circuits. This is the story of how all this changed.

But first, allow me to regress…

In September 2012, I was helping out at a local haunted house at Sleepy Hollow Sports Park in Des Moines, Iowa. My association with them began in 2004 when they were starting to work with Festivals International to build the permanent home of the Des Moines Renaissance Faire. When they found out I was a “computer guy,” I was asked if I knew much about electronics and automation. This led me to building prop controller boxes (based on the EFX-TEK Basic Stamp Prop-1 boards) for their haunted houses.

My little boxes, built using as much off-the-shelf RadioShack stuff as possible (to allow for quick local repairs if needed), would trigger 12V solenoids that controlled pneumatic pistons to move various props or figures. We built a motion-activated gas chamber prop (complete with gas, lights, and several animations including standing up), and several other pop-up type figures. The first test-run of the gas chamber prop can be found on YouTube:

It was a great learning experience, and I wrote a BasicStamp program that allowed multitasking two (or more) prop sequences in the same box. I later found out this was written about by Jon Williams in an article found in Nuts and Volts magazine (available here as a PDF file, though he misspells my name). If there is ever any interest in BasicStamp programming, I would be happy to share more on those projects as well.

Anyway, I didn’t really do anything again with hardware until last year, instead focusing more on audio and video effects. In 2011, Sleepy Hollow brought on a local hauntrepenuer named Nathaniel who had been doing very elaborate backyard haunts in Urbandale, Iowa for years. Nathaniel introduced us to PC-based show control systems. We tested out his system by converting the “Torture Chamber” museum at the Renaissance Faire in to a computer controlled light and sound tour… And suddenly had lines never seen before at the attraction. A pre-opening test video can be found on YouTube:

The wiring of lights and speakers in the torture chamber was just the beginning. We continued to wire up the entire haunted castle (which was not open during the Renaissance Faire) and had our own Haunted Mansion style experience that October, complete with a ghostly narrator that followed guests from room to room. A duplicate computer system was used to run a pre show and some lighting effects at a new laser tag zombie shootout attraction. It was a ton of work, but a great learning experience.

And that’s where the Arduino came in. Or would, a year later.

In 2012, we did further upgrades to the torture chamber, haunted castle, and zombie shootout, and even added an all-new haunted house. The hobbyist-grade software we were using was already having difficulties keeping up. We had encountered several issues with it the past season, so we began to explore various other options. We even evaluated some high end professional products like Venue Magic. Unfortunately, there wasn’t a budget for something like that so we had to make due with cheap netbooks and whatever we could cobble together.

However, during our evaluation of Venue Magic (initially in a trial “runs forever, but cannot save” mode), I started exploring how it handled inputs. It did not support any of the input hardware we already had, so we looked in to some other solutions (in the $150 price range). They all seemed expensively complex for our needs. The cheap interfaces we had acted like simple USB serial devices, sending serial data when a switch was triggered… which gave me an idea.

At work, someone had an old Arduino Duemilanove. I borrowed it over lunch and found that it could easily act as a USB serial device, and quickly had something hacked together that would read the status of the digital input pins and emit a letter for each pin triggered. My original code looked something like this:

#define DI_PIN_START  2
#define DI_PIN_END    14
#define DI_PIN_COUNT  (DI_PIN_END-DI_PIN_START)

int pinStatus[DI_PIN_COUNT];

void setup()
{
  // Initialize the pins and pinStatus array.
  for (int thisPin=0; thisPin < DI_PIN_COUNT; thisPin++ )
  {
    pinMode(thisPin+DI_PIN_START, INPUT_PULLUP);
    pinStatus[thisPin] = digitalRead(thisPin);
  }

  // Initialize the serial port.
  Serial.begin(9600);

  while(!Serial) {
    ;
  }
}

void loop()
{
  int status = -1;

  for (int thisPin=0; thisPin < DI_PIN_COUNT; thisPin++)
  {
    status = digitalRead(thisPin+DI_PIN_START);
    // Is pin status different from last time we read it?
    if (pinStatus[thisPin]!=status)
    {
      pinStatus[thisPin] = status;
      Serial.println(char((97+thisPin)-(status*32)));
    }
  }
}

On startup, it would read and store the current state of each pin, then in a loop, if a pin changed, it would print either an UPPPERCASE or lowercase letter, based on the pin. Pressing and releasing the first pin would send “A” then “a”, for example. This proof-of-concept showed it would work, and I went down to Radio Shack and purchased my own Arduino Duo to begin experimenting.

I will share more code in future posts, and explain how that simple bit of code turned into something much more elegant.

To be continued…

5 thoughts on “Part 1: How I got started with Arduino.

  1. Pingback: Part 2: From pressure mats to serial output | Appleause

  2. Pingback: Part 3: Debouncing digital inputs. | Appleause

  3. Pingback: Part 2: From pressure mats to serial output. | Sub-Etha Software

  4. Pingback: Part 3: Debouncing digital inputs. | Sub-Etha Software

  5. Pingback: Part 3: Debouncing digital inputs. | Sub-Etha Software

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.