Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

dsPIC30F for Motor Speed control

Status
Not open for further replies.

yokel

Junior Member level 3
Joined
Nov 13, 2008
Messages
30
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,529
dspic motor control

Dear All,
I am using dsPIC30F3011 for controlling 3 sensored BLDC motors. For running the motors, I am using BLDC motor drivers. My MCU in this case has to just input 3 things to these motor drivers- (1) PWM signal of certain dutycycle (2) The CW/CCW direction (3) The Start/Stop instruction. I can also extract the current speed information of the motors from the pwm signal served by the BLDC drivers.

In my system, I have to change the speed and direction of the motors very frequently: My MCU can do that easily by setting the PDC value of pwm input signal (to the bldc driver) from 0-1000, where at PDC=0 the motor comes to a stand still. The problem is, the transition time to change in speed is much higher.

For exaple, now the motor is running at a speed corresponding to PDC = 500. Then if I change it as PDC = 0 (or any higher or lower value), the motor speed start decreasing and the total transition time taken for the speed to become 500 to 0 is quite high. Please tell me, if I want the motor to come to its new speed value instantly (ASAP) what should I do? Please keep in mind all the operations in my case here are done through the bldc drivers and I have very little things to do from my MCU (as far as I know).

Please let me know if you need any further information.

waiting eagerly to hear from you.
 

pwm dspic

You can normaly apply a brake to a brushless motor by simultaneously grounding all the phases.
If you are driving the motors via motor drivers, you can not do this.
Some motor drivers have a brake input.
What happens if you apply a Stop command to the drivers, do the motors Stop quickly or wind down slowly?
If they Stop you could use this to transition through the speed change.
What happens if you change direction, does that help to slow it down?
 

    yokel

    Points: 2
    Helpful Answer Positive Rating
dspic30f pwm

1. If I send STOP command to the drivers the motor stops instantly. But the problem is- if I want to start it again, there is a delay to start the motor after sending the START command.

In my system, I have to start and stop the motor very frequently. That's why I choose the SPEED_0 command instead of STOP so that I can avoid the starting delay. If I stop the motor with SPEED_0 then it starts to rotate instantly as I send SPEED_500 (eg.) command. As I mentioned, the transition time in all these cases is the problem here.

Moreover, all time I send START or STOP command there is a click sound in the driver before starting or stopping of the motor. That's really annoying, as I have to continuously on and off 3+3=6 motors in the system. Actually it's one of the main causes, for which I don't want to send STOP or START command to the driver once I start the machine.

Another important issue is my problem is not only related to stop or start, I want to decrease the transition time for any speed transition (if possible make it near to zero)

2. If I change the direction the motor changes it's direction instantly but it's speed doesn't decrease at all, even if I change the direction in time of any transition of speed change.

3. I will look for the BRAKE input in the motor driver and let you know


Thanks a lot for the nice answers and suggestions. Please let me know if you have more directives.
 
pid dspic

What if when slowing down, you just give it a very short blip of reverse, so it doesn't have time to reverse, but slows it down?
 

    yokel

    Points: 2
    Helpful Answer Positive Rating
dspic c30 delay.h

btbass said:
Some motor drivers have a brake input.

Hi,
I have found a braking option in my motor driver and it works fine. In the driver, there is an input point for the motor braking and if I give some input there the motor comes to a halt without any transition time and starts instantly to move with the same speed (though with a huge vibration :( ) when I remove the input.

Now I need some programming tips from you. The motor-brake works in the same manner for both 1 or 0 input in the brake input point of the driver. How can I work with that? If I want my motor to brake for input 0 and start again for input 1 or vice versa, what should I do? I have to give this input from my dsPIC30F3011.


Thanks a lot to you for being so helpful to me
 

dspic dsp.h

That seems a little strange, normaly you would have 1 for go and a 0 for brake or vise versa?
You will have to study the data sheet of the driver chip. There must be some information about it there. What driver chip is it?
If it is true that the brake action happens on a transition from 0 to 1 and 1 to 0, you could AC couple it using a series cap and resistor to ground at the driver chip side.
You will have to experiment and try somthing like,
motor at 500,
apply brake,
motor at 400
apply brake,
motor at 300.
To try to get a smooth transition.
 

    yokel

    Points: 2
    Helpful Answer Positive Rating
dspic30f

That seems a little strange, normaly you would have 1 for go and a 0 for brake

Ya, it seems very strange to me too. But I have tested it and the datasheet doesn't have any clarification about this issue. Anyway, I have got an idea. I will connect the brake input with default 1 or 0 point through a Transistor/Mosfet switching and the Mosfet switch will be triggered by a signal from my MCU. If you have any better idea please let me know.

Please tell me if I don't want to use brake due to huge vibration after resuming the motor, do I have any option to make my transition time for speed variation smaller? How about using PID controller? Please give me some tips on how I can implement the PID controller in my case using dsPIC30F30. I have found that if I change the amplitude of the voltage of my input PWM signal the rpm of the motor also changes for a certain PWM duty cycle.

Thanks again and again for helping me

with regards,
Kamrul
 

motor control dspic

If you are using the Mplab C30 compiler, (which is a very good compiler, a port of gcc), you will find a PID is included in the dsp library. If you look in the header file, 'dsp.h', which is located in \MPLAB C30\src\dsp\include, you will find the function prototypes at the end of the file.
If you search Microchip web site you will find examples of using the PID for motor control.
 

    yokel

    Points: 2
    Helpful Answer Positive Rating
programming dspic for motor control

btbass said:
If you are using the Mplab C30 compiler, (which is a very good compiler, a port of gcc), you will find a PID is included in the dsp library. If you look in the header file, 'dsp.h', which is located in \MPLAB C30\src\dsp\include, you will find the function prototypes at the end of the file.
If you search Microchip web site you will find examples of using the PID for motor control.
Actually I also have code samples for PID control. As I have said you, the only output I give to the driver is a PWM signal of certain duty cycle (which indicates the speed), the direction and the start/stop instruction. My question is PID means change in the output voltage. Here how can I change the voltage as I dont have any control over it?

Thanks a lot to you for all the supports.
 

dspic pid

Here how can I change the voltage as I dont have any control over it?
By changing the duty cycle!
The duty cycle is effectivly the voltage applied to the phases. By changing the duty cycle you change the power delivered to the motor.
The PID controls the duty cycle fed to the motor
 

    yokel

    Points: 2
    Helpful Answer Positive Rating
dspic pwm

Ok.
It's done now. I had nothing to do in my MCU as it's there in my motor driver. In the driver by changing the resistance of a particular pot, the acceleration value of the motor can be changed.

Thanks a lot to all for all the supports
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top