USB haas operator panel interface

More
19 Jan 2020 07:48 #155133 by cmorley
I've been playing with an Arduino mega 2560, a HAAS keypad and linuxcnc trying to make a more professional panel.
My aim was to be able to use the HAAS keypanel as a USB keyboard so I can start a RIP linuxcnc and easily do entry to the screen.
I also wanted to be able to use the extra 'special cnc' keys as useful sshort cuts.

so far i have:
loaded a different bootloader on the mega to act as a USB keyboard.
modified the keypad library to use larger keypads and integer codes rather then characters
wrote a program to use this new library to create a way to HAAS map key-presses to USB scan codes.

The is an array for regular keyboard presses, one for shifted presses and one for non regular keyboard presses.
The HAAS keyboard shifted keys don't always follow a normal keyboard so there is a way to work around that.

It seems to work pretty well - though to do the really cool buttons requires work on the gui to support it.
( or rename the HAAS keys to reflect different behaviors)
but regular single key short cuts (such as AXIS uses) work fine.

The ketpad I have was bought on Ebay for about $50 but all the ones I see now are very expensive, but the fagor keypads should work well and are not too expensive if you search. It would be nice to have a generic one though...

If anyone is interested I could post the relevant files.
I would like to switch to the cheaper stm32 bluepill if I can figure out the libraries for it.
I would like to figure out how to use STM boards to connect to smart serial - but that may be to difficult..


Attachments:
The following user(s) said Thank You: thefabricator03, Himarc3D, vatso

Please Log in or Create an account to join the conversation.

More
22 Jan 2020 15:56 #155429 by andypugh

I would like to figure out how to use STM boards to connect to smart serial - but that may be to difficult..


There is a starting point here, as the STMBL servo drive talks smart-serial and uses STM32:
github.com/rene-dev/stmbl/blob/master/src/comps/sserial.c

Please Log in or Create an account to join the conversation.

More
22 Jan 2020 17:41 #155439 by cmorley
Yes I'm hoping I can figure out how to use/adapt the code to do what i want.
I should ask Rene if the stm32F1 bluepill is capable or do i need to use a better micro - but I'll start with getting the keyboard scanning working first - though I did get it to send HID USB Keyboard codes so that hurdle is past..

Chris

Please Log in or Create an account to join the conversation.

More
22 Jan 2020 17:43 #155440 by J Green
cmorley
Posting the relevant files would be useful .
Seems to me there is real need to incorporate better use of the existing machines keyboards in a Linux CNC conversion. Touch screens are useful, but some old geezers prefer keys to push. Reusing a machines existing keyboard is just a plus option in a conversion.
Do like where you are going with this , so keep it up -- Please.

Please Log in or Create an account to join the conversation.

More
22 Jan 2020 23:18 #155475 by cmorley
Here are the relevant files:
the modified matrix keyboard library: keypad_int
The two bootloaders for the Mega: arduino_hid_bootloader
My sketch for reading a HAAS keyboard and sending USB keyboard codes: haas_multi_usb_int

I had another sketch for sending key characters to the serial port which doesn't require the bootloader.
It's useful while mapping an unknown keyboard as it prints to the serial monitor rather then act as a keyboard.
It's fallen behind a bit so I'll add it later if wanted.

Chris
Attachments:
The following user(s) said Thank You: J Green

Please Log in or Create an account to join the conversation.

More
23 Jan 2020 00:39 #155480 by J Green
HI Chris
Thank you for the files.
Your other files-- " sketch for sending key characters to the serial port " would also be of use , so when you get the time -- a later add to will be great.
Thanks again
Bob

Please Log in or Create an account to join the conversation.

More
23 Jan 2020 03:17 #155497 by BeagleBrainz
Great Project

Have you thought about using a Arduino Pro Micro and the LUFA usb stack ?

That is if the I/O of the ATmega32U4 is enough.

Smart Serial would be the icing on the cake.

Please Log in or Create an account to join the conversation.

More
23 Jan 2020 05:33 #155505 by cmorley
This has been my first jump into Arduino boards. I picked the mega because it had lots of I/O as I wasn't sure what I was going to do.
I'm interested in using the STM32 blue pill next - it's smaller and cheaper.
I'll have to look at the pro micro to see what you are talking of - thanks.

Please Log in or Create an account to join the conversation.

More
23 Jan 2020 06:49 #155508 by BeagleBrainz
Pro Micro has a usb transceiver, no need to bit bang USB.
The LUFA USB frame work is a C library that doesn't depend on the Arduino libs or infrastructure.

Sorry I didn't link to the LUFA stuff
www.fourwalledcubicle.com/LUFA.php

I made a USB device that was enumerated as a Joystick and used it as a pendant, but that was with the BeagleBone Black running machinekit.

Please Log in or Create an account to join the conversation.

More
23 Jan 2020 16:07 #155558 by andypugh
It’s possibly worth mentioning that the 7i73 from Mesa can work as a matrix keyboard interface. (And that keeps all buttons in the real-time layer)

Please Log in or Create an account to join the conversation.

Time to create page: 0.108 seconds
Powered by Kunena Forum