I decided to build a robot!

I wanted to do something new with Arduino and I figured building some form of robot seemed to be simple enough but give a lot of possibility to make it as complicated as I like.

There were quite a few kits out there to choose from and I went with a Dagu Rover 5 mainly as it seemed to have no majorly negative reviews and it was in stock at a local NZ stockist – Mindkits.

Dago Rover 5

IMG_0425IMG_0426

Above: Unpacking the kit from Mindkits. I ended up with 4 distance sensors, 1 chassis with 4 motors, an ArduinoMEGA 2560, an MEGA Sensor shield, and 2 motor drivers. I also got an ultrasonic sensor and mounting bracket with it.

My first task was to work out how the motor worked. It seemed simpler to use the normal Arduino headers that I was used to before exploring all of the Mega Expansion shield headers. I hooked these up to a breadboard, hooked up a motor driver, added in a LiPo battery from JayCar and made some basic test code to make one track (two motors) go forward and back. Photo below.

IMG_0436

Below is some example code with some basic changes made. It makes 2 motors (one track) go forward for 3 secs, backwards for 3 secs and then do nothing for 8 secs. Repeat..

 

// # Editor : Lauren from DFRobot
// # Date : 17.02.2012

// # Product name: L298N motor driver module DF-MD v1.3
// # Product SKU : DRI0002
// # Version : 1.0

// # Description:
// # The sketch for using the motor driver L298N
// # Run with the PWM mode

// # Connection:
// # M1 pin -> Digital pin 4
// # E1 pin -> Digital pin 5
// # M2 pin -> Digital pin 7
// # E2 pin -> Digital pin 6
// # Motor Power Supply -> Centor blue screw connector(5.08mm 3p connector)
// # Motor A -> Screw terminal close to E1 driver pin
// # Motor B -> Screw terminal close to E2 driver pin
// #
// # Note: You should connect the GND pin from the DF-MD v1.3 to your MCU controller. They should share the GND pins.
// #

int E1 = 6;
int M1 = 7;
int E2 = 5;
int M2 = 4;

void setup()
{
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
}

void loop()
{
digitalWrite(M1,HIGH);
digitalWrite(M2,HIGH);
analogWrite(E1, 170); //PWM Speed Control
analogWrite(E2, 170); //PWM Speed Control
delay(3000);
digitalWrite(M1,LOW);
digitalWrite(M2,LOW);
analogWrite(E1, 170); //PWM Speed Control
analogWrite(E2, 170); //PWM Speed Control
delay(3000);
digitalWrite(M1,HIGH);
digitalWrite(M2,HIGH);
analogWrite(E1, 0); //PWM Speed Control
analogWrite(E2, 0); //PWM Speed Control
delay(8000);
}

This all worked nicely so the next step (in my next post) is to start working how I will mount all of the circuit boards and sensors on the chassis itself.

Share on Facebook
  1. Arduino Rover 5 stage 2 | DaveBlog - pingback on 18/05/2013 at 6:07 PM

Leave a Comment

Trackbacks and Pingbacks: