Introduction: Building a Semi Smart, DIY Boat With Arduino and Some Other Sensors

Picture of Building a Semi Smart, DIY Boat With Arduino and Some Other Sensors
I based this off of this really nice instructables.com post for building a water bottle boat, with some additions for obstacle avoidance and light-guided control. I used Arduino as a microcontroller, an ultrasonic sensor in the front, a few simple switches on the side of the boat, and a few light sensors on either side.  See here for a few more photos or here for a pdf step by step.

This simple little floating boat bounces off walls, can be steered with a flashlight, and won't hit something head-on. 


Step 1: MATERIALS

Picture of MATERIALS

Tape
hot glue + glue gun (silicon optional)
two small DC motors
two water bottles
wires
two small propellors
arduino + USB cable + computer
wire strippers
a plastic box 
a 9V battery + a connector
a power diode (like 1n4004)
some resistors
scissors
 a soldering iron + solder
a MOSFET transistor or TIP 120
2 few switches + 2 photocells

Step 2: Put the Motor in the Cap

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of Box Everything

Put your circuit, arduino, and battery in the box. 

Step 13: Upload the Sketch

Picture of Upload the Sketch

Open Arduino

Select the correct board and correct port. 
Compile and upload the sketch. 

Step 14: Waterproof and Get Ready for Testing

Picture of 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! 

Comments

lapenta (author)2016-02-04

very nice solutions you brought... I was wondering how I could seal my motors... I think I'll try to use the inside bottle caps. But I think i'll try to seal with silicone glue...
If I manage to make something decent I'll post here as a "I made it" in reference to you. Thanks for sharing!

anood.aydha (author)2015-03-16

I tried to do this project with two 3V DC motors and used a 9V battery to power the Arduino. However, the 9V battery drained fast in about 10 minutes when the Arduino is running the 3V DC motors through the 3.3V pin, how can I solve this problem?

kinetike (author)2012-08-26

Haha, I hate this kind of spaghetti! Good job on this creation and your SNEEL! Love them both.

Kinnishian (author)2012-07-16

I'm a bit fan of the simplicity. I'm surprised the hot glue trick works for the motor-shaft. Definitively a tip I'll be trying to store away and remember.

alcurb (author)2012-06-25

Nice project.

You have a picture when its floating? I'm trying to picture it floating and wonder if the water leaks through the motor shaft holes, unless the shafts remain above water. How do the bottles remain air/water tight with said shaft holes?

I would like to see a video showing how it moves under its own control.

mathman47 (author)alcurb2012-07-05

I race fast electric R/C boats. We put lube in the stuffing box (the tube the prop shaft goes through). I don't know of anyone who has had a problem with water entry through the stuffing box if the lube was applied properly.

N.fletch (author)2012-06-22

I'm sorry for asking a petty question: but how did you create the nice design of the arduino with the wires and other misc. components. I've seen other authors add these to their "ables". I would like to know so I could create my own.
Great instructable by the way!

peptidefarmer (author)N.fletch2012-06-23

http://fritzing.org/download/

N.fletch (author)peptidefarmer2012-06-25

Thank you peptidefarmer

janw (author)2012-06-24

Very nice project! And very good recycling of materials.

wkg7822142 (author)2012-06-22

where code?

Notquitepinoy (author)2012-06-21

love your project... good use of on hand materials... nice job

About This Instructable

62,281views

128favorites

License:

Add instructable to: