This simple little floating boat bounces off walls, can be steered with a flashlight, and won't hit something head-on.
Step 1: MATERIALS
hot glue + glue gun (silicon optional)
two small DC motors
two water bottles
two small propellors
arduino + USB cable + computer
a plastic box
a 9V battery + a connector
a power diode (like 1n4004)
a soldering iron + solder
a MOSFET transistor or TIP 120
2 few switches + 2 photocells
Step 2: Put the Motor in the Cap
1. Take off the top of both water bottles
2. Poke a hole in each cap
3. Apply hot glue to the inside of the cap, but not on the hole. Slip the motor shaft through the hole. When dry, the shaft should spin freely.
Do this with both bottle caps and motors.
Step 3: Tape the Water Bottles Together
Use two or three strips of tape to tape the water bottles together, sort of like a raft.
Step 4: Solder Leads to the Dc Motors If There Are None
The motors are now attached to the bottle caps.
Solder on long (about 10") leads to the motors, if there aren't any.
Step 5: Cut a Slit in the Water Bottle
Cut a small slit in each water bottle.
This is the hole through which the wires from the motors will poke through.
Step 6: Put on the Cap and Feed Through the Wires
Put the cap on the bottle and feed the wires into the bottle opening, then out the slit that you just made. If you have trouble screwing on the cap, use some hot glue to secure it.
Step 7: Make the Electronics House
Glue a plastic box to the top of your two bottles. You can bring the wires from the motors around the back, or poke a small hole in the side of the box to feed them into.
Now, put a bit of hot glue on the holes you made in the bottles to make sure the bottles are watertight.
Step 8: Build the Circuit
This circuit uses a TIP 120 (or similar Darlington or MOSFET) transistor, which is an electronic switch.
It uses it to power a high current load because Arduino does not output enough amperage to turn the motors.
Follow this schematic for the first motor. Then, build the SAME circuit for the second motor, on the breadboard.
(You do not need a 9V battery second power source)
Step 9: Add Some Sensors
Get creative! you don't need all these sensors. but add them as you like.
Ping Ultrasonic Rangefinder by Parallax works nicely on the front of the boat so it knows if something is in its path.
Photocells can act like antennas if you want a boat that steers towards light (for example).
I'm a fan of two simple switches, mounted on the sides of the boat, acting as obstacle detectors.
You can also modify the code and use some Infrared proximity sensors to detect short range obstacles
Step 10: Circuits for the Various Sensorsirc
See images for a circuit for a simple button with a 1K resistor. Do this for two buttons, so you can mount them on both sides of the boat so that if it hits something on either side it can adjust its steering accordingly. More information for this circuit and sample code can be found at www.arduino.cc/en/Tutorial/button
See image for a circuit with a photocell with a 1K resistor: Do this twice, also, so that you can include a photocell on both sides of the boat. For more information and sample code, see the analog input example at www.arduino.cc/en/Tutorial/AnalogInput .
Step 11: Write Some Code or Download It
You can download some super simple premade code I wrote to give the boat basic functionality. There is code for a light-following boat and a boat with an ultrasonic rangefinder, with two buttons as obstacle sensors.
Here is my code for a boat with an ultrasonic sensor, two photocells, and two switches for obstacle avoidance
The way I have it operating is that if the boat approaches an obstacle ahead, it turns to avoid it. If the boat hits something from the side, it turns away from the barrier.
But here you can find various codes for the boat if you dont want to use all of the sensors, but just some of them https://github.com/gabriella/boat-
Or write your own.
Step 12: Box Everything
Put your circuit, arduino, and battery in the box.
Step 13: Upload the Sketch
Select the correct board and correct port.
Compile and upload the sketch.
Step 14: Waterproof and Get Ready for Testing
Put the top of the box on. Seal up all the holes or potential leak spotswith hot glue (or silicon). Glue any stray wires with hotglue (like the photocells or the buttons so they dont short in the water.
Glue on the propellers to the motor shaft sticking out the cap.
test it out on the water!