Speed Control and Braking w/ High-Power Motor Driver 18V15

I have some questions about controlling motor speed and using brake on a DC motor.

I am working on a set of electronic window blinds as a part of a school project.
For my project a DC motor is connected to a shaft which controls the blades’ angle, think Venetian blinds.
Anyways, the blades can rotate 0 ~ 180 degrees and at 0 and 180 degrees there are micro-switches which operate as a limit switches.
To control the motor, I am using High-Power Motor Driver 18v15 and Arduino Uno.
Also, I am using NI Labview as a controller interface for the blind.

Here are a list of my parts.

The following is the program I wrote.
For this post, I am only including a part of my code, this parts deals with motor control in one direction and motor braking. I can post the the whole code if you need it.
So, when somebody pushes a button to change the blade’s angle on Labview’s front panel, the motor starts moving to adjust the angle.
When the button is released or when the arm attached to the motor shaft hits the micro-switch, the motor should stop.

int velo = 90;                     //velo: motor speed
int res = 2, dir = 8, pwm = 9;     //res:RESET, dir: DIR, pwm: PWM on the motor driver
int lim = 4;                       //lim: microswitch

void setup(){  
  Serial.begin(9600);
  pinMode(lim,INPUT);
  pinMode(res, OUTPUT);
  pinMode(dir, OUTPUT);
  pinMode(pwm, OUTPUT);
}

void loop(){
   byte lab = 0;                  //lab: signal from Labview
   int swi = 0;                   //swi: signal from microswitch
   
   lab = Serial.read();


   if (lab == 'f'){               //f: signal from Labview when the button was pushed 
      swi = digitalRead(4);       //                           (motor starts moving)
    
      while (swi == 0){
         lab = Serial.read();

         if (lab == 'e'){           //e: signal from Labview when the button was released 
            digitalWrite(pwm, LOW); //                                 (brake operation)
            digitalWrite(dir, LOW);
            digitalWrite(res, LOW);
            break;
         }
      
         digitalWrite(res, HIGH);
         analogWrite(pwm, velo);
         delay(10);
         digitalWrite(pwm, HIGH);
         delay(10);
         digitalWrite(dir, HIGH);
                        
         swi = digitalRead(4);
      }

      digitalWrite(pwm, LOW);         // (brake operation)
      digitalWrite(dir, LOW);
      digitalWrite(res, LOW);   
   }
    
   else{
      digitalWrite(res, LOW);
    }
}

Using this program, the motor starts moving when I push the button and stops when the button is released.
However, I have a few questions I hope you can help me with.

  1. I am trying to make the motor move slowly.
    I applied 90 to PWM to set the motor speed at about 35 % of the full speed.
    I wanted to make the motor move slower still, so I applied a number smaller than 90.
    However, the motor did not move.
    Is this because of a problem with my programming or because of a problem between the motor and the battery?

  2. I want to stop the motor movement instantaneously if i can.
    I thought that applying LOW to PWM worked as a short break and that the break would stop the motor movement very quickly.
    However, there is still a lot (~150 degrees) of over-run after the button is released or the microswitch is pushed.
    Is it impossible to stop the motor movement faster?
    Or is there a mistake in my program that is causing the brake operation to fail?

  3. Finally, are there any other suggestions you may have about my program?

I am a Mech. Engineering student and I do not know much about electronics or programming.
So I really need and really appreciate your help.

Thank you very much.

Hello.

I don’t think the minimum motor speed is the result of your programming. It’s likely that the motor just won’t turn below that minimum voltage (or at least it can’t generate the torque needed to adjust the blinds at that voltage). Will it rotate at lower speeds when not connected to the blinds? I notice that your motor has a maximum speed of 300 RPM. Does your application actually require it to be able to turn that quickly? If you only need low-speed operation (and if you don’t need the full 30 kg*cm of torque your motor has), I suggest you get a motor with a higher gear ratio, such as our 131:1 metal gearmotor. It still has plenty of torque, but its 12V free-run speed of 80 RPM means you can get some pretty slow speeds out of it.

I think you should be able to get the motor to stop more quickly than that. I think your problem is that you are reseting the motor driver, which I believe disables the outputs (coasting mode) rather than shorting them to ground (braking mode). If you want to brake quickly, don’t reset the driver. If that still doesn’t work well enough for you, you could always very briefly drive the motor in the opposite direction. Using a higher-gear ratio motor would also probably help with stopping more quickly.

I know you already have the High Power Motor Driver 18v15, but we now have a new motor controller that uses a very similar driver: the Simple Motor Controller 18v15. If programming and electronics aren’t your strong suits, I think this controller could make your project a lot easier for you. You can control it straight from a computer using USB, and our free Simple Motor Control Center software makes it very easy to configure the controller and test out your system (e.g. you could set the motor speed dynamically with a scroll bar). The Simple Motor Controller also has built-in support for limit switches, so you wouldn’t even need the Arduino; you could just control it with LabView directly, or even with an RC transmitter/receiver (it seems like that could be a pretty cool way to close your blinds). For your application, you could even most likely use the lower-power Simple Motor Controller 18v7. The controller offers addtional features, such as acceleration limiting, that might also come in handy.

- Ben

Ben

Thank you very much for responding my post.

Like you told me, I removed all “reset” parts and then the motor stopped perfectly.

For this project, we need a motor with a large torque, although we do not need such high speed.
Thank you for your suggestion.

I am really glad that I chose your company since the service like this Q&A is nice.
Thank you very much for your help.

No problem. I’m glad to hear that the motor is now stopping immediately. Please ask if you have any further questions.

- Ben