Shipwreck
Harys Dalvi
June 2022
Lots of people make remote control motorboats. Remote control sailboats are less common, although there is such a thing in Central Park. I thought I would make my own remote control sailboat using Arduino. It almost worked. Here is a video of the boat at her peak:
Unfortunately, the boat quickly declined after that. Here is how to almost make a remote control sailboat using Arduino.
Structure
Materials:
- Plastic box
- 2 empty plastic bottles
- 2 plastic forks
- Piece of paper with holes
- Scissors
- String
- Tape
For the hull, I went with a catamaran structure: I used two plastic bottles for added stability. Feeling confident, I connected the bottles to a plastic box using nothing but tape. I wish I had stronger tape. (I tried school glue as well, but it kept coming apart.)
Next came the mast and sail. For the mast, I used two plastic forks taped together. For the sail, I cut a piece of
paper with physics on it. I tied the sail to the mast using bowline knots
and then added tape for extra security. (My boat probably relied a little too heavily on tape.)
Finally, I cut a small hole in the corner to allow for tightening and loosening the sail later on.
Now I was ready to see if my vessel was seaworthy. With no captain and no ability to steer, I successfully set sail.
The next logical step was to add a captain and an ability to steer. That's where the Arduino came in.
Control
Materials:
- Arduino
- Infrared remote
- Infrared receiver module
- DC motor
- Servo motor
My plan was to control the steering using a servo motor (which can set its angular location to any value 0–180 degrees) and a regular DC motor (which just spins). I would attach the servo motor to a tiller to steer and attach the DC motor to the sail with a rope so I could tighten and loosen the sail. I connected the DC motor directly to the Arduino input pins so I could control which way it spun using code.
Circuit diagram
Code
#include <IRremote.h>
#include <Servo.h>
#define SERVO 4
#define IR 7
#define MOTOR_1 8
#define MOTOR_2 9
IRrecv ir(IR);
Servo servo;
int pos;
void setup() {
ir.enableIRIn();
ir.blink13(true);
pinMode(MOTOR_1, OUTPUT);
pinMode(MOTOR_2, OUTPUT);
servo.attach(SERVO);
pos = 90;
servo.write(90);
}
void loop() {
if (ir.decode()) {
int button = ir.decodedIRData.command;
/*
* up: 9
* down: 7
* vol-: 21
* vol+: 70
* eq: 25
*/
if (button == 9) {
digitalWrite(MOTOR_1, LOW);
digitalWrite(MOTOR_2, HIGH);
delay(100);
digitalWrite(MOTOR_2, LOW);
delay(100);
}
if (button == 7) {
digitalWrite(MOTOR_1, HIGH);
digitalWrite(MOTOR_2, LOW);
delay(100);
digitalWrite(MOTOR_1, LOW);
delay(100);
}
if (button == 21) {
pos -= 30;
if (pos < 0) {
pos = 0;
servo.write(0);
} else {
for (int i = 29; i >= 0; i--) {
servo.write(pos+i);
delay(15);
}
}
delay(100);
}
if (button == 70) {
pos += 30;
if (pos > 180) {
pos = 180;
servo.write(180);
} else {
for (int i = -29; i <= 0; i++) {
servo.write(pos+i);
delay(15);
}
}
delay(100);
}
if (button == 25) {
pos = 90;
servo.write(pos);
delay(200);
}
ir.resume();
}
}
Ship with a Skipper
Now that I had a control system and a supposedly seaworthy vessel, I just had to integrate the two. I tied and taped a string around the DC motor, while I tied and taped a plastic fork to the servo motor.
I flipped the servo motor upside down so the tiller would be in the water, and I tied the mainsheet to the sail. Of course, I secured everything with tape. Finally, I added a 9V battery. With the Arduino, my ship now had a skipper to lead a crew of motors.
However, when I tested it, I found the controls were extremely glitchy. When I pressed a button, it would hardly ever work.
So I began another set of improvements, not knowing it would be my last. I tried compensating for the glitches by programming the Arduino to move further with each button press. I also broke off the fork part of the tiller and pushed it into the bottom for extra steering power. Finally, I changed the angle of the breadboard and moved things around so the infrared sensor would be higher up, and signals would be less likely to get blocked.
I tested the new control system on land and it worked decently, though it wasn't great.
Shipwreck
I was confused about why the controls seemed to work so much better on land than on water. I was also confused about why the controls were working quite poorly either way. But rather than find the answer, I made excuses like “the sun's infrared rays are interfering” and went on another voyage. As soon as I left the harbor and set the ship on the water, I felt something wrong. The ship was quickly tilting to the right.
My reflexes kicked in and I immediately grabbed the boat to protect the components inside. Unfortunately, there was still a little splashing. The sail and the battery were completely ruined, and I was worried about the rest of the components as well, especially the Arduino.
It could have been far worse: the wreck occured close to shore, so my reflexes were quick enough that damage was minimal. Still, it meant I could go no further with the project. I took everything inside, removed all the tapes and knots, and tested the electronic components to see if they were still working. Fortunately, there was no damage as far as I can tell.
Then I did what I should have done before the shipwreck: I found out why the controls weren't working. The remote seems to have a very small range, only about a foot. Clearly the infrared hardware was designed for things like turning LEDs on and off, not sailing a small vessel across a swimming pool through 10 knot winds.
Lessons Learned
A chain is only as strong as its weakest link. This project had one weak link and one weaker link. First, the infrared remote range wasn't enough to control the boat. This wasn't directly my fault, but I should have tested the hardware more before assuming it would work for my needs.
The weaker link was a literal link between the plastic bottles and the plastic box. I just used a couple pieces of tape, but this is perhaps the most important link in the entire ship.
Without these two issues, I might have actually succeeded, although there were some more minor flaws. The paper sail was attached in a way that it was bent to one side. I should have attached it more carefully or used a boom (solid bar at the bottom of the sail) to keep it straight. The plastic fork tiller was probably too thin. Using thicker rope might have been more secure and made the knots easier to tie.
From a more general perspective, this project taught me about taking risks. I took a risk by using electronic components near water. I paid for that risk. But even though I didn't succeed, I don't regret it. I took a risk hoping it would work out, but prepared for the chance that it might not. In the end, it almost did work out, and I only lost a battery.
At the same time, my risk should have been more calculated. Although I was safe because the battery was only 9V, I knew I was putting my components in danger. I should have tested the strength of the hull and the range of the remote beforehand.
There will probably be many more times in the future where I'll try a project that might fail. Hopefully I'll be more careful next time; but even if I can't completely eliminate the risk, it may or may not still be worth taking a chance.
And most of all, I learned that tape can't solve everything.