. .
Page 1 of 2 12 LastLast
  1. #1
    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:

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

    Click image for larger version. 

Name:	GUI_typical.png 
Views:	858 
Size:	20.8 KB 
ID:	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):
    Click image for larger version. 

Name:	Wound_Stator.png 
Views:	768 
Size:	1.07 MB 
ID:	12489

    To test the motor under load I made an eddy current brake, which worked well:
    Click image for larger version. 

Name:	Eddy_Brake_2.png 
Views:	1062 
Size:	1,009.4 KB 
ID:	12488

    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:

    Click image for larger version. 

Name:	Motor_exploded.png 
Views:	1474 
Size:	1.17 MB 
ID:	12490Click image for larger version. 

Name:	NemaCover2.png 
Views:	943 
Size:	1.01 MB 
ID:	12491Click image for larger version. 

Name:	Flex_PCB.png 
Views:	808 
Size:	1.11 MB 
ID:	12492Click image for larger version. 

Name:	Motor.png 
Views:	825 
Size:	1.09 MB 
ID:	12493

    Testing with 3kW spindle:

    Click image for larger version. 

Name:	IM_test.png 
Views:	1005 
Size:	1.23 MB 
ID:	12494

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

    Click image for larger version. 

Name:	VelControllerStep.PNG 
Views:	859 
Size:	36.7 KB 
ID:	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):

    Click image for larger version. 

Name:	ServoDriveV1.png 
Views:	905 
Size:	1.07 MB 
ID:	12496Click image for larger version. 

Name:	ServoDriveV2.png 
Views:	862 
Size:	1.10 MB 
ID:	12497

    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 03:51 PM.
    Old router build log here. New router build log here. Lathe build log here.
    Electric motorbike project here.

  2. #2
    Wal's Avatar
    Lives in Stockport, United Kingdom. Last Activity: 30-03-2023 Has been a member for 9-10 years. Has a total post count of 491. Received thanks 71 times, giving thanks to others 29 times.
    >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.

  3. #3
    Hi Jonathan,

    I won't pretend to understand all of it but a very impressive piece of work, well done.
    Building a CNC machine to make a better one since 2010 . . .
    MK1 (1st photo), MK2, MK3, MK4

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

  5. #5
    nice work jon, well done.

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

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

    Quote Originally Posted by Wal View Post
    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.

    Quote Originally Posted by irving2008 View Post
    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.

    Quote Originally Posted by embraced View Post
    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.

    Quote Originally Posted by embraced View Post
    Why don't I see these sort of motors replacing spindles?
    You do:
    http://www.controleng.com/single-art...abac0ac6d.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...

    Quote Originally Posted by embraced View Post
    - 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.
    Last edited by Jonathan; 01-11-2014 at 12:22 AM.
    Old router build log here. New router build log here. Lathe build log here.
    Electric motorbike project here.

  8. The Following User Says Thank You to Jonathan For This Useful Post:


  9. #8
    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.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	ServoPCB_1p2.jpg 
Views:	2526 
Size:	894.1 KB 
ID:	14474   Click image for larger version. 

Name:	ServoPCB_1p1_stepperexpansion.jpg 
Views:	2513 
Size:	691.7 KB 
ID:	14475   Click image for larger version. 

Name:	Room.jpg 
Views:	2297 
Size:	228.0 KB 
ID:	14476  
    Old router build log here. New router build log here. Lathe build log here.
    Electric motorbike project here.

  10. #9
    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 09:03 AM.
    Spelling mistakes are not intentional, I only seem to see them some time after I've posted

  11. #10
    Quote Originally Posted by EddyCurrent View Post
    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, 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.

    Quote Originally Posted by EddyCurrent View Post
    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.
    Last edited by Jonathan; 23-01-2015 at 08:00 PM.
    Old router build log here. New router build log here. Lathe build log here.
    Electric motorbike project here.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Closed loop Step Servo Drive Driver 2HSS86H + 4.5N.M Motor + Encoder
    By george uk in forum Motor Drivers & Controllers
    Replies: 20
    Last Post: 23-06-2014, 08:38 PM
  2. Servo drive problems
    By Tomnewry in forum Motor Drivers & Controllers
    Replies: 15
    Last Post: 27-03-2013, 11:30 PM
  3. servo control vs stepper control
    By Peter. in forum Motor Drivers & Controllers
    Replies: 24
    Last Post: 17-09-2012, 08:36 AM
  4. NEW MEMBER: I am going to build a 3 axis servo control
    By markey1979 in forum New Member Introductions
    Replies: 8
    Last Post: 16-11-2011, 12:53 AM
  5. drive control system
    By oadamo in forum General Electronics
    Replies: 1
    Last Post: 22-05-2011, 07:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •