Let's Make Robots!

different versions of dagu controller behave differently?

Hi,

I posted this yesterday in someone else's thread and was advised to start a new one.  My message from yesterday:

---

This is my first post, so forgive me if I break protocol.  I bought a rover 5 and then bought a dagu 4 channel controller from a british outfit (robosavvy) and was able to create my first robot.  Super cool!

Alas, a couple of weeks later I fired up the robot but a screw had come loose, fallen onto the controller and I created an acrid puff of smoke and uncreated my first robot.  Not so cool.  Bummed by the long wait for a controller sent over the pond, I sought and found a new supplier of the dagu board I'd destroyed: robotshop.  They sent me a board tout de suit, but I was surprised to see that it didn't behave like the first board I had (before I fried it, of course).  Specifically, while I could run each wheel independently, in either direction, I could no longer run arbitrary combinations of wheels.  Worst of all, I couldn't run all wheels forward!

Assuming that I just got a bum board, I bought another.  It behaves exactly the same. 

Here's a picture of both boards, with the first one on the left.  They look similar, but clearly there's some additional circuitry by the four motor connectors (the white connectors) on the 'newer' board.

Any suggestions or ideas?  Thanks in advance for any help,

---

To add just a bit more info.  I've tried to swap out the arduino used as I feared I may have damaged it as well, but this didn't make a difference, so it seems the only additional item I may have damaged is the rover itself.  But this doesn't make sense to me as the rover's wheels can all work fine independently; it's just when some of them work together that they seem to have problems.  In particular it seems that running wheel #1 HIGH (forward) with any other wheel doesn't work.  Bizarre.

The code used to control the rover hasn't changed between versions, so it's hard to imagine that's the problem, but just in case I include it below.  When I run the test_wheels() function everything works except for the call to fwd().  The call to bak() works fine as do all of the calls to individual wheels to go fwd/bak.   :-/

Thanks for any insights you might provide!

     Tito.

--

/*
 * Simple library for controlling the dagu rover.
 *
 * example usage:
 *
 * // assign wheels to relevant pins
 * Wheel _wheels[] = { Wheel(9,8), Wheel(7,6), Wheel(5,4), Wheel(3,2) };
 * // create rover with wheelset
 * Rover _rover(_wheels);
 * // drive!
 * _rover.fwd(50); // 0-255 where 255 is max speed
 * // ...
 *
 */

#ifndef ROVER_H
#define ROVER_H

#include "WProgram.h"

struct Wheel {

  const int _dirPin;
  const int _pwmPin;
  int _pwm;  // 0-255
  int _dir;

  Wheel(int dirPin, int pwmPin)
  : _dirPin(dirPin), _pwmPin(pwmPin), _pwm(0), _dir(HIGH)
  {
    pinMode(_dirPin, OUTPUT);
    pinMode(_pwmPin, OUTPUT);  
  }
 
  void roll(int pwm, int dir=HIGH) {
    _pwm = pwm;
    _dir = dir;
    digitalWrite(_pwmPin, _pwm);
    digitalWrite(_dirPin, _dir);
  }
 
}; // Wheel

struct Rover {

  Wheel *_wheels;
 
  Rover(Wheel wheels[]) : _wheels(wheels) {}
 
  void test_wheels(int dur = 3000) {
    Serial.println("FWD!");     
    fwd(50);
    delay(dur);
    Serial.println("STOP!");     
    stop();
    delay(dur);
    Serial.println("BAK!");     
    bak(50);
    delay(dur);
    stop();
    for (int i = 0; i < 4; i++) {
      Wheel w = _wheels[i];
      Serial.print("Wheel #"); Serial.print(i); Serial.println();
      Serial.println("HIGH!");
      w.roll(50, HIGH);
      delay(dur);
      Serial.println("LOW!");
      w.roll(50, LOW);
      delay(dur);
      Serial.println("STOP!");     
      w.roll(0);
    }
    Serial.println("DONE TEST!");     
  }

  void all(int spd, int dir=HIGH) {
    int oppos = (dir == HIGH) ? LOW : HIGH;
    _wheels[0].roll(spd, dir);
    _wheels[1].roll(spd, dir);
    _wheels[2].roll(spd, oppos);
    _wheels[3].roll(spd, oppos);
  }

  void fwd(int spd) { all(spd,HIGH); }
  void bak(int spd) { all(spd, LOW); }
  void stop()          { all(0); }
 
  void roll_right(int spd) {
    _wheels[0].roll(spd, LOW);
    _wheels[1].roll(spd);
    _wheels[2].roll(spd);
    _wheels[3].roll(spd, LOW);
  }
  void strafe_right(int spd) {
    _wheels[0].roll(spd);
    _wheels[1].roll(spd, LOW);
    _wheels[2].roll(spd);
    _wheels[3].roll(spd, LOW);
  }
  void roll_left(int spd) {
    _wheels[0].roll(spd);
    _wheels[1].roll(spd, LOW);
    _wheels[2].roll(spd, LOW);
    _wheels[3].roll(spd);
  }
  void strafe_left(int spd) {
    _wheels[0].roll(spd, LOW);
    _wheels[1].roll(spd);
    _wheels[2].roll(spd, LOW);
    _wheels[3].roll(spd);
  } 
};

#endif
--

Can anyone suggest tests I might run to determine what's at fault here?   Many thanks for any suggestions as I'm at a real loss ...

     Tito.

 

old & new dagu boards