PDA

View Full Version : Build Log: Servo Drive and VFD with vector control



Jonathan
29-05-2014, 03:35 PM
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 :rolleyes:). 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:

Ratings:


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


General features:

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.


Encoders supported:

Quadrature, differential and single-ended signalling.
SSI and SPI protocol (common for absolute encoders).


General I/O:

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

12487

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

To test the motor under load I made an eddy current brake, which worked well:
12488

Here's some pictures of the motor parts with the housing I machined to hold the 17-bit encoder (http://www.avagotech.com/pages/en/motion_control_encoder_products/absolute_encoders/single-turn_encoders/aeat-9000-1gsh0/) and adapt the mounting to Nema 23. Note the flexible PCB:

12490124911249212493

Testing with 3kW spindle:

12494

Typical step response (note load inertia of brake is *VERY* high compared to CNC router/mill, so response is not as fast):

12495

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

1249612497

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.

Wal
29-05-2014, 07:19 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...

Wal.

routercnc
29-05-2014, 09:03 PM
Hi Jonathan,

I won't pretend to understand all of it but a very impressive piece of work, well done.

irving2008
30-05-2014, 06:10 AM
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

dazza
30-05-2014, 10:06 AM
nice work jon, well done.

embraced
29-06-2014, 01:45 AM
Jonathan,

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.


Lindsay

Jonathan
01-11-2014, 12:17 AM
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...


Video - or it never happened...


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.


Jonathan, that's some mightily impressive work for an undergraduate 3rd year project in 8months. Kudos to you.

Thank you. I got the prize for the best project, so the people in charge agreed. It was 4th year though - I did MEng not BEng and I'm glad I did as most of the modules in 4th year were useful.



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.

Out of types of servo motors they have the highest power density (excluding maybe some esoteric designs), but out of motors in general it's unlikely. Power density is strongly dependent on heat, so since most servo motors tend to use passive cooling they're not going to achieve particularly high power densities. Just search on google 'permanent magnet synchronous motor' (pmsm) and you should find plenty of information. The less common feature of the one I used is the rotor being on the outside, which makes things interesting from a cooling point of view...

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.


Why don't I see these sort of motors replacing spindles?

You do:
http://www.controleng.com/single-article/permanent-magnet-motors-outperform-induction-motors-in-many-applications/413305407b2989675983a5babac0ac6d.html

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



- Why don't I see these motors in non-hobby applications?


Part of the problem for companies using these is the potential for large fluctuations in the magnet price. These motors use neodymium magnets and the vast majority of neodymium is mined in China. The Chinese government therefore controls the export prices, so the magnet cost can increase suddenly without notice. That clearly makes it difficult to justify economically, especially in consumer products with low profit margin. Apparently motors with these magnets are currently used in some military applications, but for these reasons there's research into finding alternatives. You do find them in some consumer products - e.g. direct drive washing machines and hybrid cars.

Jonathan
20-01-2015, 12:00 AM
I seem to have made some progress:

http://www.mycncuk.com/attachment.php?attachmentid=14474&stc=1

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:

http://www.mycncuk.com/attachment.php?attachmentid=14476&stc=1

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:

