Pages: [1]   Go Down
Author Topic: How to control a 4wd robot to move by arduino?  (Read 8402 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,
I want to control a 4wd robot to move using arduino.
http://www.dfrobot.com/index.php?route=product/product&path=35_49&product_id=97

But I am new in this region and don't know how to code.
I have assembled the robot together, also installed the arduino software. I have all the materials needed.

Can anybody tell me the process of making it move, also tell me how to code?

Thank you very much! smiley
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8472
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Can anybody tell me the process of making it move, also tell me how to code?
Anything else while we're at it smiley

To do this we would have to analyse the Romeo controller schematic and spend a lot of time. And that's if you already now how to write code.

Surely there are examples on the dfrobot site.


______
Rob

Logged

Rob Gray aka the GRAYnomad www.robgray.com

London, Ontario, Canada
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I would like to know if you can turn without tearing the wheels off.  4WD drive usually self-destructs as wheels try to rub sideways during a turn.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8472
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

With no steering this would be the case with any robot wouldn't it.

And with no diff how does one handle the different travel of inside and outside wheels?

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Boston
Offline Offline
God Member
*****
Karma: 3
Posts: 575
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I built this as well as the 2 wheeled version.  Both are coded similarly.
The 4 wheel one tends to slide more than actually turn.

http://www.robotliving.com/building-robots/four-wheeled-robot/
« Last Edit: April 11, 2011, 03:14:47 pm by Pauly » Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I would like to know if you can turn without tearing the wheels off.  4WD drive usually self-destructs as wheels try to rub sideways during a turn.

I've seen large skid-steer consruction equipment that didn't have the wheels falling off.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8472
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes most Bobcats etc do this, it's hard on the gear though and needs a lot of power (depending on the surface).

Obviously tracked robots have the same issues and they seem to work.

______
Rob
 
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Full Member
***
Karma: 11
Posts: 147
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The way tanks steer is by having one tread move faster than the other. The ratio of the speeds controls the turning radius.  The bigger the turning radius the gentler the turn on the wheels.  You could do that with an Arduino.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm so appreciate to see many replies, but I still feel confused. Maybe I don't ask the question clearly. Hope someone can help me with the following questions:
1.Which equipment do I need? The arduino, the assembled robot, the robot controller(board), anything else? Do I need a Ethernet shield,cable?
How to install and connect?

2.What's the theory by controlling the robot move?

3.What kind of server-side technology do you recommend? J2EE or something else?

Thank you again for your patience.
Logged

New Hampshire
Offline Offline
God Member
*****
Karma: 17
Posts: 781
There are 10 kinds of people, those who know binary, and those who don't.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You are asking for a considerable amount of information here

http://www.societyofrobots.com/step_by_step_robot.shtml

That link should give you an idea of just how much information you're asking for.  It's got nothing to do with the dfrobot 4wd platform you are looking at, but it should give you a much better idea of what's involved with building a robot piecemeal or from scratch.
Logged


Boston
Offline Offline
God Member
*****
Karma: 3
Posts: 575
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To get started all you really need are four things.
1. An Arduino
2. The robot body/kit
3. Motor controller (I used one from Adafruit)
4. Batteries

Check out how I built the 2 wheeled robot.  It is almost the same for building the for wheeled robot.  http://www.robotliving.com/building-robots/two-wheeled-robot-2/
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Below is a link to a kit 4wd robot assembly instructions. You should be able to learn a lot by studying their assembly instructions.

http://www.lynxmotion.com/driver.aspx?Topic=assem05
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,
Thank you all for your kindly replies. Yesterday I finally get my first step, use the code involved here:http://www.dfrobot.com/wiki/index.php?title=DFRduino_RoMeo and finally the motor moves,(although only one moves, I'm still learning and fixing it).
The code involved in that link is as follows:
Code:
Sample Code:

int E1 = 5;     //M1 Speed Control
int E2 = 6;     //M2 Speed Control
int M1 = 4;    //M1 Direction Control
int M2 = 7;    //M1 Direction Control

///For previous Romeo, please use these pins.
int E1 = 6;     //M1 Speed Control
int E2 = 9;     //M2 Speed Control
int M1 = 7;    //M1 Direction Control
int M2 = 8;    //M1 Direction Control


void stop(void)                    //Stop
        {
          digitalWrite(E1,LOW);   
          digitalWrite(E2,LOW);     
        }   
void advance(char a,char b)          //Move forward
        {
          analogWrite (E1,a);      //PWM Speed Control
          digitalWrite(M1,HIGH);   
          analogWrite (E2,b);   
          digitalWrite(M2,HIGH);
        } 
void back_off (char a,char b)          //Move backward
        {
          analogWrite (E1,a);
          digitalWrite(M1,LOW);   
          analogWrite (E2,b);   
          digitalWrite(M2,LOW);
}
void turn_L (char a,char b)             //Turn Left
        {
          analogWrite (E1,a);
          digitalWrite(M1,LOW);   
          analogWrite (E2,b);   
          digitalWrite(M2,HIGH);
        }
void turn_R (char a,char b)             //Turn Right
        {
          analogWrite (E1,a);
          digitalWrite(M1,HIGH);   
          analogWrite (E2,b);   
          digitalWrite(M2,LOW);
        }
void setup(void)
{
    int i;
    for(i=6;i<=9;i++)
    pinMode(i, OUTPUT); 
    Serial.begin(19200);      //Set Baud Rate
}
void loop(void)
{
     char val = Serial.read();
     if(val!=-1)
       {
          switch(val)
           {
             case 'w'://Move Forward
                     advance (100,100);   //PWM Speed Control
                     break;
             case 's'://Move Backward
                     back_off (100,100);
                     break;
             case 'a'://Turn Left
                     turn_L (100,100);
                     break;       
             case 'd'://Turn Right
                     turn_R (100,100);
                     break;         
            }     
          delay(40);
       }
      else stop(); 
}

What I used are a Duemilanove Arduino, a Romeo, a 4wd robot and of course batteries. But the problem is :
1.The code above controls only two motors, when I control four motors, where should I change?

2.As you can see, there are many switch-case in the loop method, but I never used that before,what does that mean?
For example, can I enter the word "w" to control the robot move forward? Where to enter? How can I write a java interface or web interface to control?

Thank you again for everyone's help, in this place I really learned a lot. smiley-kiss
Logged

New Hampshire
Offline Offline
God Member
*****
Karma: 17
Posts: 781
There are 10 kinds of people, those who know binary, and those who don't.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1.The code above controls only two motors, when I control four motors, where should I change?

When dealing with fixed orientation motors/wheels, controlling four motors is the same as controlling two motors, because you should be controlling the motors in pairs.  There's no reason for the two motors on the left side to be driven separately (same for the right side).  Ideally, just wire the two left motors in parallel to the motor controller (making sure the motor controller can handle the current of two motors), and then wire the two right motors in parallel to the motor controller.
Logged


Boston
Offline Offline
God Member
*****
Karma: 3
Posts: 575
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would just double up your motor code.
Here are some examples from my code. I used the Adafruit motor shield.
RF = Right Front LF = Left Front, etc..

Code:
// defining motors

AF_DCMotor motorRF(1, MOTOR12_1KHZ);
AF_DCMotor motorLF(2, MOTOR12_1KHZ);
AF_DCMotor motorRR(3, MOTOR12_1KHZ);
AF_DCMotor motorLR(4, MOTOR12_1KHZ);

Code:
//Going forward
  motorRF.run(FORWARD);
  motorLF.run(FORWARD);
  motorRR.run(FORWARD);
  motorLR.run(FORWARD);
Logged

Pages: [1]   Go Up
Jump to: