Let's Make Robots!

Rover 5 with Audrino and Dagu 4 Channel DC Motor Controller

 

Hello

Myself and a few friends have been trying to build a robot for our university assignment which is due in about two weeks time. We were just having a few problems and were hoping we could get some help.

We require this robot to use sensors to drive thought a course avoid a few simple obstacles and place a softball in a bucket.

We currently have an audrino UNO SMD edition attached to a Dagu 4 Channel DC Motor Controller in the following configuration.

Channel One
PWM pin 3~
DIR pin 4

Channel Two
PWM pin 5~
DIR pin 7

Channel 3
PWM pin 10~ 
DIR pin 8

Channel 4
PWM pin 11~
DIR pin 12 


We do not have any of the encoders or the current sensors attached yet we are just trying to take all of this one step at a time since it is our first robot We dont really plan on using the encoders.

We have 6 AA batteries to a breadboard which powers the audrino and the motor controller. We have a 5V voltage regulator to power the Logic part of the Dagu motor controller. We have not yet attached any sensors to the robot because as i said we are just trying to build up to getting this thing ready.

Our current problem is that we cannot get the motor to drive forwards they only drive backwards.

At the moment this is the code we are currently running on the aurdino which one of my group members wrote.

int PinPWM_b1 = 3;   // make sure these pin numbers are correct !!! ch1

int PinPWM_b2 = 5;   //ch2

int PinPWM_y1 = 10;   //ch3

int PinPWM_y2 = 11;  //ch4

 

int PinRot_g1 = 4;   //ch1

int PinRot_g2 = 7;   //ch2

int PinRot_r1 = 8;    //ch3

int PinRot_r2 = 12;   //ch4

 

// 2 is right motors 1 is left motors

 

void setup()

{

Serial.begin(9600);

pinMode(PinPWM_b1,OUTPUT);    // back left motor pwm

pinMode(PinPWM_b2,OUTPUT);   // back right motor pwm

pinMode(PinPWM_y1,OUTPUT);   // front left motor pwm

pinMode(PinPWM_y2,OUTPUT);    // front right motor pwm

 

pinMode(PinRot_g1,OUTPUT);     // back left motor dir

pinMode(PinRot_g2,OUTPUT);     // back right motor dir

pinMode(PinRot_r1,OUTPUT);     // front left motor dir

pinMode(PinRot_r2,OUTPUT);     // front right motor dir

}

 

void loop()

{

digitalWrite(PinRot_g1,HIGH);   // turn all motors backwards

digitalWrite(PinRot_g2,HIGH);  

digitalWrite(PinRot_r1,LOW); 

digitalWrite(PinRot_r2,LOW); 

digitalWrite(PinPWM_b1,230);     // provide power to all motors

digitalWrite(PinPWM_b2,230);

digitalWrite(PinPWM_y1,230);

digitalWrite(PinPWM_y2,230);      

delay(1000);

digitalWrite(PinPWM_b1,LOW); // stop motors

digitalWrite(PinPWM_b2,LOW); 

digitalWrite(PinPWM_y1,LOW); 

digitalWrite(PinPWM_y2,LOW); 

delay(1000);

//analogWrite(PinRot_g1,LOW);   // turn all motors forward

//analogWrite(PinRot_g2,LOW);  

analogWrite(PinRot_r1,HIGH); 

analogWrite(PinRot_r2,HIGH); 

//digitalWrite(PinPWM_b1,200);     // provide power to all motors

//digitalWrite(PinPWM_b2,200);   // test using HIGH or 255/200/etc HIGH is full power.

digitalWrite(PinPWM_y1,200); 

digitalWrite(PinPWM_y2,200); 

delay(1000);

//analogWrite(PinPWM_b1,LOW); // stop motors

//analogWrite(PinPWM_b2,LOW); 

digitalWrite(PinPWM_y1,LOW); 

digitalWrite(PinPWM_y2,LOW); 

delay(1000);

//digitalWrite(PinRot_r2,HIGH);   // turn right motors 

//digitalWrite(PinRot_g2,LOW);  

digitalWrite(PinRot_r1,LOW);   // turn left motors

digitalWrite(PinRot_g1,HIGH); 

//digitalWrite(PinPWM_y2,200);   // provide power to right motors

//digitalWrite(PinPWM_b2,200);  

digitalWrite(PinPWM_y1,230);   // provide power to left motors

digitalWrite(PinPWM_b1,230);  

delay(1000);

digitalWrite(PinPWM_b1,LOW); // stop motors

digitalWrite(PinPWM_b2,LOW); 

digitalWrite(PinPWM_y1,LOW); 

digitalWrite(PinPWM_y2,LOW); 

delay(1000);

} 

 I will upload some pictures as soon as i get them from a fellow team member. Thankyou for looking any help would be greatly appreciated. 

 Luke

 

AttachmentSize
Audrino(new).jpg391.65 KB
Dagu(new).jpg356.94 KB
image_3(new).jpg330.98 KB
image(new).jpg373.76 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thanks mate! much appreciated

I added the pictures i said i would put up anyway.

i found these links here to be pretty useful if anyone else was intrested.
http://arduino.cc/en/Reference/AnalogWrite
http://arduino.cc/en/Reference/DigitalWrite