Arduino Slambot

Instructions for building an Arduino Controlled RoboSlam Robot.

One of the key aims of the RoboSlam initiative is to develop a set of broadly accessible resources that support the development of interesting, inexpensive robots. Arduinos are still out of our preferred price range, although they are undeniably becoming less expensive. They also are less “industrial” than we would like. They would not be the preferred development platform for engineers. On the other hand, Arduinos have a significant following. For this reason, we thought that it would be a good idea if we produced a “next step” for those who wished to adapt the RoboSlam bot to fit an Arduino that they already have at home.
The adapted design and associated instructions presented here, were devised by UC Berkeley Computer Science student Noah Keen as part of his summer internship in the FOCAS Institute at DIT.

PART ONE: Building the Circuit.

NOTE: This is a first pass at this circuit – so for instance, you may notice that the one of the capacitors are missing from the circuit. But nevertheless, it seems to work quite well.



First insert the motor driver i.c. into rows 22 to 29 making sure that the u shaped indent at one end of the i.c. is positioned as shown above.


Next using single core red wire, connect D29 to G22 and use another two to tie the red voltage supply “rail” to A22 and to A29. Then using a black single core wire connect the blue ground “rail” to A26.

sevenNext you connect the power from the Arduino Uno (5V pin) to the + voltage “rail” (long red wire)  and the Arduino’s GND pin to the Ground “rail” (long black wire) on the breadboard.

sixNext  connect the two purple motor control signal wires from Arduino pins 2 and 3 to B23 and A28 respectively.

five… and the same for the other side of the motor controller. This time from pins 4 and 5 on the Arduino to breadboard pins J23 and J28 respectively.

threeThe leads for the two motors (also purple) are inserted into D24 and B27 for one motor and I24 and I27 for the other. The motor driver is now wired up to the Arduino and motors.

twoThe 4 pin SRF 04 Rangefinder is now inserted into breadboard with sensors pointing out and pins inserted in pins J4 to J7 in the breadboard


oneFinally, to finish the circuit, the +V power (pin H4) and Ground (pin H7) wires are connected to the associated Red (V+) and Blue (ground) rails. Then the trigger and echo pins are connected to Arduino pins 7 and  8.

Finally (not shown in this version) you connect the red (+V) and black (ground) wires from the battery pack on to the V+ and Ground rails on the breadboard.20140811_103359-001 Here is a picture of one mechanical configuration of the Arduino Slambot. There are many other ways to connect the components toegther.

Please ensure that you glue or otherwise fix a “back plate” onto the underside of the breadboard. Do not be tempted to use the adhesive back of the breadboard to stick the motors and battery pack onto the breadboard.

 PART TWO: Programming the Arduino to control the “bot”

The code listed here is a simple program for making the robot respond to the rangefinder.

// Simple Arduino Listing for an Arduino controlled Slambot
// This code was adapted from Ted's original MSP430 "C" code
//                                       Noah Keen August 2014
// Name the pins that we will use to make the program readable
#define trigPin 7
#define echoPin 8
#define motor1A 2
#define motor1B 3
#define motor2A 4
#define motor2B 5

// and some variables
unsigned long pulseTime;
unsigned long distance;

void setup() {
  // the serial interface allows some debugging during programme
  Serial.begin (9600);
  //set the "direction" of the pins we will use
  pinMode(motor1A, OUTPUT);
  pinMode(motor1B, OUTPUT);
  pinMode(motor2A, OUTPUT);
  pinMode(motor2B, OUTPUT);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  //Initialise our variables
  unsigned long pulseTime = 0;
  unsigned long distance = 0;

void loop() {

  //trigger range finder
  digitalWrite(trigPin, HIGH);
  digitalWrite(trigPin, LOW);
  //find out how long it took for echo to return
  pulseTime = pulseIn(echoPin, HIGH);
  //calculate distance to opponent
  distance = pulseTime/58;
  //send it out on serial interface
  if (distance < 20)
    //Go forward - push opponent
    digitalWrite(motor1A, HIGH);
    digitalWrite(motor1B, LOW);
    digitalWrite(motor2A, HIGH);
    digitalWrite(motor2B, LOW);   
      //Spin - searching for opponent.
      digitalWrite(motor1A, LOW);
      digitalWrite(motor1B, HIGH);
      digitalWrite(motor2A, HIGH);
      digitalWrite(motor2B, LOW);

Please feel free to experiment with circuit or code and let us know how you get on.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s