Go Down

Topic: R/C Rover 5 platform (Read 2387 times) previous topic - next topic

Joccer

Feb 15, 2014, 12:05 pm Last Edit: Mar 15, 2014, 04:26 am by Joccer Reason: 1
Hello,
I am looking to put together a rover 5 (4 motors, 4 encoders) that is remote controlled using arduino. I have a arduino uno and the motor driver pictured with the uno (attached). I am wondering how to wire it up and what sketch to use. I have seen examples with elements of my project but not my actual project. I am new to this, please help me if you know anything about how I could make this robot. Also, if you know of any remote controls that will work well with arduino please let me know.
Thanks in advance,
Joccer

Drew Davis

Quote
that is remote controlled using arduino


What remote control/ receiver???  That completely changes how the program will work. If you don't have one I would go with an xbee system (long range) or Ir(short range). Sparkfun sells a nice Ir kit for cheap.  If you have your remote control let us know what kind it is.

Joccer

I am thinking of using along the lines of this: https://www.sparkfun.com/products/11759
Why implications would this have on the sketch/ wiring up?

Drew Davis

Quote
I am thinking of using along the lines of this: https://www.sparkfun.com/products/11759
Why implications would this have on the sketch/ wiring up?



The remote control does not work by it's self. When the Arduino receives the signal from the remote via a IR receiver it then has to decide how to act... which requires a sketch.  Spark fun gives you an example sketch for it.. https://www.sparkfun.com/products/11761



As for wiring you need to connect a PWM pin on your Arduino to each pin on the board that says PWM. Then take a regular digital output on your Arduino like 13,12,8,7 (just not 1/2) to each pin marked DIR . Then take each pin marked CUR on the board to a Analog input on your Arduino (this is optional). Then tie the ground and 5v of your Arduino into the board. The gnd/ 5v pins are on the top right by motor 4 output. 

Here is some example code that should get you started. It does not use the cur pins or the encoders, but It should drive your robot around and give you a place to start.


Code: [Select]
const byte P1 = 11; // Pin on arduino (left motor)
const byte P2 = 10;// Pin on arduino (left motor)
const byte P3 = 9;  // Pin on arduino    (right motor)                   
const byte P4 = 6;   // Pin on arduino  (right motor)

const byte M1 = 13;// Pin on arduino (left motor)
const byte M2 = 12;// Pin on arduino (left motor)
const byte M3 = 8;  // Pin on arduino     (right motor)                 
const byte M4 = 7;   // Pin on arduino     (right motor)                   

void setup()
{
  pinMode(M1, OUTPUT);   // set as output
  pinMode(M2, OUTPUT);  // set as output
  pinMode(M3, OUTPUT);    // set as output
  pinMode(M4, OUTPUT);  // set as output

  pinMode(P1, OUTPUT);    // set as output
  pinMode(P2, OUTPUT);  // set as output
  pinMode(P3, OUTPUT);    // set as output
  pinMode(P4, OUTPUT); // set as output
}

void loop()
{

  digitalWrite(M1,LOW);   //direction control
  digitalWrite(M2,LOW);   //direction control
  digitalWrite(M3,LOW);   //direction control
  digitalWrite(M4,LOW);   //direction control
 
  analogWrite(P1, 250);   //PWM Speed Control (fast)
  analogWrite(P2, 250);   //PWM Speed Control ( fast)
  analogWrite(P3, 250);   //PWM Speed Control (fast)
  analogWrite(P4, 250);   //PWM Speed Control ( fast)
   delay(2000); // delay 2 sec
   
  digitalWrite(M1,HIGH);   //direction control
  digitalWrite(M2,HIGH);   //direction control
  digitalWrite(M3,HIGH);   //direction control
  digitalWrite(M4,HIGH);   //direction control
 
  analogWrite(P1, 250);   //PWM Speed Control (fast)
  analogWrite(P2, 250);   //PWM Speed Control ( fast)
  analogWrite(P3, 250);   //PWM Speed Control (fast)
  analogWrite(P4, 250);   //PWM Speed Control ( fast)
     delay(2000); // delay 2 sec
   
  digitalWrite(M1,HIGH);   //direction control
  digitalWrite(M2,HIGH);   //direction control
  digitalWrite(M3,HIGH);   //direction control
  digitalWrite(M4,HIGH);   //direction control
 
  analogWrite(P1, 150);   //PWM Speed Control (slower)
  analogWrite(P2, 150);   //PWM Speed Control ( slower)
  analogWrite(P3, 150);   //PWM Speed Control (slower)
  analogWrite(P4, 150);   //PWM Speed Control ( slower)
 
  delay(2000); // delay 2 sec
   
  digitalWrite(M1,LOW);   //direction control
  digitalWrite(M2,LOW);   //direction control
  digitalWrite(M3,HIGH);   //direction control
  digitalWrite(M4,HIGH);   //direction control
 
  analogWrite(P1, 150);   //PWM Speed Control (slower)
  analogWrite(P2, 150);   //PWM Speed Control ( slower)
  analogWrite(P3, 150);   //PWM Speed Control (slower)
  analogWrite(P4, 150);   //PWM Speed Control ( slower)
 
     delay(2000); // delay 2 sec

}





Once you get that working you can add in the encoders with this library...
http://www.pjrc.com/teensy/td_libs_Encoder.html

Joccer

Thank you so much for your helpful comments. I will have a look at what you have said over the next few days
Thanks again,
Joccer

dsmavis

Joccer,

I recently got my Dagu Rover 5 operational.  Perhaps you would be interested in my project...

A few details about the Rover:

Dagu Rover 5 Chassis -- 4 motors, 4 encoders though encoders are not currently used
Sparkfun Rover 5 Motor Driver Board (4 Channel)
Dagu Wild Thumper Wheels (4)
Airtronics 2-channel RC transmitter and receiver (75 MHz surface frequency)
Arduino Uno R3 processor board
Foscam F18910W pan/tilt IP camera
Medialink Wirelss N router

The whole thing is powered by ten 3-amp hour nicad cells (12 volts nominal) feeding 3 switching power supplies to give me 5 volts for the Arduino, RC receiver and motor drive logic, 5 volts for the Foscam camera, and 9 volts for the on-board router.  I supply 12 volts to the motors but back down on their maximum PWM time so the voltage integrated over time does not exceed the rated 7.2 volts for the motors.  This seems to give me good motor torque without overheating them.

Here is a short video of my rover doing a drive-by along with the FPV camera footage as picture-in-picture.

http://www.youtube.com/watch?v=qKWfq7O01x0

Good luck with your project and I would be happy to share additional information with you.

--dsmavis
What do you mean, "They cut the power?" How could they cut the power, man? They're animals!

Joccer

Thankyou Drew for your helpful comments.
I do have some questions though of some things that I do not understand or would like to know.
What wiring needs to be done to connect the receiver for the remote to Arduino and the Motor Driver?
Does the sketch include the remote?
I am assuming that you mean the motor driver, but what do you mean when you say "Then take each pin marked CUR on the board to a Analog input on your Arduino..."?
Also when you are talking about the inputs, does which number I connect it to make any difference and if so which numbers must be connected to which channels on the motor driver (I am assuming that there is one channel for each motor)?
Relating to the previous question, how should I be numbering the motors so that they fit with the sketch?

Thanks,
Joccer

kas

I use an Android smartphone to control my Rover 5



Have a look here

- Rubik's cube Robot solver                 forum.arduino.cc/index.php?topic=271827.0
- Android Bluetooth joystick               forum.arduino.cc/index.php?topic=173246.0
- Balancing robot for dummies           forum.arduino.cc/index.php/topic,8871.0

Go Up