Over the past 8 months, or so, I've designed and prototyped a servo motor controller. In short, I had to do a project for my final year at university, hence I asked if I could make a servo drive for a CNC machine (with a particular machine in mind ). I started by getting a cheap motor from hobbyking and finding out what would be required to run it as a servomotor. The design I've come up with can run different types of motors and uses the vector control algorithm to accurately and efficiently control the motor torque.
Here are some specifications:
- 240VAC single phase (only tested up to 100VAC, will try mains soon).
- 8.5A line current with no fan up to 40°C ambient - more possible with better cooling.
- 18-24VDC@300mA required for logic.
- With the motor from Hobbyking, about 1kW (so slightly OTT).
- Vector control - can operate in position, speed and torque control modes.
- Tuning of controllers via GUI - can test step response, measure torque vs speed, etc.
- Mains is isolated, some inputs also isolated (so single or double isolation depending).
- Hardware over-current/over-voltage protection (adjustible).
- Software over-current protection (partially inherently implemented, trivial).
- Drive temperature readout / protection.
- LEDs and switches for something (not really sure what).
Motor types supported:
- Permanent Magnet Synchronous Motors: (PMSMs, i.e. most modern servomotors, motors from hobbyking). Sensored only, but working on sensorless control.
- 3-phase Induction motors (e.g. spindle): The common 2.2-3kW spindles work well. Vector controlled currently only if sensored (not tested), harware supports sensorless so will work on adding that. Tested and works fine with Vf control and SVPWM - so slightly better than the cheap drives that come with the spindles, but potential for a lot more at a lower cost.
- Single phase induction motors: (not tested, but don't see why not).
- DC motors: (for those that live in the 19th century
Could be implemented (just requires programming):
- 6-Phase PMSMs: Algorithm worked out, still under development, requires 2 drivers.
- Stepper motors: Limited performance possible with one driver per motor, could run 3 motors from 4 drivers but that's getting a bit silly and I don't really see much point in pursuing it, as although a cheap mains voltage stepper driver would be nice ... a cheap mains voltage servo driver is nicer.
- Quadrature, differential and single-ended signalling.
- SSI and SPI protocol (common for absolute encoders).
- USB via RS232 converter (GUI uses this, but can configure for other things)
- Few spare pins which can be mapped to any spare peripheral the PIC supports (e.g. RS485, SPI ...)
- Step/Dir (Could also configure these for quadrature input, which is advantageous as can obtain higher step frequency)
- Isolated fault indication output.
In addition to the usual methods to control the driver, I made an interface using MATLAB, so you can adjust all the controller gains and try different tests (e.g. measure torque vs speed characteristic of load) by clicking buttons. Here's an example - graph shows q-axis current controller (part of the vector control algorithm - torque is proportional to q-axis current):
I rewound the motor, to make the current ratings more reasonable and enable it to be driven directly from the mains (instead of requiring a big expensive PSU):
To test the motor under load I made an eddy current brake, which worked well:
Here's some pictures of the motor parts with the housing I machined to hold the 17-bit encoder and adapt the mounting to Nema 23. Note the flexible PCB:
Testing with 3kW spindle:
Typical step response (note load inertia of brake is *VERY* high compared to CNC router/mill, so response is not as fast):
The position controller step response isn't so good - it oscillates quite a bit, but I think I know how to solve that now so I'll try it again when I have time.
Last but not least, here's the actual driver - first version of PCB made using toner transfer, 2nd one got made professionally (both use SMT components):
This was quite a big project (barely scratched the surface with this post) so any questions welcome. I might upload some videos, but I don't think there's much point as I'm sure you can imagine what a spinning motor looks like...
I have not yet decided how I should take this project further - namely make it just open source, open hardware, both or neither. My next step will be to make some more and test them on my CNC mill and router.
Last edited by Jonathan; 29-05-2014 at 02:51 PM.
>I might upload some videos, but I don't think there's much point as I'm sure you can imagine what a spinning motor looks like...
Video - or it never happened...
Jonathan, that's some mightily impressive work for an undergraduate 3rd year project in 8months. Kudos to you.
Sent from my HTC One_M8 using Tapatalk
nice work jon, well done.
I was previously under the impression that AC servos had the highest power density, but after seeing this (and your new X3 thread), my entire world is a lie!
Are you able to point me in the right direction to learn more about this sort of motor? I'm unable to find anything useful on them.
Also, I have a few questions you may be able to help me with:
- Why don't I see these sort of motors replacing spindles?
- Why don't I see these motors in non-hobby applications?
As a final year Mechatronic student (in Australia), this project, and your abilities absolutely dazzle me. I thought I was good, but you are in an entirely separate universe...
Love your work.
Almost forgot about this thread ... too many things going on.
I'm currently re-designing the PCB for the motor controller. I've split it into two boards - one for the power electronics and one for the controller and IO. They'll stack so the end result will be much more compact, not that that's a priority. I'll hopefully have that done within a few weeks, then I'll send off to get maybe 10-20 of the boards made. That's enough for my needs and hopefully some other people if I make it open source and they're interested in helping with the code - be that firmware or software.
I've also spent a little time testing a sensorless control algorithm, as it'll be good for applications where you don't need such high accuracy - e.g. spindle motors. The method I'm trying is based on the fact the machine inductance is a function of rotor position (in my case due to saturation not saliency), so if you can measure the inductance in real time you can infer the rotor position. To measure the inductance I'm injecting a high frequency voltage on top of the existing signal, then filtering and processing the current readings to isolate that signal. I get promising results when analysing the data in MATLAB, but I didn't have an encoder on the motor I tested so it's hard to compare the estimated position to the actual position. I'll try again some time with the encoder attached...
Coming soon - I connected it back up last week and found the encoder was misaligned, so once I've fixed that I'll take a video.
One initially confusing thing is people talk of 'Brushless DC' and 'Brushless AC' motors as if they're significantly different - when in fact they're both PMSMs, but with different control algorithms and shaped differently to get trapezoidal or sinusoidal back-emf.
But they are less common than induction motors. Induction motors, whilst (perhaps) not having the best power density, do have the advantage of being an inherently robust design. Also bear in mind it's only relatively recently that it's become cheap to implement vector control in a microcontroller - e.g. the PIC I used is less than £5 and it's by no means the cheapest one that is capable. Ten years ago the cost was a lot greater...
Last edited by Jonathan; 31-10-2014 at 11:22 PM.
The Following User Says Thank You to Jonathan For This Useful Post:
I seem to have made some progress:
So need to buy VFDs from China now. I was intending to split the design into a logic board and power board, but realised that realistically it's going to be a some time until I have time to complete that design, so instead I made a few improvements to the previous PCB and got a heap of them made.
I've worked a bit on the code too - it can now drive motors with hall sensors. I'm using the sensors to generate a position reference field oriented (vector) control, so it's smoother than the generic method of just switching on hall signal transitions. I'll take a video soon, but for now here's a picture:
With the previous design and more-so with this one, I've made is so spare I/O and signals are available on headers, so I can make 'expansion boards'. Here's one to add a 4th output to enable controlling stepper motors:
Now I've actually thought about it, I'm pretty confident you can control a stepper motor properly with a 3-phase inverter, so I might instead use this board to do power factor correction or just an isolated buck converter to eliminate the need for a transformer when using low voltages. If you connect the two phases of a stepper motor together, then connect the center point and two ends to the 3-phase inverter, you can still apply bipolar voltages to each.
I also mounted a 12-bit encoder on a 3Nm stepper motor yesterday, so I'm planning to use that to implement sensored vector control, rather like the Leadshine closed loop version ... but open source and cheap. There's plenty of information on how to do it, such as this, so I'll try it and see. That paper makes it look straightforward ... watch this space.
Re. stepper motor use.
If you are splitting the power section onto a separate board maybe you could use a common DC link psu to power several controllers. I suppose this is what the current stepper drivers do.
Also if you fit encoders maybe it would be worth including a system for homing a master /slave without external intervention.
Keep up the excellent work
Last edited by EddyCurrent; 22-01-2015 at 08:03 AM.Spelling mistakes are not intentional, I only seem to see them some time after I've posted
If instead of adding an extra leg I connect the stepper motor to the 3-leg inverter, as mentioned in my previous post, the only obvious disadvantage is you end up with 'poor' utilization of the DC-bus voltage, V. Depending on the output voltage vector angle, you either get V or V/sqrt(2). See this paper, fig 4. I don't think that's an issue though, as we can simply supply the motor from a higher voltage to compensate. The current controller bandwidth will have to be a little higher to compensate and the insulation resistance of the motor also must be greater, but I don't think the difference in voltage is a big enough factor to matter in either case. Maybe there's something I've missed, as it seems strange that all commercial drives seem to use 8 mosfets when this method only needs 6.
I've started soldering five of the PCBs. It's very time consuming though, maybe I should make a pick and place machine next.
Last edited by Jonathan; 23-01-2015 at 07:00 PM.
By george uk in forum Motor Drivers & ControllersReplies: 20Last Post: 23-06-2014, 07:38 PM
By Tomnewry in forum Motor Drivers & ControllersReplies: 15Last Post: 27-03-2013, 10:30 PM
By Peter. in forum Motor Drivers & ControllersReplies: 24Last Post: 17-09-2012, 07:36 AM
NEW MEMBER: I am going to build a 3 axis servo controlBy markey1979 in forum New Member IntroductionsReplies: 8Last Post: 15-11-2011, 11:53 PM
By oadamo in forum General ElectronicsReplies: 1Last Post: 22-05-2011, 06:30 PM