Arduino Forum

Topics => Robotics => Topic started by: nickgammon on Dec 11, 2011, 03:27 am

Title: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Dec 11, 2011, 03:27 am
So I finally connected together a few things that arrived in the mail. :)

This incredibly-sloppily wired-up robot is my first attempt to make something useful, eg. that will one day deliver a can of beer to my hands. ;)

Right now it's a prototype. :P

It consists of a Dagu 5 chassis which I bought from here:

http://www.robotgear.com.au/Product.aspx/Details/554

(There are suppliers overseas too).

I also got their controller board which supports up to 4 motors and encoders.

At this stage the encoders are not used (although you may spot the wiring for them on the top). There is interrupt-driven code in the sketch to detect one of the encoders.

To help others get started, here is how I wired it up:

(http://gammon.com.au/images/Dagu Controller.png)

The battery is actually 6 x 1.5 NiMh batteries taped to the side.

This is the sketch:

Code: [Select]
// 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


And this is the robot banging into walls (52 seconds):

http://vimeo.com/80324804

The code is designed to drive the robot forwards or backwards for 10 seconds. Then it attempts to turn by driving the wheels in opposite directions for 1.2 seconds.

The current-sense circuit is used to detect too much load on the motors, if that happens the code immediately skips to the next phase.

There are quite a few improvements that could be made. For one thing, it needs a beer carrier. ;)

It also could use a sensor to detect nearby obstacles. And a smarter algorithm would help it get out of being stuck in tight places. Oh, and it needs a sensor to stop it turning upside-down and spilling its guts.

This photo, taken after I neatened up the wiring with a my wire-wrapping tool, shows the connections between the motor board and the Arduino:

(http://gammon.com.au/images/Dagu Photo.png)
Title: Re: Dagu Rover 5 chassis robot demo
Post by: krishna84 on Feb 21, 2012, 02:22 pm
hello nick gammon....thanks for information provided but i need to know what the controller board, which you have used to support the rover 5 is called as...because the doing a project with arduino and planning to buy the rover 5 for my project...
Title: Re: Dagu Rover 5 chassis robot demo
Post by: dxw00d on Feb 21, 2012, 02:39 pm
Hi Nick,

I don't know if they are available in your part of the world, but this might fit - http://www.amazon.co.uk/Bigtrak-Can-Holder-Junior/dp/B005G3R4Z0

Been meaning to get one for my BigTrak. Also been meaning to make my BigTrak autonomous, but I only got it for Christmas, and I think it might be too soon to start tearing it apart.

Only problem with the can holder is that it'd need someone in the kitchen to put the can in.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: cr0sh on Feb 21, 2012, 05:04 pm

Hi Nick,

I don't know if they are available in your part of the world, but this might fit - http://www.amazon.co.uk/Bigtrak-Can-Holder-Junior/dp/B005G3R4Z0

Been meaning to get one for my BigTrak. Also been meaning to make my BigTrak autonomous, but I only got it for Christmas, and I think it might be too soon to start tearing it apart.

Only problem with the can holder is that it'd need someone in the kitchen to put the can in.


I wonder if that'll fit the original Big Trak (still have mine from when I was a kid; then again, I have the transport dumper, so maybe I don't need the can holder...)?

:)
Title: Re: Dagu Rover 5 chassis robot demo
Post by: dxw00d on Feb 21, 2012, 05:41 pm
It should fit. I think the mouldings are the same.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Feb 21, 2012, 08:24 pm

hello nick gammon....thanks for information provided but i need to know what the controller board, which you have used to support the rover 5 is called as...because the doing a project with arduino and planning to buy the rover 5 for my project...


The link above would have led you to it, but here is the controller:

http://www.robotgear.com.au/Product.aspx/Details/555

No doubt there are non-Australian suppliers as well.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: E40racer on Feb 24, 2012, 12:07 am
Nice to see another Rover 5 :) I bought one a couple of weeks ago. I've managed to write a sketch that lets me remote control it through a Nrf24L01 wireless module. I'm using the Mega1280 based Dagu red back spider controller and motor controller. Power comes from a 2 cell lipo battery.  Here's a video of mine:

http://vimeo.com/37265377

I also have the version with 4 encoders/motors, but don't really have a clue what to do with the encoders  :~
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Feb 24, 2012, 12:19 am

I also have the version with 4 encoders/motors, but don't really have a clue what to do with the encoders  :~


Very cute!

I'm not using the encoders right now, but what you could do with them is find how far it has gone. For example, you put out "full power" but you don't know whether, after 3 seconds, you have gone one foot or five. Reading the encoder data back would tell you how much the wheels have moved. Off course that doesn't take into account the wheels slipping.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: mcb1 on Feb 24, 2012, 04:58 am
Nick
I heard of one guy using the guts of an optical mouse, in a sumobot.
He simply detected if he was moving backwards while he was driving the wheels forward and acted on it.

This might help overcome the slippery surface issues.


Mark
Title: Re: Dagu Rover 5 chassis robot demo
Post by: krishna84 on Mar 01, 2012, 08:39 pm
hello everyone...i am doing a project which has three sensors, which when detects anything moves in other direction. For these work i am planning to going with rover 5 and also going with encoder compatible board(nick as suggested) but i guess i need some help with stuff....new for these kind of stuff...
Title: Re: Dagu Rover 5 chassis robot demo
Post by: krishna84 on Mar 01, 2012, 09:06 pm
hi nick...i am really sorry for the way of the message...i guess its hurt u alot...really sorry for that...i was trying get some information from you and i was in a little hurry...that's it....actually i am trying to develop a robot which should have three sensor's..as it detects something..the vehicle should move...its my final project....
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Mar 01, 2012, 09:47 pm

... i guess its hurt u alot...really sorry for that...


This is referring to a couple of personal messages I received in the last few days which shouted at me in all caps.





... i guess i need some help with stuff....


@krishna84 - I'm sorry but I don't see a question here. No wonder no-one else has answered.


actually i am trying to develop a robot which should have three sensor's..as it detects something..the vehicle should move.


What sensors? We can't read your mind you know. Motion detectors? Sound? Light? Colour? Distance?  "as it detects something" ... what? A cat? A wall? A hand? A line? A hole?

Read this:

http://mattgemmell.com/2008/12/08/what-have-you-tried/

I'm not going to sit here and design a cat-avoidance system so you can pass your final project in your exam. At least try something yourself. Choose some sensors. Post a link to them. Show how you wired them into your project (photo or schematic). If you don't know how to do that Google it and find out. If you can't make it work then, at least show how far you got, including links to the web sites you found with Google. If you write some code, post it. If it doesn't work, describe in what way.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: E40racer on Mar 03, 2012, 08:40 pm
In your first post you said that the rover is sloppily wired. I got my share of that today, and needed to perform some surgery on my rover. I was trying out a sketch and suddenly one motor stopped running. I was fearing the worst thinking that one of the FETs on the motor controller had given up. Turned out to be a loose wire... one of the wires going from the coil to the connector had come loose. There was almost no solder to be seen on that connection so it's no surprise it came loose.
I've been working on an autonomous sketch using an ultrasonic sensor to detect obstacles. The code works but it keeps bumping into stuff. Think I need some more sensors and fancier code :)
Title: Re: Dagu Rover 5 chassis robot demo
Post by: robtillaart on Mar 03, 2012, 09:48 pm

Quote
This incredibly-sloppily wired-up robot is my first attempt to make something useful, eg. that will one day deliver a can of beer to my hands

Something like this?

- http://www.youtube.com/watch?v=gjAZ5esOBZw -
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Mar 03, 2012, 10:57 pm

Something like this?


Exactly like that. :)
Title: Re: Dagu Rover 5 chassis robot demo
Post by: troymcklure on Apr 08, 2012, 05:51 am
Nick,

I have the same setup as you to in this tutorial, but i cannot get the bot to move  for more than .5 seconds per direction. I havent changed any code at all and double checked the wiring.

Also in the code, to a novice, it appears you are using pins 8 and 9 as pin A & B respectively, but in the diagram they are not hooked up.. Could you please explain that to me.

Thanks!
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Apr 08, 2012, 06:13 am
Pins 8 and 9 were for the rotary encoders which I didn't use in the end, although the article talked about them.

It stops after about a second if it doesn't get another message from the remote, so it sounds like the connection might be flaky.

You could change this:

Code: [Select]
const unsigned long TIME_BEFORE_WE_GIVE_UP = 1000;  // ms

Where 1000 mS is 1 second. But you probably need to work out the underlying problem. Do you have an aerial at all? I stuck a short bit of wire in to help with that.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: troymcklure on Apr 08, 2012, 06:15 am
Also for the interrupt 0 assignment, that doesnt seem to be hooked up either,.   Sorry I am rather new at this.

To clarify, my rover is going thru the fwd, left, backwards, right sequence but it is only moving for like .25 to .5 a sec before changing to the next direction in the list.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Apr 08, 2012, 06:26 am
Oh I thought you were referring to this:

