Arduino Sailboat

To build the sailboat we used

  • Arduino Uno [1]
  • Prototype shield with bread board ($5)
  • Wireless RF module and remote ($6)
  • Small servo ($6)
  • 6x AA batteries with case and plug
  • K’Nex building pieces
  • 4 plastic bottles
  • 1 small plastic container with a lid
  • String, Duct tape, and a garbage bag (white if you have it)

The boat construction used the 4 bottles for flotation and a K’Nex frame.

structure

Mounting the rudder will probably require some trial and error, our design used some Lego pieces, duct tape and wire to hold it in place.

servo1

For the electronics we had some good success with a wireless RF (Radio Frequency) module. The wireless RF modules are relatively low cost ($6), and they do not require any fancy programming. remote1

wiring

The final Arduino code is :

//
// sailboat1.ino - use a wireless RF motor to move a servo on a sailboat
// RF buttons:
// A = straight (90deg), B = turn left (10deg), C = turn right (10deg)
// Limit rudder turning from 60-120 degrees
//
#include <Servo.h> 
 
Servo myservo; 
int pos;

void setup() {
 pinMode(5, INPUT); // A button - D0 pin on RF module
 pinMode(6, INPUT); // B button - D1 pin on RF module 
 pinMode(7, INPUT); // C button - D2 pin on RF module 
 pinMode(8, INPUT); // D button - D3 pin on RF module 


void loop(){

if (digitalRead(5) == HIGH) { 
 Serial.println("Button A");
 pos = pos + 10;
 if (pos > 120) { pos = 120;} 
 myservo.write(pos); 
 delay(250);
 } 
 if (digitalRead(6) == HIGH) { 
 Serial.println("Button B"); 
 pos = 90;
 myservo.write(pos); 
 delay(250);
 } 
 if (digitalRead(7) == HIGH) { 
 Serial.println("Button C");
 pos = pos - 10;
 if (pos < 60) { pos = 60;} 
 myservo.write(pos); 
 delay(250); 
 } 
 if (digitalRead(8) == HIGH) { 
 Serial.println("Button D"); 
 delay(250);
 }

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s