Page 1 of 1

MD10C problem

PostPosted: Sat Jul 07, 2012 4:54 pm
by syahmisalim
Hi,
I'm having problem with MD10C. When i push button A and B everything working perfectly.
But when I play around with PWM and DIR by change them both for HIGH, the power light become dim.
And V1 as highlighted seems heat up.What happened? Can anyone help me?
Thanks.

Re: MD10C problem

PostPosted: Thu Jul 12, 2012 9:38 pm
by yonghui
hi,

not sure what is your problem. but for PWM pin need to feed with PWM pulse. the motor not running with PWM pulse to the pin?

Re: MD10C problem

PostPosted: Sat Jul 21, 2012 12:25 pm
by syahmisalim
Problem settled. I'm interfacing the MD10C using arduino leonardo. This is my coding :

CODE: SELECT_ALL_CODE
// constants won't change. They're used here to
// set pin numbers:
int buttonPin1 = 2;
int motora_pwm = 3;
int motora_dir = 5;

// variables will change:
int buttonState1 = 0;


void setup() {
  // initialize the motor pin as an output:
  pinMode(motora_pwm, OUTPUT);
  pinMode(motora_dir, OUTPUT);

  // initialize the pushbutton pin as an input:
  pinMode(buttonPin1, INPUT);

}

void loop(){
  // read the state of the pushbutton value:
  buttonState1= digitalRead(buttonPin1);

 

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState1== HIGH) {     
     
    digitalWrite(motora_pwm,HIGH);
    analogWrite(motora_dir,191);
 
  }
}


According to the user manual, pin DIR on MD10C is for the direction for the motor. I'm using pwm output on DIR pin. It supposed to change the rotation when I put the DIR output to 191(equal to 75% of the duty cycle) right? As I put the value of DIR pin to 191 (equal to 75% of the duty cycle), the rotation of the motor wouldn't change.Anyone can help me?
Thanks.
Thanks.

Re: MD10C problem

PostPosted: Sat Jul 21, 2012 10:07 pm
by robosang
Show the hardware interface first.....

Re: MD10C problem

PostPosted: Mon Jul 23, 2012 9:55 am
by waiweng83
As robosang suggested, could you please capture a picture showing the hardware connection of your system?

Anyway, I notice that in your code, you changed the PWM value to 191 when the buttonState1 is high. But how about when the buttonState1 is low? you didn't do anything. That's why the motor will continue to move in the previous direction.

Re: MD10C problem

PostPosted: Mon Jul 23, 2012 2:46 pm
by syahmisalim
CODE: SELECT_ALL_CODE
// constants won't change. They're used here to
// set pin numbers:
int buttonPin1 = 8;
int buttonPin2 = 12;
int motora_pwm = 10;
int motora_dir = 6;

// variables will change:
int buttonState1 = 0;
int buttonState2 = 0;


void setup() {
  // initialize the motor pin as an output:
  pinMode(motora_pwm, OUTPUT);
  pinMode(motora_dir, OUTPUT);

  // initialize the pushbutton pin as an input:
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);

}

void loop(){
  // read the state of the pushbutton value:
  buttonState1= digitalRead(buttonPin1);
  buttonState2= digitalRead(buttonPin2);

 

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState1== HIGH) {     
     
    analogWrite(motora_pwm,191);
    digitalWrite(motora_dir,HIGH);
   
  }
    if (buttonState2== HIGH) {     
     
    analogWrite(motora_pwm,191);
    digitalWrite(motora_dir,LOW);
    }
else {
    // turn motor off:
    analogWrite(motora_pwm, 0);
    digitalWrite(motora_dir, LOW);
  }
}

This is the new coding. Everything just work fine now but the motor spin very slow. I measure the voltage at pin motor A and B at MD10C and I only get about 3.5V. I supply the MD10C with 12V 5A lead acid battery. The motor spec is 12V 3.3A. How to increase the speed of the motor?

Based on the pictures, Vin of MD10c is being fed to 5V of the arduino. DIR is fed to pin 6 of the arduino. PWM is fed to pin 10. Pin 10 and 12 is the input which is the switch.GND of MD10c is being connected to GND arduino.

Re: MD10C problem

PostPosted: Mon Jul 23, 2012 7:03 pm
by robosang
Spend some time went through MD10C User's Manual, I don have this motor driver. No point connect the 5V from arduino to the Vin since it require at least 12V to work. You need to move the jumper to Vmotor. Try to put the PWM value to 255 (maximum) and look at the output.

I doubt your code work properly because the if and else combination is not suitable, at least in your case, press button1 and button2 will have different speed despite the direction. Try analyze your code step by step, you will understand..... :mrgreen: I don check the hardware interface in deep, but definitely the code have problem.

Try explain how your code work, I will explain how to fix it.

Re: MD10C problem

PostPosted: Tue Jul 24, 2012 8:57 am
by syahmisalim

int buttonPin1 = 8; // set pin 8 as switch 1
int buttonPin2 = 12; // set pin 12 as switch 2
int motora_pwm = 10; // set pin 10 as pwm
int motora_dir = 6; // set pin 6 as dir control


int buttonState1 = 0;
int buttonState2 = 0;


void setup() {
pinMode(motora_pwm, OUTPUT); // set pwm pin as output
pinMode(motora_dir, OUTPUT); // set dir pin as output

pinMode(buttonPin1, INPUT); // set switch 1 as input
pinMode(buttonPin2, INPUT); // set switch 2 as input

}

void loop(){
// read the state of the pushbutton value:
buttonState1= digitalRead(buttonPin1); // read the state of switch 1
buttonState2= digitalRead(buttonPin2); // read the state of switch 2




if (buttonState1== HIGH) { //if switch 1 is high, PWM is 191 is DIR is HIGH. Motor spin clockwise

analogWrite(motora_pwm,191);
digitalWrite(motora_dir,HIGH);

}
if (buttonState2== HIGH) { // if switch 2 is high, PWM is 191 and DIR is LOW. Motor spin counter clockwise.

analogWrite(motora_pwm,191);
digitalWrite(motora_dir,LOW);
}
else { // else PWM 0 and DIR LOW, motor stop.
// turn motor off:
analogWrite(motora_pwm, 0);
digitalWrite(motora_dir, LOW);
}
}



I have another problem right now. The pin PWM and DIR keep giving output even though I didn't connect the switch. Once i put the jumper in the pin 8 and 12 (the other end of the jumper is not connected to any pin), the motor start to spin. How is that happen?Anyone please help me.

Re: MD10C problem

PostPosted: Wed Jul 25, 2012 10:20 pm
by robosang
Explain how your switch work, when press is HIGH or LOW? Then explain how your code work. :mrgreen: