Hacking a Keyboard for EMC2 / Axis Control


Results 1 to 17 of 17

Thread: Hacking a Keyboard for EMC2 / Axis Control

  1. #1
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default Hacking a Keyboard for EMC2 / Axis Control

    I'm in the early stages of dsigning and acquiring parts for a CNC router. I'm a linux user and have succesfully installed EMC2 and have made motors move!

    Now my thoughts have turned to a button console for easy control of EMC2 to suppliment the keyboard. I have seen examples where people have wired buttons via a Parallel port interface and created nets to connect to HAL inputs.

    Surfing the net I came across some MAME encoders (was looking for optical encoders on ebay) which are used for home arcade consoles. These are a neat solution for the gamers as they have the two player keys mapped with easy connections for buttons. But not really suitable for EMC2.

    So why not hack a keyboard to get the encoder, they are cheap ~$10 for a USB keyboard, and with a little time and effort should do the trick.

    Similar Threads:
    Attached Thumbnails Attached Thumbnails Hacking a Keyboard for EMC2 / Axis Control-emc2-keyboard-hack-01-jpg   Hacking a Keyboard for EMC2 / Axis Control-emc2-keyboard-hack-03-jpg   Hacking a Keyboard for EMC2 / Axis Control-emc2-keyboard-hack-06-jpg   Hacking a Keyboard for EMC2 / Axis Control-emc2-keyboard-hack-07-jpg  



  2. #2
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    By using a keyboard encoder we have USB connectivity for the console and we don't tie up a parallel port.

    Most people seem to trace out the buttons on the membranes to work out pin assignments. This is a real pain so I soldered on some ribbon cable and and idc plug so that the pin assignment could be aquired. A simple keyboard checking application is all that is needed. Plug the hacked encoder in and pin out the connection.

    Attached Thumbnails Attached Thumbnails Hacking a Keyboard for EMC2 / Axis Control-emc2-keyboard-hack-14-jpg   Hacking a Keyboard for EMC2 / Axis Control-emc2-keyboard-hack-10-jpg   Hacking a Keyboard for EMC2 / Axis Control-emc2-keyboard-hack-13-jpg  


  3. #3
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    Next step will be to wire up push buttons, now does anyone have a complete list of Axis keyboard commands??

    I can't locate and Axis docs (google EMC2 Axis and there are hundreds of hits)...

    Any help appreciated.



  4. #4
    Community Moderator
    Join Date
    Mar 2004
    Location
    Sweden
    Posts
    1661
    Downloads
    0
    Uploads
    0

    Default

    Yes, why not? Would be really easy to find out the connections for the most important buttons, and with Halui you can map a bunch of new keys to get jogging and that kind of stuff.
    I bought a gamepad and have made everything from that. With some tricks I now have jogging for XYZ in three different speeds, must hold down a speed to make the pad safer. I also have stepping functionality and a uge cancel button. Best of all, I still have buttons left.
    Now when it's working, I will make a better looking box in alu and sneek some buttons from my neighbour workshop, he's renovating archade games and those buttons are very nice.

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

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

    Goto to the wiki and search for "joypad" and you'll get more reading.



  5. #5
    Community Moderator
    Join Date
    Mar 2004
    Location
    Sweden
    Posts
    1661
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by scotta View Post
    Next step will be to wire up push buttons, now does anyone have a complete list of Axis keyboard commands??

    I can't locate and Axis docs (google EMC2 Axis and there are hundreds of hits)...

    Any help appreciated.
    I think you have to go trough the menues. But as I wrote, with halui you can map almost anything.



  6. #6
    Member
    Join Date
    Jun 2007
    Location
    SW Wis USA
    Posts
    61
    Downloads
    0
    Uploads
    0

    Default

    At the top right of the screen is the Help drop down, click that and then click Quick Reference. Or ALT H then ALT R if you like using the keys. Ed.



  7. #7
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    Thanks for the pointer atex.

    The simplest way will be to wire directly the keys required, but Linux has a niftly utilty called xmodmap which allows the user to remap keys. This would allow any input to be used and then remapped to the appropriate AXIS shortcut key.

    Contemplating using a arcade style microswitch joystick as a multi axis jog input rather than an encoder MPG, the trick would be to add a third axis (Z) rotational axis to the joystick for full 3 axis control. By adding a NO "enable" switch in series with the axis jog switches will stop accidental jogging and be a kind of a dead man switch.

    Just need to figure out if this can be achieved with two keyboards connected, the standard keyboard and the control console / pendant, with the keymappings only being applied to the second keyboard.

    Looks like more googling required...

    Scott

    Last edited by scotta; 10-15-2009 at 04:54 AM.


  8. #8
    Community Moderator
    Join Date
    Mar 2004
    Location
    Sweden
    Posts
    1661
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by scotta View Post
    Thanks for the pointer atex.

    The simplest way will be to wire directly the keys required, but Linux has a niftly utilty called xmodmap which allows the user to remap keys. This would allow any input to be used and then remapped to the appropriate AXIS shortcut key.

    Contemplating using a arcade style microswitch joystick as a multi axis jog input rather than an encoder MPG, the trick would be to add a third axis (Z) rotational axis to the joystick for full 3 axis control. By adding a NO "enable" switch in series with the axis jog switches will stop accidental jogging and be a kind of a dead man switch.

    Just need to figure out if this can be achieved with two keyboards connected, the standard keyboard and the control console / pendant, with the keymappings only being applied to the second keyboard.

    Looks like more googling required...

    Scott
    It's nice that you try it all out, but you don't have to do any mapping with xmodmap. As I wrote, you can map almost anything with Halui inside EMC2, both software buttons and hardware dito's.
    I don't understand what you mean about the gamepad, I use the gamepad with the safety button functionality. I jog Z with a pair of buttons. If you buy a gamepad with an analog joystick (mine is simple and hardwirded to eiter 0 or 255) you have seamless feed as well. Push harder, higher speed. And if you buy the two joystick version you have a joystick for Z as well.



  9. #9
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    I spent several years working for ABB Flexible Automation as an Applications Engineer, I suppose I'm use to Robot teach pendants which have a dead man switch that must be pressed and held while manually jogging the robot. It's not much fun accidentally moving a robot with a $$$ tooling hanging off the end.

    My thought was to build a similar, but simpler, sytle of pendant for manual control of the router I'm in the midst of designing.

    Is HALui capable of maping a second keyboard without confusing keycode coming from the main / standard keyboard? You would have to somehow assign the connected device ID??

    Scott



  10. #10
    Member dertsap's Avatar
    Join Date
    Oct 2005
    Location
    canada
    Posts
    4230
    Downloads
    1
    Uploads
    0

    Default

    Quote Originally Posted by scotta View Post
    Is HALui capable of maping a second keyboard without confusing keycode coming from the main / standard keyboard? You would have to somehow assign the connected device ID??

    Scott
    I'm not sure if emc will get confused with two keyboards or not (probably not ) but I haven't had any trouble with my setup . I've been working off and on for a couple of years now on a keyboard hack control panel to work with mach , what i did to make it simple was to use a DIN-5 keyboard connection as well as have the other keyboard thru the usb , it works quite well and I hadn't found any issues yet ,
    something that you may find handy is to find a keystroke display , one that will display what each key is , i tried to find an old download link to a good one for you but the link is now dead , if you can't find one then pm me or something and i will see if i can dig up the one that i downloaded , I'm sure I've got it here somewhere

    A poet knows no boundary yet he is bound to the boundaries of ones own mind !! ........


  11. #11
    Community Moderator
    Join Date
    Mar 2004
    Location
    Sweden
    Posts
    1661
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by scotta View Post
    I spent several years working for ABB Flexible Automation as an Applications Engineer, I suppose I'm use to Robot teach pendants which have a dead man switch that must be pressed and held while manually jogging the robot. It's not much fun accidentally moving a robot with a $$$ tooling hanging off the end.

    My thought was to build a similar, but simpler, sytle of pendant for manual control of the router I'm in the midst of designing.

    Is HALui capable of maping a second keyboard without confusing keycode coming from the main / standard keyboard? You would have to somehow assign the connected device ID??

    Scott

    As I wrote, I do have the dead man button. If you get a unique HW id from the keyboard then yes, halui would differ the keyboards.
    You didn't read the links I posted, did you?
    http://wiki.linuxcnc.org/cgi-bin/emc...Remote_Pendant



  12. #12
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    Sorry, had a look back over the links you posted. Now I have some questions after trying to get the second keyboard connected with hal_input.

    Firstly when using a name specifier for the hal_input I kept getting a no device with name error, when using an eventN as the specifier and I would get a permission denied error.

    Ok, created a 51-plugdev.rules file in etc/dev/udev.rules with SUBSYSTEM=="input", mode="0660", group="plugdev"

    Rebooted and checked the permissions on the /dev/input/.. and the group was still root.

    I then checked to see if I actually had a group called plugdev, I didn't so a created one.

    Rebooted again, still no luck???

    Should I have had a plugdev group by default? My emc2 installation was via the live CD.

    If I can get this to work then using hal_input will be the most flexible way of creating the console.

    Scott



  13. #13
    Community Moderator
    Join Date
    Mar 2004
    Location
    Sweden
    Posts
    1661
    Downloads
    0
    Uploads
    0

    Default

    You don't have to reboot to get the umask working for the device, you only need to take unplug it an replug it. There are only a very few things that needs a reboot in Linux.
    The subsystem rule you've created has nothing to do with your keyboard. You're creating a rule for - gamepads!
    The wiki article I linked is for gamepads, you are using a keyboard. I suspect you don't need a rule for the keyboad but check the other rules in the folder if there's something you can copy. I'm at the moment not close to my Linux machines so I can't check it up for you.

    EDIT: And no, you don't need the plugdev parts if you don't have plug devices. They will be created automagically if you plug one in.



  14. #14
    Community Moderator
    Join Date
    Mar 2004
    Location
    Sweden
    Posts
    1661
    Downloads
    0
    Uploads
    0

    Default

    Scotta, here's a copy-paste from the mailing list. There's some interesting reading.

    There's a new version of hidcomp available from here
    http://hidcomp.sourceforge.net This adds a Socket interface so updates can
    be made to the LCD from an external program (like a hal user space python
    component).

    Also released is an update of GenericHID
    (http://generichid.sourceforge.net/). This is my drag and drop USB HID
    device maker. Use it to build your own USB pendants.

    I used GenericHID to build my CNC Lathe Pendant
    (http://www.franksworkshop.com.au/CNC...thePendant.htm). I
    went overboard and added a hi-res LCD and menu, driven by a python user
    space component.

    Now I just need to get my lathe running.

    Enjoy.
    Frank




  15. #15
    Registered
    Join Date
    Oct 2005
    Location
    Australia
    Posts
    81
    Downloads
    0
    Uploads
    0

    Default

    Very interesting reading and very impressive. I'd never be able to go something so professional looking. I know a little electronics, enough to be dangerous I guess...

    I haven't given up on the keyboard hack just yet, just been a little side tracked as my new spindle vfd arrived (first one went bang) and it has a "modbus" connection. Trying to get comms working and then I'll be diving into classic ladder. So much to learn, so little time.

    Scott



  16. #16
    Registered
    Join Date
    Dec 2008
    Location
    NZ
    Posts
    3
    Downloads
    0
    Uploads
    0

    Default

    Hey there Frank, very impressive. An idea to bait you with... How about robbing a wireless USB module from a Rumblepad or something to make your very nice pendant independent?



  17. #17
    Registered
    Join Date
    Apr 2010
    Location
    USA
    Posts
    486
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by cncnoel View Post
    Hey there Frank, very impressive. An idea to bait you with... How about robbing a wireless USB module from a Rumblepad or something to make your very nice pendant independent?
    In my mind, this is not a good idea. On my Sherline mill I've found that my wireless mouse doesn't work well with the spindle turning, forcing me to go to keyboard control only.

    This condition seems to vary from day to day.

    And, as usual, YMMV.

    Tom



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

Hacking a Keyboard for EMC2 / Axis Control

Hacking a Keyboard for EMC2 / Axis Control