http://www.gammon.com.au/forum/?id=11506

The forum is incredibly slow right now, it's taking 5 minutes for a page to load, so please bear with me.

Here, in the code on page 1 of this thread:

Code: [Select]
  delay (500);
 
}  // end of loop


So it changes direction every 1/2 a second. Change that to a bigger figure if you want.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: gearz on Apr 08, 2012, 06:33 am
The forum is incredibly slow right now, it's taking 5 minutes for a page to load, so please bear with me.....

Your not alone,  the site is sooo slow lately.   Whats goin on? ...   Wait don't answer that.  I will start my own thread to hijack.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: troymcklure on Apr 08, 2012, 06:44 am
Might I ask what the delay is in there for?  It was my understanding the objective of the code was for it to fw/backward for 10 sec and turn for 1.2 sec.

Thank you for your patience with answering my questions.

EDIT**  I am assuming that is the delay between direction changes?

By the way, I changed that value to 2 seconds, and it pulses in a direction for about .5 seconds then waits 2 seconds before changing directions to pulse again.  I will try to get a vid.

thanks.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Apr 08, 2012, 07:02 am
Er, maybe I was wrong. My mind is still seething over the lengthy delays trying to ban spammers on the forum. ;)

This code here:

Code: [Select]
  // check current drain
  while (millis () - start < time_to_go)
    {
    if (analogRead (0) > 325)  // > 1.46 amps
      break;   
    }


That makes it stop if the current drain exceeds 1.46 amps. You might want to tweak that a bit. Perhaps your motors are drawing more than mine did. So if you make it higher, it will draw more current before stopping.

Quote
I am assuming that is the delay between direction changes?


Yes.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: troymcklure on Apr 10, 2012, 05:55 am
So far, I have to crank up that current drain value beyond 600, and even still, it will cut out when going in half the directions..  :~

Is there something potentially very wrong with my setup to cause that?

Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Apr 10, 2012, 07:15 am
Hard to say. Try commenting out the check, and testing. Be ready to hit the power switch if things start smoking. :)
Title: Re: Dagu Rover 5 chassis robot demo
Post by: tigerdorr on May 01, 2012, 02:36 pm
hi, dagu photo.png, could you please tell me why you need power from arduino board icsp?

and why don't you use the jumpers of motors on the chassis?

thanks
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on May 01, 2012, 10:57 pm

hi, dagu photo.png, could you please tell me why you need power from arduino board icsp?


Those two wires (red and black) are just +5V and Gnd, which were available on the ICSP pins. Since they are pins on both ends it was easy to wire-wrap them.


and why don't you use the jumpers of motors on the chassis?


What jumpers are you referring to?
Title: Re: Dagu Rover 5 chassis robot demo
Post by: tigerdorr on May 02, 2012, 12:28 am
hi, thanks your reply.

abt q1, can i get V5 from other pin of arduino board?
it's hard to find f/f jumper wire, where did you get it?

q2, i saw about 5-6 female pin jumper out of the chassis motor, where there should be connected to?
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on May 02, 2012, 01:58 am

abt q1, can i get V5 from other pin of arduino board?


Yes, wherever you want to.

Quote
it's hard to find f/f jumper wire, where did you get it?


http://www.adafruit.com/products/266

Quote
q2, i saw about 5-6 female pin jumper out of the chassis motor, where there should be connected to?


4 wires are the encoder on the motor, the other 2 drive the motor. See close-up photo:

(http://www.gammon.com.au/images/Arduino/Arduino_forum_779785.jpg)

Of course there is another set for the other wheel.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on May 02, 2012, 02:03 am
The red and black wire you see going across the board is just for the voltage readout I stuck on the front, so I could see when the LiPo battery was going flat:

(http://www.gammon.com.au/images/Arduino/Arduino_forum_779785b.jpg)
Title: Re: Dagu Rover 5 chassis robot demo
Post by: tigerdorr on May 03, 2012, 02:01 am
hi my rover works now, thanks a lot


and in Arduino_forum_779785.jpg

why the jumpers come from rover motor are single but the heads on controller board are two rows.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on May 03, 2012, 02:53 am
Do you mean the encoder?

The first row (where I have the wires) are from the encoder on the motor. The other row is for connecting to the Arduino (eg. to an interrupt pin). I wasn't using that personally so you could omit them, ignore them, or tape them up somewhere.

I think the circuit just "ors" the two encoder outputs together so you can have a single interrupt pin (labelled INT on the board) which you connect to an interrupt (eg. D2/ D3) and then to see which way it is turning (if you care about that) connect ENC1 and ENC2 to some other pins.

I didn't care about the encoder as I was driving "visually", so I didn't need it to know exactly how much the wheels had turned.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: tigerdorr on May 03, 2012, 02:56 pm
i am trying to connect a push sensor or a IR sensor on the rover. so it can avoid the obstacles.

do you know where i can find some example codes?
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on May 31, 2012, 10:52 pm
I got mine here:

http://www.robotgear.com.au/Product.aspx/Details/554

I don't know if they have replacement tracks ... you could ask.

Mine tend to slip off, and I find it impossible to adjust the track height. Maybe I'm not doing it right.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Jun 07, 2012, 11:35 pm
No idea, sorry.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: spcomputing on Jun 15, 2012, 08:06 am


Mine tend to slip off, and I find it impossible to adjust the track height. Maybe I'm not doing it right.



I just got my Rover 5 and had pulled the retaining bracket (metal L-brac with two screws inside the chassis) to pull the appendage out to set the height.  I think it was an EE solution to a ME problem ;)  Unfortunately, if you have track slippage with the low profile mode, adjusting the height up will make it worse.

I have a composite eye (lots of IR) coming in next week to see how the Dagu demo will work. The DFR Romeo will be interesting in running the R5 Motor/Encoder Board (4motors/4encoders), (2) servos and (6) tactile buttons.  I think there might be a 74HC595 chip and a dev board in there.

Thanks to Nick for opening this thread.  I look forward to any further developments to this platform.

-George
Title: Re: Dagu Rover 5 chassis robot demo
Post by: Nik0lashka on Jul 18, 2012, 03:37 pm
Hello! i have a problem, when logic power on Dagu is NOT powered from Arduino, motors rotate easily in both directions, but when i connect logic power (5V) from Arduino, motors begin to rotate harder in one particular direction. Firstly i connected logic from 5V Arduino pin which is near analog pins, then i tried to connect from ICSP pins, same result. Then I've done everything exactly like you to exclude my mistakes, but it doesn't work.

P.S. Moreover i bought two Arduinos and two Dagus, I thought i fired smth, but motors bahaves on both.
P.P.S Everything works fine with Pololu motor driver shield and Arduino - motors rotate easily in both directons.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Jul 19, 2012, 11:34 am
Not sure what to suggest. Wiring problem? Faulty motor? Faulty motor board?

Quote
Everything works fine with Pololu motor driver shield and Arduino - motors rotate easily in both directons.


So, not a problem?
Title: Re: Dagu Rover 5 chassis robot demo
Post by: Nik0lashka on Jul 21, 2012, 03:00 pm
Yes, with Pololu Shield works fine. I wondered if there was some secret may be with Dagu, but if you don't know the exact reason, it can be anything) Nevertheless thank you for the reply and for your project!
Title: Re: Dagu Rover 5 chassis robot demo
Post by: alisercan on Dec 28, 2012, 01:43 pm
Hi,

I'm wondering that what will happen when I use only a simple L298 ic for driving the Rover 5? Or in other words: Is it possible to drive it like this?

-Ali
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Dec 28, 2012, 10:19 pm
I don't see why not. The board shown does other stuff like encoder inputs and current detection. A simple driver (suitable for the motors) should be all you need.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: alisercan on Dec 29, 2012, 12:40 am
Thank you = ) At this point the encoders are excessive  -I guess- for me. I won't use them for my current project. Buying that 4 channel would be more convenient however I have've limited time and if a delay happens during shipping it won't be good for me : ) If I get stuck I'll get some help from the driver's schematic : )
Title: Re: Dagu Rover 5 chassis robot demo
Post by: E40racer on Dec 29, 2012, 12:51 am
I have a Rover 5 with 4 motors/encoders and use the Dagu 4 channel motor controller. I use the current sensing feature of the motor controller. Powered from a 2S Lipo at full PWM the motors draw about 1A /motor when turning left/right (when going forwards/backwards the motors draw less current). Stalled these motors draw over 3A a piece. I have used a cheap L298 board from Ebay on another robot and have taken a good look at the datasheet of the L298 chip. There are some things you need to take in to account. If you are pulling 1A from one channel of an L298 you will have a voltage drop of 1.8 - 3.2V on the output. That also means that a serious amount of heat is wasted in the L298. You need a big heatsink to dissipate that heat. The Dagu 4 channel motor controller uses fets with a very low RDSon, so there is only a tiny voltage drop. So no power is wasted and a heatsink is not necessary. The Dagu controller was especially designed for the Rover 5 and is rated for 4A stall current / channel.
Here is a photo of my Rover: http://www.bajdi.com/?attachment_id=623 It's my "development platform" :)      
Title: Re: Dagu Rover 5 chassis robot demo
Post by: zheli on Jan 07, 2013, 02:05 pm

