Driving Servo BLDC motor

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
MonieJacobsen
Posts: 12
Joined: Thu Mar 11, 2010 8:10 am
Location: Danmark
Contact:

Driving Servo BLDC motor

Post by MonieJacobsen »

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.
Attachments
Blok Diagram
Blok Diagram
Servo-Illustration.jpg (160.69 KiB) Viewed 11195 times
Best regards,
Monie

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: Driving Servo BLDC motor

Post by DavidA »

Post now in relevant forums.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Driving Servo BLDC motor

Post by medelec35 »

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?
Martin

MonieJacobsen
Posts: 12
Joined: Thu Mar 11, 2010 8:10 am
Location: Danmark
Contact:

Re: Driving Servo BLDC motor

Post by MonieJacobsen »

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
Attachments
ServoBLDC.fcf
(6.5 KiB) Downloaded 608 times
Best regards,
Monie

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Driving Servo BLDC motor

Post by medelec35 »

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.
Martin

MonieJacobsen
Posts: 12
Joined: Thu Mar 11, 2010 8:10 am
Location: Danmark
Contact:

Re: Driving Servo BLDC motor

Post by MonieJacobsen »

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
Best regards,
Monie

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Driving Servo BLDC motor

Post by medelec35 »

I did ask a question to derive what you are after.
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?
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.

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

User avatar
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

Post by Benj »

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.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Driving Servo BLDC motor

Post by medelec35 »

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 :-)
Martin

r_romeo
Posts: 54
Joined: Wed Nov 02, 2011 3:57 pm
Has thanked: 14 times
Been thanked: 3 times
Contact:

Re: Driving Servo BLDC motor

Post by r_romeo »

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?

Post Reply