Author Topic: programable keyboard  (Read 8349 times)

0 Members and 1 Guest are viewing this topic.

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18065
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
programable keyboard
« on: January 24, 2021, 10:51:21 am »
I am thinking of getting a keyboard that I can use for keyboard shortcuts and macro's so things like #include or "ctrl + v". I have some software with my cherry mouse that will just work with any keyboard as well so have been experimenting and it's really good and I want more  ;D. Currently i am starting to use up my "F" keys but I do use those for their actual uses plus it would be nice to be able to use it on multiple machines.

Any advice on products? I see there are many. Does not look like any support multiple programs so I can't reuse keys for different programs.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: programable keyboard
« Reply #1 on: January 24, 2021, 11:27:15 am »
If you need fully customizable multi-application support, you probably need to consider using AutoHotkey scripts as a translation layer between your add-on keypad and your applications.  The keypad needs to either identify as a HID joystick device (joypad) or needs to be programmable with scancodes not found on your regular keyboard, so that AutoHotkey can distinguish between your macro buttons and your regular keyboard, as unfortunately it cant bind to a specific HID device.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18065
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #2 on: January 24, 2021, 12:08:01 pm »
Yea this is why I would rather get an off the shelf keypad with software that is distinct.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: programable keyboard
« Reply #3 on: January 24, 2021, 01:04:53 pm »
The problem is: Anything affordable & off-the-shelf almost invariably has really sucky crippled software.  If you come across any sort of keypad that doesn't, I'd probably be interested as well.

You may well be better off building your own based on an Arduino Micro or other ATmega32U4 Arduino, as then you can easily make it return HID joystick button events or custom HID keyboard scancodes, so you can use a free choice of third-party macro utilities. 

Also consider 'giving up' a key you rarely use, e.g the 'Menu' key (usually opens right button context menus), as a modifier key to most other keyboard keys, to invoke application specific AutoHotkey macros, without conflicting with the other keys' normal function.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18065
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #4 on: January 24, 2021, 02:43:12 pm »

Also consider 'giving up' a key you rarely use, e.g the 'Menu' key (usually opens right button context menus), as a modifier key to most other keyboard keys, to invoke application specific AutoHotkey macros, without conflicting with the other keys' normal function.

No that's not the point. It has to be single key so that one hand is free for the mouse. I can cut copy and paste already and do other things too but it always involves two keys so it would be nice to dedicate a key to that two or more key press and that works really well in speeding anything up I do repeatedly in any program.
 

Offline Syntax Error

  • Frequent Contributor
  • **
  • Posts: 584
  • Country: gb
Re: programable keyboard
« Reply #5 on: January 24, 2021, 03:04:29 pm »
The only truly programmable (key sequence) keyboards with extra macro keys are the glow in the dark rgb gaming keyboards.

A quick web search, the Corsair K57 looks like a contender to me. And it doesn't look too 'teenage' either. ;)
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18065
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #6 on: January 24, 2021, 03:10:17 pm »
I have a cherry mouse that came with a program that will allow me to re-assign keys on my keyboard and their mouse. It works even with my keyboard that is not theirs as I just bought the mouse. I have keys now dedicated to cut, copy and paste and other macros of my choice like ctrl+M to remove formatting in libre office.

So as this is really neat and I will run out of keys so I'd like an additional keypad that will have those dedicated keys.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13133
Re: programable keyboard
« Reply #7 on: January 24, 2021, 03:16:15 pm »

Also consider 'giving up' a key you rarely use, e.g the 'Menu' key (usually opens right button context menus), as a modifier key to most other keyboard keys, to invoke application specific AutoHotkey macros, without conflicting with the other keys' normal function.

No that's not the point. It has to be single key so that one hand is free for the mouse. I can cut copy and paste already and do other things too but it always involves two keys so it would be nice to dedicate a key to that two or more key press and that works really well in speeding anything up I do repeatedly in any program.
In that case, you probably need a mouse with extra buttons that AutoHotkey can 'see'.   e.g. on a five button mouse, you could set up the mouse 'browse back' button as a modifier button to enable F1-F10 and 1-9,0 keys as hotkeys.  If the mouse has extra buttons that can be programmed as keys, you'll have even more options.

