Introduction: Marble Disorder - a Marble Maze Simulator With Tilt Switches

Picture of Marble Disorder - a Marble Maze Simulator With Tilt Switches
Marble Disorder is a borderline case of Marble Madness :)
It simulates a marble maze by sensing the box's orientation with 2 tilt switches.

Stop the press: there's a new and more intuitive version that doesn't require the spin knob (See video).

I keep documenting the original version below for historical purposes, but don't watch this - watch that.
Bonus game: The Marble Disorder box is compatible with Ariadne. (the only difference is the tilt switches).
Build once, play twice :)

Step 1: Hardware and Software

Picture of Hardware and Software
Note: the new version is a bit different (and requires less components).
It is advised to build the new version (much more fun to play).

Hardware
 You'll need:
  • An Arduino
  • A Hitachi HD44780 compatible LCD display (I used 16x2, but 20x4 should work too)
  • 2 tilt switches
  • A pushbutton
  • 3 10K Ohm resistors (pull-up for the tilt switches and the buttons)
  • 2 10k Ohm potentimeters (one for spin control and [an optional] one for LCD contrast)
  • Optional piezo speaker
See breadboard diagram.

Software

The code is here.
The maze generation algorithm is the same as Ariadne's (See explanation there).

If you connect the piezo speaker, you can mute it by setting MUTESOUND  to 1.
Actually - this is the default :)
Why have the speaker and mute it? Glad you asked:
Like I've mentioned, you can also run Ariadne's code on this box.
Ariadne only beeps when you hit a wall (i.e. you've made a mistake). This can be avoided.
Marble Disorder beeps whenever there's a spin (i.e. when both tilt-switches allow the marble to move to 2 different cells, and the spin potentiometer determines which one).
This can't be avoided - so you end up with a pretty noisy game. It does help play the game - but I'm not sure it's worth the hassle of all those beeps.
Another option is to put a switch on the piezo speaker (something my Electronic Brick shield doesn't allow).

Step 2: Construction

Picture of Construction

I'm the last person to teach anyone how to do stuff in the physical world, and anyway - you'll most probably need to do it in a different way (I happened to have an Electronic Brick kit and a SeedStudio harness), but cutting a transparent Tupperware clone seems like a nice and easy way to do it.

Let me know (and show some photos) if you make your own box. I'm sure it would look nicer than mine :)

Enjoy,
@TheRealDod

Step 3: Playing the Game

Picture of Playing the Game

Note: the new version is a lot easier to play (so easy - it doesn't even need instructions).

This step is kept here for historical purposes.


Playing the game
is almost as intuitive as playing a physical marble maze. The only difference is that tilt-switches don't have a neutral state: The tilt is always NE/SE/SW/NW and there's no way to tilt the maze N/E/S/W. Most of the time this doesn't matter, because if - for example - the tilt is NE, and there's a northern or eastern wall - the marble only has one way to go.

What happens when the marble can "chose" between 2 options? In that case - the marble's spin (controlled via the potentiometer) determines whether the marble takes the direction that is more clockwise or the counter-clockwise one. See photo and annotations below.

This doesn't mean you have to ride the spin-control knob constantly. Usually, if you can't go where you want with the current spin, it would work fine on the way back. In the rare cases where the spin does matter, you stop at some corner, adjust the spin and continue. Takes some practice - but not too much.

Enjoy,
@TheRealDod

Step 4: Update: V2 - a Spin-free Version

Picture of Update: V2 - a Spin-free Version
I was reading what I wrote in the previous step: "tilt-switches don't have a neutral state saying "The tilt is always NE/SE/SW/NW and there's no way to tilt the maze N/E/S/W" and then I felt so stupid I could kick myself: why not rotate the switches 45 degrees and and ditch the spin altogether? So that's what I did.


As you can see in the video and photo, the tilt switches now point NW and NE (instead of W and N). This means that what you get is what you deserve: a sing N/E/S/W heading, no spin attached. I'll try to upload a video soon. It's as intuitive as candy for a baby.

This means that we no longer need the potentiometer, and the piezo speaker does nothing in this version either, but I wouldn't ditch them (unless you need them urgently for some other project), since this keeps the box Ariadne compatible.

One more improvement is that pressing the button pauses the marble (see photo). If you can't take a sharp turn - simply pause before you make it and make sure you got the box tilted right. If there was justice in the world, there should have been a penalty in the score for this (e.g. paused time is counted twice), but it works on an honor system at the moment :)

The code is in the same place, but you should use marble_disorder_v2.pde instead of marble_disorder.pde.

Comments

gzaloprgm (author)2010-12-06

Cool, but next time use a graphical lcd (128x64 for example), and an accelerometer and it will be way cooler...

thedod (author)gzaloprgm2010-12-06

You're right, but this is all I have at the moment. I've only made a single mail order since I got a bare-bones freeduino (about a month ago). I've ordered 2 things that were called something like "starter pack" and I'm playing with what I got.
An accelerometer and an OLED are on my wish list (so sooner or later I'll most probably write what you propose, and maybe throw in a few treasures and monsters once I'm no longer limited to 8 glyphs), but it will take some time before I can make another mail order (moving soon to the other side of Thailand, so no snail mail address and not much money at the moment), and then it's servo time (robotic traditional Thai shadow puppets).
Glad you like this. Thanks.

dread (author)thedod2012-01-26

Robotic shadow puppets is something you MUST video if you do it. Excellent idea.

About This Instructable

3,857views

5favorites

License:

Bio: Sucks at soldering, compensates with coding. Twitter: @TheRealDod Twister/github/etc.: @TheDod Diaspora: thedod@diasp.de
More by thedod:Cheap solderless reset button for Raspberry PiMake Seedstudio's I2C LCD monitor work with an old ArduinoThermoscope - 16x2 LCD thermometer with S/M/H graphs
Add instructable to: