Boat

by 1023268 in Circuits > Arduino

27 Views, 0 Favorites, 0 Comments

Boat

0.jpg

Hi, I am Rohan Kulkarni and this is my Intructable on how to build a fully working DIY boat. You will be able to use any remote to control this boat. You will be provided all the steps and code needed to build this boat.

Supplies

Circuit for Motor

Screenshot 2024-06-15 181008.png
unnamed.jpg

H-Bridge


  • Using red wire connect the 5V pin to the an end on the positive rail of a bread board
  • Place H-Bridge near the other end of the breadboard (leave 3 to 4 columns open)
  • Using red wires connect the power 1 and 2 pins to the positive rail.
  • They are located one the two corners of the H-Bridge
  • Connect the ground pins on one side of the H-Bridge (the two middle pins) to the negative rail
  • Connect the enable 1 pin (located on the far corner) to pin 9 on the Arduino Uno
  • Connect Input 1 pin (located next to the enable pin) to pin 2 on Arduino
  • Connect Input 2 pin (located next to power pin) to pin 3 on Arduino
  • Add a 0.01 uF capacitor by connecting the two output pins.
  • Connect output pins to the motor pins.


IR-Sensor


  • Place an IR sensor near the middle of the breadboard
  • Connect the ground side (middle wire) to the negative rail
  • Connect the power side (right wire) to the positive rail
  • Connect the output side (left wire) to pin 11 on Arduino


Completing the Circuit


  • Using a black wire connect the two negative rails on the end of the breadboard


Flashing Lights

Screenshot 2024-06-17 083453.png
unnamed.jpg

Soldering


Take three LEDs, green, yellow, red. Connect the positive side to the negative side of the other LED use solder. Then take the other three LEDs and do the same. Then connect the two LED chains. Negative to negative, and positive to positive


555-Timer Circuit


  • Place two 555 - timer circuits on the breadboard
  • Connect power pin to the positive rail for both chips
  • Connect the ground pin to the negative rail for both chips
  • Add a 100 uF capacitor to the negative and positive rail on the top left of the breadboard
  • Connect a 0.01 uF capacitor to the trigger pin on the middle chip
  • Connect a 100 uF capacitor to the trigger pin on the left chip
  • Connect the ground side of both those capacitors to the negative rail
  • Connect the trigger pin to the threshold pin on both of the 555-timers
  • Connect the Out pin and the threshold pin on the middle chip using the 1 mega ohm resistor
  • Connect the out pin and the threshold pin on the left chip using a 10k resistor
  • Connect the out pin on the middle chip to the positive side of the LEDs you built using a 330 resistor in the middle
  • Connect the out pin on the left chip to the negative side of the LEDs you built
  • Connect the two negative rails of the breadboard

Coding

Demo code for IR sensor


#include <IRremote.h>


int RECV_PIN = 11;


IRrecv irrecv(RECV_PIN);


decode_results results;


void setup()

{

 Serial.begin(9600);

 irrecv.enableIRIn(); // Start the receiver

}


void loop() {

 if (irrecv.decode(&results)) {

  Serial.println(results.value, HEX);

  irrecv.resume(); // Receive the next value

 }

}


Explanation


The Demo Code is to set up a remote to the IR sensor. Every but on every remote has its own frequency, so to figure out what frequency your remote has, use the demo code.

Add the demo code into the Arduino app. Download these files at add them into the libraries in the Arduino file.


Once code is uploaded into the Arduino, open serial monitor and click a botton on the remote to the IR sensor. Copy the code that prints and add it here.

(results.value == 0x(paste code hear)


Begin with


#include <IRremote.h>


int RECV_PIN = 11;


IRrecv irrecv(RECV_PIN);


decode_results results;


Then declare your control pin names. Like so


int m1 = 3;

 int m2 = 2;

Then start void setup code for enable pin and control pins


void setup()

{

 Serial.begin(9600);

 Serial.println("Enabling IRin");

 irrecv.enableIRIn(); 

 Serial.println("Enabled IRin");

 pinMode(m1, OUTPUT);

 pinMode(m2, OUTPUT);

  

}


Then define forward, backward driving and also stop


void forward(){

  digitalWrite(m1,LOW);

  digitalWrite(m2,HIGH);

}


void backward(){

  digitalWrite(m1,HIGH);

  digitalWrite(m2,LOW);

}

void stopMotor(){

  digitalWrite(m1,LOW);

  digitalWrite(m2,LOW);

 }


Then start void loop code to tell the arduino what to do if a certain button on the remote is pressed


void loop()

{

  

 if (irrecv.decode(&results)) {

  Serial.println(results.value, HEX);

  irrecv.resume(); 

   

  if(results.value == 0x57E39867){

   forward();

  }

  else if (results.value == 0x57E3CC33){

   backward();

  }

  else if(results.value == 0x57E3E817){

   stopMotor();

  }

 }

 delay(100);

  

}

Putting It All Together

Use this design as your boat frame

https://www.tinkercad.com/things/67iK9dY9T7O-copy-of-mystemkits-boats-kit-tinkercad/edit


And 3-Print the boat


  • Place the soldered LED chain into the boat
  • Then place the 555- circuit on top of the LEDs
  • Then cover the circuit using a paper
  • Then place the motor circuit on top of the paper
  • then super glue the motor to the back of the boat
  • Then super glue the batteries to the sides of the boat
  • Connect one battery to the Arduino and the other to the bread board
  • Then using wires connect the positive and negative rails of both bread boards


Then the Boat should be complete