Let's Make Robots!

motors driver card impulse at the boot up

I have an aruino mega for piloting a motor driver card, using PWM to control the speed and one pin other pin for controlling the rotation way.

 

Each time the arduino boot up (by connecting the USB or the 9V) also when I established a serial connection, the motors impulse at full speed for really short time.

 

The pin out from the arduino are connected directly to the motor board ; Do I need some kine of filter like capacitor, resistor ?

Do I need shielded cables ?

see the picture of the motor card bellow, bought on Ebay

http://www.ebay.com/itm/151020554752?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

 

see the video here

https://www.youtube.com/watch?v=dwMAibieS8w&feature=youtube_gdata_player

here is the diagramm of the circuit

 

close picture

 

The code (really simple)

 

const int dir1 = 2; // motor 1 direction - white
const int pwm1 = 3; // motor 1 PWM - green
const int dir2 = 4; // motor 2 direction - brown
const int pwm2 = 5; // motor 2 PWM - black
void setup()
{
Serial.begin(9600);
pinMode(dir1, OUTPUT);
pinMode(dir2, OUTPUT);
Serial.println("Speed (0-9) or + - to set direction");
}
void loop()
{
if ( Serial.available()) {
char ch = Serial.read();
if(isDigit(ch))
{
int speed = map(ch, '0', '9', 0, 250);
analogWrite(pwm1, speed);
analogWrite(pwm2, speed);
Serial.println(speed);
}
else if (ch == '+')
{
Serial.println("+");
digitalWrite(dir1,LOW);
digitalWrite(dir2,LOW);
}
else if (ch == '-')
{
Serial.println("-");
digitalWrite(dir1,HIGH);
digitalWrite(dir2,HIGH);
}
}
}

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I finnally fix it by installing a pull-down resistors (thank odd-bot), I put a 2k2 resistors, see the following schematic

Somebody experienced this problem with arduino ? yes, how to fix it ?

is it my arduino bad or the motor driver ?

 

I feel disarmed, disapointed, please help me, any ideas ?

I had a relay to to cut the power of the motors during the boot

and I coding that

  // ARCOS //
  //
// constant declaration
    int solenoidPin = 6;        // relay coil connected to pin 2
    unsigned long currenttime;  // current time
    unsigned long boottime;     // system boot up time
    const int dir1 = 2;         // motor 1 direction - white
    const int pwm1 = 3;         // motor 1 PWM - green
    const int dir2 = 4;         // motor 2 direction - brown
    const int pwm2 = 5;         // motor 2 PWM - black
// setting up the system
  void setup()
  {
    pinMode(solenoidPin, OUTPUT); // relay coil pin is an output
    currenttime = millis();       // what time is it ?
    boottime = currenttime;       // record the time as a boot time
    Serial.begin(9600);           // set serial connection
    pinMode(dir1, OUTPUT);        // motor 1 direction pin is an output
    pinMode(dir2, OUTPUT);        // motor 2 direction pin is an output
    Serial.println("Speed (0-9) or + - to set direction"); // print on screen the instructions
  }
// main loop
  void loop()
    {
    currenttime = millis();
    if(currenttime >= (boottime + 10000));  // if 10 secondes past since the boot ...
      {digitalWrite(solenoidPin, HIGH);}   // relay activates
    if ( Serial.available());
      {char ch = Serial.read();
        if(isDigit(ch))
          {int speed = map(ch, '0', '9', 0, 250);
          analogWrite(pwm1, speed);
          analogWrite(pwm2, speed);
          Serial.println(speed);}
        else if (ch == '+')
          {Serial.println("+");
          digitalWrite(dir1,LOW);
          digitalWrite(dir2,LOW);}
        else if (ch == '-')
          {Serial.println("-");
          digitalWrite(dir1,HIGH);
          digitalWrite(dir2,HIGH);}
      }
    }

but that doesnt work, the relay is immediately activation without any delay, and also latching after power down the arduino, until I disconnect one of the solenoid wires !!!!

 

help!

Yes, you need to connect all your grounds together. Always.

It's a good thing.

I did, thanks

Servos do a similar thing. When you first power up your controller, all I/O pins are input by default and in a high impedance state.

Try adding some pulldown resistors. 4K7 from motor controller inputs to motor controller ground. Make sure your motor controller ground is connected to your Arduino ground. This will hold the inputs low until the Arduino initializes.

I try the 4K7 pull down resistors, that doesnt change something, the motor still do a full throttle impulsion at boot up, not really good for the transmission !

Do you mean the ground need to be be common ?

- 22.2V battery (motor power) to the negative of the 11.1V (arduino power) ?

- Or from the -22.2v to the -9V ?

- Or from the -22.2V to the -5vdc on arduino board ?

- All negatives together ?

Try putting these lines at the very first of your setup() function:

pinMode(dir1,OUTPUT);

pinMode(dir2,OUTPUT);

digitalWrite(dir1,LOW);

digitalWrite(dir2,LOW);

analogWrite(pwm1,0);

analogWrite(pwm2,0);

 

put those FIRST, before ANYTHING else and see if that helps

that change nothing, exept compilation problem.

 

I have an idea, because I can found what is the problem I will try to avoid that as possible :

I will install a relay between the 22.2V battery and the motors board, activates this relay 5 secondes after reboot or reset.

I know I will use the millis() cmand on arduino, but I am not familiar with that !

can I expect help ?