CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > LinuxCNC (formerly EMC2)


LinuxCNC (formerly EMC2) Discuss LinuxCNC (formerly EMC2) Controlers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 10-13-2009, 03:59 AM
 
Join Date: Oct 2005
Location: Australia
Posts: 80
scotta is on a distinguished road
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.
Attached Thumbnails
Click image for larger version

Name:	EMC2 Keyboard Hack 01.jpg‎
Views:	120
Size:	108.5 KB
ID:	91011   Click image for larger version

Name:	EMC2 Keyboard Hack 03.jpg‎
Views:	123
Size:	119.7 KB
ID:	91012   Click image for larger version

Name:	EMC2 Keyboard Hack 06.jpg‎
Views:	139
Size:	119.7 KB
ID:	91013   Click image for larger version

Name:	EMC2 Keyboard Hack 07.jpg‎
Views:	184
Size:	119.8 KB
ID:	91014  

Reply With Quote

  #2   Ban this user!
Old 10-13-2009, 04:10 AM
 
Join Date: Oct 2005
Location: Australia
Posts: 80
scotta is on a distinguished road

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
Click image for larger version

Name:	EMC2 Keyboard Hack 14.jpg‎
Views:	200
Size:	134.6 KB
ID:	91015   Click image for larger version

Name:	EMC2 Keyboard Hack 10.jpg‎
Views:	199
Size:	142.5 KB
ID:	91016   Click image for larger version

Name:	EMC2 Keyboard Hack 13.jpg‎
Views:	289
Size:	98.3 KB
ID:	91017  
Reply With Quote

  #3   Ban this user!
Old 10-13-2009, 04:13 AM
 
Join Date: Oct 2005
Location: Australia
Posts: 80
scotta is on a distinguished road

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.
Reply With Quote

  #4  
Old 10-13-2009, 04:21 AM
Community Moderator
 
Join Date: Mar 2004
Location: Sweden
Posts: 1,084
svenakela is on a distinguished road

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.
Reply With Quote

  #5  
Old 10-13-2009, 04:23 AM
Community Moderator
 
Join Date: Mar 2004
Location: Sweden
Posts: 1,084
svenakela is on a distinguished road

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.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 10-13-2009, 02:11 PM
 
Join Date: Jun 2007
Location: SW Wis USA
Posts: 24
atex57 is on a distinguished road

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.
Reply With Quote

  #7   Ban this user!
Old 10-15-2009, 03:23 AM
 
Join Date: Oct 2005
Location: Australia
Posts: 80
scotta is on a distinguished road

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 03:54 AM.
Reply With Quote

  #8  
Old 10-16-2009, 10:32 AM
Community Moderator
 
Join Date: Mar 2004
Location: Sweden
Posts: 1,084
svenakela is on a distinguished road

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.
Reply With Quote

  #9   Ban this user!
Old 10-16-2009, 07:54 PM
 
Join Date: Oct 2005
Location: Australia
Posts: 80
scotta is on a distinguished road

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
Reply With Quote

  #10  
Old 10-16-2009, 09:20 PM
dertsap's Avatar
Gold Member
 
Join Date: Oct 2005
Location: canada
Posts: 3,668
dertsap is on a distinguished road
Buy me a Beer?

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 !! http://cnctoybox.org
Reply With Quote

Sponsored Links
  #11  
Old 10-17-2009, 02:17 AM
Community Moderator
 
Join Date: Mar 2004
Location: Sweden
Posts: 1,084
svenakela is on a distinguished road

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
Reply With Quote

  #12   Ban this user!
Old 10-17-2009, 08:47 PM
 
Join Date: Oct 2005
Location: Australia
Posts: 80
scotta is on a distinguished road

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
Reply With Quote

Reply

Tags
emc2 axis keyboard hack




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
keyboard hacking dertsap General Electronics Discussion 20 12-08-2009 09:11 AM
Looking for how to set Keyboard Command for Z axis LockTech Machines running Mach Software 5 05-14-2008 10:13 AM
Jogging 4th axis with keyboard? Chuck Reamer Tormach PCNC 7 11-09-2007 09:44 AM
Feedrate control in EMC2? pauldkeeton LinuxCNC (formerly EMC2) 4 11-06-2007 12:14 AM
"HACKING" the optional functions on the Haas control? AMCTony Haas Mills 16 12-03-2006 11:28 AM




All times are GMT -5. The time now is 05:12 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361