http://www.mycncuk.com/attachment.php?attachmentid=14475&stc=1

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 (http://www.controldesign.com/assets/Media/MediaManager/wp_040_jat_vergge.pdf), so I'll try it and see. That paper makes it look straightforward ... watch this space.

EddyCurrent
22-01-2015, 08:59 AM
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 :applause:

Jonathan
23-01-2015, 07:58 PM
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.

Currently the design has a rectifier so it accept an AC input, but I also put connection to the DC-link so you can power from a DC source, add more capacitance or share between drives. One interesting consequence of connecting the DC links in parallel is energy can transfer from one motor (regenerating) to another, which is a regular occurrence on a CNC machine as often when one axis is decelerating another will be accelerating.

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 (http://www2.humusoft.cz/www/papers/matlab13/038_laskody.pdf), 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.


Also if you fit encoders maybe it would be worth including a system for homing a master /slave without external intervention.

Yes, why not ... it's just software. When I've got the code tidy enough I'll release it as open source and hardware, then people can add things like that if they like. Also the encoder I'm currently using is absolute, so homing is trivial.

I've started soldering five of the PCBs. It's very time consuming though, maybe I should make a pick and place machine next.

Erythros
24-01-2015, 06:04 PM
I think that separate controller board and inverter with power supply is the only way to go. I recetly began looking into PMSM control and the differences in motors are too big to use one MCU/power stage combo. On eBay there is plentiful of used servomotors from industrial machines (probably from modernization/retrofit), which are quite cheap and for us hobbyist still good enought. And the difference in DC link bus voltage of inverter stage is huge. The motor I bought has the original driver using 670V DC link, some Fanuc ones use about 100V and so on. Also there is difference for power resistor for dynamic braking and other aspect of design that make me think that ability to differentiate the inverter is only way to go for general purpose driver.

Jonathan
20-03-2015, 02:42 AM
I think that separate controller board and inverter with power supply is the only way to go. I recetly began looking into PMSM control and the differences in motors are too big to use one MCU/power stage combo. On eBay there is plentiful of used servomotors from industrial machines (probably from modernization/retrofit), which are quite cheap and for us hobbyist still good enough.

I tend to agree. Since we're not too concerned about efficiency you can get some way by over-rating the components, which doesn't increase the cost too much, but you soon become limited by the switching frequency (and thus control bandwidth) that can be used.


On eBay there is plentiful of used servomotors from industrial machines (probably from modernization/retrofit), which are quite cheap and for us hobbyist still good enough.

I've been vaguely looking out for one to try, as my driver may not be working well with position control just due to the non idealistic properties of the motor I've been testing with.

Really trying to keep the ball rolling with this project, but my PhD work and related things keep getting in the way as I tend to be spending 9am~8pm in the lab. Still, I have however done some more soldering on a few of the PCBs. Here are a few pictures:

http://www.mycncuk.com/attachment.php?attachmentid=14924&stc=1http://www.mycncuk.com/attachment.php?attachmentid=14925&stc=1

Can anyone spot the mistake in this one...

http://www.mycncuk.com/attachment.php?attachmentid=14926&stc=1

Time to stop now though as it's 1:30am and I don't want to miss the eclipse this morning...

Gotty101
20-03-2015, 06:53 PM
I cant see that great on my phone, but is it that component across the pins on the microcontroller?

Great work!

Jonathan
20-03-2015, 08:42 PM
I cant see that great on my phone, but is it that component across the pins on the microcontroller?

Yes that's right - I accidentally connected the core voltage regulation filter pin to Vss instead of the capacitor. Fortunately that pin is only connected to a capacitor, so I'm instead lifting that pin and soldering an 0402 capacitor between it and the adjacent Vss pin. Bit fiddly, but it works ...

I've not found any other mistakes yet.

JAZZCNC
21-03-2015, 02:53 AM
I've been vaguely looking out for one to try, as my driver may not be working well with position control just due to the non idealistic properties of the motor I've been testing with.

What Voltage motor would you want I have a few Large-ish Parker AC Servo motors.?

Jonathan
21-03-2015, 07:22 PM
What Voltage motor would you want I have a few Large-ish Parker AC Servo motors.?

Sounds good. Anything up to around 300V, 15A would be fine. Do you have the part number so I can check?

JAZZCNC
22-03-2015, 10:14 PM
Sounds good. Anything up to around 300V, 15A would be fine. Do you have the part number so I can check?

Ok will Dig out and let you know but i think it's much higher than 300v but I may have smaller one kicking around.

GEOFFREY
05-04-2015, 07:58 PM
Since joining this site, I have mentioned in a couple of posts that I needed an HF spindle drive inverter (1000hz, not the usual 400hz, and also low voltage - 60volts). I have been trying for several years to get a spare as I knew that my inverter was out of production, and nobody seems able to offer a repair service. I contacted Jonathan who told me that he could configure his new driver to suit my needs, so I ordered two of his new drives. Last week my inverter failed and a quick call to Jon had him burning some midnight oil to finish and set up one of the new drives for me. Thank you Jonathan, I have just installed the new driver and have in fact completed a small job. The spindle runs faultlessly throughout the RPM range and I am very impressed. I am aware that this driver can be configured to perform many more functions than I require, but I am over the moon that I have been able to get an inverter that will drive my spindles. Thanks again jonathan. G.