I got mine here:

http://www.robotgear.com.au/Product.aspx/Details/554

I don't know if they have replacement tracks ... you could ask.

Mine tend to slip off, and I find it impossible to adjust the track height. Maybe I'm not doing it right.


Mine did that in the beginning, then I just change them to the other side.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: ectar on Jan 19, 2013, 05:56 pm
I would like to know if this Motor driver board will work with Arduino Due ?  ( 3.3V  Due)
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Jan 20, 2013, 10:07 am
I don't know for sure. I don't have a Due, so I suggest you email the makers (or suppliers) of the board.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: E40racer on Jan 20, 2013, 12:05 pm
The designer of most Dagu products posts on the letsmakerobots.com forum. You could ask him there...
Title: Re: Dagu Rover 5 chassis robot demo
Post by: ectar on Feb 27, 2013, 07:00 am
Another question:

Any idea what is the type of 4 white JST connectors  for motors? Got the board, trying to connect motors.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Feb 27, 2013, 07:12 am
Not really. The motor and the driver board happened to have matching connectors.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: ectar on Feb 28, 2013, 02:06 am
Thank Nick you for the sample sketch!

I've manage to put together a small rover based on same motor control board and Leonardo.
Only one difference I have 4WD, so I will modify it in order to handle all 4 wheels, if you don't mind.

I solve my problem with JST by just wrapping bare wire around prongs, no pretty by will work for now.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Feb 28, 2013, 02:51 am
Looks good. :)
Title: Re: Dagu Rover 5 chassis robot demo
Post by: ollie_d on Mar 23, 2013, 06:53 am
Hi Nick,
This is quite a long lasting thread. Like the rest, I've recently bought a 2-motor Dagu 5 rover and I also have the motor shield you seem to be using.
Firstly, I have a bit of a problem. Just to test out the Rover, I hooked up the rover to my Arduino Uno just like you have, also neglecting the encoders and I ran your code. When the rover drives, it favours the right rear motor (making it veer to the right). Any ideas on how to remedy this?

Secondly, my rover needs to navigate an obstacle course and hence needs to know approximately where it is. You mentioned above about using the encoders to determine the no. of revolutions of each wheel. Now, I'm what you would call a 'complete novice' when it comes to Arduino and the like and I was wondering how you would go about using the encoders for this purpose. If you had any instructions for me, or could point me in the direction for some help, I would be greatly appreciative. Cheers!
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Mar 23, 2013, 07:33 am
Quote
... it favours the right rear motor ...


I doubt the motors all have identical performance, so it is quite likely it would veer a bit. You could try to determine what factor to increase/decrease that motor by to compensate.

Quote

You mentioned above about using the encoders to determine the no. of revolutions of each wheel.


I have a snippet (small example program actually) in the section "Reading the rotary encoders". You could incorporate that to find out whether one wheel is moving faster than the other and perhaps use that as a motor compensation.

However this will be thrown out if the track spins, which it tends to a bit, because if one spins a bit as it comes up to speed the number of counts won't reflect which way it is going.

If you are negotiating an obstacle course a proximity sensors might help keep it going straight. For example, sideways mounted IR emitters/detectors could be used to make sure it is in the middle of the current lane. I haven't tried this, it's just a suggestion.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: ollie_d on Mar 23, 2013, 10:24 am
Compensate by adjusting the PWM value of a particular motor? That's a good idea!

What kind of battery would you recommend to power the motor shield? At the moment, whilst I'm getting my bearings I'm just playing around with 6 regular Alkaline AA batteries but what I've heard is that these may provide an unreliable current/ current drops off quite quickly. I looked at LiPo but they seemed quite expensive at JayCar (~$70 for 12V 3600mAh). Is a regular 9V battery ok for supplying power to the Arduino board?

Thanks for you're help!
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Mar 23, 2013, 11:03 am
I used the 7.4V 3300 mAH battery from JayCar.

Sure you can use AA batteries but don't expect them to last very long.

What do you mean by 9V battery exactly? Not the sort you put in smoke alarms?
Title: Re: Dagu Rover 5 chassis robot demo
Post by: ollie_d on Mar 23, 2013, 11:50 am
Yep, the type you put in smoke alarms. They're no good?