Personally I use a five button mouse with X-Mouse Button Control for application specific macros, as I don't actually need the extra flexibility of AutoHotKey*.  I use  'Browse Back' as a modifier (shift) button so I can use all four remaining buttons + wheel up and down as hotkeys without loosing their original function.   If I needed more for any particular application, I could set up 'Browse Forward' as another modifier  for a total of twelve ten macros, though I normally map it simply to [Page Down]  to facilitate reading web pages and documents. Edit: I'd loose a  macro button to be the extra modifier.

* I *USED* to use AutoHotkey to 'bind' Numpad 5 with Numlock off (normally a 'dead' key) to Excaliber RPN calculator, turning on numlock when it opened, and minimizing the calculator if I toggled numlock back off.  However I spend less time on machines with full-sized keyboards nowadays so have had to give up that luxury.
« Last Edit: January 25, 2021, 02:47:22 pm by Ian.M »
 
The following users thanked this post: Someone


Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15441
  • Country: fr
Re: programable keyboard
« Reply #9 on: January 24, 2021, 04:22:03 pm »
Thing to consider is, do you want a keyboard with a regular number of keys, and key combinations for macros (in that case, third-party software exists that can be used with any keyboard, although this is true that some do suck, so you have to find the right one - you can take a look at this: https://mediachance.com/multikeyboard/index.html ), or would you like extra keys that can be assigned macros with a single key press?

You can find keypads like this:
https://www.amazon.com/Koolertron-Single-Handed-Programmable-Mechanical-Keyboard/dp/B076LZJ5JS/ref=pd_sbs_4?pd_rd_w=92Mb5&pf_rd_p=409c42e8-023e-4951-9f77-4c63073a4537&pf_rd_r=TPMX9J172RTNBMEYMCVS&pd_rd_r=cbd22d40-4d72-41e1-b815-bc4aa02b18d1&pd_rd_wg=ij78U&pd_rd_i=B076LZJ5JS&psc=1
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18065
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #10 on: January 24, 2021, 04:24:15 pm »
I'm not looking for a standard keyboard but a separate pad that can be dedicated. I have ordered a 9 key job off amazon as a starter.
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23096
  • Country: gb
Re: programable keyboard
« Reply #11 on: January 24, 2021, 05:20:19 pm »
Use any old keyboard and AutoHotKey.

Some of the better mechanical keyboards (read Ducky, Durgod) have Fn keys which can be used as a meta key for any other key on the keyboard.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18065
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #12 on: January 24, 2021, 05:25:55 pm »
I'd rather have something that as suggested in the description of what I have bought I can move from machine to machine without installing stuff.
 

Offline Jope

  • Regular Contributor
  • *
  • Posts: 111
  • Country: de
Re: programable keyboard
« Reply #13 on: January 24, 2021, 05:47:20 pm »
Interesting topic. About two weeks ago, I've ordered this from Aliexpress for exactly this purpose.
What I'm planning to do is what Ian talked about. I will connect this PS/2 numpad to an MCU,
which will itself act as a USB keyboard, and send function keys F13, F14, etc., which are not present on normal keyboards.
On my PC I will use the already mentioned AutoHotkey (which I already use for application-specific shortcuts).
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18065
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #14 on: January 24, 2021, 05:49:57 pm »
golly, they still make PS2 stuff.
 

Offline Jope

  • Regular Contributor
  • *
  • Posts: 111
  • Country: de
Re: programable keyboard
« Reply #15 on: January 24, 2021, 05:55:18 pm »
golly, they still make PS2 stuff.

Thankfully. It's very easy to interface with an MCU. For a USB keypad you would need a USB host on the MCU side.
 

Offline Ranayna

  • Frequent Contributor
  • **
  • Posts: 919
  • Country: de
Re: programable keyboard
« Reply #16 on: January 25, 2021, 08:15:46 am »
I'm not looking for a standard keyboard but a separate pad that can be dedicated. I have ordered a 9 key job off amazon as a starter.
This claims to be what you want:
https://www.amazon.com/ELSRA-Programming-ControlPad-PK-2068-programmable/dp/B079BTFFQN
EDIT: Related products for this on amazon shows a boatload of similar programable keypads, but most are significantly more expensive...

Apparently all keys except Enter are programmable, and the programming is stored on the board itself.
« Last Edit: January 25, 2021, 08:17:55 am by Ranayna »
 

Offline jc101

  • Frequent Contributor
  • **
  • Posts: 692
  • Country: gb
Re: programable keyboard
« Reply #17 on: January 25, 2021, 06:14:54 pm »
These might do what you want, I've used them before with a Live Broadcast system.  Pretty sure keys can be assigned to anything the local OS supports.  You can set the icons on the keys too.
You can also create folders from memory, where a couple of keys can be used to go into a subset of additional actions on a group of other keys.

https://www.elgato.com/en/gaming/stream-deck
https://www.amazon.co.uk/Elgato-Stream-Deck-Controller-customizable/dp/B07DYRS1WH?ref_=ast_sto_dp&th=1

They come in various sizes. 

Got me thinking of getting one to program with all the shortcuts I can't remember in the various apps I use.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6970
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #18 on: January 26, 2021, 12:53:39 am »
Any advice on products? I see there are many. Does not look like any support multiple programs so I can't reuse keys for different programs.
If you want to build your own, I can warmly recommend Teensy LC for this.  It has a native USB, so it will be a standard USB keyboard; no drivers needed anywhere, and it will work as-is with every operating system (that supports USB keyboards).  Moreover, the Teensyduino add-on to Arduino has USB keyboard support built in, so all you need to do is write the logic for converting keypresses to HID events yourself.  (That is, it has keyboard.print() you can use to emit the keystroke macros.)

As to the board, I do recommend the diode-per-key matrix form.  I know many people dislike it, but it gives the extra robustness that I crave.  I've even designed a Teensy LC button matrix with up to 32 buttons and 9 pots, where each button or pot is wired (with actual wires, I mean) to the button itself, not sitting on the board.  The schematic itself is trivial,

Note that the resistors are there for "safety" (ensuring programming bugs won't burn the microcontroller I/O pins by effectively shorting VCC and GND).

The reason for designing this is that such "keypads" are useful for e.g. game cabinets running Linux and some emulator like MAME.  The hard part is finding buttons and their positioning that have the feel you like.  I happen to like the feel of the standard 12×12mm tactile buttons with round or square hats (see my Pro Micro clone Gamepad), but their placement is nontrivial.

So, what I'd suggest, is making something like the above board, and then either 3D print or manipulate dead tree carcasses to make different "keyboards", for just holding the tactile buttons in place, with enough room to run their wires to the separate board.  That way you can change the positioning of those buttons without having to make a new board for each one, by just 3D printing or chiseling a new button holder.  (I can imagine, for example, that the cheapie 6mm×6mm tactile switches in two or three dense arcs would work better here, just left/right of your keyboard, the other side of your mouse/trackball.  But I don't know for sure, and experimentation is needed to find out.)

I can imagine also adding a couple of rotary encoders (EC11 or similar) or mouse wheels for horizontal/vertical scrolling or panning.

Since Teensy LC uses 3.3V signaling, it can also directly interface to the small OLED displays (I recommend the 128x32 or 128x64 I2C ones using SSD1306 controllers (also from eBay/Banggood/etc.), so if you add a couple of "switch macro set" buttons, you could have multiple sets of macros the keys can emit, with the small OLED showing the macro set name.  You can even add a "explain" button, so pressing it and any other button shows what macro that other button emits. (The Pro Micro clones typically run at 5V, but the small OLED displays really prefer 3.3V signaling.  Teensy LC can only provide about 100mA at 3.3V for external devices, but these OLED displays consume under 35mA even when fully lit.)

If you don't like Teensies, there are lots of other microcontrollers you can use instead; just pick one that has native USB.  My reason for suggesting Teensy LC for this is because I know it works, is cheap, and is easy to program (due to Teensyduino support, especially keyboard.print()).  I do not claim it is the best for this; just that even an uncle bumblefuck like me can easily make it work.



If you don't want to build anything yourself, and instead want to buy something off the shelf, I wonder if an external touchpad – projected capacitive kind, like the Apple ones – might work.  The idea is, you basically place a sheet of paper, or a transparency (with print in reverse on the underside), on top of the pad, to remind you of the button locations.

You'd need to write a "driver" yourself for mapping the touchpad locations to buttons triggering macros, but at least in Linux that is trivial.  I recently showed DiTBho a skeleton of such an uinput daemon with virtual button support, but for a matrix of touchpad buttons, it would be even simpler.  A companion program, say a Python3 Qt UI or C GTK+3 UI could provide an interface for changing the button grid and macros at run time, saving configurations as "sets" you could switch at any time.

I can say that if anyone provided one (an external USB HID touchpad) for me, it'd be just a couple of days work of writing those programs and packaging them for e.g. Debian derivatives.
I don't have Windows, though, and don't write Windows drivers or programs, though; but I do believe the same is possible there, too.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6970
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #19 on: January 26, 2021, 04:32:12 am »
Another interesting option (at least in Linux) would be to get a keyboard with a trackpad, like Logitech K400plus,

and instead of using the trackpad as a trackpad, use it as a touch/figure macro board.

One could treat it as a 9-button keypad, but I think gestures/figures would be easier to recall (for me personally) than positions on a grid.
Plus, the audio/multimedia buttons could instead be used to select between touchpad and macropad modes, providing a notification similar to e.g.
    notify-send -t 1000 -c device -i preferences-desktop-keyboard 'Macropad mode'
    notify-send -t 1000 -c device -i preferences-desktop-keyboard 'Trackpad mode'

 

Offline andycsmith

  • Contributor
  • Posts: 16
  • Country: gb
Re: programable keyboard
« Reply #20 on: January 26, 2021, 04:30:16 pm »
Try https://github.com/TaranVH/2nd-keyboard, Taran from Linus Tech Tips is an editor and likes to use keyboard macros and shortcuts to make his life easier.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18065
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #21 on: January 27, 2021, 08:07:17 pm »
Any advice on products? I see there are many. Does not look like any support multiple programs so I can't reuse keys for different programs.

If you want to build your own, I can warmly recommend Teensy LC for this.  It has a native USB, so it will be a standard USB keyboard; no drivers needed anywhere, and it will work as-is with every operating system (that supports USB keyboards).  Moreover, the Teensyduino add-on to Arduino has USB keyboard support built in, so all you need to do is write the logic for converting keypresses to HID events yourself.  (That is, it has keyboard.print() you can use to emit the keystroke macros.)

As to the board, I do recommend the diode-per-key matrix form.  I know many people dislike it, but it gives the extra robustness that I crave.  I've even designed a Teensy LC button matrix with up to 32 buttons and 9 pots, where each button or pot is wired (with actual wires, I mean) to the button itself, not sitting on the board.  The schematic itself is trivial,

Note that the resistors are there for "safety" (ensuring programming bugs won't burn the microcontroller I/O pins by effectively shorting VCC and GND).

The reason for designing this is that such "keypads" are useful for e.g. game cabinets running Linux and some emulator like MAME.  The hard part is finding buttons and their positioning that have the feel you like.  I happen to like the feel of the standard 12×12mm tactile buttons with round or square hats (see my Pro Micro clone Gamepad), but their placement is nontrivial.

So, what I'd suggest, is making something like the above board, and then either 3D print or manipulate dead tree carcasses to make different "keyboards", for just holding the tactile buttons in place, with enough room to run their wires to the separate board.  That way you can change the positioning of those buttons without having to make a new board for each one, by just 3D printing or chiseling a new button holder.  (I can imagine, for example, that the cheapie 6mm×6mm tactile switches in two or three dense arcs would work better here, just left/right of your keyboard, the other side of your mouse/trackball.  But I don't know for sure, and experimentation is needed to find out.)

I can imagine also adding a couple of rotary encoders (EC11 or similar) or mouse wheels for horizontal/vertical scrolling or panning.

Since Teensy LC uses 3.3V signaling, it can also directly interface to the small OLED displays (I recommend the 128x32 or 128x64 I2C ones using SSD1306 controllers (also from eBay/Banggood/etc.), so if you add a couple of "switch macro set" buttons, you could have multiple sets of macros the keys can emit, with the small OLED showing the macro set name.  You can even add a "explain" button, so pressing it and any other button shows what macro that other button emits. (The Pro Micro clones typically run at 5V, but the small OLED displays really prefer 3.3V signaling.  Teensy LC can only provide about 100mA at 3.3V for external devices, but these OLED displays consume under 35mA even when fully lit.)

If you don't like Teensies, there are lots of other microcontrollers you can use instead; just pick one that has native USB.  My reason for suggesting Teensy LC for this is because I know it works, is cheap, and is easy to program (due to Teensyduino support, especially keyboard.print()).  I do not claim it is the best for this; just that even an uncle bumblefuck like me can easily make it work.



If you don't want to build anything yourself, and instead want to buy something off the shelf, I wonder if an external touchpad – projected capacitive kind, like the Apple ones – might work.  The idea is, you basically place a sheet of paper, or a transparency (with print in reverse on the underside), on top of the pad, to remind you of the button locations.

You'd need to write a "driver" yourself for mapping the touchpad locations to buttons triggering macros, but at least in Linux that is trivial.  I recently showed DiTBho a skeleton of such an uinput daemon with virtual button support, but for a matrix of touchpad buttons, it would be even simpler.  A companion program, say a Python3 Qt UI or C GTK+3 UI could provide an interface for changing the button grid and macros at run time, saving configurations as "sets" you could switch at any time.

I can say that if anyone provided one (an external USB HID touchpad) for me, it'd be just a couple of days work of writing those programs and packaging them for e.g. Debian derivatives.
I don't have Windows, though, and don't write Windows drivers or programs, though; but I do believe the same is possible there, too.


Good idea, I'm going to use this: https://www.arduino.cc/reference/en/language/functions/usb/keyboard/
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6970
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #22 on: January 28, 2021, 05:25:27 am »
Good idea, I'm going to use this: https://www.arduino.cc/reference/en/language/functions/usb/keyboard/
Just make sure the board you use has native USB, not an FTDI etc. USB-Serial bridge.

I have had good success with cheap eBay Pro Micro clones (see e.g. my Pro Micro gamepad).  In the Arduino environment, just remember to treat them as Arduino Leonardos, because they have the Leonardo bootloader.

These clones are actually (and quite legally!) derived from SparkFun Pro Micros (as opposed to from Arduino Pro, or from Arduino Micro), except that the clones use the Arduino Leonardo bootloader.  Which is quite fine, actually.  The ones I've bought off fleabay are surprisingly good boards for USB HID stuff, considering I've only paid about 4€ apiece for them.

If you do something that seems to "brick" those clones (like accidentally compile and upload firmware intended for some other board), and you use Linux, worry not: as long as you can ground the RST pin, they're USB-reprogrammable.  The timing is a bit tight, just a couple of seconds, which can be a bit frustrating. I use a scriptlet interposing hardware/tools/avr/bin/avrdude, so that it ignores the port chosen in the Arduino IDE, and instead waits until a Leonardo-like USB device appears, and redirects avrdude to use that.  (I could modify the script so that it tells the user when to ground the RST pin, but otherwise is automagic, if anyone is interested.)
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: programable keyboard
« Reply #23 on: January 28, 2021, 05:33:50 am »
Interesting topic. About two weeks ago, I've ordered this from Aliexpress for exactly this purpose.
What I'm planning to do is what Ian talked about. I will connect this PS/2 numpad to an MCU,
which will itself act as a USB keyboard, and send function keys F13, F14, etc., which are not present on normal keyboards.
On my PC I will use the already mentioned AutoHotkey (which I already use for application-specific shortcuts).

That was exactly what I was going to suggest.

If one was unable to find a PS/2 keyboard I don't think it would be very hard to replace the controller in any random keyboard with a microcontroller running custom firmware and have it spit out whatever you want in response to pressing a key.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6970
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #24 on: January 28, 2021, 06:24:15 am »
Interesting topic. About two weeks ago, I've ordered this from Aliexpress for exactly this purpose.
What I'm planning to do is what Ian talked about. I will connect this PS/2 numpad to an MCU,
which will itself act as a USB keyboard, and send function keys F13, F14, etc., which are not present on normal keyboards.
The aforementioned Pro Micro clones are well suited for PS/2 stuff.  You'll find Paul Stoffregens PS2Keyboard Arduino library (Github) useful.  It includes details on hardware wiring, too.

(I do believe it is possible to use pin 7 for the PS2 clock signal, since it is INT6; the problem is that in Arduino terms, it is the fifth interrupt – there is no INT4 or INT5, just INT0-INT4 (pins 3, 2, 0, 1) and INT6 (pin 7).)

What I don't understand is why require AutoHotKey in the mix.  The Arduino/Teensyduino Keyboard library can trivially generate the wanted key sequences directly.  Even the Pro Micro clones have > 2000 bytes of RAM left over the support stuff, so you could use e.g. USB HID protocol – no OS drivers! – to maintain the key sequences, if you don't want to put them into Flash.  The Pro Micro clones support 1,024 bytes of "EEPROM" using the Arduino EEPROM library, so you could make the macros persistent.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf