Here's a schematic for setting up an animatronic War Machine cannon with sound effects.
This uses the Arduino micrcontroller, which is very low cost and easy to use
There's more info about Arduino here-
http://arduino.cc
Lots of different companies build Arduino boards and I buy mine from Sparkfun-
http://www.sparkfun.com/commerce/categories.php?c=103
The easiest board for first timers to use is probably this one-
http://arduino.cc/en/Main/ArduinoBoardDuemilanove
The nice thing about the Duemilanove board is that it has built in USB, shield compatibility and 3.3v output for powering sensors so it's very easy to use. A shield is simply a board that plugs on top of the Arduino board and allows you to connect stuff like sensors and additional electronics.
There are all kinds of shields but for this what you want is a prototyping shield like this one-
http://www.sparkfun.com/commerce/produc ... ts_id=7914
Adafruit sells a nice one as well-
http://www.adafruit.com/index.php?main_ ... ucts_id=51
Once you get an Arduino you need to upload some code- you simply cut and paste it into the Arduino window, hit verify and then upload and you're good to go.
For getting started with Arduino there are some great tutorials here:
http://www.ladyada.net/learn/arduino/index.html
So this diagram shows how you would connect a Wii Nunchuck and the other necessary electronics to an Arduino. The Wii Nunchuck has four wires- red, white, green and yellow. The red and white wires are for power and ground so they are connected to 3.3v and ground pins. The green and yellow wires are for data and clock and are connected to analog input pins 4 and 5. Simple.
On the opposite side are the output pins. Pins 4,5,6 and 7 are for connecting servos. Servos have 3 wires- signal, power and ground. The signal wire is the yellow wire and power is red and ground is black. Sometimes the signal wire is white depending on servo brand. The signal wire is connected to the Arduino output pin. A note about servos and microcontrollers- servos generate a fair bit of electrical noise so it's best to provide them with their own power supply.
Pin 10 is an output for connecting a sound board- I use the Adafruit Wave shield-
http://www.adafruit.com/index.php?main_ ... ucts_id=94
Pin 11 is for controlling a LED. Arduinos have a maximum output of 40mA for each pin so if you want to use something like a Luxeon LED you will need to use a transistor (basically an electronic switch) in order to provide more power. A TIP120 transistor is only a couple of bucks and can provide a fair bit of power. When Pin 11 goes HIGH the LED turns on.
Pin 12 is for connecting a motor (this motor would be something like a cordless drill motor to spin the cannon barrels.) Since this would be a continuous speed motor all you would need is another transistor. When Pin 12 goes HIGH the motor turns on.
The 1K resistors are there to protect the Arduino output pins. The blocking diode on the motor transistor is there to protect the transistor from back voltage from the motor.
I wrote this particular code in 2007 to interface a Nintendo Wii Nunchuck controller to an Arduino. The Nunchuck controller has a 3 axis accelerometer, joystick and two buttons. I never used the Z axis of the accelerometer so I left that out. So the way this works is you connect the Nunchuck to your Arduino and it reads the inputs and translates them into servo movements to move your cannon. So by using this code you can move the joystick and the cannon will move up/down and rotate right/left and pressing the buttons will make the cannon rotate ans well as light up LEDs in the barrels and even allow the firing sound (more on that later.) If you want you can use the accelerometer functions to move the cannon instead.
I took apart the Nunchuck and removed the joystick from the board. I detached the finger buttons from the board and made an extension cable. The board is then mounted inside the helmet. So with this setup you can mount the Wii Nunchuck board in the top of your helmet (try to get it as level as possible) and you'll have a head tracking cannon system. Push one button and the barrels will spin and pushing the second button will make the LED (you could put one in each barrel) light up and trigger the firing sound.