512,476 active members
1,220 visitors online
Register for free
Login
IndustryArena Forum > OpenSource CNC Design Center > Open Source Controller Boards > PIC Open source Servo Driver Schematics development?
Page 2 of 5 1234
Results 21 to 40 of 91
  1. #21
    Registered
    Join Date
    Apr 2004
    Posts
    169
    You will need to place a limit on how big the intergral term can get other wise it can build up and swap the others. I didn't use interupts for the encoder - just polled it at 40 kHz and read them all at once. The problem I saw was if the encoder was sitting right on the edge of a transition you could get a continous stream of encoder interrupts and not get any time to do anything else.To keep the speed up i kept a 8 bit count for the step/dir interrupt and encoder polling and then transfered them to a 32 bit counter periodically before they could overflow.

    Are you writing the whole thing in assembler or just the interrupts? After looking at the C generated code I decided that I couldn't really save much by using asm.
    The encoder polling routine was 103 instructions (for all 3 encoders) and the step/dir 23 instructions, assuming 2 clocks per instruction the total, for 3 step interrupts and a encoder poll is about 11uS with a 16 MHz clock. At 40 kHz which is as fast as most driving software will go 44% of the processor time is being used so there is a bit to spare.

  2. #22
    Registered
    Join Date
    Apr 2004
    Posts
    718
    tachus42,

    I'm a little bit confused on your 40Khz encoder update. I have some 500 line encoders, with 4x quadrature, that is 2000counts/per rev. I calculate a maximum rpm of about 1200. Have you done some testing to see what the real world max rpm is without any miss counts? There seems to be a much greater chance of missing counts when polled vs. interrupts.

    I quickly looked over your code but since it isn't commented, I couldn't easily tell if you are doing 1x or 4x quadrature decoding.

    Jim

  3. #23
    Registered
    Join Date
    Apr 2004
    Posts
    169
    I took the encoder polling rate from the expected max step rate because in practice you can't really have the motor running any faster than this (well unless you multiply the steps with the micro). The motors i'm using have 200 line encoders which gives 3000 rpm with quadrature decoding.
    The encoder polling rate should probably be a little higher than this to allow for lines which aren't 50% wide, but thats just a small amount of tuning when i finally get everything together.
    The polling is started by a timer interrupt so it allways happens on time. I did consider reading the encoder on a pin change interrupt but was put off by the transistion problem and figured 1 interrupt would be faster than 6 considering that they would share a interrupt you would have the overhead of testing them all anyway to see which one had changed. If you are not using quadrature decoding the transition problem ( which might not exist, just being carefull ) isn't a problem of course.

    I didn't see any problem with missed counts with mach 2 at its max step rate.

  4. #24
    Registered
    Join Date
    Jun 2003
    Posts
    125
    We are writing the entire program in C because assembler would drive us crazy before we ever got anywhere. I'm still not sure about the problem with the motor sitting on an encoder, haven't really thought about it much. Right now we are running just one motor per MCU because I have 2500 count encoders and I think it might be too much for the AVR at 6000rpm. I am also going to add a step multiplier so the board can be used with PC driven software like Mach2 CNC. We also might provide an option to run the encoder in 2x or 4x mode by poling just one encoder signal state change for 2x or both for 4x. This would give the user some more to play with. When we get this board finalized we're probably going to sell them for a reasonable price with more features than the competition. But this will only be a +-10V PWM drive, so you will need an appropriate amplifier to drive a motor. In the future we might design the motor drive portion also, but right now this is enough work .

    David B.

    www4.ncsu.edu/~dsbloomf

  5. #25
    Registered
    Join Date
    Apr 2004
    Posts
    169
    Im not sure the motor sitting on a encoder transistion is a problem either. If you use a schmitt trigger on the input it should be ok but I thought i would just avoid the possibility.
    500 line encoders and 6000 rpm seems a bit tricky it only gives you 80 clock cycles to get everything done. You might need to use a external counter.

  6. #26
    Registered
    Join Date
    Jun 2003
    Posts
    125
    I think you're right about cutting it close. Wouldn't give the chip much time to do anything but read encoder pulses. It might be cheaper to set up a tinyAVR as the "counter". This code could be very very short and I'm sure it wouldn't have trouble keeping up. And at $3 each, it's not a bad deal. Still need to check the prices of counter chips, they would save us the time of not having to program another AVR per board.

    David B.

  7. #27
    Banned
    Join Date
    Apr 2004
    Posts
    678
    Quote Originally Posted by tachus42
    Im not sure the motor sitting on a encoder transistion is a problem either. If you use a schmitt trigger on the input it should be ok but I thought i would just avoid the possibility.
    500 line encoders and 6000 rpm seems a bit tricky it only gives you 80 clock cycles to get everything done. You might need to use a external counter.
    A schmitt trigger alone will not help you at all. It's probably already there, inside the encoder if you use a commercial one.

    What you need is a low pass filter followed by a schmitt-t.

    Why do you need 6KRPM!? Motors with that high speed don't have much torque so I suggest you use motors with max 3KRPM, even 1500 is fine. A motor of the same power (and appx size) at 1500RPM will have 4 times the torque as the motor delivering the same power at 6KRPM. You're still beating the steppers by a mile.

  8. #28
    Registered
    Join Date
    Aug 2004
    Posts
    170
    Amazing! I hope you be heare in the future, maybe on my 4rth CNC !!!!!

    Thanks fou your ressearch and sorry about my english.

    Ito-BRAZIL

  9. #29
    Registered
    Join Date
    Jun 2003
    Posts
    125
    Ito, whom where your comments directed too? ESjaavik, I don't really need the motors to move that fast, but I really want a huge overhead in encoder speed to cover every application. I now have my motors setup and should be able to test encoder rates shortly.

    David B.

  10. #30
    Registered
    Join Date
    Sep 2004
    Posts
    40
    Just thought everyone would like to know the link ESjaavik posted www.elm-chan.org/works/smc/report_e.html was recently updated by adding the step and direction inputs.

  11. #31
    Banned
    Join Date
    Apr 2004
    Posts
    678
    Re: Encoder sitting undecisively on a transitition.

    This will only happen when the motor is at standstill. So why not apply some "furry logic": If the speed is Very Slow, then switch from interrupt driven to polling. It is physically impossible for the motor to accelerate too fast for the program to change strategy. Especially since it "knows" it is going to accelerate.

  12. #32
    Banned
    Join Date
    Apr 2004
    Posts
    678
    @DragnsBane: That link just sends you to a Domain Pusher.
    Here is the correct address: http://elm-chan.org/works/smc/report_e.html

    Hint: Use cut-and-paste from the address line of the browser.

  13. #33
    Registered
    Join Date
    Sep 2004
    Posts
    40
    sorry about that sometimes mt typing skills leave something to be desired.

    so theoretically, these could be attached to a BOB and you would have a servo control. would the upgrade to a 32 bit chip actually be necessary since it is running of a computer? If so , what would be a good chip to start with?. I think this area warrants further R&D. Someone here who is much smarter than I am will hopefully look into this.

  14. #34
    Community Moderator
    Join Date
    Mar 2003
    Posts
    6855
    Quote Originally Posted by ESjaavik
    Re: Encoder sitting undecisively on a transitition.

    "furry logic":
    Is that "fuzzy logic"?

  15. #35
    Registered
    Join Date
    Aug 2003
    Posts
    143
    I,m very impressed by this project. Nice job guys!!

    Tachus:

    Can you point me where I can find the instruction set for the AVR you are using. I do all my work with PIC microcontrollers (In Assembly) and am not familliar with the Atmel products. I guess this is as good a time as any to learn!


    P.S. I've suffered from a lot of "Fuzzy Logic" in the past, usually it allways ended up getting me in trouble or getting my name in the newspaper.
    Patrick;
    The Sober Pollock

  16. #36
    Registered
    Join Date
    Apr 2004
    Posts
    169
    Patrick avrfreaks.net is a good place to start. The code is intended for avr - gcc, look for the winavr package.

  17. #37
    Registered
    Join Date
    May 2004
    Posts
    13
    Recently DragnsBane asked if the servo controller design at http://elm-chan.org/works/smc/report_e.html could be used with the simple BOB. I was wondering if anyone had considered it, since it now supports STEP and DIR? I beleive that should make it compatible with TurboCNC. Assuming all the parts could be obtained, would it be worth while making a board in Eagle? Is anyone interested?

  18. #38
    Banned
    Join Date
    Apr 2004
    Posts
    678
    @Paul: Actually I'm not sure what the definition of "Fuzzy Logic" is. That's why I did'nt use "Fuzzy". But what I'm suggesting is that when one specific condidtion (low speed) is met, the strategy is completely changed from that normally used.

    @Patric: There is only one place: www.AVRfreaks.com. There you have the device data, forums, downloads, tools, just everything AVR.

    @heyarnold: ELM's servo board is really just a concept test, but as such it is good. I would not use it in a real mill/router though. I'll try to be specific later.

  19. #39
    Registered
    Join Date
    May 2004
    Posts
    13

    Elm Smc

    Thanks ESjaavik for your reply,

    I'm not experienced with AVR and servos, so any additional comment would be welcome. For now my guess is that the cost and power of the 2313 avr makes it unfeasible.

  20. #40
    Banned
    Join Date
    Apr 2004
    Posts
    678
    What about the cost? Too high or too low?
    The chip has 2K program memory and 128byte RAM + registers. It runs at 10MHz and one instuction / cycle, which is quite fast. Choose one with more RAM and Flash, then go to a cheaper device if it turns out that will fill the requirements.

    I should make my position clearer on ELM's solution. There is nothing wrong with it that I have seen. In fact I think it is a very good platform to start work at. Several things can be studied and learned from using it. But there are features missing that will make it a sophisicated transistor toaster if hanging inertia (mill table, gantry ...) on the motor. So not good for running a real machine.

    It should have a way to deal with energy fed back from the motor when braking / changing direction. Then the motor will run as a generator and the DC bus voltage will rise. If there is enough headroom, fine. If not: POOF!. So this must be added. Not a big problem, the solution is very cheap. Measure the DCbus voltage and stop regenerating when it gets too high.

    And there are more things that should be improved to come closer to a hook up and run system that can be used by someone not knowing much about what goes on inside it. I've followed a project on a German CNC board where one guy made one very similar to ELM and offering it on the board. Many have problems with it. And the reason may well be that the motors and the tasks they are asked to do are outside what this guy had envisioned.
    There also seems to be much smoke made from incorrect sequencing of power.

    So I suggest we benefit from their experiences, and discuss what can be improved without sending the cost through the roof. If CNCadmin OK's it, I'll post a link for those that understand German.

    The ATmega162 looks like a good choice. It has enough RAM and Flash, and is even faster at 16MHz. What's the status on this? The webpage link above does not work.

    Did anyone have a problem with the encoder "riding a flank" or was this mentioned out of fear it might happen?

Page 2 of 5 1234

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
  •