Driving Servo BLDC motor
Moderator: Benj
-
- Posts: 12
- Joined: Thu Mar 11, 2010 8:10 am
- Location: Danmark
Driving Servo BLDC motor
Servo signal to the TR-M-80-HV
Funktion Speed control of 1 stk. BLDC Motor.
Can any one in this forum help me with a code example on how to make a servo controller,
which can control a TR-M-80-HV for 1 motor, enabeling me to regulate the speed wit a potentiometer
rangeing from 0 to full speed a a tension between 0 - 5 volt in on (ECIO40P Pic-18F445) AN0 – pin 4.
I user: FlowCode 4 for PICmicro
Show her: http://www.hobbyking.com/hobbyking/stor ... oduct=8945
I did search on http://www.matrixmultimedia.com/mmforums/index.php
Servo but I only found code written in C-code which I don´t understand.
It will please me a lot being able to run 1 BLDC motor.
Funktion Speed control of 1 stk. BLDC Motor.
Can any one in this forum help me with a code example on how to make a servo controller,
which can control a TR-M-80-HV for 1 motor, enabeling me to regulate the speed wit a potentiometer
rangeing from 0 to full speed a a tension between 0 - 5 volt in on (ECIO40P Pic-18F445) AN0 – pin 4.
I user: FlowCode 4 for PICmicro
Show her: http://www.hobbyking.com/hobbyking/stor ... oduct=8945
I did search on http://www.matrixmultimedia.com/mmforums/index.php
Servo but I only found code written in C-code which I don´t understand.
It will please me a lot being able to run 1 BLDC motor.
- Attachments
-
- Blok Diagram
- Servo-Illustration.jpg (160.69 KiB) Viewed 11870 times
Best regards,
Monie
Monie
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Driving Servo BLDC motor
I have created a few projects to control DC and BLDC and EC motors. All I did was determine a frequency in which to drive the motor (by trial and error). Too high and motor will over heat, too low and there will be a jerking movement, and too noisy. One motor was driven at 5KHz and another was driven at 10KHz. I would suggest the latter frequency. You could either use the bit bang to create a PWM (pulse width modulation) method or use the PWM module (so long as is supported by chip). Then you can create a test program to o/p a pwm (use ADC then a formula to convert to duty) varying form 0% duty to 100% duty and check if the whole speed range of motor is required. E.g if you only need 0 to 80% duty at 10KHz , and you are using 8bit mode and a variable called duty at an osc freq = 48MHz then 0V = 0% and 5V will = 80%, so the formula required will be: Duty = Duty *6 /25.
I also used two other ADC channels. one for motor current monitoring and one for battery voltage monitoring.
where HW is concerned, the microcontroller, was driving a logic voltage N channel FET. The motor was connected between +ve supply and drain. Source was connected to gnd. Most importantly a Schottky diode was connected in parallel with the motor, to dampen back EMF.
This is just a rough guide, If you are stuck then post a flowcode of what you have done so far,I will then see if a can give you further assistance.
Edit: This was a bit rushed because of the time, and I should of been in bed. I will see what flowchart I can produce as a guide line when I get more time free. You can then add bell and whistles. It will only be guess work since I do not have any of the hardware you have got, or motor/controller details. Have you got a better link to the hardware in question?
I also used two other ADC channels. one for motor current monitoring and one for battery voltage monitoring.
where HW is concerned, the microcontroller, was driving a logic voltage N channel FET. The motor was connected between +ve supply and drain. Source was connected to gnd. Most importantly a Schottky diode was connected in parallel with the motor, to dampen back EMF.
This is just a rough guide, If you are stuck then post a flowcode of what you have done so far,I will then see if a can give you further assistance.
Edit: This was a bit rushed because of the time, and I should of been in bed. I will see what flowchart I can produce as a guide line when I get more time free. You can then add bell and whistles. It will only be guess work since I do not have any of the hardware you have got, or motor/controller details. Have you got a better link to the hardware in question?
Martin
-
- Posts: 12
- Joined: Thu Mar 11, 2010 8:10 am
- Location: Danmark
Re: Driving Servo BLDC motor
To medelec35
I have tried with your info, but without success.
So I have to attach File: ServoBLDC.fcf
So it will be very happy if you have any suggestions for code example.
Sincerely,
Monie
I have tried with your info, but without success.
So I have to attach File: ServoBLDC.fcf
So it will be very happy if you have any suggestions for code example.
Sincerely,
Monie
- Attachments
-
- ServoBLDC.fcf
- (6.5 KiB) Downloaded 638 times
Best regards,
Monie
Monie
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Driving Servo BLDC motor
Hello by MonieJacobsen.
Are you saying you want to make a circuit to replace the controller you have posted a link to? Or do you want to control the controller, and you have already got the controller hardware?
If it is the former then the hardware is fairly involved, since you are controlling a 3 phase BLDC where as I have been controlling a single phase BLDC, I would not have software you can use.
For the hardware design see http://www.rcgroups.com/forums/attachme ... id=1610722 (best to know the hardware, before software design, since you may think it's too involved)
The microcontroller is just replaced with the one you would like to use. If you do not have the confidence to build the hardware, then you could consider one of the Freelance Embedded Engineers, who at the same time could help with the software.
Re software: The required drive waveform is included on the hardware schematic. You will not require the servos, but instead be using 6 PWM channels. Since ECIO only has two PWM channels. Two FETs connected together on each motor connection so are in push-pull arrangement therefore cannot be on at the same time, so make sure that is taken into consideration. The other way could be to use a pwm channel, then use AND gates to control each FET.
So I would advise build the circuit 1st, then design the hardware.
Are you saying you want to make a circuit to replace the controller you have posted a link to? Or do you want to control the controller, and you have already got the controller hardware?
If it is the former then the hardware is fairly involved, since you are controlling a 3 phase BLDC where as I have been controlling a single phase BLDC, I would not have software you can use.
For the hardware design see http://www.rcgroups.com/forums/attachme ... id=1610722 (best to know the hardware, before software design, since you may think it's too involved)
The microcontroller is just replaced with the one you would like to use. If you do not have the confidence to build the hardware, then you could consider one of the Freelance Embedded Engineers, who at the same time could help with the software.
Re software: The required drive waveform is included on the hardware schematic. You will not require the servos, but instead be using 6 PWM channels. Since ECIO only has two PWM channels. Two FETs connected together on each motor connection so are in push-pull arrangement therefore cannot be on at the same time, so make sure that is taken into consideration. The other way could be to use a pwm channel, then use AND gates to control each FET.
So I would advise build the circuit 1st, then design the hardware.
Martin
-
- Posts: 12
- Joined: Thu Mar 11, 2010 8:10 am
- Location: Danmark
Re: Driving Servo BLDC motor
To medelec35
Thanks for the information, viewing the information you came with!
But it was not the information I sought.
I tried code example of servo controller for a DC motor.
Should there be others who had suggestions, so it would delight me very much.
Best Regards
Monie
Thanks for the information, viewing the information you came with!
But it was not the information I sought.
I tried code example of servo controller for a DC motor.
Should there be others who had suggestions, so it would delight me very much.
Best Regards
Monie
Best regards,
Monie
Monie
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Driving Servo BLDC motor
I did ask a question to derive what you are after.
Since you have posted information which in my opinion could be causing confusion in what you require I could only second guess. (unless I am totally wrong and misread your post of course), so chances are it may not be the information you are after.
The link you posted is not for a servo, it is for a BLDC driver, which will cause the BLDC to continuously rotate speed, is controlled by a pot. You also stated you wanted to control the speed of a BLDC motor. The link I posted was for the circuit diagram of a similar BLDC controller. Flowcode you posted and your title 'Servo' suggests you just want to precisely move the position of motor clockwise or counter clockwise then stop the motor when in the correct position, using some form of positional feedback. Pot causes the motor to rotate until desired position is reached.medelec35 wrote: Are you saying you want to make a circuit to replace the controller you have posted a link to? Or do you want to control the controller, and you have already got the controller hardware?
Since you have posted information which in my opinion could be causing confusion in what you require I could only second guess. (unless I am totally wrong and misread your post of course), so chances are it may not be the information you are after.
Martin
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Driving Servo BLDC motor
Hello,
The TR-M-80-HV is a brushless speed controller. I have no experience with this specific part but I have used brushless speed controllers in my projects.
Basically the brushless speed controller should have the following connections. If these are different to your connections then the device will have to be setup in a different way.
3 x thin wires for servo input
2 x thick wires for Power input
3 x thick wires for brushless motor drive output
Simply connect the 3 thick wires to your brushless motor, connect the 2 thick wires to your high power voltage source. EG a 12V Lipo battery or an external PSU etc. Then connect the 3 x thin wires as follows.
Black - GND
RED - 5V
Orange - To I/O pin of uC.
Note that the colours listed above may vary depending on your speed controller.
You will also need to join the ground signals from the servo and external / battery connections so there is one ground relative to both the motor drive and servo control voltages.
Then you need to create your Flowcode program to control the single servo output channel which controlls the speed of the motor.
With my brushless motor projects you have to set the servo position to 0 then enable the channel and then slowly ramp up the position. If you start with a position that is not 0 then the controller automatically goes into its special diagnistics and setup mode and remains there until the proper startup sequence is acheived.
The TR-M-80-HV is a brushless speed controller. I have no experience with this specific part but I have used brushless speed controllers in my projects.
Basically the brushless speed controller should have the following connections. If these are different to your connections then the device will have to be setup in a different way.
3 x thin wires for servo input
2 x thick wires for Power input
3 x thick wires for brushless motor drive output
Simply connect the 3 thick wires to your brushless motor, connect the 2 thick wires to your high power voltage source. EG a 12V Lipo battery or an external PSU etc. Then connect the 3 x thin wires as follows.
Black - GND
RED - 5V
Orange - To I/O pin of uC.
Note that the colours listed above may vary depending on your speed controller.
You will also need to join the ground signals from the servo and external / battery connections so there is one ground relative to both the motor drive and servo control voltages.
Then you need to create your Flowcode program to control the single servo output channel which controlls the speed of the motor.
With my brushless motor projects you have to set the servo position to 0 then enable the channel and then slowly ramp up the position. If you start with a position that is not 0 then the controller automatically goes into its special diagnistics and setup mode and remains there until the proper startup sequence is acheived.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Driving Servo BLDC motor
That's fair enough, I totaly take back the "its not a servo part" as I did not realise the bldc driver has a servo based i/p.
I have only worked with nono servo based bldc motors.
Thank you Ben for the correction
I have only worked with nono servo based bldc motors.
Thank you Ben for the correction

Martin
Re: Driving Servo BLDC motor
I also want to control a BLDC motor but directly from dsPIC, any example code there??
Later on I will implement a position control with a quadrature sensor in the motor
and after that a PID closed loop , I will post the results. this would be very interesting for robot implementation.
Anyone interested?
Later on I will implement a position control with a quadrature sensor in the motor
and after that a PID closed loop , I will post the results. this would be very interesting for robot implementation.
Anyone interested?