Author Topic: programable keyboard  (Read 15840 times)

0 Members and 1 Guest are viewing this topic.

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 14135
Re: programable keyboard
« Reply #25 on: January 28, 2021, 07:18:33 am »
AutoHotkey makes it simple to auto-switch to different macro sets, depending on which application has focus.  If you do the macro expansion on the MCU, there's no way of detecting the current application (without a helper daemon on the PC), so that's a last resort for locked-down PCs.
 
The following users thanked this post: Nominal Animal

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #26 on: January 28, 2021, 07:44:34 am »
AutoHotkey makes it simple to auto-switch to different macro sets, depending on which application has focus.  If you do the macro expansion on the MCU, there's no way of detecting the current application (without a helper daemon on the PC), so that's a last resort for locked-down PCs.
Oh, now I understand!  Yes, that makes sense.

This is also a good example of why observing others' workflows is so informative.  I personally was thinking in terms of task-oriented macros (when doing certain type of work, regardless of the application used), but application-specific macros – albeit requiring an application like AutoHotKey or a custom daemon – are more robust, because they're always targeted to the correct application.

It is also useful to understand the underlying USB keyboard report format; in particular, that the modifier key status is passed along with every single report.  This means that one can provide e.g. Shift+Ctrl+F13 keypress in a single report (followed by a release in the next report), without affecting the modifier state in other keyboards.  It also means that pressing e.g. Shift on one keyboard does not need to affect other keyboards; it is completely up to the OS whether it mixes the state from different input devices or not.  The HID Usage Tables (PDF) section 10 contains the USB keyboard key codes; 0x68 (F13) - 0x73 (F24) seem particularly good choices for use with AutoHotKey.
« Last Edit: January 28, 2021, 07:47:32 am by Nominal Animal »
 

Offline Jope

  • Regular Contributor
  • *
  • Posts: 117
  • Country: de
Re: programable keyboard
« Reply #27 on: January 28, 2021, 09:50:40 am »
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.

Because AutoHotKey cannot just replace a key with (an)other key(s), it can replace it depending on what window is currently on the top. I.e., depending on the program that is currently running, it will replace a certain key with other keys, and for another program it will replace it with another key sequence. AutoHotKey can also generate mouse movements, start programs, etc. Your external keyboard cannot do that. It will just send keys.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #28 on: January 28, 2021, 10:23:04 am »
AutoHotKey can also generate mouse movements, start programs, etc. Your external keyboard cannot do that. It will just send keys.
:o Of course it can.

Even the Arduino/Teensyduino defaults support a combined Keyboard + Mouse + Joystick device, and have such an example.

For example, if you have a trackpad with four buttons, it usually exposes two devices: one HID device with two buttons and the trackpad (as an absolute positioning device), and another HID device with the other two buttons.  If you want, you can map keys to mouse scroll, or even to move the mouse cursor by a specific amount.

What USB HID devices do not know, is what application is currently active.  (You could use a normal unprivileged program, communicating via USB HID to the microcontroller, to maintain the macro set, or to consume the HID device events and map them to actions, including starting specific programs, bringing specific open program to the focus, et cetera.  That way absolutely no OS level drivers are needed.)
« Last Edit: January 28, 2021, 10:26:16 am by Nominal Animal »
 

Offline Jope

  • Regular Contributor
  • *
  • Posts: 117
  • Country: de
Re: programable keyboard
« Reply #29 on: January 28, 2021, 10:53:22 am »
(You could use a normal unprivileged program, communicating via USB HID to the microcontroller, to maintain the macro set, or to consume the HID device events and map them to actions, including starting specific programs, bringing specific open program to the focus, et cetera.  That way absolutely no OS level drivers are needed.)

Or you could just use AutoHotKey, which is much more flexible and simpler to use.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #30 on: January 28, 2021, 11:00:10 am »
(You could use a normal unprivileged program, communicating via USB HID to the microcontroller, to maintain the macro set, or to consume the HID device events and map them to actions, including starting specific programs, bringing specific open program to the focus, et cetera.  That way absolutely no OS level drivers are needed.)
Or you could just use AutoHotKey, which is much more flexible and simpler to use.
I cannot, because I do not use Windows, and AutoHotKey is Windows-only.
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23102
  • Country: gb
Re: programable keyboard
« Reply #31 on: January 28, 2021, 12:10:32 pm »
Use AutoKey instead  :-DD
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #32 on: January 28, 2021, 12:24:28 pm »
Use AutoKey instead  :-DD
:-DD

Nah, the neighborhood hobos type in what I tell them on a second keyboard for shots of hand sanitizer, it's much easier!   :phew:
 
The following users thanked this post: bd139

Offline GodIsRealUnless DefinedInt

  • Contributor
  • Posts: 42
  • Country: us
  • The Implicit None
Re: programable keyboard
« Reply #33 on: February 14, 2021, 03:06:29 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.

If You can stand ergonomics, the Software Engineers at worked turned me onto Microsoft Natural Ergonomic Keyboard 4000. It has a macro editor (built into the MS Mouse and Keyboard Center), it already has remapped Function Keys which you have an extra key F-LOCK on the row so you can lock them between normal F keys and Remapped. You have a bunch of media keys including generic 1-5 keys you can map to anything you want. This is a programmers keyboard so if you are big into programming or development you can be sure to find someone with mod or support or something for it. With the macros you can have general macros and you can have app specific macros.

I went through 7 years of mechanical keyboards and started getting wrist pain after a lifetime of never being bothered and the Ergonomic keyboard is such a lovely thing to type on for extended periods of time that I like using the computer again.

I'm a big AutoHotKey user in the past though recently I only use it when I want to disable ALT-TAB, the WINDOWS KEY and other keys that will break me out of a program and kick me back to the desktop rudely.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18916
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #34 on: February 14, 2021, 08:04:41 am »
I'm going to make something with an Arduino. I just want a custom keypad.
 

Offline GodIsRealUnless DefinedInt

  • Contributor
  • Posts: 42
  • Country: us
  • The Implicit None
Re: programable keyboard
« Reply #35 on: February 14, 2021, 05:55:06 pm »
If you only want a custom keypad be sure to evaluate HID Macros (if Windows) once you got the hardware side finished.

http://www.hidmacros.eu/

The only macro software that out-of-the-box has the ability to take commands from a specific keyboard HID while ignoring another keyboard HID.
« Last Edit: February 14, 2021, 05:57:03 pm by GodIsRealUnless DefinedInt »
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18916
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #36 on: February 14, 2021, 06:38:51 pm »
HID macro's is dead according to your link and replaced by luamacro's, the github page has a warning:
Quote
Disclaimer
Don't use this software. Really. It's difficult to use, has bugs and the author has very little time to maintain it. It was written just to connect multiple keyboards to a flight simulator (X-Plane) to control different knobs and buttons in the plane/helicopter. The author is using it just for this purpose.

It can do many things, but you need to understand what you are doing and you definitely need to know and use the Lua scripting language. If you just found LuaMacros by a Google search or saw some nice YouTube videos, but don't know how to write a Lua script it will be painful to get what you want, and you will end up frustrated. Please, don't use it in this case.

There's a support forum available at http://www.hidmacros.eu/forum where you can ask how things work, see example scripts, etc. But please don't expect I will write Lua scripts for you or teach you Lua.

If you know Lua or are able to learn it first, if you understand what example scripts are doing and are not afraid of spending some time playing with it, enjoy LuaMacros.

This is the circle i keep going in with any program. It's either not really supported or too complicated to bother with. I find it would be easier to make a keypad connected to an arduino that I can easily program to do what i want faster than I can fathom all this stuff out.
 

Offline GodIsRealUnless DefinedInt

  • Contributor
  • Posts: 42
  • Country: us
  • The Implicit None
Re: programable keyboard
« Reply #37 on: February 14, 2021, 07:28:07 pm »
This I understand, if your doing it for the educational side it's worth it. If you just want to solve an immediate need then 7 quid/$10 and software will solve it vs 3 times or 6 times the money invested in building your own hardware. Beware the hidden pitfalls, the same applications on different operating systems sometimes will have completely differing shortcuts to drive the menus or functions. You won't be able to necessarily move the HW solution as easily between devices and the corner cases can drive you bonkers at times.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18916
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #38 on: February 14, 2021, 07:43:29 pm »
I'm only really interested in windows. Cut, copy and paste are actually the same in linux and those are the only ones I use.
 

Offline SparkyFX

  • Frequent Contributor
  • **
  • Posts: 745
  • Country: de
Re: programable keyboard
« Reply #39 on: February 14, 2021, 07:50:43 pm »
Gaming keyboards already come with software that automatically switches macros depending on application that has the focus. Logitech named as one example.

For rolling your own on Windows have a look at eventghost for getting the context and having some feedback to your application.
Support your local planet.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18916
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #40 on: February 14, 2021, 07:55:34 pm »
The problem with keyboards with customisable keys is that they don't have many keys. Plus I use the Dvorak layout which may be why the last off the shelf customizable keyboard I tried was a disaster although i had other issues with it. I have just found affordable Dvorak keyboards and want to try and keep it that way as it will work more easily than having to keep relabelling keys.
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 8931
  • Country: 00
Re: programable keyboard
« Reply #41 on: February 17, 2021, 08:59:22 am »
Mentioned earlier is the Stream Deck. I got one of those (the 15-key job) for the same reason as this topic. I have it set up so when I use Altium (which is the worst app for magic keys) it switches to the Altium set of keys. When I use other apps it uses those app-specific keysets, etc.

I'd considered an add-on USB keypad but the problem there is you still need to remember what key does what. The Stream Deck is brill because each key is a tiny display, so for changing track width, say, it shows me a track with the width arrows and even says "Track width" in tiny letters. Don't need to remember what any key does.

