585,708 active members*
3,805 visitors online*
Register for free
Login
Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2005
    Posts
    94

    Yet another servo control mechanism

    Howdy there folks.

    Here's the deal!

    I have a daughter who is VERY interested in software development as a career. She's already put together some web sites complete with credit card ordering and etc, but she wants to try her hand at something more "programmy". To this effect, I've talked her into writing some code for a servo controller.

    WHY?!

    A couple of reasons. The UHU is good, but does not have current control, or adjustable cross conductance dead time, or open source. I would like this project to be open source for the hardware and software.

    The reason I want to build it is because the various controllers out there all are limited to about 3 amps, until you get to the multiple hundreds of dollars range, THEN you get into the 6+ amps controllers that are suitable for a nema 34 motor (32? I mix these up all the time).

    So, what I am wanting to use is luminary microsystem's lm3s811 controller (because I have several of them *AND* it's fast fast fast with LOTS of pwm capability, 1mhz a/d conversion on two channels, and has lots of memory and the development boards for them are cheap and programmable via usb.)

    The feature set I would like to have, initially, is the following.

    1) It can control a bipolar stepper motor with or without a shaft encoder.
    2) It can control a bldc motor with a shaft encoder (quadrature only at this time)
    3) It can be set up using a serial port, or an I2C bus.
    4) It can have it's maximum current to the motor set up via dipswitches or serial port. (PROBABLY will just use the serial port as I more or less would like to keep the dip switches to a minimum)
    5) it will use surface mount components for cost and size considerations except for the mosfets (or igbt's) which will be thru hole for ease of replacement and ease of mounting a heat sink. (I beleive this will give me more flexibility).

    Now then, the help part.

    I am using the general design of the allegro style stepper controllers, but I want to measure the current at "The right place"

    I'm not sure if that should be at the bottom of the common ground for the h-bridges, or if it will be at the motor windings. I've been researching this quite a bit and would like to avoid the noise problems that prevent the allegro controller from making even steps at the top and bottom of the microstepping current curves.

    Also, the processor I'm interested in using multiplexes the a/d converter which means I would not be able to get a simultaneous snapshot of all the motor phases, and with BLDC's typically requiring 3 phases, I'm thinking that I will have to reevaluate either the CPU, or knuckle under and use three seperate a/d converters of 3 sample hold circuits.

    Any and all suggestions would be appreciated.

    Rick

  2. #2
    Join Date
    Dec 2005
    Posts
    3319
    Compromises, compromises, compromises. Three words that affect any design not the least of which is that of an electronics component.

    Remote current sensing subjects you to the ravages of inductance and/or EMI/RF noise. For this reason and this reason alone, I'd sense current as close to the driver(s) as possible. Since you'll have to have a precise shunt in place, you're choices either become that of creating a shunt from shunt wire or use a dedicated resistor with built in Kelvin connection - via use of the latter, mounted in the amplifier box, should enable you to keep the leads short and cool to keep current sense accurate. Fuses can be used as shunts as they do tend to be rather accurate - if you toast the fuse, you REALLY protect the rest of the high current pass elements.

    Via use of a proper instrumentation amp - preferrably bipolar supply and at of +/-15 vdc (remember high noise immunity is critical) - you should be able to sense current accurately and QUICKLY.

    If you use adequate size conductors from amp to motor(s), voltage drop/current flow should not be THAT much of a problem in dealing with. Remember: your device will be hooked up by "amateurs" thus it has to be robust - real robust. If they can't/won't wire its connection properly (real issue but should it concern you?) you still need to have the amp do its thing properly - as in protect itself.

    IT would be nice to make the amp totally self protecting of any/all abuse, but really, you can't. Make the drive side robust. Make the current sense side robust and noise tolerant/resistant. Make the high current pass elements robust and easy to service - when/if the user toasts parts as they surely will, as long as the fets were driven to full enhancement and without the potential for dV/DT and/or voltage spike problems, you've done your best.

  3. #3
    Join Date
    Dec 2005
    Posts
    94
    Hello there NC Cams, thank you for taking the time to input your thoughts!

    And yes, compromises is ALLWAYS the key, it would appear.

    I have been giving this a LOT of thought and trying to wrestle with what features I want/need.

    The biggest thing is that my daughter get a taste of embedded software. That really is the key number one point of this excersise for me.

    RE: Current sensing.. I found a device that I'm thinking might be good for what I wish to do, which, is basically using pwm on the motors to control the total current draw. take a peek at this!

    http://www.lem.com/hq/en/component/o.../output_type,/

    Now, one of the things I'm struggling with is this whole notion of half step/ quarter step 1/8 step etc.. and it SOUNDS like to implement that requires turning the motor windings on partially (via pwm, yes?) while measuring the current to the motor windings in order to vary the current to the pair of windings to make the rotor partially step between windings.

    I read pminmo's posting on the allegro chip with great interest as well as the allegro data sheet which seems to show that there is a LOT more than meets the eye to getting this to work right.

    So, being an edison kind of guy, my thoughts are thus...

    Make the motor winding drive code such that it is 'tuneable' on a per fractional step basis. Yup, that's right. That means that once the motors are in place, the mechanism is actually functioning, that you take a dial indicator and you start tweaking table entries for the amount of time each winding is pwm'd (More acureately, the perrcentages of pwm that go to one winding vr.s the other winding) until the motor moves appropriately.

    Is it easy to do? Nope, won't be easy at all, BUT, if it is coupled with a PC application then it becomes a matter of 'following the instructions' in the program and entering data from the dial indicator into the program which then 'does all the right stuff' to get the tables into the controller and, once tuned, save it as a table in the eeprom of the micro.

    I'm also thinking , at this time, The I really need to simplify this to make it an acheivable 'semester' sized chunk of code for her, which means ditching the servo motor and the encoder stuff.

    On teh subject of making it bombproof for wiring it up to motors.. I saw someone mention putting a light bulb in series with the power supply to the motor to help limit the current in case something locks up or goes horribly wrong. That might help make the system a bit more robust.

    On the subject of robustness, Yes, it concerns me greatly. most especially if this DOES turn into some kind of product, then I want it to be as robust as possible.. soo.. fuses.. And the ability to current limit the motors.. (again, by fuses if necessary, though I want to also be able to do so with software, though I'll happily toss that if it turns out to simply be too much for one 4 month project.)

    Anyways, you have given me a lot to think about. thanks!

    horsedorf

  4. #4
    Join Date
    Dec 2005
    Posts
    3319
    If you adequately and properly sense the current flowing thru the driver bridge, you should be able to limit current to any value you want - the trick is that as soon as you put in a pot to adjust current, you enable the DIY to screw with the amount of current programed into the drive.

    We used base of H drive current sensing on our R/C car PWM speed controls and we could allow any/all current to flow or as little as 1 amp - all you did was twist a pot and change the ref voltage sent to the current sense comparison circuit. The current sense amp simply drained off "drive" voltage to the PWM and reduced PWM "on" time percentage until the pre programmed current limit was not exceeded. Simple, effective and essentially bullet proof and infinitely tuneable.

    I'd be disinclined to make the thing software current controlling - you then need to do more F to V and/or other expense to set current reference voltages and you only have so much LPT port thru put. Some analog circuits are simple and adequate - not EVERYTHING needs or has to be digital.

    You could put a pot on your development models and then replace the pot with fixed resistors. THis way, you'd "hard code" the current capabilities and free up/simplify your daughter to do the basic programming instead of another task that anybody with basic electronics capabilities can do.

    This scheme also limits the ability of the DIY "tuner" to overload the thing via faulty settings in the Mach or whatever software is going to run the thing.

    If you look at the TI/Unitrode UC3717 stepper driver, they simply feed the current sense shunt into the controller IC. Simply by changing the logic to the digital control pins, you can limit current to 1 of 4 values (100%, 50%, 15% or Inhibit) - some simple coparator window circuit work would program the chip as needed/desired. Surely, other stepper IC's have similar capabilities.

  5. #5
    Join Date
    Dec 2005
    Posts
    94
    AHHhh.. Okay, I see what you are saying. Thing is though, you also stated...

    "and you only have so much LPT port thru put" which I think infers you are assuming that there will be a lot of control from the LPT port. There won't be, only step and direction. The rest of this is all on the onboard micro. So BASICALLY what I would be recreating here is an allegro 3977 (I think that's the number) except the fets will be external, so that they can be made to handle whatever currents I would like. (Looking at the range of about 6 amps for teh 1000 oz in steppers)

    Initially, the system will be pretty simple, just full steps, but eventually, I would like to have it perform half/ 1/4 1/8 etc stepping. However, I do llike the notion of a trim pot fo the current limitting, and basically that would feed into a comparator that enables/disables the outputs and hence providing me my current averaging.

    Thing is, if I understand correctly, the microstepping is acheived by turning on two phases of the motor at the same time, but with differing amounts of current. Yes? And that moves the rotor proportionally between poles of the motor?

    Still scratching my head over this one. In the mean time for some cnc projects I need to finish *NOW* I'm just buying some 3977 boards from pminmo!

    Thanks for your input!
    Rick

  6. #6
    Join Date
    Dec 2005
    Posts
    3319
    I'm confused.

    Step/direction takes up 2 channels per axis. That leaves 6 more unused in a typical single LPT.

    take away 2 more for current control - assuming 2 channels which give 4 possible levels of current on 2 data bits. You now have 4 gone, 4 to go.

    Add any sort of other output signals like a 2nd or third axis and POOF you're out of channels pretty quick for digitally controlling anything more than simple step/direction.

    Start adding more LPT's to do data out or input and you now have thru put issues to contend with.

    This is why remote current sensing with analog devices has so much charm - you don't use up drive channels on LPT doing what can easily be done with linear circuits. Moreover, the self protection doesn't have to be done with PC brains - a good linear circuit will suffice and still be fast and let you do more with the PC than protection overhead.

  7. #7
    Join Date
    Dec 2005
    Posts
    94
    LOL! Yeah, I can see why you are confused now!

    See, the device will have it's own microcontroller on it.. it will take step and direction as inputs from teh parallel port, but the setting for current will be either dip switch, or input via a serial port during configuration. I would like to do things like, reduce current for idle when the motor is not being moved as well as control the current between windings so that i can microstep.

    It's the microcontroller's functionality that I'm interested in, not the pc side of things. For that I'll jsut use emc or.. whatever.. however, for setup and tuning, that will need a serial port of some kind or a usb port.

    That way, what I can try to get is, a single controller board that is fairly configurable, can drive relatively high currents, and even drive a servo motor instead of steppers!

    Cost is , as of now, unknown, but I'd LIKE it to stay under $150 in parts... which is a LOT of parts.. and if designed properly, the only thing that needs to change for added functionality, would be the software!

    Also, since my primary objective here is really teaching my daughter embedded software techniques, the actual final functionality of the system is a bit up in the air at the moment. I MOSTLY just have to be darn sure that what I set out to do is acheivable. I want to set her up for success, not failure.

    Thanks again!

    RIck

  8. #8
    Join Date
    Dec 2003
    Posts
    24220
    Would it not be advantageous to look at digital sent over a non-proprietary communication bus, as opposed to non-digital step/dir through the limitations of the parallel port?
    I believe that many systems use this method now as it allows feed back to the control, whereas the parallel port method does not.
    If you could achieve this with EMC and a suitable HMI you may come up with a true closed loop controller.
    Al.
    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.

  9. #9
    Join Date
    Dec 2005
    Posts
    94
    Hello Al! And thank you for taking the time to Chime in.

    YES! You are, of course, 100% on that, however, all of the CNC control systems that I currently know about use the step and direction pulses on the parallel port to control the cnc machine.

    I do not know what's going on with EMC, but I do know that it has been debated for a while as to how the system should be changed. I do not, however, know if any changes have been made to it so that it would be able to use, say.. a usb port to communicate with the motor controller.

    So I agree with you fully in that using step and direction is.. primitive, but I'm not sure what *ELSE* to make it do or how else to make it work so that it works with current systems. If you have a url that points out some things or if you have some ideas about how this controller board should communicate with the controlling system, I would love to hear it!!

    Thanks!
    Horsedorf

Similar Threads

  1. Motor drive mechanism
    By Sureform in forum CNC Wire Foam Cutter Machines
    Replies: 1
    Last Post: 07-09-2006, 06:25 PM
  2. Power DrawBar Mechanism
    By vmax549 in forum Bridgeport / Hardinge Mills
    Replies: 6
    Last Post: 11-19-2005, 12:10 AM
  3. Sources for Lead Nut Mechanism
    By space_case in forum Linear and Rotary Motion
    Replies: 3
    Last Post: 04-22-2005, 01:58 AM
  4. Digital Stop Mechanism
    By polyhedron12 in forum Community Club House
    Replies: 0
    Last Post: 02-21-2005, 03:54 AM
  5. lead screw mechanism
    By sp00k1e in forum DIY CNC Router Table Machines
    Replies: 9
    Last Post: 02-10-2004, 12:14 AM

Posting Permissions

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