PVC Submarine
These are instructions for how to build a cube submarine that is able to swim underwater, sink and float, and fit inside a standard bucket.
Parts List
- One 10 ft, ½ in. PVC pipe
- Eight ½ in. 3-way PVC pipe elbows
- Three ½ in. PVC pipe Tee junctions
- One PVC pipe socket cap
- One disk magnet
- Screw
- One 1/2 in. x 6 ft. Polyethylene Pipe Insulation
- Five Velleman DC motors
- 24 zipties
- 2 10’ lengths of Cat5e
- USB to mini USB cable
- OSEPP Uno R3
- OSEPP Motor and Servo shield
- Mad Catz V1 joystick
- Chromebook
- 12 header cables
-
12 volt DC charger with stripped end
- Wax
Tools
- Pipe Cutters
- Wire Cutters
- Wire strippers
- Soldering Iron + solder
- Electrical tape
- Driver
Cut the PVC Pipe and Build Frame
Cut ten 5 in. pieces of PVC pipe from the 10 ft pipe
Use four cut PVCs and four 3-way elbows to create a perfect square.
Use four more cut PVCs and attach them to the square
Build the Front
Attach a 5-inch PVC pipe(A) in between two 3-way elbows (B and C). The bottom of the 3-way elbow should face down, meaning that the open junction should be resting on the table. (See image 1)
Repeat previous step with another 5-inch PVC pipe. Attach the pipe(D) in between two 3-way elbows (E and F).The 3-way elbows should both be facing the inside so that they can be joined to form a square. (See image 2)
Cut one of your 5-inch PVC pipe into four 1 1/4 inch PVCs
Attach one of each of the newly cut 1 ¼ inch PVCs (G, H, I, J) onto the 3-way elbows so that they all face the inside (you will use this to complete your square.) Now you should have two wide U’s. (Image 3)
Attach two Tee-Junctions(K and L) to attach the two U’s together. (Image 4)
Use another 5-inch PVC to cut two 1 1/4 inch pieces
Attach a Tee-junction in between the two wide U’s. The tees should point inside the square, directly facing each other.
Attach a 1 ¼ inch PVC (M) to the Tee-junction that is already on the perimeter of the square. Attach another Tee-junction to the PCV that you just attacked. The Tee (N) you attach should have it’s opening going the opposite way as the remaining openings of the 3-way elbows (up). Attach your final 1 ¼ inch PVC (O) to the other side of the Tee (not the one facing up) This final pipe will connect to the Tee on the square frame. (Image 5)
Use leftover PVC to cut a 1 ½ inch pipe
Once the connecting PVC pipe w/ the Tee junction is done, use the 1.5 inch pipe and attach it to the Tee junction that’s sticking out. Put a cap over the exposed air hole/pipe.
After the exposed end is covered, attach the magnet by drilling a screw through the piece that’s sticking out w/ the cap. The disk magnet has a hole for the screw to go into. You don’t need a pilot hole - just use a driver. It will be slow until the screw penetrates, then it will have little resistance.
At this point you should have the front of the sub and the rest of the frame. Use the open ends of the 3-way elbows on the front to attach the front to the rest of your sub. Now you should have a complete cube.
Completing the Top
Cut two 5” pieces of styrofoam from your 6 ft. Polyethylene Pipe Insulation
Add the two 5” pieces of styrofoam to two parallel PVC pipes on top. It doesn’t matter what side you decide to be the top and bottom. Make sure to add the foam so that it is “facing” the same direction as the extension with the magnet. The pipe insulation is cut with an opening, so just open it and slide it on the the PVC pipe.
Once the styrofoam is attached, use two zip ties to secure the styrofoam onto the pipe. Repeat on the other side
Build the Motors
You should have 5 motors. Repeat this step for every motor.
Gather a motor and wrap tape around the cylindrical part of the motor. Put take on the ends as well, making sure not to interfere with the axle.
Strip a standard gray wire so that one inch of the black and red is showing on one side, and 4 inches of the black and red is showing on the other side.
Strip each of the 4 wires down so that ½ an inch of copper wire is showing.
Attach the short-stripped side to the motor, onto the side without the axle. Each side is marked with a plus or minus. The red wire wraps through and around the positive side and the black wire wraps through the hole and around the negative side.
Solder the connection that you made with the wires
Make 2 balls of wax about half an inch in diameter
Insert one ball at the bottom of the container and make sure to push the axle out from the bottom hole. The wax is there to waterproof your sub.
Pull the gray wire that is attached to your motor through the lid of the container.
Put another ball of wax on the top of the motor and close the lid. The gray wire should be coming out of the container.
Use a disinfecting wipe to clean all the wax off of the outside container, axle, and wires until they are no longer sticky from the wax.
Get a propeller, put super glue in the hole of the propeller and attach it to the axle.
Attaching the Motors
Attach a motor parallel to the pipe the magnet is attached to. The propeller should be facing the inside of the cube. Attach it with zip ties and secure it with electrical tape to make sure it will not come off.
Attach two more facing out from the cube (one on each side) secure them with zip ties.
Attach another motor to the top (propeller facing upwards)
Tape and zip tie the motors to secure them.
Secure with zipes and tape all the motors up so that they don’t move. Make sure that the tape doesn’t have any holes in it so it doesn’t fall off in the water. Make sure that the tape doesn’t touch the axle of the motor so that it doesn’t get caught.
Electronics
Take the wires of all the motors and strip the insulation of the loose end off with a wire stripper.
Strip the Cat5e cable so you have 4 pairs of cables. Each color will be paired with a white wire.
Take each cable pair and untwist them. Then strip the insulation of each wire off about 1/2 of an inch
Attach header cables to the stripped wires and solder each connection.
Blue header cable gets attached to the solid color cable and the gray one goes to the white striped(as in white and another color) wire.
Do this for every pair of cables from the Cat5e. Now each cable should have a header cable. Again, blue header cables go with the solid color and gray header cables go with the white striped one. You should have 8 header cables total.
Now it’s time to wire up the motors to the other end of the Cat5e wire. Strip the other end of the Cat5e until you have 4 pairs of cables exposed. Untangle the wires (there are 8 total) and strip ½ inch off of all of them until the copper is exposed.
Take the pair of motors on the top and bottom of the sub that are located on the back end. Each motor has a red wire and a black wire. Twist together the red wire of the top motor and the black wire of the bottom motor, I’ll call this pair 1. Then twist together the black wire from the top motor and the red wire from the bottom motor, I’ll call this pair 2.
Solder pair 1 to a solid color wire from the Cat5e cable.
Solder pair 2 to the white striped wire from the Cat5e cable. It should be from the same pair as the solid color cable.
Tape up the soldered connection with electrical tape.
The motors on the left and right side of the sub need to be connected to the Cat5e cable together as well. Repeat the previous steps with the motors on the left and right of the sub.
The forward motor (located at the front)is just single paired with the Cat5e cables. The black and red wire needs to be twisted and soldered with a solid color and a white striped cable from the Cat5e. Make sure that the red motor wire goes with the solid cable and the black motor wire goes with the white striped cable. Afterward, solder the connection and cover it up well with electrical tape.
Hooking Up the Arduino
Attach the motor shield on top of the Arduino. It should snap right into place and fit perfectly.
In the section that is labeled M1, plug in the header cable of the motors that are on the left and right of the submarine. The blue header cable goes into port A and the gray header cable goes into port B.
Plug in the forward motor into M2. This is the motor that is at the front of the submarine along (attached to the extension that holds the magnet.) The blue header cable goes into port A and the gray header cable goes into port B.
Plug the top and bottom motor into M3. These motors are located at the back end of the sub. You know which one it is by the color that you attached it to. The blue header cable goes into port A and the gray header cable goes into port B.
In the top left, there should be a thing labeled J2. There is a small black rectangle that is attached to J1 and J2. Move that so it covers J2 and J3
Attach the wire of the DC charger without the insulation to the terminal that says MOTOR - (motor negative). Attach the other side of the wire of the DC charger to the terminal that says VSrc +.
Plug in the mini usb cable into the Arduino and plug in the other side into the computer.
Programming the Submarine
Open your chromebook and get into developer mode (tutorial)
Press ctrl+alt+T and install crouton if you don’t have it installed link
Open up a chroot via sudo startxfce or sudo startunity (based on how you configured your crouton)
Once you are in linux, open up the terminal via ctrl+alt+T
Type in this command: sudo apt-get install python3 arduino pip libpython-dev
Download and install pycharm(link)
Type in this command: sudo pip install pyserial pygame
Open up pycharmCreate a new project and python file
The Code
Go to https://github.com/liavt/BeneathTheSurface and click on Clone or download. Extract the compressed folder to anywhere you wish.
Open up pycharm and load up that folder as a project. It will be ready to be run now.
Arduino
In the Arduino IDE, open up where you cloned the Github repo, and navigate into the folder called BTS. Then open up the .ino file and the code will be ready for you to use.
Bringing It All Together
Download the Adafruit Motor Library(link)
In the arduino program, go to Tools -> Manage Libraries -> Add library
Direct it to the zip or tarbell file of the Adafruit motor shield. It should be at ~/Downloads
Make sure that the arduino is plugged in. It should have a light open.
Press the upload button at the top of the arduino program. It should be green arrow.
Plug in the joystick
Open pycharm and go to Run -> Run
If the python fails to run, try again in 10 seconds or verify that the arduino is plugged in
Now if you move your joystick, the sub will move in that direction. It is using holonomic drive.