Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : can Pi tell a computer that a key has been pressed?
Author | Message | ||||
Stefan Newbie Joined: 28/10/2021 Location: GermanyPosts: 4 |
Hi there, it is possible to send a push of a button to a computer that is connected to the pi via USB. I would like to tell my calculator during an action on the Pi that the x key was pressed. Greetings Stefan |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 5648 |
It might be possible but you'll need to do a lot of work. To send a key from the Pi it'll have to emulate a USB keyboard. So, you'll have to figure out how those work first. Luckily sending a single key wouldn't involve having to decode the entire keyboard. Whether it's even possible within the limitations of the Pico USB system I've no idea. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 532 |
Isn't possible to send it over serial? Pi connected over USB can communicate over serial, it can be easily tested with PySerial library... Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), CMM2.fun |
||||
darthvader Regular Member Joined: 31/01/2020 Location: FrancePosts: 72 |
This can help you .... pi pico mechanical keyboard Cheers ... Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 5648 |
Nicely spotted! Just make one with one key. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5867 |
A few years ago I had a desire to send a small string to a PC so I butchered a keyboard and used the keyboard IC to do the heavy lifting. I just traced the circuit board to find out which pins needed shorting for the desired keys. One incarnation used a micromite to 'hit' the keys in the right sequence. This version has a simple pushbutton. Jim VK7JH MMedit MMBasic Help |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 1722 |
@TassyJim That is clever. Perhaps you don't need to butcher the keyboard. Run a ribbon cable in the back to the desired PCB tracks making it dual purpose. |
||||
Stefan Newbie Joined: 28/10/2021 Location: GermanyPosts: 4 |
Good morning, thank you very much for the quick answers. then I will handle it in such a way that I use an output pin and operate a keyboard with it. Greetings Stefan |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 5648 |
Be careful, Stefan. A keyboard will be multiplexed so you can't use a common power supply for the Pico and the keyboard unless you use something like a CMOS switch to isolate the Pico output pin from the row + column of the keyboard matrix. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Calli Regular Member Joined: 20/10/2021 Location: GermanyPosts: 74 |
Pico can perfectly do USB-HID. However, not using MMBasic I guess. "Someone" needs to develop libraries... Carsten |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 5648 |
Well volunteered. ;) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
MikeO Senior Member Joined: 11/09/2011 Location: AustraliaPosts: 275 |
I think you could use Node red on the Pi, using node-red-contrib-keyboard-mouse-triggers , detect the key input and then send payload output via Serial(USB). Codenquilts |
||||
SimpleSafeName Senior Member Joined: 28/07/2019 Location: United StatesPosts: 284 |
Hi Stefan, Just so we're clear (or me, I tend to lag behind a bit) what is the make and model of your calculator? Basically I'd like to know if this is a true USB connection, or serial over USB. Is this a program that you run on your PC or is it as simple as hitting a "X" and off she goes? And scanners have been using keyboard "wedges" for ages. It's how a scanner tricks a PC into thinking that the input is coming from the keyboard. Just something to think about. In linux it should be even simpler, pipe the standard output from the keyboard to the serial port. If your calculator ignores anything but an "X" then send whatever key was hit, otherwise it will take some programming. So, if it is as simple as hitting an "X" on a keyboard that is plugged into a calculator, then get your hands on a cheap USB keyboard and inside you will find a membrane and a potted chip that connects to the USB cable. Find the "X" connection, and possibly the "Shift" key and have at it. John |
||||
Print this page |