To build a self-propelled water craft and a human interfacecontroller (the “Helm”) capable of wirelessly controlling the water craft.
The goal of the game was for each team’s boat to fill abucket with water in the opposing team’s base. Whichever team filled theopponent’s base with the most water in 5 minutes was declared the winner. Onlyone base was active at any given time which means each team was required toswitch back and forth between offense and defense.
- Design Approach
Per the project specifications, the helmsperson’s actions“…should be inventive and interesting for the audience to watch.” Inaddition, the actions should make the helmsperson “look and feelfoolish.” To accomplish these specifications and our primary Helm featureof simplicity, we decided to design a Nintendo-like Power Glove in which thehelmsperson would use solely the Power Glove to control the boat. Moreover, the state of the game would be displayed on an object on top of theforearm next to the Power Glove. We decided to separate the navigationand special action functionalities into separate sensors.
Helm Design: Navigation
The user controlled the boat by waving a hand through theair. Pitching the hand controlled the throttle: downward pitch moved the boatforward while upward pitch moved the boat backward. Rolling the hand turned the boat: right rollsteered the boat right and vice versa. Theuser could also combine these actions in any way to turn while going forward orturn while going backward.
To navigate the boat (control speed and direction), we implemented athree-axis accelerometer from the course lab's shop, as shown below in Figure 2.
- Because the accelerometer provided three sources of data (i.e. the three axes), wedecided to use it to control both speed and direction. The accelerometerwas mounted on the Power Glove for the helmsperson’s right hand. However,this provided a challenge at first for us because an accelerometer producesspace-fixed measures of gravity, and we desired body-fixed angles. Toovercome this challenge, we used a body-fixed rotation matrix to find thebody-fixed angles from a particular orientation of the accelerometer. Right-handed, orthogonal reference frames A and B are initially aligned witheach other, and B is subjected to rotation θb z thenrotation φb x.
Helm Design: Water Delivery
The user controlled the cannon simply by clenching his orher fist. When the hand was flat, thecannon would be off. As the user made atighter fist, more power was transferred to the cannon to blast water out ofthe hose. In this way, the user controlledhow far the cannon shot water.
To accomplish the project specification requiring a sensing modality forwater delivery and special actions, we implemented a flex sensor as shown belowin Figure 3.
- Helm Design: Special Action
Figure 4 below shows the readout on our helm. The twobuttons at the bottom triggered special actions on the boat. Any boat couldhave up to two binary special actions. Teams implemented special actions suchas horns, sirens, and boosts.
- Helm Design: Gameplay
While the Helm waited to read an iButton, the yellow LED wason. After reading an iButton, the yellow LED turned off and the teamcolor LED (red or blue) turned on in addition to the watercraft number beingdisplayed on the double digit 7-segment LED display. When an EngagementStart command was received, the green LED turned on and the active goal LED blinkedat 5 Hz. When a Stand Down command was received, the yellow LED blinkedat 5 Hz for 10 seconds; the green and team color LEDs remained on and theactive goal LED continued to blink at 5 Hz. When an Engagement Overcommand was received, only the small red LED was on until a hard reset commandwas received, which resulted in the Helm waiting for a new iButton.
If the team affiliation was red and the active goal was also red, then only thelarge red LED blinked. If the team affiliation was red and the activegoal was blue, then the large red LED turned on and the large blue LED blinkedat 5 Hz.
Helm Design: Materials
To mount the accelerometer onto a glove, we cut a hole in athin, lightweight black glove between the pinky and ring finger on the oppositeside of the palm. For the flex sensor, we cut part of the middle fingermaterial on the opposite side of the palm; as the helmsperson clenched his/herfist, the flex sensor bended from 0° to roughly 90° for a full range ofvariable resistance. To mount the gameplay LEDs and team number display,we used two soccer shin guards and sewed them together, sandwiching the wiresoperating the LEDs. See Figure 5 below for a photo of the Helm.
- To keep the large number of wires in one bunch emanating from theHelm to the bag carrying the circuit boards, E128 microcontroller, and 7.2-Vbattery, we used plastic tube to encase them. An elastic band cut fromthe shin guards was used to keep the shin guards securely on the helmsperson’sforearm during an Engagement.
The watercraft was designed to be stable, fast, andagile. Two motor-driven propellers were mounted within foam pontoons thatform the bulk of the craft. Twin motors allowed the craft to turn inplace and also to achieve a high top speed. The two pontoons were bridgedby a series of ½- in wooden dowels that support the main electronics (housedinside a small Tupperware container). The electronics contained LEDs toindicate team color and game state. However, since the LEDs were notespecially visible during the day, a wooden dowel mast at the rear of the craftallowed the user to hang a blue or red flag adorned with the craft’snumber. A 500-GPH Bilge Pump was mounted near the rear of the craft and a¾-in tube was connected to a ½-in nozzle near the front of the craft to arcwater into the air in front of the craft.
A classic staple of video games is a turbo mode, thus we decided toimplement a turbo mode on our boat. Wheneverthe user activated special 1, the boat would get a 25% speed boost and travelin a straight line for 2 seconds. Thiswas extremely useful for going from one side of the pond to the other. After the turbo was activated, it could not beused again for 5 seconds in order to prevent damage to the motors.
ZigBee Software Design
Both the craft and helm used similar software design forinteracting with the ZigBee modules. They transferred bytes along a 9600-baudasynchronous line using an interrupt service routine (ISR). The ISR storedeach byte into a large receive buffer and kept track of the index of the lastbyte stored. If the byte matched the ZigBee Start Byte, then the ISR alsonoted the index of the Start Byte.
The main program loop constantly checked to see if a new Start Byte had beenreceived. If so, the main program waited for the next two bytes (LengthMSB and LSB) and checked that these bytes matched what was expected. Ifthere was an error, the program ignored the Start Byte and returned to its lastplace in the main program. If there was no error, the main program waitedfor the remainder of the message to be received and then processed it. Atthe start of this ISR, a copy of the Start Byte index was made so that ifanother Start Byte was received by the ISR, the processing routine would stillreference the first Start Byte.
A/D pin 3 on the E128 was used as an input pin for thevoltage from the flex sensor. For the lower nibble of the Special Actionsbyte corresponding to the water delivery power level, we needed to output avalue ranging from 0 to 15 (0x*0 to 0x*F). To accomplish this, weempirically found the A/D low and high values from the flex sensor: the lowvalue was 268 and the high value was 475. After observing the output frombending the flex sensor in the Power Glove, we decided to change the high valueto 350 to control the output more tightly for better PWM control of the waterdelivery system. After creating software to create floor (268) andceiling (350) values of the A/D values, we mapped the A/D values to a valuebetween 0 and 15. This value was sent wirelessly as the lower nibble ofthe Special Actions byte for PWM control of the water delivery system.
To map the tilt and pitch angles to values ranging from 0 to 15, we firstdivided the tilt angle by 0.5π; we divided the pitch angle by (3π/8). Next, we multiplied both the tilt and pitch angles by 7, then added 8 to eachof them (the neutral point for each nibble). The part of the result afterthe decimal point was ignored by declaring each nibble as an “int” variabletype. To account for the direction nibble being the upper nibble, wemultiplied its value by 16. We added the speed and directionnibbles to form the navigation byte, which we sent wirelessly to the watercraftfor appropriate use in motor PWM and direction control.
We used two high-speed DC motors and small, three-bladedpropellers designed to run at high RPM. We had initially selectedslightly larger propellers, but in testing found that these drew over 3A ofcurrent when running at 5V in water. This was well over the peak-poweroutput from the motors and also risked burning out the motors. Switchingto the smaller propellers reduced the current draw to 1.7A which was safer andproduced similar thrust.
The motors were housed individually inside PVC tubing and wereconnected by universal couplers to the propeller shafts. Brass bearingsleeves covered the shafts and small Masonite circles inserted inside the PVCsupported the sleeves which exited the PVC through a small hole in oneend. All joints in the PVC were sealed carefully to make the motorhousing as water tight as possible. Sitting in the foam pontoons, themotor assemblies were exposed to only small amounts of water near the endopposite the motors; however, we made waterproofing sensitive areas a toppriority from the start.
Our boat implemented a turbo special action. In normaloperating conditions, the drive motors were limited to a maximum PWM duty cycleof 75% to limit their power consumption. However, on activating the turbospecial, both motors were set to 100% duty cycle and the craft moved forward ata higher speed for two seconds. We limited turbo activation to once everyfive seconds to reduce the chance of motor overheating.
The electronics container was protected from water with onlythree external access points. The main power switch and iButton reader wereinserted through cut-outs in the container top and were easilyaccessible. Power lines for the LEDs, motors, and pump emanate through asmall tube that was covered with cellophane wrap to protect against water whilestill allowing for easy access. All holes in the container were sealedcarefully with glue.
Electrical: Helm Power Consumption Spec
To fulfill the project specification of the Helm havingsufficient battery capacity for 8 hours of continuous operation, we measuredthe current through the battery’s leads (one 7.2-V NiCad battery rated at 1900mA-hr) for 10 minutes and measured its average current to be roughly 49 mA.
This measurement gave us a theoretical operating time of1900mA*Hr / 49mA = 38.8 hours, which was well above the 8-hour requirementoutlined in the specifications.
- Electrical: Helm Display
To show the helmsperson the current state of an engagement,we placed five LEDs on the Helm: a set of small green, yellow, and red LEDs todescribe the engagement status, and large blue and red LEDs to show the teamaffiliation and active goal. See Figures 4 and 5 to see these LEDs. We placed a relatively standard 3.3-kΩresistor in series with each of these five LEDs. In addition, we placed adouble-digit 7-segment LED display on the Helm. We placed a 220-Ωresistor in series with each of the double-digit 7-segment LED display’s LEDsto have a fairly high current for brightness purposes. Each of the LEDshas a forward voltage drop of 2.0 V. Inaddition to our added resistors, the E128 protection board has a 1k seriesresistance per pin. Thus, our calculatedcurrent through the 7-segment LEDs was 2.5 mA. The calculated current through the fivedisplay LEDs was 0.7 mA, which was enough to see the LEDs, but also kept thepower consumption very low.
The double-digit 7-segment LED display was common anode (oneanode per digit). Digit 2 was considered to be the digit next to thedecimal point while Digit 1 was considered to be the digit in the tensplace.
Electrical: Boat's Main PIC micro-controller
The Main PIC communicated with the ZigBee board andcontrolled the pump uni-directionally through PWM, which was level-shifted to5V. The Pump drew up to 2.5A, which could easily be supplied by the TLEH-Bridge. The Main PIC gave commands to the Left and Right PICs througheight individual I/O lines connected directly to these PICs. Four linesper PIC gave 3-bit speed resolution and one direction bit. While thismethod used a large number of I/O, we had sufficient ports available and it wassimple to implement and troubleshoot. The Main PIC also controlled red,blue, and yellow LEDs. The resistors were sized by experimentallymeasuring the current at which the LED stops growing brighter and thencalibrating this current (and the LED drop-off voltage) for the 3.3-V PIC.
Electrical: Boat's Secondary PIC micro-controllers
The Left and Right PICs had four input lines from the MainPIC; each of the secondary PICs drove one of the drive motors bi-directionally. Both the PWM and direction lines were level-shifted to 5V to work with the TLEH-Bridge driver.
The motors drew roughly 4.5A stall current at 5V, which was belowthe 6A maximum for the TLE 5206-2. Also, when tested in water, they drew1.7A continuous, which was well below the 5A maximum for the driver.
All software for the Helm was written in C for the E128microcontroller.
All software for the boat was written in Assembly Languagefor the PICs.
We completed all intermediate deadlines and the project ontime. Though we spent close to $250, orroughly $100 over the maximum allowed budget, we used quality components whilestill seeking great value.
During the public demonstration, our boat and controller hadthe longest battery lives. In addition,we allowed several young children to operate our boat; every child quickly andeasily controlled the boat with precision.
I learned a tremendousamount of information during the course and project in the areas of micro-controller communication, communication protocols, and user interface design.
See Figures 6 and 7 below for photos of our final boat andHelm.