# WiFi Sailboat Passes Bathtub Test


Last summer, I built a pop-bottle sailboat with my (then) four year old.  After trying a couple of designs with keels in our bathtub, we settled on a catamaran style design with two pop bottles.  We tied a string to it, threw it into the pond, let the wind carry it away, and then pulled it back to shore.

And I thought, wouldn't it be cool to add remote control functionality?

So I did.  I finished my smartphone controlled, WiFi sailboat on Saturday.

![Field test on a rainy, windless day.  The bane of any sailor.](images/FieldTestWithRainButNoWind_sm.jpg 'Field test on a rainy, windless day.  The bane of any sailor.')

The sailboat consists of:

- 2 x 2L pop bottles
- Rubbermaid body
- Plastic shopping bag sail
- Dowel mast, plywood rudder
- 2 [servos](www.dx.com/p/mg995-tower-pro-servo-12832)
- Raspberry Pi with [USB WiFi adapter](http://www.dx.com/p/ultra-mini-nano-usb-2-0-802-11n-150mbps-wifi-wlan-wireless-network-adapter-48166)
- Arduino Uno
- AA Battery pack with a [5V regulator](http://www.castlecreations.com/products/ccbec.html)

I configured the Raspberry Pi to act as a WiFi hot spot.  Using any smart phone, you can connect to the boat, and visit its web page.

The page has two jQuery slider controls.

![Web Interface - jQuery sliders control the sail and rudder](images/BoatWebInterface.png 'Web Interface - jQuery sliders control the sail and rudder')

When re-positioned, the slider controls drive a PHP page which sends commands over the USB interface to the Arduino, which then controls the servos.

It seems like overkill - an Arduino AND a Raspberry Pi for such a simple task?  I'd considered alternatives - using only an Arduino with Bluetooth or another [wireless interface](http://www.dx.com/p/arduino-apc220-wireless-rf-modules-w-antennas-usb-converter-143011), or using the Raspberry Pi to directly control the servos - but in then end, I just used the parts I had on hand.

My initial design used a 7805 IC to supply the 5V for power - that didn't work...  Everything would boot, the 7805 would get super-hot, and the Raspberry Pi would crash after moving a servo a few times.  A little reading lead me to pick up a switching regulator (I happened to pick up one from [Castle Creations](http://www.castlecreations.com/products/ccbec.html) at my local hobby store).

I tested the design out with my assistant in our bathtub, and everything worked!

[Bathtub Test Video](images/BoatBasicFunctions_sm.mp4)

But, by the time everything was built, the city drained the reflecting pool I had intended to use for trials for the fall - I had to try it out in a nearby pond.  And, of course, there was no wind.  I'll post more photos following a windy day test.

Check out these far grander projects - these individuals are trying to build autonomous boats that can cross the Atlantic:  
[http://gotransat.com/](http://gotransat.com/) [http://www.gpss.force9.co.uk/autop.htm](http://www.gpss.force9.co.uk/autop.htm)

With a little more money, and a little more time, I think it would be fun to build a boat I could launch in lake Ontario, at the foot of Yonge St., to sail autonomously down the St. Lawrence to Brockville, where friends in Ottawa could retrieve it.

[Download Sailboat Project Files](/projects/boat.zip)

