DAGU 5 just motors connected

Building an ANTBOT Part 1 (the robot basics) to get the motors running

The Insect Robotics Group at Edinburgh University published a partly defunct plan  (No sources and incomplete building instructions) to build an ANTBOT.

I thought I nevertheless give it a go and see where I end up. The whole guide is practical and not intended to communicate endless theory that can be found elsewhere. What we want to achieve here are the minimal requirements to get the robot chassis going.

I ordered a Dagu Rover 5  (4 motors and 4 encoders) a Dagu – 4 Channel DC Motor Controller with Encoder Support and a Arduino MEGA 2560 Rev3.

You can buy it anywhere, I have no affiliation with said Robosavvy company and just used their Amazon store and Amazon itself.

https://www.amazon.co.uk/gp/product/B007XEV6X6/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1
https://www.amazon.co.uk/gp/product/B00F94YU4E/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1

https://www.amazon.co.uk/gp/product/B0046AMGW0/ref=oh_aui_detailpage_o05_s00?ie=UTF8&psc=1

What you receive is this.

Dagu Rover 5 with packaging
Dagu Rover 5 with packaging

and the Dagu – 4 Channel DC Motor Controller with Encoder Support like this

 

Dagu - 4 Channel DC Motor Controller with Encoder Support
Dagu – 4 Channel DC Motor Controller with Encoder Support

The Arduino comes in a neat wee box

Arduino-Mega-2560-Rev3-with-box
Arduino-Mega-2560-Rev3-with-box

After unpacking you find that the Dagu Rover looks like this.

Dagu rover 5 without packaging
Dagu rover 5 without packaging

Our task is now to connect the bits and pieces together in a somehow meaningful way.

Now we have to connect the motors to the Motor Controller card which is useful as it protects us from damage of stalling motors and so on.

Dagu 5 encoder wiring
Dagu 5 encoder wiring

Keep attention that you use the colours indicated and connect left and right. In my opinion front and back will be determined how you wire it. There is no classified front.

DAGU 5 Motor wires in place
DAGU 5 Motor wires in place

As you can see I made myself a ply wood plate to rest the board on as the Rover 5 comes with out mounting options besides 4 plastic screw holes.  I made a hole in the middle as the length of the cables is not very long. You can make no mistake in polarisation as the clips prevent you from doing that.

Wired Motors close up
Wired Motors on expansion board close up

 

DAGU 5 just motors connected
DAGU 5 just motors connected

Now we will hook up the motor instructions wires to Arduino and while we are just at it also the feedback wires from the wheel encoders which give you information of the state of the robot.  This is not necessary for the absolute basics, but is good info to have in mind.

Wheel Encoders Dagu 5
Wheel Encoders Dagu 5

What we need now is some male to female breadboard wires, I luckily had laying around.

Male to female breadboard wires
Male to female breadboard wires

Hook everything up like this.

 4 Channel DC Motor Controller to Arduino
4 Channel DC Motor Controller to Arduino

Now your robot should look somehow like this.

Controller wired to Arduino MEGA 2560
Controller wired to Arduino MEGA 2560
Controller wired to Arduino MEGA 2560
Controller wired to Arduino MEGA 2560

The Dagu 5 Rover comes with a massive long 1.5 V AA battery container. I discarded this and replaced it with a 9V battery connector which is a lot smaller.

On the controller board you will find one set of power for the motors.

4 channel Motor Controller DescriptivePhoto
4 channel Motor Controller

Here make sure your board is oriented the right way and insert power and ground for whatever motor battery you will use in the LOWER blue power supply (called Motor supply 4.5 V – 12 V)

9V battery connected to Controller board
9 V battery connected to Controller board

And then connect two male to male bread board cables to the +5V and GND on the Arduino.

5 V connected Controller to Arduino
5 V connected Controller to Arduino

Now mount your build onto something so the robot doesn’t drive away. I just used a Bosch Glue Pen box.

Mounted Rover 5
Mounted Rover 5

To power the static chassis you need the batteries for your motor power connector. If you used the contraption that comes with the rover use 6 1.5 V batteries or in my case one 9V battery.

You can get a load more battery power if you buy industrial 9V batteries as sold on Amazon.
https://www.amazon.co.uk/Duracell-Industrial-Batteries-Alkaline-Manganese-Dioxide/dp/B00LGE31FA/ref=sr_1_4?ie=UTF8&qid=1499875678&sr=8-4&keywords=9V+batteries

At the time of writing you got 10 batteries for 10 pounds, while in a store that would cost up to 6.50 for 2 so 32.5 more than three times that much.

I found advise somewhere that the Arduino 5V should be powered BEFORE you plug in power to the motors. So keep to that routine if you power anything.

The Arduino can now be powered by your computer you will use to program the Arduino and later on you can use a power bank that are sold everywhere for mobile phones.

Choose whatever fits your budget
https://www.amazon.co.uk/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=power+bank

Now that we have prepared everything to be powered up just plug in the connection cable from your Arduino Power to your computer and download the Arduino IDE software in case you don’t have it yet.

https://www.arduino.cc/en/main/software

and follow their installation instructions.

Once you have the Arduino IDE installed. Select the right Serial  Tools Port and the right Board Arduino/Genuino MEGA  or MEGA 2560 and as Chip the ATMEGA2560.

Now you are set to program the Arduino.

Every motor has a direction pin and a speed pin. So we need now to define these for each motor and these need to match the numbers you plugged into the Arduino. In the setup routine then set these pins as OUTPUT pins on the Arduino  and set a starting condition and speed as 0 .

In the loop we just drive the motor forward an backwards and that’s the simplest version we need for later testing.

Once the motors go back and forward you achieved the basics to get your DAGU Rover going.

This is somehow as it should look.

#define DIRECTIONLEFTA 29
#define MOTORLEFTA 30

#define DIRECTIONLEFTB 5
#define MOTORLEFTB 4

#define DIRECTIONRIGHTA 22
#define MOTORRIGHTA 24

#define DIRECTIONRIGHTB 16
#define MOTORRIGHTB 17

char buf[50];
unsigned long timeOld;

void setup() {
  // put your setup code here, to run once:
  // Set up pins for Motor
  pinMode(DIRECTIONLEFTA,OUTPUT);
  pinMode(MOTORLEFTA,OUTPUT);
  pinMode(DIRECTIONLEFTB,OUTPUT);
  pinMode(MOTORLEFTB,OUTPUT);

  pinMode(DIRECTIONRIGHTA,OUTPUT);
  pinMode(MOTORRIGHTA,OUTPUT);
  pinMode(DIRECTIONRIGHTB,OUTPUT);
  pinMode(MOTORRIGHTB,OUTPUT);

  // Switch motors off and at speed zero

  digitalWrite(DIRECTIONLEFTA,LOW);
  analogWrite(MOTORLEFTA,0);
  digitalWrite(DIRECTIONLEFTB,LOW);
  analogWrite(MOTORLEFTB,0);

  digitalWrite(DIRECTIONRIGHTA,LOW);
  analogWrite(MOTORRIGHTA,0);
  digitalWrite(DIRECTIONRIGHTB,LOW);
  analogWrite(MOTORRIGHTB,0);




}
int command = 255;
void loop() {
  unsigned long  timeNow = millis();
  sprintf(buf, "%lu, %d,  \n", timeNow, command);
  if (timeNow - timeOld > 700){
    command = -command;
    timeOld = timeNow;
  }
  Serial.print(buf);  
    if (command >  0) {

  digitalWrite(DIRECTIONLEFTA,LOW);
  analogWrite(MOTORLEFTA,command);
  digitalWrite(DIRECTIONLEFTB,HIGH);
  analogWrite(MOTORLEFTB,command);

  digitalWrite(DIRECTIONRIGHTA,LOW);
  analogWrite(MOTORRIGHTA,command);
  digitalWrite(DIRECTIONRIGHTB,HIGH);
  analogWrite(MOTORRIGHTB,command);

   }
    else {
  digitalWrite(DIRECTIONLEFTA,HIGH);
  analogWrite(MOTORLEFTA,-command);
  digitalWrite(DIRECTIONLEFTB,LOW);
  analogWrite(MOTORLEFTB,-command);

  digitalWrite(DIRECTIONRIGHTA,HIGH);
  analogWrite(MOTORRIGHTA,-command);
  digitalWrite(DIRECTIONRIGHTB,LOW);
  analogWrite(MOTORRIGHTB,-command);

    }