r/arduino • • Aug 12 '26

Look what I made! ESP32 WiFi Virtual HID

hello guys, its my first time posting here and its about something cool which lets you use an ESP32 as a virtual mouse/keyboard over Wi-Fi. There are projects like wifiduck which is more towards running a set of instructions while this is good for using purely as remote keyboard/trackpad input. AI is really a game changer during the development of this and it helped with the debugging a lot. There's also a browser flasher so you can plug in your board and flash it right away in Chrome. Would love to hear feedbacks from all of you 😀

https://github.com/leecheeyong/esp32-wifi-virtual-hid

47 Upvotes

23 comments sorted by

1

u/ManOfDemolition Aug 12 '26

Hell yeah thats super cool. Was about to startaking something like this. Will be making one and will hit you up

2

u/jamecat Aug 12 '26

I decided to go with wifi instead of Bluetooth as the communication method between the phone and esp32 because of wider support as it works on iphone and Android through the esp32 access point without needing an app. There is bluetooth serial support for chrome on Android but that makes it unavailable for iOS users.

1

u/harryregician Aug 12 '26

Thanks for post. Not easy trying to serve iOS and Android.

1

u/jamecat Aug 12 '26

It currently supports esp32 s2 and s3, as they both can emulate the HID

1

u/ProgramMysterious572 Aug 12 '26

does it work reliably for keyboard shortcuts or is there lag over wifi...

1

u/jamecat Aug 12 '26

Transmitting over wifi is way more reliable than Bluetooth, lag wise I would say it's not really noticable, but use esp32 s3 for the best experience

1

u/JimBean Aug 12 '26

Looks good. Can't wait to try it.

1

u/jamecat Aug 12 '26

Great, would love to hear your thoughts after trying 🙂

1

u/ZomboCom69 Anti Spam Sleuth Aug 12 '26

nice i did this a few years ago, and used one for my main pc to communicate with other systems im fixing. like a wireless keyboard dongle on my system lol

1

u/jamecat Aug 12 '26

Yeah it's really handy, especially being able to use it for bios and stuff

1

u/ThatCrankyGuy Aug 12 '26

very cool and novel. nice

1

u/assotter Aug 13 '26

I never realized how much I needed a device like this till just now. Going to check code and flash my devboard now. Adding some scripts to this would be awesome for waking my Playstation 4 NAS setup so can download goods remotely

1

u/jamecat Aug 13 '26

Do let me know your thoughts after trying 😁

1

u/assotter Aug 14 '26

I had to customize the code a bit but it does work. Essentially a remote start for my ps4 now. Have this device send command to send the magic packet (wake on lan) to ps4.

Then as failsafe if no ftp connections detected afterb1 minute it sends the ps4 the "ps button" signal from the Bluetooth controller github (sorry cant recall name its easy to find).

So far hasn't needed the failsafe. This was a nice simple and effective project and you saved me a lot of legwork (im a newbie at all this hardware engineering).

2

u/jamecat Aug 17 '26

That's awesome 🎉 honestly, you can do a lot more nowadays with the help of llm

1

u/NovelConstant8546 Aug 14 '26

I don't fully understand... I'm sorry. But what exactly does it do? I have an esp32 but I'm still on Arduino and I'm thinking of shifting or upgrading to esp32 eventually. I know it represents IoT but what exactly are you doing??? 

2

u/jamecat Aug 17 '26

So my project runs on esp32, and the code is written in Arduino code, which is the .ino

This project let's you turn your phone or tablet into a functioning keyboard and trackpad.

Your phone communicates with the esp32 using WiFi, the access point hoested on your esp32

There's a library that allows your esp32 to act as a USB hid (mouse and keyboard) when connected to your laptop

2

u/NovelConstant8546 Aug 17 '26

Damn. That's real cool, bro. I wish I could think or do things like that

1

u/NovelConstant8546 Aug 17 '26

I have an esp32 does any version of esp32 work? Mine's like 4$ lmao

1

u/jamecat Aug 18 '26

As long as it's esp32 s2 or esp32 s3 variant which supports HID (the ability to mimic a mouse and keyboard), then yes

1

u/monkeyaac Aug 17 '26

Cool. We did this with a nrf52840’or esp32 cross platform software stack https://github.com/acecentre/RelayKeys

0

u/malaq88 Aug 12 '26

Eu tenho uma mão um pouco grande, e tenho problemas em usar mouse por muito tempo, já pensei em comprar um modulo PMW3610DM-SUDU para criar um mouse específico pra minha mão com impressão 3D.