Robotics‎ > ‎


Something New
After years of teaching robotics, I was starting to get a little bored. So, I decided to start doing something new and different-facilitate an after school session where we build robotic submarines. Here's a picture of the submarine I made. It's constructed primarily of ABS pipe. It has two drive motors to propel it forward and backward as well as turn it left and right. It also has a dive motor to control depth. Thanks to a foot long inch and a half diameter pipe filled with cement and a few 5 inch sticks of #3 rebar, it is almost neutrally buoyant (slightly positive so that if something goes wrong it is easy to retrieve). It uses an NXT Lego brain as an on board processor. Using the programs shown below (and attached at the bottom of this page), the NXTsub can be remotely controlled. It can also execute simple autonomous missions.

A six and a half inch length of 4 inch diameter ABS pipe was used for the hull. An end cap was fastened to one end and a test plug is used on the other to allow the operator to insert and remove the NXT while insuring a water tight cavity. Three inch diameter "wings" (for lack of a better term) were used to move the motors further from the hull to provide greater maneuverability. A steel piece of metal bent in a U shape was used to attach ballast. Motors were mounted using conduit clamps. Speaker wires connected the motors to modified NXT cables by means of holes drilled in the hull. Epoxy was used to make the penetrations water tight. No efforts were made to make the motors waterproof (I just shoot a little WD-40 into them after each use and replace them as necessary-they're cheap).

Specialty Materials
Pretty much everything can be purchased from either Lowes, Home Depot, or Radio Shack except the motors, the propellers, and the polystyrene bushings used to connect the two. To purchase these items go to:
 Part Name / Description
 Source  Part #
 Motors 12V DC  29DCM8
 Polystyrene Bushing 1/8 x 14"
 Propeller, 1 3/4", 1/8" diameter hole  3003
(Special thanks to Robert Vieth of the Juneau economic counsel for locating these suppliers which he uses for SeaPerch)

Materials Found at a Local Hardware Store
Here's a list of most of what you'll need to get from a hardware store. It does not include soldering materials.
Picture Description Price
(per unit)
* 16 oz of ABS to PVC Transition Cement (Oatey Inc 31912 Cement Flowguard CPVC) $9
* 16 oz of ABS Cement $6
* 1½” ABS Cap $3
* 4x2” Pipe Increaser/Reducer Coupling $6
* 2” PVC Cap (From Home Depot) $2
* 60 grit sand paper (Four 9” sheets should do) $4
* Epoxy (for plastic) $6
* ¾” Conduit Hangar w/Bolt $1
* 4” Plastic Test Plug $6
* ¼”-20 3’ long Threaded Rod $12
* 1-3/8" x 72" 14 Gauge Plated Slotted Flat Steel Bar $8
* 50’ of 20 guage red stranded wire $11
* 50’ of 20 guage black stranded wire $11
* 4” ABS Pipe 8’ long $24
* 3” ABS Pipe 2’ long $8
* 2” ABS Pipe 2’ long $10
* 1½” ABS Pipe 10’ long $6
* #3 Rebar 6’ long $5
* Bag of concrete mix $7

The Android App
Pictured below is the logic behind the Android App used to remotely control the NXTsub. The source code is available for download at the bottom of this page. If you want to use the App "as is" you can just download and install the .apk file which is also available at the bottom of this page. This App is fully capable of remotely controlling the NXT and driving the left and right motors. However, since the bluetooth connection is lost as soon as the submarine dives below the surface, you will need to upload a program onto the NXT to control dives. You can also pass such a program two parameters by entering values into text boxes provided on the right hand side of the App's screen.

(Click to see full size picture)

The "Dive" Program
Here is a simple dive program. It waits to receive two messages from the App before doing anything. It then uses the messages received to control the depth of the dive as well as how far it travels during the dive. Students can and should create their own dive programs. However, it is recommended that they use this program as a template, altering only the part following the loop on the last line of code.

(Click to see full size picture)

Jack Mount
To make life a little easier, I went ahead an purchased mindsensor sockets for use with the next groups of kids that I'll be building subs with. I also designed a mounting bracket to hold them.

Download skp file (for use with SketchUp)

Adding a Sensor
Recently I designed a bracket to hold a sensor in my new and improved NXTsub that now has a nose cone. Either a gyroscope or a compass sensor should be able to provide me with feedback to get my robot to follow a bearing! In addition to writing a program in NXT-G, I tried writing one in LabVIEW as well as NXC in an attempt to improve the quality of the Bluetooth communication. Sadly, I ended up returning to NXT-G not because it's perfect, but because it appears to do as well as the other two if not better. While I was able to write a program that would follow a bearing (available below as NXTGDiveGyro.rbtx), it does wander slightly. I'm chalking this up to the inherent deficiencies of the gyroscope.

Download skp file (for use with SketchUp)

To do List:
I'd like to squeeze some of the wandering out of the gyroscope-any ideas would be greatly appreciated. I'd also like to add a button to my Android App to automatically calibrate the gyroscope. This would entail writing an NXT-G program that would run on the NXT and store a file that would later be read by the dive program. Not too hard to do, but time consuming enough that it's a project for another day.
Michael Backus,
Apr 18, 2012, 11:19 PM
Michael Backus,
Jul 8, 2013, 9:02 PM
Michael Backus,
Jul 8, 2013, 9:04 PM
Michael Backus,
Jul 8, 2013, 9:05 PM