Introduction: Submersible - AT-AT Sub - Team 47

This is Team 47's sub from 2016 - 2017 BTS competition. This submersible was designed for the floating obstacle.

Materials

  • 8 1/2" PVC Elbows
  • 4 1/2" Tees
  • 2 10' PVC pipes
  • 6 1” diameter PVC caps
  • 2 40' sections of wire
  • 4 motors
  • 2 breadboards 6.88" x 2.56"
  • 45 Zipties
  • Arduino Uno
  • MPU-6050
  • PS3 Controller
  • 20 jumper wires
  • 2 VNH2SP30

In addition, you need the following tools.

  • PVC pipe cutter
  • Soldering iron
  • Wet sponge

Step 1: Cut Your Parts

First, we need to cut the long PVC pipe into the individual parts that we need. You will need to cut:

  • 3 x 5" of pipe
  • 2 x 2" of pipe
  • 4 x 1' of pipe
  • 8 x 1" pipes

Optional:

  • 1 x 7" section of pipe

Use the PVC pipe cutter to cut each pipe.

I recommend using a measuring tape to measure the length that you need and mark it down with a pencil. Only then should you use the PVC pipe cutter.

In addition, the PVC pipe cutter takes off around 1/8" - 1/16" of pipe, so you should place the PVC pipe cutter slightly past the line.

Step 2: ​Put Together the Frame

Take your four ½” tee pipes and three 5” pipes. Connect the short side of a tee pipe to each end of 2 x 5” pipes. Angle them so that when placing the entire thing on the table, it will lie completely flat. Align the two pieces you just connected so that they are parallel and connect them together with the third 5” pipe between them. You should end up with something that looks like the picture.

Step 3: Make the “Claws”

Take two 1” pipes and connect them at the interior ends of your ½” tee pipes. Take your two 2” pipe and connect the ends of one 2” pipe with two if the ½” elbows facing the left, doing the same for the other 2” pipe but facing the elbows to the right.

Connect a 1” pipe in the top left ½” elbow, doing the same for the top right ½” elbow. Connect a ½” elbow to the ends of the 1” pipes. Put a ½” cap on the elbows and make sure they are facing upwards. Connect the claws to the first frame. Attach the two “claws” to the front of the frame, on the interior side of the frame.

Step 4: Make the Legs

Attach the legs to the to the frame.

Put one of the 8” pipes on each of the open Tee connectors.

Attach an elbow facing down, to the 1” pipe.

Attach a 1’ pipe to the elbow.

Put a cap on the end of the 1’

Step 5: Wire the Motors

Making the motors:

Step 1: Assemble what you need.

You will need 1 container of toilet bowl wax.

A set of wire cutters with size 22

A set of wire cutters with size 14

A spool of solder

A soldering iron

4 Jameco 232047 Small 12v motors

4 clear film canisters

4 Dumas Plastic Prop 1/8" .19-.35 Tower Hobbies DUMB1860

A pack of rubbing alcohol wipes

A wet sponge

A tube of Kragle

Medium-grade sandpaper

Step 2: Plug in the soldering Iron

Step 3: Put gloves on

Step 4: Make 4 Quarter sized wax balls

Step 5: Make 4 Dime sized wax balls

Step 6: Take the stickers that came with the motor and put them on it. The one with the hole should go over the shaft and the long one should go around the motor. The last goes on the back, (make sure not to cover the metal tabs on the back of the motor or the red dot

Step 7: Repeat Step 6 for all of the motors

Step 8: Strip the wires that came with the motor, with the smaller set of strippers.

Step 9: put the red wire into the hole in the red tab on the back of the motor, fold it back on itself and then twist it to secure it

Step 10: Press the solder to the wire and then tap the iron to the solder until it melts the solder over the connection. (look up a youtube video if you need a better tutorial)

Step 11: Do the same thing using the other wire on the other tab.

Step 12: Take the wires and twist them together

Step 13: Take a quarter sized wax ball and put it on one of the motors shafts, then insert it into one of the film canisters. Make sure the shaft goes in first, once in take one of the dime-sized balls and put it on it to cover it. Slide down the film canister cap and close it.

Step 14: Repeat Step 8-13 for all 4 motors.

Step 15: Turn the motors on and take the piece of sandpaper, clean off any wax on/around the shaft with it.

Step 16: Turn off the motors. Apply 2 drops of Kragle to the inside of the propellers and then slide it onto the shaft of the motor. Make sure it doesn’t touch the plastic.

Step 17: Repeat step 16 for the other motors.

Step 6: Mount the Motors to the Sub

Attach the back motors.

A) Attach a zip tie around the motor leaving enough slack for another zip tie to fit

B) Place the motors on the Tees, opposite of the claw and opposite of the legs, facing so the propellers face away from the claw

C) Put a zip tie through the one surrounding the motor and use it to attach to the frame. The zip tie should be going the same direction as the motor

D) Do C again so that there are 2 zip ties running through the one surrounding the motor

E) Do A-D again on the opposite side. If you did it on the left side behind the claw you now need to do it on the right

Attach the side motors
A) Put a zip tie around the motor to stabilize it

B) Attach the motor to the submarine vertically

C) Put the zip tie around the motor and the pipe to keep the motor from falling off. The zip tie should be facing the same way the motor is facing.

D) Do step C again so that the motor is as tight as possible with 2 zip ties so that there are no mistakes.

E) Do steps A-D again to even out the weight and the amount of motors

Step 7: Attach Floaties

Officially, we used a PVC insulation to do this, but I'm pretty sure a pool noodle will do the job too.

Cut a (2) 2" piece of pool noodle

Attach on the top frame of the sub, via zip tie.

Step 8: Attach the Cat-5 Cable to the Motors

Strip both ends of the Cat 5 cable to reveal the 5 paired sets of wires, then strip each of those wires so the copper wire is exposed. Wire one pair of motor wires to one pair of Cat 5 wires. Solder the red motor wire to the white Cat 5 cable and the black motor cable to the colored Cat 5 cable. On one end of the Cat 5 cable, solder 1 pin cables to each of the Cat 5 wires

Step 9: Solder the Header Pins Into the MPU-6050

When you first get the MPU-6050, all you have are a bunch of header pins and the actual board. Unfortunately, you can’t just plug the board into the breadboard, so you have to solder the pins to the MPU-6050.

Insert the header pins into the MPU-6050, lining them up. You may end up with an extra pin at the end. That is OK. Simply break it off.

Plug in the soldering iron, and wait for it to heat up. You can tell when the iron is hot enough by touching it to a wet sponge. You should see some steam come out. If you don't see any steam, WAIT.

Gently press the tip of the soldering iron to the gap between the first pin and the hole it went through. Wait a couple seconds. Take the solder and press it to the header pin on the opposite side of the soldering iron. The solder should immediately melt and fill the gap. If not, YOUR IRON IS NOT HOT ENOUGH. ABORT! You will get a cold solder, which means that the solder is not really fused to the metal. Wait for the iron to heat up.

When finished, first remove the solder, then remove the soldering iron. Otherwise, you may get some solder stuck to the soldering iron.

Repeat for the other 7 pins on the MPU-6050.

Step 10: Mount the MPU-6050 Onto the Breadboard

Take the breadboard and rotate it so that the long side is running horizontally, and the shorter side is running vertically. Line up the MPU-6050 so that each pin of the chip is in a different column, meaning the pins are running horizontally or parallel to the long side. Phrased differently, each pin should be on a different number column.

This is essential because the circuits on the breadboard run vertically (in our current orientation). If you put it in so all the pins are in the same column, you will short circuit the board.

Once you have it lined up, gently press the MPU-6050 into the motherboard. It shouldn’t take that much effort to insert.

Step 11: Wire the MPU-6050 Into the Arduino

Insert one jumper cable into the breadboard hole right below the MPU-6050 for each pin. Attach the cable under the VCC pin of the MPU-6050 to the 5V port on the Arduino, the GND pin to the GND port, the SCL pin to port A5, and the SDA pin to port A4.

Depending on the code you are running (the submersible controller code doesn’t need this, but the HUD code does), you may need to attach the INT pin to digital port 2 on the Arduino (the third pin).

Explanation

The VCC pin powers the Arduino, and the GND completes the power circuit. The SCL and SDA pins are part of the I2C specification, which is a specification that establishes a method of communicating between embedded devices. The SCL line is the clock line for timing synchronization, and the SDA line is the actual data line.

The optional INT line is theinterrupt line, used for signaling the Arduino whenever data is ready. However, the reason it is optional is because the code can manually check for data, removing the need for the INT pin.

Step 12: Solder and Install the VNH2SP30s

The VNH2SP30s come with header pins, similar to the MPU-6050.

