Translate

Rover 5 Project: Part 2

I was a little busy and didn't get the chance to work on it yesterday but I did today. Now that I am done connecting the Arduino to the motor driver board, I figured I should mount it to the chassis and connect channels 1 & 2 to the front like it says in the instructions. I was wondering why you don't connect channel 3 & 4 so you can move all the motors. Since I only needed 2 wires from the chassis, there was a bunch of tangled wires I didn't need, so I taped them together. Then I took a piece of cardboard and taped the chassis so I could mount the chips.
Cardboard is used to cover unnecessary wires and for mounting the chips

This is the underside. I just used simple masking tape ;D

I then mounted the Arduino and the motor driver board. I had to tape the batteries that power the motor driver board to the side. I hid the other set of batteries beneath the cardboard because I had no room for it.
 
On the left is the Motor Driver Board (red) and on the right is the Arduino Uno (blue). You can see that I taped the batteries to the side. You can also see the DC connector that is coming out from inside the rover.

Now that I'm are done building it, I need to insert the program that is provided on the forums:

 


// Dagu 5 Chassis example.
// Author: Nick Gammon
// Date:   11th December 2011

volatile int rotaryCount = 0;

#define PINA 8
#define PINB 9
#define INTERRUPT 0  // that is, pin 2

#define DIRECTIONA 4
#define MOTORA 5

#define DIRECTIONB 7
#define MOTORB 6

#define TIME_FORWARDS 10000
#define TIME_BACKWARDS 10000
#define TIME_TURN 1200

// Interrupt Service Routine for a change to encoder pin A
void isr ()
{
  boolean up;

  if (digitalRead (PINA))
    up = digitalRead (PINB);
  else
    up = !digitalRead (PINB);

  if (up)
    rotaryCount++;
  else
    rotaryCount--;
}  // end of isr


void setup ()
{
  attachInterrupt (INTERRUPT, isr, CHANGE);   // interrupt 0 is pin 2, interrupt 1 is pin 3
  pinMode (MOTORA, OUTPUT);
  pinMode (DIRECTIONA, OUTPUT);
  pinMode (MOTORB, OUTPUT);
  pinMode (DIRECTIONB, OUTPUT);

}  // end of setup

byte phase;
unsigned long start;
int time_to_go;

void loop ()
{

  analogWrite (MOTORA, 200);
  analogWrite (MOTORB, 200);
  start = millis ();
  
  // check current drain
  while (millis () - start < time_to_go)
    {
    if (analogRead (0) > 325)  // > 1.46 amps
      break;    
    }
    
  
  switch (phase++ & 3)
    {
    case 0: 
      digitalWrite (DIRECTIONA, 1); 
      digitalWrite (DIRECTIONB, 1); 
      time_to_go = TIME_FORWARDS;
      break;
      
    case 1: 
      // turn
      digitalWrite (DIRECTIONA, 1); 
      digitalWrite (DIRECTIONB, 0); 
      time_to_go = TIME_TURN;
      break;

    case 2: 
      digitalWrite (DIRECTIONA, 0); 
      digitalWrite (DIRECTIONB, 0); 
      time_to_go = TIME_BACKWARDS;
      break;

    case 3: 
      digitalWrite (DIRECTIONA, 0); 
      digitalWrite (DIRECTIONB, 1); 
      time_to_go = TIME_TURN;
      break;
      
    } // end of switch
    
  analogWrite (MOTORA, 0);
  analogWrite (MOTORB, 0);
  delay (500);
  
}  // end of loop


  


This is what happens when I used pluged the DC connector to the Arduino:


 

 

As you saw, my rover didn't work correctly. I believe it is because I didn't program and attach the other 2 motors. My Rover 5 robot chassis has 4 motors. After looking at the link this guy bought his Rover 5 at, I realized his was a 2WD.

Rover 5 Project: Part 1

Yesterday I opened my Rover 5 robot chassis and started working on it. I am following instructions I found on the Arduino forums. You can find the instructions I'm going to follow at http://arduino.cc/forum/index.php?topic=82618.0.

In the picture below is my Rover 5 robot chassis, an Arduino (right) and the Motor Driver Board for the Rover 5 (left). The Rover 5 is just the frame for the robot. It has 4 motors and 4 encoders. On the right is an Arduino. This chip acts like the brain for the robot. It can be connected to the computer and programmed. Over on the other side of the chassis is the Motor Driver Board. Since the chassis consists of just the frame and motor, the MDB is responsible for coordinating the movement of the motors when given the command from the Arduino.


You start by connecting the Arduino to the MDB with breadboard jumper cables. Follow the diagram (from the website above) below that shows you how to attach the Arduino to the MDB.

The brown shows you what to attach to those spots



 This is what mine looks like:












This is as far as I got yesterday. I am going to continue on the robot today and post on my progress tomorrow. See Ya!