Arduino Project Hub
Project showcase

Arduino Remote Controlled Vehicle © GPL3+

  • 79 views
  • 0 comments
  • 0 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
DC motor (generic)
×2
L298 Dual H-Bridge Motor Controller
×1
Electrical Wire
×10
Tens70
9V battery (generic)
×1
AA Battery
×4
Zip Ties
×4
CA Adhesive
×1
Hot Glue
×1
Rubber Bands
×10
Wooden Rod
×1
Push Button Switch
×4
PVC Electrical Connector
×1
Aluminum Spacer 3/4"
×4
Screws 1/4"
Should fit the threaded spacer
×8
Magnets
×6
Marbles
×2
Pipe Cleaners
×1

Necessary tools and machines

3drag
3D Printer (generic)
Lasercutter
Laser cutter (generic)
09507 01
Soldering iron (generic)
Hacksaw
Digital Multimeter
Hy gluegun
Hot glue gun (generic)

Apps and online services

D94d qxu
Autodesk Fusion 360
Adobe Illustrator

About this project

This is project is a continuation from my previous project, which can be found at:  https://www.hackster.io/jenniferchen/working-chassis-design-463e1c.


I designed the vehicle after a parade float.  With a rectangular shaped chassis and eye-catching decorations on top, you can drive a miniature parade float just in time for the holiday parades.  

The remote controlled vehicle is driven by two motorized wheels and two marble casters.  I designed and 3D printed the wheels in Autodesk Fusion360 and the caster STL file can be downloaded from http://www.thingiverse.com/thing:8959.  Rubber bands around the wheels provide traction for the vehicle and the 3D printed casters work very well (can be scaled to fit different sized marbles).


The simplicity of the external appearance hides the complexity of the internal components.  The lid of the box closes smoothly and stays secure, thanks to 3 pairs magnets glued to the lid and chassis.  The reason behind using 3 pairs of magnets rather than 4 pairs, is to have just enough force to lock the lid in place while also allowing for convenient removal (to replace batteries and turn on/off the vehicle).  I considered using clips and fasteners, but decided on using magnets for a seamless look.

The internal components are neatly packed into the body of the vehicle.  Press-fit wooden dowels separate the components and keep them in place while the vehicle is moving.  I also used hot glue to strengthen the wooden separators.  I was able to customize the length and placement of the wooden dowels so that everything fit together while also leaving room for the 9V battery to connect to the Arduino.  


All the wires are soldered to the Arduino prototyping shield (circuit schematic can be found in my previous project which is linked at the top of the page).  Following convention, I used red wires for 5V and black wires for Ground.  The other connections use different colored wire.  Solid core wire was used for board-to-board connections.  The leash connecting the vehicle to the remote is stranded electrical wire, which I looped around a 3D printed ring to distribute the force of picking up the vehicle by its leash.  When soldering everything, I noticed that the solid core wire (after being soldered to the shield) was very fragile, and bending the wire slightly would cause it to break off.  Individual strands of the stranded wire tended to fray and would also break off.  I was able to work around the difficulties of using stranded wire by applying a small amount of solder to the ends of the wire to glue the strands together.

The remote controls the forward, backwards, and rotating (Left and Right) motion of the vehicle.  Two laser cut pieces of wood sandwiches a PVC electric connector.  The remote features 4 buttons. Each pair of buttons control the forwards and backwards motion of one of the wheels.  The Arduino kit only comes with small switches, so I bought larger buttons for the remote. The large blue buttons are ergonomic and quite fun to play with.  

The laser cut holes for the buttons are intentionally a bit larger than the button.  The button comes in two pieces, the blue button cap and the push button mechanism at the bottom.  If the laser cut holes were smaller, the button wouldn't be able to "click" because the wood between the button cap and push mechanism is too thick for the button to be pressed down.  To work around this, I glued a thin piece of sturdy cardboard from a cereal box to the bottom of the wood to secure the buttons.  The cardboard worked really well and left plenty of clearance for the buttons to work.


The PVC electrical connector reduces some of the tension on the wiring and keeps everything organized.  I also looped the group of wires forming the leash around one of the spacers to prevent someone from accidentally pulling out all the wires from the remote.


