|
Forum Index : Microcontroller and PC projects : Picomite as an HID keyboard
| Author | Message | ||||
| Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1655 |
I have a couple of projects where I would like to use a device to simulate a USB keyboard: A joystick to input "A,S, W, Z, space" or similar. An input device for a mini computer to drive a menu driven system (a simple HMI) using rugged buttons rather than a more fragile keyboard with many more buttons than are needed. This HMI would use MMBasic. I would like to use MMBasic on the Pico because I'm familiar with it but that does not seem to support the Pico being used as an HID device. While Circuit Python will do it, that's not really the way want to go because I would find it easier to add extra bells and whistles using MMBasic. Does anyone know how this could be done? Thanks Bill Keep safe. Live long and prosper. |
||||
TassyJim![]() Guru Joined: 07/08/2011 Location: AustraliaPosts: 6426 |
This is cheap and should save a lot of work. Coupled with a picomite to read the buttons etc. https://www.electrodragon.com/product/serial-to-hid-keyboard-emulator/ I have a couple but apart from a quick test to prove they work, I haven't put them into use. Jim VK7JH MMedit |
||||
| Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1655 |
Thanks Jim, I did see that some time ago but was put off by the Chinese language on the config interface and was a bit suspicious that they wouldn't do what I want. I would still need a Pico anyway and if it comes down to that I may as well use a Pico with Circuit Python with a little bit of help from AI. Bill PS I should have said that the HMI does use MMbasic. Keep safe. Live long and prosper. |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8430 |
I've used a RP2040-Zero as a HID using Circuit Python. It works very well and I didn't need AI to figure it out! I'm not sure where my code is now, unfortunately, as it was ages ago when I was experimenting with making game controllers that no-one seemed to be interested in! I found snippets on the web. I'm not aware of anyone managing to use MMBasic for an HID even though the USB port can be run as a master. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| Arne Regular Member Joined: 05/01/2025 Location: GermanyPosts: 44 |
Hello Bill, You can use HID-Remapper on a second pico. It could be adapted/configured to your needs via browser and controlled by MMBasic thru the GPIOs. Here fotos of my actual prototype as IR-Controller. ![]() ![]() I actual made some tests to use it as a multi remote control. Without the second pico you can control the MMBasic editor e.g. with mouse or joystick etc. See also my post „Picomite & HID-Remapper“. Arne |
||||
Quazee137![]() Guru Joined: 07/08/2016 Location: United StatesPosts: 602 |
I have been making keypads to help with my right hand not working much. Here are two of my first runs at it. I have others but are more like adding custom key pad macros with mouse and game controller all in one. Quazee137 sometimes finding board files for Arduino and get the tools config right or close enough to make code work "bites" Have FUN Keypads ref.zip |
||||
| Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1655 |
Thank you all for the comments. It seems that I'm not the only one with a need or interest. Maybe a CSub for MMBasic would do it but that's probably beyond me. I'll go with the Circuit Python and Pi Pico option. AI has given me a program which I will check out eventually. I have no desire to learn Python. The idea of using indentation as part of the program structure just seems so wrong to me. Thanks Bill Keep safe. Live long and prosper. |
||||
| mozzie Senior Member Joined: 15/06/2020 Location: AustraliaPosts: 192 |
G'day, Arne, Many thanks for the link to the "Remapper" github, hadn't seen this before but have loaded up a Pico and it works plugged into the PicoMite with no problems. Also a nice piggy back solution you have there ![]() Turbo46, I too would love to see the ability to use a PicoMite as a USB I/O expander / keyboard or serial link plugged into another as a host, I believe this has been discussed in the past and is not as simple as it seems. My own testing with CircuitPython plugged into a PicoMite USB host doesn't work, the CircuitPython shows up as multiple devices on Windows and MMbasic doesn't recognize it as a keyboard or mouse, other peoples experience may vary, I'm no expert by a long shot. I would suggest trying the Remapper as suggested by Arne. The GPIO can be setup to send keystrokes / mouse functions or macros so should do as a simple keyboard no problems. Unless the Arduino IDE is an option Regards, Lyle. Edited 2026-01-04 14:27 by mozzie |
||||
bigmik![]() Guru Joined: 20/06/2011 Location: AustraliaPosts: 2975 |
Hi Bill, My option is a `little different' than those proposed but still requires extra hardware (a bog standard USB-TTL) adapter. There is a nice little program for a PC called DataSnip that intercepts a serial stream and patches the data into the PC' keyboard routine. The program is free and will just parse the data through as is, however if you want to filter out keys or convert them to a string or other features then the program needs to be registered and a $10AU fee (about $6US). >>> DATASNIP <<< All that would be needed is your Pico to transmit the ASCII codes of what keys you need to the USB-TTL adapter and set DataSnip up to intercept the relevant Com Port and away you go. Kind Regards, Mick (The Big one) . Edited 2026-01-04 15:47 by bigmik Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
| Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1655 |
Thanks Mick (The Big one), There are more options than I thought! Being a pig headed old sod, I'll try the Circuit Python way first and if the problems Mozzie mentioned occur and can't be fixed I'll decide which option to try next. Thanks all Bill Keep safe. Live long and prosper. |
||||
| dddns Guru Joined: 20/09/2024 Location: GermanyPosts: 726 |
TTL to Ch9329 |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8430 |
There are a lot of web sites showing how to use Circuit Python for HID on the Pico. If you are happy with MMBasic then I doubt if you'll have much difficulty with Circuit Python - it's not a difficult language. Just a few: PICO-HID scripter Simulating the computer mouse USB keyboard emulator Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| cosmic frog Guru Joined: 09/02/2012 Location: United KingdomPosts: 306 |
This one works well video Software Here Dave. |
||||
| mozzie Senior Member Joined: 15/06/2020 Location: AustraliaPosts: 192 |
G'day, Not wanting to hijack this thread, however Bills (Turbo46) question has re-kindled my interest in this subject, will start another thread if needed. Just to clarify, I believe the original question was for a programmable keyboard on a pico/picomite that can be plugged into a PICOMITE USB HOST running as HMI. I have tried a few of the suggested programs with only a couple of them being seen by the PICOMITE USB HOST as a keyboard, has anyone else tried these setups with success? Basically they will work with a PC, but not with a PicoMite_USB in my testing so far. Remapper as suggested by Arne does work well with both, thanks :) If my interpretation of this is correct: For the PicoMite USB Host a boot keyboard is required, despite what CircuitPython says, their usb_hid.keyboard device descriptor is not boot compatible, neither are most of the Arduino sketches. Also need to disable Serial / CDC / MIDI / MDC as these appear to interfere with the connection, although not always. For CircuitPython you need to create/modify BOOT.PY as shown in the following: info for boot.py from: https://www.danielhankewycz.com/blog/2022/09/pi-pico-boot-warning-bypass/ For Arduino, the Adafruit_TinyUSB library needs to be used in place of the built in USB / keyboard / mouse librarys. The good news is, after a LOT of swearing and wearing out of flash cycles I now have both CircuitPython code and an Arduino sketch that allow an RP2040 PICO / ZERO to send keypresses and strings to the PICO USB HOST :) These still require some cleaning up if anyone is interested, but hopefully the info above will help someone out. This just confirms my belief that MMBasic has been sent to us from the gods, Python and Arduino are the spawn of the devil.... As usual I am probably making this harder than it really needs to be, any thoughts welcome. Regards, Lyle. |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2916 |
A DIY hardware option could be to gut a keyboard for it's chip and cable. (Assuming the chips are not available on line.) Before dismembering it trace the tracks of keys you wish to use back to the chip and record the pin numbers. Your input device can then link its output to the required pins via optocouplers. |
||||
| Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1655 |
My original question maybe wasn't clear enough. My main requirement is to use the device as: 1. A keyboard imitator that can be used with a switched joystick for games control on a PC. 2. A keyboard imitator that can be used with switches for control of a simple HMI written in MMBasic on a PC. The ability to use it for a Pico, or Maximite would be a bonus if I/O on that device was limited or if you didn't want to use the I/O for some reason. A PC can use more than one keyboard at a time which would be handy for testing but I believe that is a problem for an HDMI Pico. @Lyle, The AI's that I have asked about it all say it is possible and describe a similar method to that in your link. I'm working on other things at the moment and need to get some more Picos I would like to try your version, if you post, it when I can. @Phil That was the first thing I tried some time ago. It worked well until I somehow let the smoke out. You can buy USB keyboards quite cheaply at some op shops - more cheaply than buying the encoder boards online. When I opened the keyboard it exploded into a million pieces and I could not hope to put it back together if I needed to. I decided to look for an alternative. One of the AI versions: pico_joystick_keyboard.zip Thanks for all the comments. Bill Keep safe. Live long and prosper. |
||||
| Arne Regular Member Joined: 05/01/2025 Location: GermanyPosts: 44 |
Hello Bill, To do the things you wanted MMBasic is not needed. Do it directly with HID-remapper: - solder 4 lines to the pico (see also manual/picture) - install remapper.uf2 on the pico (e.g. rp2040 version) - connect switches/LEDs etc. to the relevant GPIOs (e.g. to make your own controller) - configure via browser - save configuration permanent to pico Thats it. The hardware can be used on PC/ Mac/Picomite etc. Here a short overview to have an idea: ![]() Have fun Arne |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |