Project - Remote Controlled Boat

THE ARGO
Showcase

The Argo is a remote controlled boat that was custom designed with a range of approximately 100 meters from controller to boat. It communicates using Xbee modules at 2.4 GHz frequency.


Boat Schematic

Boat Schematic
Boat PCB Layout


Boat PCB
Boat Arduino Code

#include <SoftwareSerial.h>
#include <XBee.h>
#include <Servo.h>

SoftwareSerial XBee(3, 2); //RX TX

Servo rudder;

int pos=100;
int data=0;

void setup() {
  rudder.attach(4);
  pinMode(5, OUTPUT); // fan motor
  Serial.begin(9600);
  XBee.begin(9600);
}

void loop() {
  if(XBee.available())
  {
    data = XBee.read();
    Serial.print(data);
  }
  if (data == 119) //Dec for "w"
  {
    digitalWrite(5, HIGH); // boat forward  
  }
  else if (data == 97) //Dec for "a"
  {
//    for (pos = 60; pos <= 150; pos += 1) { // goes from 0 degrees to 180 degrees
//      // in steps of 1 degree
//      rudder.write(pos);              // tell servo to go to position in variable 'pos'
//      delay(15);                       // waits 15ms for the servo to reach the position
//    }
    if (pos < 150)
    {
      pos += 1;
      rudder.write(pos); 
      //delay(100);
    }
  }
  else if (data == 115) //Dec for "s"
  {
    digitalWrite(5, LOW); // boat Stop
  }    
  else if (data == 100) //Dec for "d"
  {
//    for (pos = 150; pos >= 60; pos -= 1) { // goes from 180 degrees to 0 degrees
//      rudder.write(pos);              // tell servo to go to position in variable 'pos'
//      delay(15);                       // waits 15ms for the servo to reach the position
//    }
    if (pos > 60)
    {
      pos -= 1;
      rudder.write(pos); 
      //delay(100);
    }
  }
  else
  {
    digitalWrite(5, LOW); // boat Stop
  }
  
  data = 0;
}
Boat Build

Unfinished Boat Top Unfinished Boat Bottom Boat PCB Unfinished Boat Full Unfinished Boat Finished Boat Bottom Finished Boat
Remote Schematic

Remote Schematic
Remote PCB Layout


Remote PCB
Remote Code

#include <XBee.h>
#include <SoftwareSerial.h>
int analogPin = A0; // potentiometer wiper (middle terminal) connected to analog pin 3
int potVal = 0;  // variable to store the value read
int toggleGoPin = 4; //D4
int goPinVal = 0;
int tempGoPinVal = LOW;
int potToRudderVal = 0;
int tempPotPinVal = 0;

double POT_TO_MOTOR_CONVERTER = 8.133333;

SoftwareSerial XBee(3, 2); //RX TX

void setup() {
  // put your setup code here, to run once:
  //732 seems to be the max reading 
   Serial.begin(9600);
   XBee.begin(9600);

   pinMode(toggleGoPin, INPUT); // D4
   pinMode(analogPin, INPUT); // A0
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println(potVal);          // debug value

  potVal = analogRead(analogPin);  // read the potentiometer from the remote
  goPinVal = digitalRead(toggleGoPin); // read the toggle lever position (limit switch) on remote
  //go motor stuff
  if ((goPinVal != tempGoPinVal)&&(goPinVal == HIGH)){
    XBee.write(2);
  }
  if ((goPinVal != tempGoPinVal)&&(goPinVal == LOW)){
    XBee.write(1);
  }
  if (goPinVal == HIGH){
    tempGoPinVal = HIGH;
  }
  else if (goPinVal == LOW){
    tempGoPinVal = LOW;
  }
  ///////////////////////////////////////////////////////
  //rudder stuff
  if ((potVal != tempPotPinVal)&&(potVal != tempPotPinVal+1)&&(potVal != tempPotPinVal-1)){
    potToRudderVal = 150-(potVal/8.13333);
    XBee.write(potToRudderVal);
    tempPotPinVal = potVal;
  }


  delay(50); // input delay to prevent spam
}
Remote Build

Remote_1 Remote_2 Remote_3
Galary

Boat on Shelf Boat on Table Boat on Rock Boat Side