This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com). This project will feature an animatronic pirate ship that uses a servo to move the ship up and down (as if rocking on the seas), flashing red LEDs in the cannons and cannon portholes, and yellow internal lights for ambience.
Step 1: Acquire Electrical Components (and Screw)
You will need approximately 40-50 feet of wire, 16 red LEDs, 2 Yellow LEDs, Arduino Uno, Servo motor, and a single #6 or below machine screw that is at least an inch long with a nut to match.
Step 2: Print 3D Parts
Print all 3D parts associated with this project. I have removed all text and my University's logos from the project.
Step 3: Paint Parts As Desired
Step 4: Assemble the Ship
Glue the 16 red leds into the ship's cannons and glue fiber optic cables into the opening of the cannons. Place the lower cannon pieces onto the pegs inside the ship halves. Place the upper deck cannons on the deck, snaking the wiring through the slits of the deck. Run the wires from the top deck of the ship through the "middle bar" of the ship for manageability. Run one yellow LED up the side of the ship (there's a tiny extrusion to be used as a wire guide) into the wheelhouse, run the other yellow led along the middle ship bar to light up the galley. Place the "middle bar" into the inserts of the ship and assemble the two halves of the ship, gluing them together. Insert the deck lid into the top of the two halves. Glue the sails and anchor onto the deck of the ship and glue the ship wheel onto the top of the wheelhouse.
Step 5: Attaching to Arduino Box
Insert the bar hanging down from the ship into the lid of the Arduino box. Glue the Servo Cover printed part over the arm of the servo you will be using. Insert the machine screw (or bolt) through the servo arm cover as well as the bar hanging down from the ship and fasten with a nut. Slide this box lid part into the groove of the box now and glue the servo motor into the cavity on the floor of the Arduino box, pushing the wires through the opening in the back. Insert the LED wires through the other openings in the Arduino box lid. Insert the Arduino Uno into the small ridged region of the box with the holes for the connections, insert the breadboard into the larger ridged region. Glue the bracing rod onto the box lid that has the small perforations around the circular wire holes (this "L" perforation indicates a corner edge of the bracer to line up with it).
Note: the bar attaching to the servo is very thin, you may want to consider modifying or reinforcing this slightly but it worked for my purposes. If it's difficult fitting the bracer rod into the cavity built into the middle ship bar, consider propping up the rear of the ship using other pieces glued to the roof of the arduino box. I covered the whole bottom portion with cloth to hide the wires and supports so use whatever's convenient.
Step 6: Wiring the Breadboard and Arduino Uno
Attach the wires, resistors, and remote sensor to the breadboard and Arduino as shown in the Fritzing diagram attached to this step. Slide the other half of the box lid over the breadboard and Arduino setup. The red LEDs are in groups of 4, each member of a group running parallel with the others, and each group connecting to a separate Arduino pin. In this sketch, the red LED pins on the Arduino are 6, 7, 8, and 9. Pin 5 operates the Servo motor and pin 4 operates the remote receiver. Note the low resistance resistors associated with the red LED groupings (I was simply using the 220 ohm resistors in a kit I purchased) and the larger resistor used for the remote receiver. There is no exact value necessary for this larger resistor, but I used a 1 kohm resistor (220 was too low).
Step 7: Coding the Arduino Uno
Upload the attached Arduino code to the Arduino Uno. This code is fully commented with the functions outlined in the code. You will notice a significant portion of the code commented out. This will be explained in the final "OPTIONAL" step. The code is designed so that the following buttons on my remote activate the following functions:
1) Start Servo
2) Stop Servo
3) Start cannon light sequence
4) Stop cannon light sequence
5) Start yellow ambiance lighting
6) Stop yellow ambiance lighting
You will need to adjust the code for the remote that you are using. When you first start up the code, open the serial port. When you press a button on your remote, the serial port should read what the value of that particular button is. You can then input that into the code where necessary. After editting the code as necessary for your remote, you should be good to go! There is an additional feature I was working on for this project that did not come to fruition that will be described in the next optional step
Step 8: (OPTIONAL) Moving Cannons, Stepper Motor Addition, Cam Shaft Addition
Along with the aforementioned features, I was also working to include moving cannons on this ship that would retract when the red LEDs flash, then reset and fire again. This was achieved through the use of 2 cam shafts, spring additions, a stepper motor, and the necessary Arduino coding. However, due to either a motor failure, friction forces, or wires blocking motion, the stepper motor fails to turn in my project. Because I do not know the source of error, I wished to mark this as an optional separate step. If you include this step and the stepper motor fails (as in my project) the rest of the functions will still perform appropriately, you just wont have movable cannons.
1) 3D print the attached STL files.
2) Place springs over the cylinders lining the inside of the ship, between the wall of the ship and the bottom cannon inserts.
3) When assembling the ship, insert the rotating cam shafts into the back of the ship, so that the gears are under where the wheel is on the deck of the ship.
4) Obtain a stepper motor that has a centrally located shaft that rotates. If it's not centrally located, you will need to make modifications to the 3d printed ship (you can simply carve out the correct location to utilize my other prints).
5) Glue the front insert into the front of the ship (under the anchor) between the two rotating shafts to prevent motion and glue the rear insert into the back of the ship between the two rotating shafts to prevent motion.
6) Glue the stepper motor into the cavity in the back of the ship and glue the 3D printed spur gear over the shaft. Glue some small supports onto the stepper motor under the spur gear to prevent wobbling. The part files I have attached for this are tiny so it is best not to use a printer to make these, but to find some small plastic or hard pieces of scrap material and just use that.
6) Uncomment lines 68, 69, 70, 71, 74, 165, and 166 of my Arduino code and connect the Stepper motor to the Arduino in the pins indicated in the code while connecting the positive and ground wire to the appropriate breadboard strips
7) Now theoretically the cannons will move with the initial flashing of the LEDs if all worked appropriately. I simply wanted to provide you with the opportunity to attempt this feature if you wished to.