EMC2 and a rotary encoder


Page 1 of 2 12 LastLast
Results 1 to 12 of 20

Thread: EMC2 and a rotary encoder

  1. #1
    Registered
    Join Date
    Jun 2005
    Location
    Indianapolis, IN, USA
    Posts
    91
    Downloads
    0
    Uploads
    0

    Default EMC2 and a rotary encoder

    I am building a CNC tube bender as a senior project for my BS in MET. I am using EMC2 on Ubuntu 8.04. I am using a breakout and relay board to control a 120V Vickers directional control valve. I have a 500 PPR rotary encoder. It is my wish to use the rotary encoder to track die position (0-100ish degrees). I hooked the required ports (A,B,Ground and +Vdc) to the breakout board. I would like to have a small DRO on the screen that tells me angular position in degrees. I have searched online but found nothing. I have sent EMC2 to look for pins 12 and 13 as spindle position A and spindle position B. Pins 1 and 14 are outputs that are set as Spindle CC and Spindle CCW. I have absolutely no clue what to do next. Please guide me as I am a new user to EMC2. Check out my build here if you are interested:

    http://cnczone.com/forums/showthread...796#post531796

    Similar Threads:


  2. #2
    Registered
    Join Date
    Nov 2006
    Location
    Germany
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default

    Hi!
    You may take a look at Parallel-port Two-axis PWM servo controller for Etch CNC
    It uses two simple DC-Servo connected to a PWM bridge and encoders. All connected directly to the parallel port.
    You did not write anything about home or reference switches (and limit switches...)? Hope your design has one (at least).
    Without any real knowledge about tube benders (except they bend tubes...) i would mount a reference or home switch at a (slightly) negative angle (-5°) to leave some space when inserting the tubes...

    EDIT: The config files are there, too. So you can have a look at them.

    Jürgen

    Last edited by juergen; 11-27-2008 at 06:38 PM.


  3. #3
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    23053
    Downloads
    0
    Uploads
    0

    Default

    AFAIK EMC like Mach does not input an encoder into the parallel port, you might look at wether EMC does interface a Manul Pulse Hand Wheel, this is typically a 100p/turn encoder for manual motion and adapt this routine.
    EMC also has the option of add-on cards for servo operation.
    Otherwise you would have to use the A & B pulses and write an algorithm that detects one pulse as counts and the other for direction. You may run into a timing issue, depending on how fast the parallel port was read and the encoder speed.
    You may not necessarily need home or limit switches as the hydraulics could simply bottom out on a stop.
    For home registration, you could just bottom to a stop, and when motion was zero for so many seconds, make this zero reference.
    Al.

    CNC, Mechatronics Integration and Custom Machine Design

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


  4. #4
    Registered
    Join Date
    Sep 2004
    Location
    USA
    Posts
    149
    Downloads
    0
    Uploads
    0

    Default

    These links might help, they are related to using encoders with parallel ports in emc2:

    http://wiki.linuxcnc.org/cgi-bin/emc..._A_MPG_Pendant

    http://emergent.unpythonic.net/projects/01142347802

    http://wiki.linuxcnc.org/cgi-bin/emc..._With_Encoders

    http://www.members.shaw.ca/swstuff/spindle-encoder.html

    So I guess it can be done, in any number of ways. I haven't done it myself yet, but I want to try it too.


    Thanks,
    Dan



  5. #5
    Registered
    Join Date
    Jun 2005
    Location
    Indianapolis, IN, USA
    Posts
    91
    Downloads
    0
    Uploads
    0

    Default

    The first link with the MPG writeup seems like it will work well. I am going to try it when I get home. If I manage to get the rotary encoder hooked up, will EMC2 display a DRO displaying angular position in degrees?



  6. #6
    Gold Member acondit's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1778
    Downloads
    0
    Uploads
    0

    Default

    I built a rotary encoder for the spindle of my lathe and I am using the parallel port to read its inputs. I am only using the index and 100 count features, I never got the B channel hooked up and working. I am attaching the portion of my ".hal" file that has to do with the spindle encoder.

    Here is a link to my thread. The encoder starts at message 48 and continues (off and on) to message 85.

    Alan

    Attached Files Attached Files


  7. #7
    Registered
    Join Date
    Jun 2005
    Location
    Indianapolis, IN, USA
    Posts
    91
    Downloads
    0
    Uploads
    0

    Default

    Wow, thanks for your help Alan. I probably don't need the B channel either. My rotary encoder will never rotate more than 100 degrees because my tube bender can't move past 102ish degrees. My encoder is 500PPR, so it will only ever send out 130 pulses over 15 seconds, leading to 9 pulses per second (very minimal). Your file opens in Notepad as a paragraph; everything is smashed together. Hopefully Linux will open it differently.



  8. #8
    Gold Member acondit's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1778
    Downloads
    0
    Uploads
    0

    Default

    Linux uses LF (linefeeds) to denote the end of a line but windows/dos expects a CR/LF pair.

    Alan



  9. #9
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    23053
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by supahonkey View Post
    Wow, thanks for your help Alan. I probably don't need the B channel either. My rotary encoder will never rotate more than 100 degrees because my tube bender can't move past 102ish degrees.
    How will you indicate a bi-directional count with one channel, or do you intend to set it up un-directional count?
    Al.

    CNC, Mechatronics Integration and Custom Machine Design

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


  10. #10
    Gold Member acondit's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1778
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by Al_The_Man View Post
    How will you indicate a bi-directional count with one channel, or do you intend to set it up un-directional count?
    Al.
    Al,

    If he never rotates more than 100° he should be able to just use a direction signal and count. He might even be able to use the index to set up home.

    Alan



  11. #11
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    23053
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by acondit View Post
    Al,

    If he never rotates more than 100° he should be able to just use a direction signal and count. He might even be able to use the index to set up home.

    Alan
    I have not used EMC, but am not sure I see how he would get a count and a direction from just the A channel?
    The general premise for an encoder is one channel is the count and the other the direction pulse, no?
    Al.

    CNC, Mechatronics Integration and Custom Machine Design

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


  12. #12
    Gold Member acondit's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1778
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by supahonkey View Post
    Wow, thanks for your help Alan. I probably don't need the B channel either. My rotary encoder will never rotate more than 100 degrees because my tube bender can't move past 102ish degrees. My encoder is 500PPR, so it will only ever send out 130 pulses over 15 seconds, leading to 9 pulses per second (very minimal). Your file opens in Notepad as a paragraph; everything is smashed together. Hopefully Linux will open it differently.
    The only reason I never hooked up the B channel was because I couldn't seem to get the third optical switch positioned correctly. In the hal file I posted you should only need to change a couple things to hook up your B channel which would then give you (2000 cpr / (100/360))=555.56 counts for 100° or 555 counts for 99.9°.

    Alan



Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

EMC2 and a rotary encoder

EMC2 and a rotary encoder