How to get microcontroller to act as keyboard for macros + shortcuts

Thread Starter

-live wire-

Joined Dec 22, 2017
959
Hi, I would like to make it so that my ESP32 board can act as a USB keyboard and ideally a mouse too. It might use ultrasonic sensors, a simple touchscreen, or other inputs. The main use is probably macros. Can anyone help me find the right library to do this?
 

Thread Starter

-live wire-

Joined Dec 22, 2017
959
Thanks, but I don't have an Arduino pro micro, and I don't want to have to buy something I could do for free and better (using software on a better microcontroller). So how do I do it with an ESP32?
 
Thanks, but I don't have an Arduino pro micro, and I don't want to have to buy something I could do for free and better (using software on a better microcontroller). So how do I do it with an ESP32?
Well, you have to walk before you can run - right? That is actually a pretty good tutorial and I think that you would gain a lot of understanding about HID that would come in handy. You could even get to the point where you could tackle translating the code in the tutorial to the ESP using the Arduino C/IDE.

If you want to just skip all that, search and find something more to your liking...search for ESP32 as HID device or as keyboard and so on.
This one looks interesting https://github.com/asterics/esp32_mouse_keyboard

But, I have not done specifically what you want to do , so I am just giving you an idea of how I would go about doing it.
 

djsfantasi

Joined Apr 11, 2010
9,237
Thanks, but I don't have an Arduino pro micro, and I don't want to have to buy something I could do for free and better (using software on a better microcontroller). So how do I do it with an ESP32?
You do realize that these functions don’t require an Arduino Pro Micro? The article was written some time ago. Recent Arduinos can also do the job.

If you want to use the ESP32, be prepared to write a lot of code to emulate the Arduino functions.

You can use a microprocessor in the Arduino class of microprocessors. Or you can start from scratch and write the code for the functions already available on another platform.

The choice is up to you. Use available, tested and supported code. Or write your own. Good luck
 

Thread Starter

-live wire-

Joined Dec 22, 2017
959
What about using an arduino nano first? While in the future I might want to do something requiring more memory, processing power, bluetooth enabled, etc, it seems starting simpler is the smarter thing to do.
 

djsfantasi

Joined Apr 11, 2010
9,237
What about using an arduino nano first? While in the future I might want to do something requiring more memory, processing power, bluetooth enabled, etc, it seems starting simpler is the smarter thing to do.
What about it? Should work,,.

You can use a microprocessor in the Arduino class of microprocessors. Or you can start from scratch and write the code for the functions already available on another platform.
A Nano is a microprocessor in the Arduino class.
 

Thread Starter

-live wire-

Joined Dec 22, 2017
959
I tried it and the library gave me some issues. I looked and it said the builtin one only works with certain boards according to the arduino website.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,237
I tried it and the library gave me some issues. I looked and it said the builtin one only works with certain boards according to the arduino website.
I have a few questions for clarity.
  • What library?
  • What issues?
  • The built in what?
  • What boards?
I want to help. And know your objective. But without the information above, don’t know how to respond.
 
I tried it and the library gave me some issues. I looked and it said the builtin one only works with certain boards according to the arduino website.
...and therein lies the crux of the biscuit. Do you want to undertake this as a project that requires a lot of learning and understanding and problem solving to get where you want to go...

https://hackaday.com/2012/06/29/turning-an-arduino-into-a-usb-keyboard/

...or do you want something that is turn-key and works with a minimum of time and effort?

https://www.adafruit.com/product/1535

There is no shame in either route, it just depends on how you want to get there.
 
Top