Also, I seem to remember reading somewhere that you can't disconnect the power supply to the Arduino board whilst the power supply to the motor board is still connected. Will this damage my Arduino board?
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Mar 23, 2013, 10:03 pm
Those smoke-alarm batteries certainly won't driver the motors. They might power the Arduino for a while.

I don't see any harm in turning the Arduino power off even if the motor board is on.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: ollie_d on Mar 24, 2013, 06:20 am
Yeah, I was just going to use (for now) a 9V smoke alarm battery to power the board and 6 AA batteries for the motor.
So I was thinking to engage the Arduino board to cycle through the program I write I'd just slap a swith between the Arduino power supply and the Arduino board. So I would have a flip switch or something similar. Do you think this would suffice?
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Mar 24, 2013, 06:25 am
Yes, that is what I have. Not even a switch, I just plug the battery in.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: ollie_d on Mar 24, 2013, 06:37 am
Thanks Nick, I think that covers all of my concerns for this project (for now!). You've been a massive help!
Doubtless I will have more questions arising in the future though. Cheers
Title: Re: Dagu Rover 5 chassis robot demo
Post by: ollie_d on Apr 11, 2013, 02:46 am
Hi Nick,
I just wanted to run some things past you and get your opinion.
So for the power supply of our rover (the motor shield and the arduino uno board) I'm using a 12 V 1300 mAh Sla battery which is run through a voltage regulator and so the output is a steady 9 V. This is then wired into both the Arduino and into the motor shield.

