512,692 active members
3,864 visitors online
Register for free
Login
IndustryArena Forum > OpenSource CNC Design Center > Open Source Controller Boards > PIC Open source Servo Driver Schematics development?
Page 3 of 5 12345
Results 41 to 60 of 91
  1. #41
    Gold Member
    Join Date
    Dec 2004
    Posts
    524

    ATmega16 Seems Fast Enough to Handle Encoder Input

    The issue of an encoder sitting at a transition should not be a problem. The way to handle this is to require that counting always occurs on alternating channels. So if the last count was (say) up on channel A, then a transition back on channel A is ignored. If the encoder continues moving in that direction, the next count will be down, but it will be caused by the transition on channel B. This means that there is built in hysteresis of one transition (on a 500 line encoder, this is one 2000th of a revolution).

    On an AVR (the ATmega16 is my current processor of choice because I already use them), it is a simple matter of disabling the interrupt on the last channel that it occurred on. So on an A interrupt, disable A and enable B. On a B interrupt, disable B and enable A.


    I've written some prototype code and it appears that it will less than 4 usec to handle each interrupt on an ATmega16 running at 20 MHz. It's 53 words of code for each interrupt. Not all of it will need to execute. When I have some time, I'll try to get a better figure.

    An encoder with 2000 transitions per revolution will take around 8msec per revolution. At 3600 rpm (60 revs per second), it will use about half of the processor cycles when running at full speed. -- But note, that other code had better not disable interrupts for more that around 4 usec.

    Ken

  2. #42
    Here on this Link is an selfmade PID Servocontoller for brush Servomotors whis encoder, for HP or Agilent Encoders, an works whis 200-1000 Step encoders
    The circuit make maximum 80V and 25A for the Servomotor, and is verry easy an stable
    The circuit has an Clock and and direction input, an can connect to par port of an PC.
    Basis is an Atmel Controller, and the cost including the programming = 20Euro
    The Hex File is not only avaible
    The Rest of Matterial is < 20 Euro
    http://5128.rapidforum.com/topic=112...267&startid=23

    Servo motor diskussion is on this link
    http://5128.rapidforum.com/topic=112282918267

  3. #43
    Banned
    Join Date
    Apr 2004
    Posts
    678
    @Hardwarekill: I have followed the thread you mention, and may order the board. But I also would like to have the source to see how the control is implemented. If you look through the first pages of the thread, there is some indication that some important facts are not known by the developer (who is one person). Check the replies to Hartmut's questions. He is of course entitled not to release the code, but it may benefit the design if he did place it under GPL.

    It seems I'm more or less echoing your postings in that thread, but it is still my opinion.

    Did you try it out?

  4. #44
    Banned
    Join Date
    Apr 2004
    Posts
    678
    @lerman: Did you consider using one of the built-in counters?

    In real life a motor running at a speed approaching the (software) counting abilities of an ATMega16 @ 20MHz will simply not just begin rotating in the opposite direction! So why not change strategy from software counting with direction discriminator to just measure the speed? Then you would be able to follow a motor with 4096 transititions/rev and more up to when it throws it's windings. If you choose the input pins with care, this can all be done in software. It will only count on one flank of one of the phases, thus getting only 1/4 of the resolution but again, at that speed that will be a moot point anyway. Just shift the counter result left twice to make it correct.

    If using step/dir control, use same strategy to keep up with this. If the host decides to swap direction while issuing step pulses at high speed, it's a lost case anyway. I know commercial drives that will not allow this either.

    I did not try this out, so please shoot me down if I'm wrong.

  5. #45
    @ESjaavik

    The Quellcode or the Hex File ist NOT availble, unfortunately.
    Only the programmed Atmel Controller (20Euro) and the Crcuit ( Free whis including the Atmel) or/and the PCB ( 8,xx Euro) iss avaible.
    I have written the Auhor a Email, the answer is, NO i will not give the Hex or Quellcode for Open Source
    Many german People work whis this Servocircuit, an ALL People have no problems whis this, works great
    Look here 2 Videos of an CNC the first whis Stepper an than same CNC whis Servodrive whis this circuit.
    http://www.jocomomola.de/downloads/downloads.html

    Apology for my bad Enlish, I im a german.

  6. #46
    Gold Member
    Join Date
    Dec 2004
    Posts
    524

    Why I Would Not Use Counters

    Quote Originally Posted by ESjaavik
    @lerman: Did you consider using one of the built-in counters?

    In real life a motor running at a speed approaching the (software) counting abilities of an ATMega16 @ 20MHz will simply not just begin rotating in the opposite direction! So why not change strategy from software counting with direction discriminator to just measure the speed? Then you would be able to follow a motor with 4096 transititions/rev and more up to when it throws it's windings. If you choose the input pins with care, this can all be done in software. It will only count on one flank of one of the phases, thus getting only 1/4 of the resolution but again, at that speed that will be a moot point anyway. Just shift the counter result left twice to make it correct.

    If using step/dir control, use same strategy to keep up with this. If the host decides to swap direction while issuing step pulses at high speed, it's a lost case anyway. I know commercial drives that will not allow this either.

    I did not try this out, so please shoot me down if I'm wrong.

    I wouldn't say that you are wrong, but here are my thoughts.

    At "zero" speed, you could sit at a transition. Any little vibration might cause rapid cycling up and down. Remember that every lost count on a servo represents an error in position -- it corresponds to a lost step on a stepper.

    Of course, if you put a linear encoder on the table, then you can use the rotary encoder for speed feedback and the linear encoder for position.

    One neat way (for me, at least -- I'm a programmer) to handle the problem might be to dedicate a chip to read the encoder and also read the commands from the host (PC). By writing the code in assembly language, I believe I could handle 3600 rpm with a 2000 transition per rev. encoder.

    A second processor would read the current error (from the first processor) at the rate of a thousand times a second or so.

    Ken
    Kenneth Lerman
    55 Main Street
    Newtown, CT 06470

  7. #47
    Community Moderator
    Join Date
    Mar 2003
    Posts
    6855
    Quote Originally Posted by ESjaavik
    If CNCadmin OK's it, I'll post a link for those that understand German.
    That's fine with me.

  8. #48
    Registered
    Join Date
    Feb 2005
    Posts
    11
    Hi
    There seems to be somthing missing from this cirut. Where is the 4 X Zenadiodes hooked up to??(left of 4 X U3)?
    regards
    Zekk_2

  9. #49
    Registered
    Join Date
    Feb 2005
    Posts
    1
    Hi
    I am shahid from saudi arabia and working on linear motion can u please send me the source code will talk with u later my email is ele@son.com.sa or sny2ksa@yahoo.com

  10. #50
    Registered
    Join Date
    May 2003
    Posts
    4
    Quote Originally Posted by Hardwarekill
    @ESjaavik

    The Quellcode or the Hex File ist NOT availble, unfortunately.
    Only the programmed Atmel Controller (20Euro) and the Crcuit ( Free whis including the Atmel) or/and the PCB ( 8,xx Euro) iss avaible.
    I have written the Auhor a Email, the answer is, NO i will not give the Hex or Quellcode for Open Source
    Many german People work whis this Servocircuit, an ALL People have no problems whis this, works great
    Look here 2 Videos of an CNC the first whis Stepper an than same CNC whis Servodrive whis this circuit.
    http://www.jocomomola.de/downloads/downloads.html

    Apology for my bad Enlish, I im a german.
    Hi do you know where I can order this board/AVR? I looked at the link but did not see any sign for purchase.

  11. #51
    Registered
    Join Date
    Feb 2005
    Posts
    5
    If it is usefull, here you can find a servo controler that a design a build few years ago for telescope control (2 axis) (full avr code and schematic),

    http://www.saand.es/joseyana/minidrive.htm

    It works with avr128, hardware encoder reader (LS7266), and a L298,

    Regards

  12. #52
    Registered
    Join Date
    Feb 2005
    Posts
    11
    Quote Originally Posted by ESjaavik
    Greg: Yes, it's quite common that servo drives take step/dir input. All I have does that. Internally it counts the desired-position value up/down based on step/dir. This means the drive must do the torque, velocity and position loops computations internally. With a voltage input drive often doing just the first or the two first.

    And the step/dir servo can take pulses at high speeds. If the motor is not able to follow, it will not loose the end position. It will just loose position on parts of it's journey there. Not like a real stepper where a lost step will never be regained. (Unless by chance it looses the same number of steps going in the other direction.)

    Here is a simple approach to the main components, except step/dir input: http://elm-chan.org/works/smc/report_e.html
    Hi Einar
    Ref. your link to :Here is a simple approach to the main components, except step/dir input: http://elm-chan.org/works/smc/report_e.html

    Can you download the software that is posted on http://elm-chan.org/works/smc/report_e.html via the serial I/F on the schematic, or do you need a separat burner to download the software??
    Regards
    Zekk_2

  13. #53
    Registered
    Join Date
    Jul 2003
    Posts
    45
    Quote Originally Posted by lerman

    One neat way (for me, at least -- I'm a programmer) to handle the problem might be to dedicate a chip to read the encoder and also read the commands from the host (PC). By writing the code in assembly language, I believe I could handle 3600 rpm with a 2000 transition per rev. encoder.
    Some interesting ideas on this thread!! I agree with Lerman that a dedicated chip to read encoder position is much more reliable than polling (You must be absolutely certain that every pulse is counted ). The 7266R chip mentioned by Vider will track encoders in quadrature mode at 17MHz and they have two 24bit counters with latched outputs, so data can be safely read without interrupting the count.
    I use 2 of these on a board with a quad 12bit DAC as a 4 axis servo control.
    mike potter

  14. #54
    Registered
    Join Date
    Jul 2003
    Posts
    45

    Question

    I appreciate that this thread is for PIC and AVR developers and I confess that I have not used this method for my servo application, but the theory is still relevant and I am interested in the different driver designs and methods of achieving the servo loop.

    I understand the reasons and advantages of designing a closed loop system but shouldn’t the controller be closed loop and not just the driver.

    There seems to be a common trend here to use step/direction signals as the input commands for the driver.

    1:- Are these signals coming from a closed or open loop source? If the source is open loop how will the input be controlled?

    2:- Are the signals generated in real time as these will need to be synchronised to the servo time base to achieve accurate feed rates.
    mike potter

  15. #55
    Registered
    Join Date
    May 2005
    Posts
    1397
    1. The source of the step and direction signals is usually a program on a PC or other controller. For example, turbocnc.com runs on old PC's and generates step and direction signals from the parallel port. With a stepper motor, this is entirely open loop. The point of using stepper motors is that open loop control can (with luck) work accuratly. If you use a servo motor with step and direction inputs, then you are simulating a stepper with the servo. In this case, only the controller needs to be closed loop because the servo isn't able to maintain position by itself the way a stepper motor can (usually).

    2. The software can be set to generate the step signals slowly enough that the steppers do not loose position. There is an upper limit on the step rate and so the feed rate, but that depends on a lot of factors so it must be experimented with on the actual machine.

    Does that help?

    See
    http://www.piclist.com/io/stepper/linistep for an open source, PIC based, linear stepper controller.

  16. #56
    Registered
    Join Date
    Jul 2003
    Posts
    45
    Thanks James. I think you have provided the answers I expected.

    To sum up:-

    The source or the step/dir signals i.e THE CONTROLLER is a pc based program similar to Turbocnc,Mach2,etc and these are open loop, but if you use a servo motor with step/dir inputs the CONTROLLER needs to be closed loop. This was my point, so which CONTROLLERS provide closed loop step/dir signals.

    Stepper motors can – if you’re lucky—work accurately and the feed rates are experimental!! This all seems a bit hit and miss. By contrast Servo motors are accurate, fast, and more powerful so why design a servo driver that will simulate a stepper motor???
    mike potter

  17. #57
    Registered
    Join Date
    May 2005
    Posts
    1397
    "Why design a servo driver that will simulate a stepper motor??"

    How else will you hook your servo up to a system that is expecting a stepper?

    There are many times when a better way of doing things is bypassed in favor of complying with a standard.

    I sponsored the design of a stepper controller that used serial communications with the host and accepted "goto x,y,z" commands rather than step and direction. The controller then produced the stepper waveforms directly using a ramp for speed which results in much faster travel than you can get, reliably, from a windows or other non-deterministic OS. You can see it at
    http://www.quickstepper.com Why isn't it selling like hotcakes? I can't seem to get anyone interested. It may be for other reasons, but as far as I can see, it's just too different, and I guess scary, for people to be willing to try it.

    So I do the old Linistepper and that sells just fine. Even though it is open source!
    http://www.piclist.com/io/stepper/linistep

  18. #58
    Its the old "chicken or egg" thing. I have a very nice little circuit that uses a single wire for step and direction. I have a test drive (a modified G201) that runs very nicely using this interface with no technical drawbacks.

    It has every advantage over the standard step / direction interface; only a single channel opto is needed, uses fewer components, easier to hook-up, more reliable, frees-up valuable PC port bits, etc, etc. I will never try to promote it, it is for my amusement only.

    Why? Established interface standards. A drive mfg. would starve trying to sell them because there would be no CNC programs to drive it. CNC developers would never write an interface for it because there are no drives to use it with. Chicken or egg.

    How does it work? Simple. A step pulse narrower than 2 uS is decoded as a CW step, a step pulse wider than 2 uS is decoded as a CCW step. Very simple to encode and decode at both ends.

    I respect standards because they keep chaos at bay; drives and CNC programs speak a common 'language'. The downside of standards is their rigidity and ubiquity; it is very hard to introduce a new one unless the advantage is overwhelming. All in all it's not a bad thing.

    Mariss

  19. #59
    James:
    What does the Quickstepper allow one to do that a conventional setup doesn't?

  20. #60
    Registered
    Join Date
    Feb 2005
    Posts
    5
    Dear friends:

    As I see there are two ways to do cnc with a servo + 1 (chickend or egg):

    Stepper simulation: (As I will do in the next days)
    one 8 bit counter driver by step/direction, and the servo-drive always following this counter, the simples way, one "red led" will alert if the counter owerflow or underflow (this is a signal that you are overdriving your servo). On most cnc programs like turbo cnc you will find "timers" to wait when the direction changes... better its if this program it is modified to wait a signal of the axis to say "ok",

    Goto:
    move comand like move x,y,z,a on the serial port is the better way (in my opinion), can be easy stacked on the micro, just butter if it include the rate of every axis, and the accel ramps, but must cnc programs i use does not do this (or i dont known how),

    Regards

Page 3 of 5 12345

Similar Threads

  1. Open Source Driver electronics
    By pminmo in forum DIY CNC Router Table Machines
    Replies: 1
    Last Post: 11-22-2009, 09:42 PM
  2. Any ideas for open source CAM package?
    By galacticroot in forum OpenSource Software
    Replies: 26
    Last Post: 10-22-2007, 05:35 PM
  3. Open Source CNC Controller Specification
    By gregmary in forum DIY CNC Router Table Machines
    Replies: 28
    Last Post: 12-05-2005, 04:58 AM
  4. 2nd Generation DeskCNC servo driver released
    By imserv in forum News Announcements
    Replies: 0
    Last Post: 11-25-2004, 01:22 AM
  5. Open source driver designs
    By pminmo in forum General CNC Machine Related Electronics
    Replies: 0
    Last Post: 05-05-2004, 03:29 PM

Posting Permissions

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