Remotely control a K-Nex sailboat

Lead Image © Ints Vikmanis, 123RF.com

Sail Away

, ,

Create your own sail boat and steer it with a low-cost remote control.

Depending on its purpose, a sailboat can come in a variety of forms and can be built with any number of different materials. We wanted a simple but stable and light design, so for our remote control sailboat, we chose K'Nex construction pieces and a catamaran configuration (Figure 1). (See the "Materials List" box for all the materials we used.)

Materials List

Sailboat

  • K'Nex building pieces [1]
  • 4 plastic bottles
  • 1 small plastic container with a lid
  • String
  • Duct tape
  • 1 garbage bag (white if you have it)

Electronics

  • Arduino Uno [2]
  • Prototype shield with bread board ($5) [3]
  • Servo ($6) [4]
  • Wireless RF module and remote ($6) [5]
  • 6 AA batteries with case and plug ($4)
Figure 1: The basic elements of a catamaran.

For the electronics, we had good success with a wireless RF (radio frequency) module. These modules are relatively low in cost, and they do not require any fancy programming. We used an Arduino Uno with a prototyping shield, but smaller and lighter weight Arduino components like a Trinket Pro or a Nano could be used as well. The battery pack provided 6 x 1.5V=9V of power. The Arduino Uno can accept 6-20V power input. The servo and the RF module were powered directly from the 5V pin on the Arduino module.

Building the Boat

For the boat design, we used four plastic bottles, two bottles on each side of the catamaran, as the hulls. The boat structure needed to be big enough to support four bottles firmly taped to the bottom and rigid enough to handle the waves and wind on the sail. The base structure had a reinforced center line, and rows of arms provided a structure on which to tape the water bottles (Figure 2).

Figure 2: Sailboat base with support arms for water bottles.

The most challenging parts of the project were building the rudder and connecting the servo firmly to the boat structure (Figure 3). The rudder was made of K'Nex pieces and some duct tape, but other options like wood and Lego pieces would also work. The K'Nex pieces were arranged so that the servo could be attached securely with a wire tie through the holes in the surrounding K'Nex pieces.

Figure 3: Rudder and servo.

Two lines tied from the top of the mast to the front of the main deck supported the mast. The boom was attached part way up the mast, and it is important that the connection between the two remains loose (pivots). The sail was cut from a white garbage bag and taped to the mast and the boom. A piece of string attached to the boom allowed it to swing about 45 degrees each way (Figure 4).The Arduino module, the RF module, and the battery pack were placed inside a small plastic container that was duct taped to the main deck. Having a lid on the container helped keep the electronics dry. Some plastic wrap and an elastic band could also be used to the same end and still not pinch the wires running to the rudder.

Figure 4: Arrangement of the mast, its support lines, the boom, and the boom line.

We mounted the servo and rudder so that the servo direction and the boat direction were the same. This meant that when we turned the servo left the sailboat turned left.

Wiring the Arduino

Servomotor wires are typically red for +5V, black for ground (GND), and yellow for data. We wired the servo data line to Arduino pin 9 and the power and GND to the Arduino Power Vin and GND pins (Figure 5).

Figure 5: Fritzing diagram of project electronics.

A number of different wireless RF modules are available. The remote control and RF module we used had four buttons, and it was rated for 20-50 meters (65-164 feet). Most RF modules have a connection for an external antenna. Although we did not use an antenna, we think our range was about 15 meters (50 feet).

Each button on the remote control is mapped to a pin on the RF module (Figure 6), and then each of the pins on the RF module was connected to an Arduino pin as shown in Table 1. Listing 1 shows the Arduino code [6] used to control the servo. Lines 13-16 set up Arduino pins 5-8 as input (from the RF module). For the button controls, each press of the C button adjusts the rudder by -10 degrees (lines 33-39), and each press of the A button adjusts the rudder by +10 degrees (lines 20-26). The B button positions the rudder to 90 degrees (i.e., straight; lines 27-32). The rudder range is limited to movement between 60 degrees (line 36) and 120 degrees (line 23), so 60 degrees is a full left turn and 120 degrees is a full right turn. The D button is set up (lines 40-43) but doesn't do anything here.

Listing 1

sailboat.ino

01 //
02 // sailboat1.ino - use a wireless RF motor
   to move a servo on a sailboat
03 //   RF buttons:
04 //     A = straight (90deg), B = turn left (10deg),
   C = turn right (10deg)
05 //     Limit rudder turning from 60-120 degrees
06 //
07 #include <Servo.h>
08
09 Servo myservo;
10 int pos;
11
12 void setup() {
13   pinMode(5, INPUT); // A button - D0 pin on RF module
14   pinMode(6, INPUT); // B button - D1 pin on RF module
15   pinMode(7, INPUT); // C button - D2 pin on RF module
16   pinMode(8, INPUT); // D button - D3 pin on RF module
17
18 void loop(){
19
20   if (digitalRead(5) == HIGH) {
21     Serial.println("Button A");
22      pos = pos + 10;
23      if (pos > 120) { pos = 120;}
24      myservo.write(pos);
25      delay(250);
26   }
27   if (digitalRead(6) == HIGH) {
28     Serial.println("Button B");
29      pos = 90;
30      myservo.write(pos);
31      delay(250);
32   }
33   if (digitalRead(7) == HIGH) {
34     Serial.println("Button C");
35     pos = pos - 10;
36     if (pos < 60) { pos = 60;}
37     myservo.write(pos);
38     delay(250);
39   }
40   if (digitalRead(8) == HIGH) {
41     Serial.println("Button D");
42     delay(250);
43   }
44 }

Table 1

Remote Control Mapping

Button

RF pin

Arduino pin

Function

A

D0

5

Turn right

B

D1

6

Straight rudder

C

D2

7

Turn left

D

D3

8

Not used

Figure 6: Remote control buttons and RF module.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content