My First Viking Longship
Helm: helm.c
Home
The Game

Water Craft

Helm

     Software
     Electronics
     Mechanics
Communications

Gems of Wisdom
Media
Pseudocode helm.c helmstatemachine.c LED.c iButton.c Test harness

Inputs:
Our input sensors provide several sensing modes. The drumsticks are constructed with torsional springs suspended inside of conducting walls. When the user impacts a surface with the drumsticks, the torsional springs contact the walls briefly and complete a circuit. The electronics provide the first averaging function, providing a slowly varying signal that spikes on drumstick impact then slowly decays. Note that this system indicates a higher voltage both with faster drumbeats (more contacts) and with harder drumbeats (contacts for longer time). The software continually reads this value, then provides a second round of averaging that provides a single number summarizing the state of the drumbeats over a given time period. This data can be combined with button inputs on the drumsticks that denote direction in order to encode XBee packets.

Encoding Scheme:
Our helm is suited for individual motor control. The user's mental map is to run the right motor more quickly if the right drumstick is beat more quickly, and same for the left. Our goal is to convert this intuition into a packet that encodes speed and direction. The first step is to encode the possible voltages into regions encoding stop, slow, medium, fast and max as numbers from 0-4. We then encode the direction of the motor in the sign of the speed. For example, the right motor going full speed backwards would be –4. The speed can then be encoded by adding the two drumstick speeds together and adding 8 to find a number from 0-8. This is the upper nibble. The lower nibble, the direction byte, can be determined by taking the signed left speed and subtracting the signed right speed. The result, ranging from –8 to 8, can be encoded as the lower nibble where the lowest values encode full left turn and the highest values encode the full right turn.

Pump and specials:
The pump is activated by shouting into a microphone. The input is digitized via an input circuit (see electronics section). The software constantly samples the output. Upon detecting a high input, a timer is activated which sends packets instructing water to turn on for ten seconds. In addition, there are two specials. A button press causes the duck to quack. The second special is activated via a mercury tilt switch on the bottom of a mug. Emptying the mug will cause the small auxiliary duck propeller to turn on.

Output:
The helm module also utilizes a set of LEDs and a seven segment display to provide output to the user. The dual seven segment display allows display of team numbers from 1 to 12. There are two sets of blue and red LEDs. One indicates the team affiliation and the other indicates the active base. These displays turn on when the ship is matched. The team affiliation and active base LEDs turn off to indicate the game end. A separate LED turns on to indicate the stand down status.

The full collection of C files may be found here.