Something NewRecently 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.
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).
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:
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.
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.
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.
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
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.