Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 23:05 03 Dec 2021 Privacy Policy
Jump to

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: Germany
Posts: 3
Posted: 12:44pm 22 Nov 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 1196
Posted: 12:59pm 22 Nov 2021
Copy link to clipboard 
Print this post

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
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 496
Posted: 02:02pm 22 Nov 2021
Copy link to clipboard 
Print this post

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: France
Posts: 49
Posted: 08:29pm 22 Nov 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 1196
Posted: 08:46pm 22 Nov 2021
Copy link to clipboard 
Print this post

  darthvader said  This can help you ....
pi pico mechanical keyboard

Cheers ...

Nicely spotted! Just make one with one key. :)
-- Mick

Zilog Inside! nascom.info for Nascom & Gemini
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 4475
Posted: 09:25pm 22 Nov 2021
Copy link to clipboard 
Print this post

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
Senior Member

Joined: 11/02/2018
Location: Australia
Posts: 227
Posted: 11:44pm 22 Nov 2021
Copy link to clipboard 
Print this post

@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: Germany
Posts: 3
Posted: 08:14am 23 Nov 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 1196
Posted: 08:44am 23 Nov 2021
Copy link to clipboard 
Print this post

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
 
Calli
Newbie

Joined: 20/10/2021
Location: Germany
Posts: 22
Posted: 09:46am 23 Nov 2021
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 1196
Posted: 09:58am 23 Nov 2021
Copy link to clipboard 
Print this post

Well volunteered. ;)
-- Mick

Zilog Inside! nascom.info for Nascom & Gemini
 
MikeO
Senior Member

Joined: 11/09/2011
Location: Australia
Posts: 254
Posted: 09:54am 24 Nov 2021
Copy link to clipboard 
Print this post

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 States
Posts: 229
Posted: 03:41am 26 Nov 2021
Copy link to clipboard 
Print this post

  Stefan said  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


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


To reply to this topic, you need to log in.

© JAQ Software 2021