Introduction: RC Boat

Hello all,

This is my first instructable, I hope you enjoy :)

in advance sorry for my bad english skill :(

The goal of this project is to have a remote control for a RC boat very fun for children

Vote for me please :)

Step 1: Component and Tools

Component

  • Arduino nano
  • Arduino pro mini 8mhz
  • 2 NRF24L01
  • wire
  • proto board
  • melamine board
  • 2 red LED
  • 2 orange LED
  • 2 green LED
  • 1 blue LED
  • 2 white LED
  • 1 Yellow LED
  • 3 toggle switch
  • 1 Push button
  • Boat bar
  • compressed polystyrene
  • micro servo 9g
  • small brushed motor

Tools

  • soldering Iron
  • Small Cutting pliers
  • Hot glue gun
  • sandpaper
  • cutter
  • wood saw

Step 2: Boat

I wanted a big difference in size between the boat and the remote control

The boat is build around an arduino pro mini 8Mhz

This choice allows me to connect it to a LIPO 3.7 volt

From the polystyrene I cut a rectangle and cut it roughly with the cutter to get the shape of the boat.

Once the rough form is obtained, with sandpaper refine the shape of the boat to have a clean result.

Dig a hole big enough to fit the battery and electronics.

Coming soon: electrical schema

<p>/* Includes ------------------------------------------------------------------*/<br>#include 
#include 
#include 
#include </p><p>/* Ports ---------------------------------------------------------------------*/
//#define CE_PIN 9
//#define CSN_PIN 10
#define CE_PIN 4
#define CSN_PIN 5</p><p>#define LED_ORANGE 2
#define LED_WHITE 3</p><p>#define PIN_GOUVERNAIL 8
#define PIN_MOTEUR 6</p><p>/* nRF24l01 ------------------------------------------------------------------*/
// NOTE: the "LL" at the end of the constant is "LongLong" type
const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
/* Joystick ------------------------------------------------------------------*/
int joystick[5]; // 2 element array holding Joystick readings
/* ---------------------------------------------------------------------------*/
Servo monServo; </p><p>int counter = 0;
void setup(){
  Serial.begin(9600);
  delay(1000);
  Serial.println("nRF24l01 Receiver Starting");
  radio.begin();
  radio.setRetries(0, 15);
  radio.setPALevel(RF24_PA_HIGH);
  radio.openReadingPipe(1,pipe);
  radio.startListening();</p><p>  monServo.attach(PIN_GOUVERNAIL);
  pinMode(PIN_MOTEUR,OUTPUT);
  pinMode(LED_ORANGE,OUTPUT);
  pinMode(LED_WHITE,OUTPUT);
  pinMode(10,OUTPUT); //on prépare le pin 3 en mode sortie
}
 </p><p>void loop(){
    
  if ( radio.available() )
  {
    // Read the data payload until we've received everything
    bool done = false;
    while (!done)
    {
    // Fetch the data payload
      done = radio.read(joystick, sizeof(joystick));
      Serial.print("X = ");
      Serial.print(joystick[0]);
      Serial.print(" Y = ");      
      Serial.println(joystick[1]);</p><p>      int dir = map(joystick[0], 0, 1024, 130, 80);
      //int acc = map(map(joystick[1], 512, 1024, 0, 512), 0,512, 0,200); //crawler radio
      int acc = map(joystick[1], 0, 100, 0, 200);
    
      monServo.write(dir);
      analogWrite(PIN_MOTEUR, acc);</p><p>      if(joystick[2] == 1) {
        analogWrite(LED_ORANGE, 200);
      } else {
        analogWrite(LED_ORANGE, 0);
      }
      
      if(joystick[3] == 1) {
        analogWrite(LED_WHITE, 200);
      } else {
        analogWrite(LED_WHITE, 0);
      }</p><p>      
      if(joystick[4] == 1) {
        buzzer();
      } else {
        digitalWrite(10, 0);
      }</p><p>      delay(50);
    }
    counter = 0;
  }
  else
  {    
    if(++counter>10) {
      Serial.println("No radio available");
      monServo.write(105);
      analogWrite(PIN_MOTEUR, 0);
      digitalWrite(10, 0);
    }else {
      delay(100);
    }
  }
}</p><p>int p=50;
void buzzer()
{
  p--; // on incémente p à chaque boucle de loop();
  if (p<10){ // teste la limite de p
    p=50; // on le remet à 10
  }
  digitalWrite(10,0); // état bas
  delayMicroseconds(p); //on attend p milli-secondes
  digitalWrite(10,1); // état haut
  delayMicroseconds(p); // on attend p millisecondes
}</p>