I used aluminum spacers to strengthen the structure of the remote, while also leaving room for connecting the buttons and electrical wiring.  The spacer is threaded on the inside, allowing me to attach a screw to each end of the spacer to fasten the top and bottom half of the remote.  The aluminum spacer also gives the remote a clean look.


Vehicle in Action

I had a lot of fun driving my remote controlled parade float!  The vehicle moves forwards, backwards, and spins in circles!  Check it out below.






Schematics

Circuit Schematic
12197100 930621873695308 1421830084 o

Code

Chassis Motor Control with ButtonsC/C++
Each button controls a function of the wheels (Forward/Backwards of Left wheel & Forwards/Backwards of Right Wheel)
//2-Way motor control - Jennifer Chen
//Remote Control Vehicle


int motorPin1 =  8;    // One motor wire connected to digital pin 8
int motorPin2 =  9;    // One motor wire connected to digital pin 9
int motorPin3 = 10;    // One motor wire connected to digital pin 10
int motorPin4 = 11;    // One motor wire connected to digital pin 11

int buttonPin1 = 4;
int buttonPin2 = 5;
int buttonPin3 = 7;
int buttonPin4 = 6;

//initial button states are 0, not pressed
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;

// The setup() method runs once, when the sketch starts

void setup()   {                
  // initialize the digital pins as an OUTPUT:
  pinMode(motorPin1, OUTPUT); 
  pinMode(motorPin2, OUTPUT);  
  pinMode(motorPin3, OUTPUT); 
  pinMode(motorPin4, OUTPUT);  
  
  //initialize the button pins as INPUT:
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);
  pinMode(buttonPin3, INPUT);
  pinMode(buttonPin4, INPUT);
 
}

// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()                     
{
  buttonState1 = digitalRead(buttonPin1);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  buttonState4 = digitalRead(buttonPin4);
  
  //Left wheel backwards
  if(buttonState1 == HIGH){
    digitalWrite(motorPin1, HIGH); //backward on
    digitalWrite(motorPin2, LOW);  //forward off
    
    if(buttonState3 == HIGH){
      digitalWrite(motorPin3, HIGH); //Right wheel backward
      digitalWrite(motorPin4, LOW);
    }
    else if(buttonState4 == HIGH){
      digitalWrite(motorPin4, HIGH); //Right wheel forward
      digitalWrite(motorPin3, LOW);
    }
  }
  
  
  //Left wheel forwards
  if(buttonState2 == HIGH){
    digitalWrite(motorPin2, HIGH); //forward on
    digitalWrite(motorPin1, LOW);  //backward off
    
    if(buttonState3 == HIGH){
      digitalWrite(motorPin3, HIGH); //Right wheel backward
      digitalWrite(motorPin4, LOW);
    }
    else if(buttonState4 == HIGH){
      digitalWrite(motorPin4, HIGH);  //Right wheel forward
      digitalWrite(motorPin3, LOW);
    }
  }
  
  //Right wheel backwards
   if(buttonState3 == HIGH){
    digitalWrite(motorPin3, HIGH); //backward on
    digitalWrite(motorPin4, LOW);  //forward off
    
    if(buttonState1 == HIGH){
      digitalWrite(motorPin1, HIGH); //Left wheel backward
      digitalWrite(motorPin2, LOW);
    }
    else if(buttonState2 == HIGH){
      digitalWrite(motorPin2, HIGH); //Left wheel forward
      digitalWrite(motorPin1, LOW);
    }
  }

   //Right Wheel forwards
   if(buttonState4 == HIGH){
    digitalWrite(motorPin4, HIGH); //forward on
    digitalWrite(motorPin3, LOW);  //backward off
    
    if(buttonState1 == HIGH){
      digitalWrite(motorPin1, HIGH);  //Left wheel backward
      digitalWrite(motorPin2, LOW);
    }
    else if(buttonState2 == HIGH){
      digitalWrite(motorPin2, HIGH);  //Right wheel forward
      digitalWrite(motorPin1, LOW);
    }
  }

  
  delay(10);
  //turn all motors off and wait for next command
  digitalWrite(motorPin1, LOW);
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);
  
  
}

Comments

Add projectSign up / Login