For each VNH2SP30:

  1. Break the long row of header pins into 1 x 8 pins and 2 x 6 pins. You should have some left over. Keep those for emergencies
  2. Install the 2 6 header pins into the matching side of the Arduino.
  3. Install the 1 x 8 pin to the bottom group of 8 holes, not the top.
  4. Carefully solder the pins to the VNH2SP30, following the instructions for the MPU-6050
  5. Take the two breadboards, and place them side by side with the long side parallel to each other.
  6. For the left breadboard, insert the side of the VNH2SP30 with the two groups of six pins into the bottom right half of the breadboard. It's best to place it so that the bottom pin is in column H, row 60.
  7. For the right breadboard, insert the right side of the VNH2SP30 in the bottom left half of the breadboard. It's best to place it so that the bottom pin is in column C, row 60.
  8. Repeat steps 1-4 for the other VNH2SP30.
  9. Place the left side of the other VNH2SP30 in the upper right half of the left breadboard. It's best to place it so that the bottom pin is in column H, row 25.
  10. Place the right side of the other VNH2SP30 in the upper left half of the right breadboard. It's best to place it so that the bottom pin is in column C, row 25.

Now for the wiring.

You will need to solder two jumper cables to digital pins 8 and 9 for both VNH2SP30, because pins 8-13 lack header pins (remember, you shouldn't have soldered header pins to those ports). In addition, solder two jumper cables to the power ports on the VNH2SP30.

For the bottom VNH2SP30, wire each port on the VNH2SP30 to the corresponding port on the Arduino.

For the upper VNH2SP30, wire port 9 to port 10 on the Arduino, port 4 to port 10, and port 9 to port 11. Also, wire port A1 on the VNH2SP30 to port A2 on the Arduino.

Step 13: Powering the VNH2SP30s

The VNH2SP30s need two power sources: one for powering the motors and one for powering the board itself.

To power the motor, you need a power cable, two alligator clips, and two jumper cables.

Cut the power cable to expose the two wires. Connect one alligator clip (preferably black) to the negative wire, and one alligator clip (preferably red) to the positive side. Connect the other side of each alligator clip to a jumper wire.

Plug the jumper wire attached to the red alligator clip into the positive rail on the right side of the right breadboard. Plug the other jumper wire to the negative rail. MAKE SURE YOU ARE PLUGGING IN THE CABLES TO THE CORRECT SIDE, OR ELSE YOU WILL BLOW UP THE CAPACITORS. I made the mistake of reversing the cables, and I blew up one of the capacitors with steam coming out of the board.

Now, solder one jumper wire each to the two power pins at the bottom of the VNH2SP30. Take the positive jumper wire and plug it into the positive rail. Take the negative jumper wire and plug it into the negative rail.

Repeat the above two paragraphs for the other VNH2SP30.

Now, to power the VNH2SP30 itself. Wire a jumper cable between the 5V port of the Arduino to the positive rail of the left side of the left breadboard. Wire a jumper cable between the GND port of the Arduino to the negative rail. It doesn't really matter which GND port you use.

Connect a jumper wire from the pin marked 5V on the VNH2SP30 to the positive rail, and the GND pin to the negative rail. Make sure that you do not accidentally attach it to the power rails powered by the wall outlet, or you will fry the board.

Step 14: Connecting the Motors

To connect the motors, simply solder the wires to the motor pins on the VNH2SP30s.

Solder the positive wire (the colored one) of the right motor to port A2 on the lower VNH2SP30. Solder the negative wire (the white striped one) of the right motor to port B2 on the lower VNH2SP30.

For the left motor, solder the positive wire to A1 on the lower VNH2SP30, and the negative wire to B1.

For the upper motors, solder both positive wires of both motors to port A2 of the upper VNH2SP30, and both negative wires to port B2 of the upper VNH2SP30.

Thus, the up/down motors are linked together.

Step 15: Prepare the Development Environment

The following instructions have only been tested on Mac OS X, so adapt the steps if you are on another OS. Windows is especially untested. You will need to download the following programs:

After downloading those programs, you will need to install some libraries.

In Processing, go to Sketch > Import Library > Add Library. Search for and install the following libraries: G4P, Sprites, ToxicLibs, and Game Control Plus.

Next, download this zip: https://github.com/jrowberg/i2cdevlib/archive/mas... and extract it somewhere safe. Inside the extracted folder, go to the i2cdevlib-master folder, then the Arduino folder. Copy the I2Cdev folder and the MPU6050 folder to (whatever your home folder)/Documents/Arduino/libraries

Explanation

The Arduino IDE is the software used to write, compile, and upload code to the Arduino. Processing is a program that allows us to easily process the data we get from the Arduino into something useful. It also allows us to easily send commands to the Arduino back.

The libraries you downloaded make interfacing with game controllers, the MPU-6050, and drawing stuff on screen much easier. In theory, we could work without them, but everything would be much harder to do.

Step 16: Obtain the Code

The latest code is always available at https://github.com/PoisonNinja/Submersible. Use your git client to clone the repository. Instructions will vary by OS.

For example, on Mac, open Terminal (Spotlight > Terminal). Type in the following commands:

Ubuntu instructions will be very similar.

From time to time, I may update the code with new features and bug fixes. If you want to update to the latest code, navigate to the Submersible directory and run `git pull`.

Step 17: Load the Code Into the IDE

We have one more library to install. It is a custom library made by me, called libsub. It contains a set of useful functions for the submersible.

Copy the libsub folder from the folder we just cloned and copy it into the same place we installed the other libraries. If you haven’t closed Terminal yet, simply run the following commands:

  • cd Submersible
  • cp -rp libsub ~/Documents/Arduino/libraries/

Now, open the Arduino IDE. Go to the menu bar, click on File, then Open. Navigate to the Code folder in your home folder, and double click on it. Then, open the Submersible folder, Arduino, then SubController. There should only be one file. Double click on SubController.ino

Open Processing. Go to the menu bar, click on File, then Open. Navigate to the same Submarine folder as before. However, this time, click on Processing instead of Arduino. Double click on SubController, then SubController.pde

Step 18: Link the PS3 Controller to the Mac

Open Preferences, whether through Spotlight or the Dock. Click on Bluetooth.

Attach the PS3 controller to the Mac via USB. Then, press and hold the PS button until the lights on the front of controller blink once. This resets the pairing. Next, unplug the USB and press the button again. Your Mac should automatically connect to the controller. Don’t worry if the lights still blink. That is normal.

Step 19: Flash the Code Onto the Arduino

Plug in the USB - Serial cable into the Arduino, with the squarish side plugged into the matching port on the Arduino. Plug in the USB end of the cable into any USB port on your computer, unless you are using a Macbook Air 2011. On a Macbook Air 2011, plug it into the left port.

Go to the Arduino IDE, click on the Tools menu bar item, then the Ports dropdown. Select the port that has the words “Arduino/Genuino Uno” after the port name. Make sure the bottom right corner of the Arduino IDE says “Arduino/Genuino Uno on (whatever port you selected)”. Finally, press the upload button (the arrow button).

Explanation

The reason why you should plug the USB into the left side of the computer if you have a Macbook Air 2011 is because for some reason, OS X assigns different /dev files to the Arduino, and the Processing program is coded to open /dev/tty.usbmodemFD121 (although autodetection of ports as a fallback fixes that). If you plug it into the right side, the Arduino will show up as /dev/tty.usbmodemFA131, which is not what we want.

Step 20: Build the Processing Program

In the Processing IDE, press the run button (play icon). Processing will build your code and automatically launch the program. Output from the program will be displayed in the black box below.

Step 21: Controlling the Submarine

The controls are pretty simple. Each joystick maps to one motor: The left joystick to the left motor, and the right joystick to the right motor.

To move forward, push both joysticks forward. To go backwards, pull both joystick backwards. To turn left, push the right joystick forward and the left joystick to anything less then the right joystick. To turn right, do the reverse of turning left.

The motors for up and down are linked to buttons L1 and R1. Press R1 to tilt up, and L1 to tilt down.

Step 22: Bonus! Control the Submarine Using Your Voice

Here's a bonus for you guys. You can control the submarine using your voice.

Make sure that Google Chrome or Firefox is installed, although Chrome is preferred. Unfortunately, I haven't had much time to get this working on other operating systems, so Mac OS X is the only one that is supported.

Navigate to the Submersible folder in terminal (cd ~/Code/Submersible). Now, run `python -m SimpleHTTPServer 3000`. Actually, you can replace 3000 with whatever port number you want.

In Processing, open the VoiceSubController file. Run it. You may need to install this library: https://github.com/muthesius/WebSocketP5. Follow the instructions from before to install the library. Once you have the library installed, build and run the program.

Open Chrome and type in localhost:3000/test.html (replace 3000 with your port number if you changed it).

To command the submarine, say `forward` to go forward, `backwards` or `backward` to reverse, and `stop` to halt the motors.

Step 23: You Are Done!

THIS IS NOT A PERFECT DESIGN

and it was never meant to be. You will have to balance out the sub, often, by filling the bottom legs with water. Ideally, you want the sub to just barely sink so that it will actually go under water. Other problems we ran into was the fact that the PVC did not want to stay together. I suggest using a liquid cement or PVC glue to seal it. (Since this was a school project we were not allowed to use any adhesive.)