Step 3: Remote Control

The goal of the remote control is to offer a design same to a boat

A big Bar

A progressive accelerator

A bare graph bind to accelerator

push button and toggle switch for interact with boat

coming soon : electrical shema

/* Includes ------------------------------------------------------------------*/
#include #include #include #include

/* Ports ---------------------------------------------------------------------*/ #define CE_PIN 9 #define CSN_PIN 10 #define ACC_POTAR A1

/*threadhold*/ #define MIN_POTAR_VAL 48 #define MAX_POTAR_VAL 341

/* nRF24l01 ------------------------------------------------------------------*/ // NOTE: the "LL" at the end of the constant is "LongLong" type const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe RF24 radio(CE_PIN, CSN_PIN); // Create a Radio /* Joystick ------------------------------------------------------------------*/ int joystick[5]; // 2 element array holding Joystick readings /* ---------------------------------------------------------------------------*/ Encoder myEnc(3, 4);

int barreValue = 512;

#define NB_LED 6 int ledPins[] = { A3, A2, 5, 6, 7, 8 };

void setup(){ Serial.begin(9600); delay(1000);

radio.begin(); radio.setRetries(0, 15); radio.setPALevel(RF24_PA_HIGH); radio.openWritingPipe(pipe);

barreValue = 512;

for (int thisLed = 0; thisLed < NB_LED; thisLed++) { pinMode(ledPins[thisLed], OUTPUT); } } void loop(){ updateBarre();

joystick[0] = barreValue;// analogRead(JOYSTICK_X); joystick[1] = map(analogRead(ACC_POTAR), MIN_POTAR_VAL, MAX_POTAR_VAL, 0, 100); joystick[2] = 0; joystick[3] = 0; joystick[4] = 0; //joystick[1] = analogRead(ACC_POTAR); Serial.print("Valeur lue : "); Serial.println(joystick[1]); updateBarrGraph(); radio.write( joystick, sizeof(joystick) ); delay(100); }

void updateBarrGraph() { // map the result to a range from 0 to the number of LEDs: int ledLevel = (map(joystick[1], 0, 100, 0, NB_LED+1));

// loop over the LED array: for (int thisLed = 0; thisLed < NB_LED; thisLed++) { // if the array element's index is less than ledLevel, // turn the pin for this element on: if (thisLed < ledLevel) { digitalWrite(ledPins[thisLed], HIGH); } // turn off all pins higher than the ledLevel: else { digitalWrite(ledPins[thisLed], LOW); } } }

void updateBarre() { barreValue += 10 * getSensRotation();

if(barreValue > 1023) { barreValue = 1023; } else if(barreValue < 0){ barreValue = 0; } }

long oldPosition = -9999; int8_t getSensRotation() { long newPosition = myEnc.read(); if (newPosition != oldPosition) { Serial.println(newPosition); }

int val = oldPosition - newPosition; oldPosition = newPosition; return val;

if(newPosition > oldPosition){ oldPosition = newPosition; return 1; } else if(newPosition < oldPosition){ oldPosition = newPosition; return -1; } oldPosition = newPosition; return 0; }

Arduino Contest 2017

Participated in the
Arduino Contest 2017

Remote Control Contest 2017

Participated in the
Remote Control Contest 2017