Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Keystroke/hotkey operator

Status
Not open for further replies.
I was looking to build a project a bit like this: https://www.instructables.com/id/Reddit-Controller-USB-UpvoteDownvote-button/step4/Teensy-Code/

It's a project that is an additional USB controller that just tells your PC/MAC to perform a hot key keystroke, for example, CTRL+SHIFT+A.

Except, this project uses a Teensy (Costing around $16) and I was wondering if this could be done with any other microcontrollers that are cheaper? For example, cheapo PICs etc.

Any suggestions?
 
Last edited:
Hi,

Think you are using Assembler ..?

Most USB projects use C with usb enabled chips like the 18F4550.

A simpler way is to use a serial link using the Pics Usart module and then pass the data though a USB/Serial converter which you can buy on Ebay for a £1 or so.
It also saves you having to use additional chips like the Max232 RS232 converter.

See the last example of this good tutorial for details for how to send out serial data using the USART module.



If you have a Pickit2 programmer you can use its USART Simulator which allows you to connect it directly to the Pic, which saves buying any extra cables or converters.
 
The USB to serial adapter will not work as-is. To generate keystroke, you need to use the Keyboard USB Class. But yes, good advice, any USB Microcontroller would do the job when using the right USB Class.
 
Ahh okay, so I can just get a USB microcontroller and program it in C to send keystrokes? I'm guessing there's no way of using Assembly then?
 
My advice, download and install Microchip MPLAB and their free C-18 Compiler. Then also download the USB Framework (Now in the Microchip Application Library **broken link removed**).

In the USB framework, they provide a code example for HID usb Keyboard.. you're more than half-done with it ;)
 
My advice, download and install Microchip MPLAB and their free C-18 Compiler. Then also download the USB Framework (Now in the Microchip Application Library **broken link removed**).

In the USB framework, they provide a code example for HID usb Keyboard.. you're more than half-done with it ;)

Thanks a bunch. :D Looks like its got a few treats in it. :)
 
If the target computer has a PS/2 keyboard port you could also consider using that as it's way simpler then usb.
 
Not 100% true. To send keystroke to PS2 it is indeed easy... to go through the PS2 initialisation on boot and have your custom interface recognized by the BIOS and Windows... it's another story. Doable, but not easier.
 
The PS2 protocol is very easy. Basically all you need to do is acknowledge you're there when asked by the pc and accept some typematic delay and initial led status commands and that's it.

**broken link removed**

You only need to implement of few commands out of that list.
 
Last edited:
Hmm, the only thing is, it's a product for a large business I own that sells clothing, but expanding to electronics and having PS2 would limit the customers.
 
Let set the record straight. YES PS2 protocol is easy, not much than a SPI device. Send keystroke IS easy. However, seems the initialisation process is not consistent.
from BIOS to BIOS, from PC to PC.

With USB Class, you don't have to mess with it, and it's consistent from OS to OS, from PC to PC.

Lazy option, find a source of few bucks keyboard, use the controller in for the initialisation process, put yours in parrallel then :D Hey, you could even have one with USB/PS2 capabilities ;)

Nah, stick to usb ;)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top