The downside is that it's expensive. Not so bad if you can justify it as a business tool. The other is that it is Windows 10 only and will refuse to even install on Windows 7. Fortunately, some kind chap has created a set of DLLs that circumvent Microsoft's attempt to lock out W7 (for that's what it is - there is no technical incompatibility) and it works very well indeed.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18916
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #42 on: February 17, 2021, 12:45:36 pm »
Yea bit pricy
 

Offline kjr18

  • Regular Contributor
  • *
  • Posts: 229
  • Country: pl
Re: programable keyboard
« Reply #43 on: March 05, 2021, 03:21:28 pm »
A few days ago I made something like that, simple single analog output 3x4 keypad, connected to arduino pro micro clone, with use of some two libraries I managed to put some shortcuts, some multimedia control buttons (standard arduino usb support lacks multimedia keys support so I tried HID-project library and works fine). All of it because my current keyboard has multimedia keys on F10 to F12 so instead one key I have to press two. I put it in 3d printed case and everything works fine.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #44 on: March 06, 2021, 05:07:33 am »
EastRising/buydisplay.com has 5" capacitive multitouch panels for less than $9 USD.  The active area is 109.6mm × 66.4mm, and the entire display overlay module is 115.20mm × 72.5mm.  They also have different sizes of these, many with multitouch (5 or 10 points).  The connector is tiny 6-pin FPC, but you can get the connector for < $0.20 USD; that way if a panel gets too scratched or whatever, you can just switch it.

A normal display would pretty quickly get image burn.  Instead of a display, one could use a stiff acrylic sheet beneath the touch panel, maybe two sheets sandwiching a printout describing the tool buttons.  Or something like an acrylic sheet or 3D printed support and a 2.7" e-Ink display module covering one half of a 7" touch panel.  In vertical orientation, you could use the upper area with the e-ink display as buttons, and the lower area as a gesture pad (or for scrolling/panning and zooming like I'd want).  Or vice versa.  I don't know the exact maximum current consumption of the FT5316-based capacitive touch panel, but I understand it is of the order of about 20 mA.  The e-Ink display only needs on the order of 15 mA while updating.  So, this is not particularly current-hungry.

You still need an USB MCU, but I think Teensy LC/3.2/4.0 would be a good fit here, depending on what one already has available.  The touch panels are standard i2c devices, with additional reset (output) and interrupt (input) pins; and the e-ink display uses a 3/4-wire SPI (with DI, DO, SCK, Data/Command, Chip Select, Reset, and Busy (input) pins).

If someone is adept at designing boards, one could use a 4.2" e-ink panel and that 5" capacitive multitouch panel with an Arduino-programmable ARM MCU, say an STM32L412 or an ATSAMD51J20 (just examples that have Arduino cores already implemented), crystal if needed for USB operation, a 5V-to-3.3V converter, and whatever voltages/support circuitry the e-ink panel needs, all on a single board with a USB 2.0 FS connector (or just pads to which to solder a scavenged USB cable).  Might make an amazing DIY toolpad.
« Last Edit: March 06, 2021, 05:09:04 am by Nominal Animal »
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 18916
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: programable keyboard
« Reply #45 on: March 06, 2021, 08:00:33 am »
Getting much more adventurous but yes a touch display does resolve the labelling issue as I was going to stick a basic character screen on it and have a row of buttons to select the program I am in so that keys can be set up for specific use minimising the overall need for more keys and making it ridiculous.
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 8931
  • Country: 00
Re: programable keyboard
« Reply #46 on: March 06, 2021, 12:12:08 pm »
Quote
A normal display would pretty quickly get image burn.

An LCD gets image burn?
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #47 on: March 06, 2021, 08:21:16 pm »
Quote
A normal display would pretty quickly get image burn.
An LCD gets image burn?
It's a term describing the uneven wear on the thin-film transistors and twisted nematic field effect cells when the potential across the cells stays static for a long time.

The datasheet on these displays and modules explicitly describes it, calling it "image sticking" or "image ghosting".  I may have used the wrong term, but this is the phenomenon I was referring to: if you were to use a specific image for a few months, then changing it may leave a "ghost" of the previous image, similar to "image burn" on CRT devices.

I haven't observed it myself, but since the datasheets consistently have a chapter describing it, I assume it is real.

(Edited to add: I believe it affects these tiny cells much more than larger cells, as obviously the volume of the cell and the size of the thin film transistor dictates how fast any degradation caused by a static field would yield a visible effect: physically, the molecules themselves do not degrade due to the static potential – if you were to simulate the effect, the results would not depend on the previous state – so it has something to do with impurities or manufacturing and such. On an 7 digit LCD display, the cell is easily a hundred to a thousand times larger, so one could expect a similarly visible effect to take a hundred to a thousand times longer to appear.  Which should explain why e.g. Dave's experiment using a static voltage potential on the LCD display he had designed (with David) and had manufactured, did not show any degradation even after several weeks, if I recall the video correctly.)

why not make a PCB that is of capacitive keys?
I personally don't need a pure keypad, I want a trackpad of sorts for scrolling/panning and zooming (in various graphics and EDA applications).  For me, the versatility of being able to switch between a toolpad and a scroll/pan/zoompad would be optimal.  (I'm thinking of say three physical tactile buttons and a small 128x32 OLED display for switching between multiple toolpad modes – at least one of them being a mode controlled by an userspace application that auto-switches the mode depending on the currently active (input-grabbing) application.)

I do have an MPR121 breakout board that is often used on such, and I know that a suitable number of electrodes and an electrode pattern can be used to create a nice projected capacitive touchpad (not only detecting touch, but also distance from the panel near the panel surface), but alas, such design is out of my current skill range; I'm only an uncle bumblefuck hobbyist, after all.
« Last Edit: March 06, 2021, 08:37:49 pm by Nominal Animal »
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #48 on: March 06, 2021, 10:33:11 pm »
BuyDisplay/EastRising also has a 4.3" panel with an USB controller they offer for R'Pi users, 4.3" 5-touch capacitive touch for under $13 USD, that apparently doesn't need drivers at all even in Windows, so probably implements some very standard USB HID device.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: programable keyboard
« Reply #49 on: March 14, 2021, 01:49:53 pm »
This kept bugging me, so I decided to order a 2.8" and 3.5" capacitive touch (FT62x6, two touch support, I2C with touch interrupt interface) panels.  I don't want a large one, and while I'd prefer to have 3-point multitouch (for rotation; two for zoom and pan), I think two will suffice for my needs.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->