We are only running the two motor dagu 5 rover and hence we have two channels on the 4 channel motor shield unoccupied. We need to run a third dc motor to raise an lower a bridge but the stall current for the dc motor we have is 6.18 A (this is the motor http://www.mabuchi-motor.co.jp/cgi-bin/catalog/e_catalog.cgi?CAT_ID=fk_260sa). The manual for the shield says that a dc motor with stall current greater than 4.5 A should not be used, else we could damage the shield. My question is can we use this motor with the shield ensuring that we read the current pin for that channel and turning the dc motor off when the current exceeds, say 4 A?
Or can we somehow just hook it up through the arduino chip, bypassing the shield? Or do we need to get a motor with a lower stall current?

Thanks for your help.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: moemzn on Apr 14, 2013, 09:09 am
Hey nick, i bought the same motor drive shield but im running a 4WD robot, im receiving a command throught a TCP server to move the robot in any direction, i wrote this code and want your opinion (Mind my low programing skills), this code is a test code.
Code: [Select]


#define motorpin0 2 // Direction ch1 front right motor
#define motorpin1 3 // Direction ch2 front left motor
#define motorpin2 4 // Direction ch3 back right motor
#define motorpin3 7 // Direction ch4 back left motor
#define speedpin0 5 //Speed Ch1
#define speedpin1 6 //Speed Ch2
#define speedpin2 9 //Speed Ch3
#define speedpin3 10 //Speed Ch4
int count=0;

void setup() {
//the motor control wires are outputs
pinMode (motorpin0, OUTPUT);
pinMode(motorpin1, OUTPUT);
pinMode(motorpin2, OUTPUT);
pinMode(motorpin3, OUTPUT);
//PWM Pins are outputs
pinMode(speedpin0, OUTPUT);
pinMode(speedpin1, OUTPUT);
pinMode(speedpin2, OUTPUT);
pinMode(speedpin3, OUTPUT);

}

void loop() {
 
    analogWrite(speedpin0,255);
    analogWrite(speedpin1,255);
    analogWrite(speedpin2,255);
    analogWrite(speedpin3,255);
   
  switch (count)
  {
    case 0: //forward
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(10000);
    count++;
    break;
   
     case 1: //Turn right
   
    analogWrite(speedpin0,50);
    analogWrite(speedpin2,50);
   
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(1200);
    count++;
    break;
   
    case 2: //backward
   
    digitalWrite(motorpin0,0);
    digitalWrite(motorpin1,0);
    digitalWrite(motorpin2,0);
    digitalWrite(motorpin3,0);
    delay (5000);
    count++;
    break;
   
   
    case 3: //Turn left
   
    analogWrite(speedpin1,50);
    analogWrite(speedpin3,50);
   
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(1200);
    count++;
    break;
}
}

Ill replace the count with the incoming command to move the vehicle as requested, im not using any encoders, also to rotate the vehicle i used the PWM, by reducing the cycle from 255 to 50 on right motoros to move it right, vice versa for the left.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: cmbyrd1989 on Aug 30, 2013, 06:05 am
hi everybody im a newbie can any one help me with a sketch to control this with a Futaba 7cap transmitter ..
what i want it to do is move with the x and y axis of the right stick on the controller  ...
any and all help will be great... thanks
Title: Re: Dagu Rover 5 chassis robot demo
Post by: MetalEd222 on Aug 30, 2013, 09:47 am

We are only running the two motor dagu 5 rover and hence we have two channels on the 4 channel motor shield unoccupied. We need to run a third dc motor to raise an lower a bridge but the stall current for the dc motor we have is 6.18 A (this is the motor http://www.mabuchi-motor.co.jp/cgi-bin/catalog/e_catalog.cgi?CAT_ID=fk_260sa). The manual for the shield says that a dc motor with stall current greater than 4.5 A should not be used, else we could damage the shield. My question is can we use this motor with the shield ensuring that we read the current pin for that channel and turning the dc motor off when the current exceeds, say 4 A?
Or can we somehow just hook it up through the arduino chip, bypassing the shield? Or do we need to get a motor with a lower stall current?


I know this was addressed to nick, but I also have the Dagu 4 motor controller and rover (4 motor version).  As long as you code it correctly and wire it to check the current on that specific motor/channel, you can absolutely have it stop when it reaches a specific amperage.
You could probably even put in a 4amp fuse on the motor if you weren't sure of your code.  A failsafe to protect your hardware.  But it is pretty straight forward and easily done with the the 4 motor controller, so that might be overkill. Just write it to operate that specific motor while the current is less than 4amps (while loop) .
I do something similar with the wheels.  Stop the motors and display a message on the screen.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: vitoovalle on Sep 05, 2013, 12:05 am
Greetings.
I've been working on modelling and control of this platform for a while now and I have a question to ask if it is possible. The encder pulses seem to be quite long or slow to be able to get a good PID control from them. Has anyone tride this? have you been successful? can you share with me the method you used for speed measurment? I'll be more than thankful for any answer.
Cheers.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: Rustie0125 on Nov 06, 2013, 12:51 pm

Hey nick, i bought the same motor drive shield but im running a 4WD robot, im receiving a command throught a TCP server to move the robot in any direction, i wrote this code and want your opinion (Mind my low programing skills), this code is a test code.
Code: [Select]


#define motorpin0 2 // Direction ch1 front right motor
#define motorpin1 3 // Direction ch2 front left motor
#define motorpin2 4 // Direction ch3 back right motor
#define motorpin3 7 // Direction ch4 back left motor
#define speedpin0 5 //Speed Ch1
#define speedpin1 6 //Speed Ch2
#define speedpin2 9 //Speed Ch3
#define speedpin3 10 //Speed Ch4
int count=0;

void setup() {
//the motor control wires are outputs
pinMode (motorpin0, OUTPUT);
pinMode(motorpin1, OUTPUT);
pinMode(motorpin2, OUTPUT);
pinMode(motorpin3, OUTPUT);
//PWM Pins are outputs
pinMode(speedpin0, OUTPUT);
pinMode(speedpin1, OUTPUT);
pinMode(speedpin2, OUTPUT);
pinMode(speedpin3, OUTPUT);

}

void loop() {
 
    analogWrite(speedpin0,255);
    analogWrite(speedpin1,255);
    analogWrite(speedpin2,255);
    analogWrite(speedpin3,255);
   
  switch (count)
  {
    case 0: //forward
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(10000);
    count++;
    break;
   
     case 1: //Turn right
   
    analogWrite(speedpin0,50);
    analogWrite(speedpin2,50);
   
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(1200);
    count++;
    break;
   
    case 2: //backward
   
    digitalWrite(motorpin0,0);
    digitalWrite(motorpin1,0);
    digitalWrite(motorpin2,0);
    digitalWrite(motorpin3,0);
    delay (5000);
    count++;
    break;
   
   
    case 3: //Turn left
   
    analogWrite(speedpin1,50);
    analogWrite(speedpin3,50);
   
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(1200);
    count++;
    break;
}
}

Ill replace the count with the incoming command to move the vehicle as requested, im not using any encoders, also to rotate the vehicle i used the PWM, by reducing the cycle from 255 to 50 on right motoros to move it right, vice versa for the left.


I Like your idea of how to handle the direction of the rover, I am doing the same , but I need to find out how I can use my joystick ( diy remote) as a double use I want to control the speed of my rover by the amount you push on the joystick, so when you press it forward 1mm it gives you very slow speed , but full and it gives you high speed but at the same time it needs to take direction into account.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: Rustie0125 on Nov 06, 2013, 02:09 pm
and other question I have is how would I handle it when n joystick is held between 12 o clock and 9 oclock . what code would run ?
Title: Re: Dagu Rover 5 chassis robot demo
Post by: tom1499 on Nov 15, 2013, 12:21 pm
Getting one of these for christmas, with a rangefinder and an IR sensor. Along with the pan and tilt sensor mount it should be a nice little rover. I intend on getting some xbees and writing a .NET app to control it from my laptop.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: E40racer on Nov 19, 2013, 10:33 am

Greetings.
I've been working on modelling and control of this platform for a while now and I have a question to ask if it is possible. The encder pulses seem to be quite long or slow to be able to get a good PID control from them. Has anyone tride this? have you been successful? can you share with me the method you used for speed measurment? I'll be more than thankful for any answer.
Cheers.


I've finally hooked up the encoders on my Rover 5 and wrote some code for them: http://www.bajdi.com/rover-5-encoder-speed-control/ Just trying to make all 4 motors rotate at the same speed. It works but maybe a PID control would be better?
Title: Re: Dagu Rover 5 chassis robot demo
Post by: mforgione on Dec 22, 2013, 02:41 pm
Hello,
I recently wired up my Arduino/Rover5 system and written a short tutorial:
http://www.dcsc.tudelft.nl/~mforgione/rover5.html (http://www.dcsc.tudelft.nl/~mforgione/rover5.html)

I implemented PID controller for the position of the robot both using the encoders and an ultrasonic sensor and
it works pretty ok.
I did not try to implement velocity control, but my feeling is that the encoders are sufficiently accurate for that.
Keep me updated!
Title: Re: Dagu Rover 5 chassis robot demo
Post by: robtillaart on Dec 22, 2013, 04:06 pm
Thanks Marco for sharing!
Title: Re: Dagu Rover 5 chassis robot demo
Post by: nickgammon on Dec 22, 2013, 09:04 pm
Thanks for posting. The lid was a good idea, I didn't think of that. :)
Title: Re: Dagu Rover 5 chassis robot demo
Post by: strykeroz on Dec 22, 2013, 10:32 pm

Thanks for posting. The lid was a good idea, I didn't think of that. :)
That sure does tidy things up a little.  There's an awful lot of stuff and not much room at all.
Title: Re: Dagu Rover 5 chassis robot demo
Post by: racksmey on Jan 04, 2014, 02:51 am
I am using the same motor driver as your are, but I am a bit confused on what pins I should use on the driver.  I am using a pololu motor and the link is listed below.  I am assuming that I need to use the pins on the right side of the board, or am I worng?

http://www.pololu.com/product/1443 (http://www.pololu.com/product/1443)
Title: Re: Dagu Rover 5 chassis robot demo
Post by: E40racer on Jan 18, 2014, 01:25 pm
Dagu is now selling a new kit that fits on top of the Rover 5 chassis: the service droid. I got an early version and just started playing with it. At the moment it's remote controlled by another Arduino through nRF24L01 modules. But I will add a raspberry pi and camera and try to do some autonomous stuff.
http://www.youtube.com/watch?v=84BcLE40RPU
Title: Re: Dagu Rover 5 chassis robot demo
Post by: binayakdash on Feb 24, 2015, 09:43 am
sir show me the connections by which i can use 4 WD 4encoders with UNO and how to make it radio controlled
Title: Re: Dagu Rover 5 chassis robot demo
Post by: MadProphet on Sep 28, 2016, 11:17 pm
I am using the same motor driver as your are, but I am a bit confused on what pins I should use on the driver.  I am using a pololu motor and the link is listed below.  I am assuming that I need to use the pins on the right side of the board, or am I worng?

http://www.pololu.com/product/1443 (http://www.pololu.com/product/1443)
I am wondering the same thing. Did you ever find the answer to this?
Title: Re: Dagu Rover 5 chassis robot demo
Post by: rorycs on Dec 23, 2016, 04:59 pm
Hi Nick

Finished up wiring my hardware yesterday. I'm starting coding now and C is quite new to me. I noticed in your sketch you wrote:

"analogWrite (MOTORA, 200);
 analogWrite (MOTORB, 200);
 start = millis ();"

As I said I am new to this, my question is: is the value "200" in the sketch the speed of the motors and is this the maximum speed of the motors? If not do you know what their max value is?

Thanks
Title: Re: Dagu Rover 5 chassis robot demo
Post by: rorycs on Jan 09, 2017, 11:06 pm
is 200 a value that controls the speed of the motors.

if so is this the maximum value

"analogWrite (MOTORA, 200);
 analogWrite (MOTORB, 200);
 start = millis ();"