You can easily build a custom Wi-Fi-controlled USB keyboard using an ESP32-S2. Perfect for remote key presses, gaming macros, or custom HID devices. Hardware is cheap, software is simple, and the code is ready to use on GitHub.You can easily build a custom Wi-Fi-controlled USB keyboard using an ESP32-S2. Perfect for remote key presses, gaming macros, or custom HID devices. Hardware is cheap, software is simple, and the code is ready to use on GitHub.

How to Build a Wi-Fi-Controlled USB Keyboard With an ESP32

2025/12/08 17:56
7 min read
For feedback or concerns regarding this content, please contact us at crypto.news@mexc.com

Have you ever wanted to build your own custom keyboard — not necessarily a full 101+ keyboard, but a small, purpose-built device, or even an interface with no physical keys at all? Imagine a virtual input that accepts commands over Wi-Fi, like simple HTTP REST requests, and turns them into keyboard events on your computer.

It’s easier than you think.

Use case

Here’s what got me into this project. I often play RPGs in co-op with a friend, and my computer acts as the server. That gives me a few extra abilities he doesn’t have — like Quick Save (F5) and Quick Load (F8). The problem? Whenever I step away, he’s stuck. He can’t save or reload the game on his own.

So I wanted a simple way for him to trigger just those two keys — F5 and F8 — on my machine, without giving him full remote control. That’s all. Two keys, nothing else.

But once you start thinking about it, the possible use cases expand quickly. You could build a tiny physical keypad where each button types a whole sentence instead of a single character.

\n Or a remote keyboard that works a bit like a simplified KVM-over-IP — just without the video component.

\n Or even a DIY solution for waking a computer over USB keyboard input when the network card doesn’t support Wake-on-LAN.

And of course, HID isn’t just keyboards. It covers mice, gamepads, joysticks — basically anything that counts as a “Human Interface Device”. With the same approach described in this article, you could build any of those.

Choosing your approach

At first, I tried the software route — wrote a program that listened on a TCP port and injected keystrokes into an active application. It worked… with Notepad, but it didn’t work where it mattered: the game. I tried running as Administrator, fiddled with security profiles, and tested different things, but the simulated keystrokes never reached the game window.

That experience taught me two things. First, sending keystrokes from userland is fragile. Second, it's OS-dependent: different operating systems use different input APIs, and there can be multiple APIs in the same OS, so what works for a simple text editor will not necessarily work for full-screen applications. Finally, a pure software solution can’t handle machines that aren’t booted or are asleep.

So I switched strategies: if software injection is unreliable, let’s speak the computer’s native language. Time to move to a hardware approach.

Hardware

To make this work, I needed a device that could speak two languages at once: network on one side (Wi-Fi or Ethernet) and USB HID on the other. In other words, something that could receive commands over the network and then act as a USB keyboard when plugged into a computer — essentially a tiny Ethernet/Wi-Fi-to-USB bridge.

Raspberry Pi

My first thought was to use an old Raspberry Pi 1B I had lying around. It had USB, it had Ethernet — seemed perfect. After digging through the docs, I found how to switch its USB controller into device (peripheral) mode. Rebooted… and lost the network entirely.

Which makes total sense in hindsight: on the older Pis, the Ethernet chip is actually connected through USB. Once the USB controller switches from host mode to device mode, it stops handling the Ethernet interface. Newer Raspberry Pi models have multiple USB controllers and can make this work, but it's still a bit fiddly and not guaranteed to behave nicely.

ESP32 Microcontroller

A bit more research pointed me to a much better option: certain ESP32 microcontrollers — specifically the ESP32-S2 and ESP32-S3 — can act as a USB device and use Wi-Fi at the same time. Perfect. The S3 is more powerful and has extra features, but for this project, I didn’t need that horsepower, so I went with the ESP32-S2. The Raspberry Pi RP2040 might also work, but I didn’t test it.

And the cost? Very reasonable. An Adafruit QT Py ESP32-S2 cost me £15.90, including shipping. If you prefer the budget route, you can get a pair of no-name ESP32-S2 boards on Amazon for about £9.99.

Note on board producer.

The ESP32-S2 chip itself is made by Espressif, but different companies build their own boards around it — adding voltage regulators, USB connectors, buttons, LEDs, etc. And this is where choosing a reputable manufacturer seriously matters.

For your own sanity, consider buying from Adafruit, Seeed Studio, or any other well-known maker.

Two reasons:

  1. Their boards just work. I tried a no-name Amazon board first. Arduino IDE could detect it, but flashing failed every single time — different computers, different operating systems, different cables… nothing helped. I sent it back. The Adafruit board, on the other hand, flashed successfully on the first try.

    \

  2. They contribute massively to the community. Great documentation, clear tutorials, tons of libraries, and examples for all kinds of sensors and modules. All open, all high quality. Those extra few quid directly support the ecosystem you’re relying on.

And as a bonus, the Adafruit board comes with a tiny programmable RGB LED — super handy for showing status while the firmware runs.

Software

Programming these boards is pleasantly straightforward. There’s no operating system, no filesystem, no threads, no asyncio — just your code running directly on the microcontroller.

The program is essentially split into two parts:

  1. Initialization – This runs once at startup. Here we configure the LED, connect to Wi-Fi, switch the USB controller into device (HID) mode, and prepare anything else the board needs.
  2. Main loop – After initialization, the microcontroller runs this loop forever (or at least until power is cut). In it, we wait for incoming connections, read the HTTP request, parse the command, send the appropriate keystroke over USB, and return a small HTTP response.

Thanks to the community — especially contributors like Adafruit — you don’t have to implement low-level networking, Wi-Fi drivers, USB HID descriptors, or USB protocol handling yourself. Libraries take care of all of that. You only need to focus on the logic: how the HTTP command is encoded (I used part of the URL) and which keystrokes the board should send over USB.

The full source code is available on GitHub. Just install the Arduino IDE, clone the repository, drop your Wi-Fi credentials into the `wifi_defs.h`` file, plug in your board, and click “Upload.” A minute later, you’ll have your custom keyboard ready to go.

At the top of the code file, you’ll find a few configuration options — you can disable the Adafruit NeoPixel LED if your board doesn’t have one, change the HTTP port, or temporarily turn off the USB HID functionality (useful when debugging the HTTP handling).

Conclusion

As you can see, building your own remotely controlled USB keyboard is not only possible — it’s surprisingly easy and inexpensive. With just a small microcontroller and a bit of code, you can create a custom HID device tailored exactly to your needs, whether that’s a two-button remote for gaming, a macro pad that types full sentences, or something completely different.

The project in this article is just a starting point. You’re welcome to use the code as a foundation, modify it, break it, rebuild it, and push it in whatever direction your imagination takes you. If you end up making your own version — or come up with a fun or unusual use case — I’d love to hear about it. Feel free to share your ideas and projects in the comments.

:::info Disclaimer: I’m not affiliated with any of the companies or organizations mentioned. All hardware was purchased with my own money, and this project was not sponsored in any way.

:::

\

Market Opportunity
READY Logo
READY Price(READY)
$0.010426
$0.010426$0.010426
-1.26%
USD
READY (READY) Live Price Chart
Disclaimer: The articles reposted on this site are sourced from public platforms and are provided for informational purposes only. They do not necessarily reflect the views of MEXC. All rights remain with the original authors. If you believe any content infringes on third-party rights, please contact crypto.news@mexc.com for removal. MEXC makes no guarantees regarding the accuracy, completeness, or timeliness of the content and is not responsible for any actions taken based on the information provided. The content does not constitute financial, legal, or other professional advice, nor should it be considered a recommendation or endorsement by MEXC.

You May Also Like

200,000,000 XRP out in 2 Weeks: What’s Going On?

200,000,000 XRP out in 2 Weeks: What’s Going On?

The post 200,000,000 XRP out in 2 Weeks: What’s Going On? appeared on BitcoinEthereumNews.com. In the last 14 days, wallets with between 1,000,000 and 10,000,000 XRP have reduced their holdings by around 200,000,000 tokens. This change, displayed by Santiment data, suggests that some of these holders are leaving the mid-level group, reducing their combined holdings to around 6.74 billion XRP.  They are not small retail accounts, but they also do not match the scale of the very largest XRP players.  Such movements usually matter because of the amount of supply in control, which can influence short-term trends. Of late, these whales have clearly been reducing their holdings. The XRP price has been trending down while XRP has been levitating close to $3, bouncing between $2.90 and $3.30, without going in a clear direction.  The fact that these wallets are selling could be one of the reasons why the token has struggled to increase in value, even though the general crypto market has had a mix of positive and negative days. Why do XRP whales sell? One possibility is that these holders are simply taking profit after XRP’s climb earlier in the summer.  Another reason is caution: with the Federal Reserve’s interest rate decision coming up and money availability across markets looking uncertain, some investors may prefer to derisk their exposure now instead of holding amid price chaos. It is important to know that not all of these tokens have been moved to cold storage.  The number of XRP going into exchanges has gone up, which suggests that some of the 200 million XRP has been sent to trading platforms. This means that some of the selling pressure could be transferred to the open market if those tokens are moved directly there. Source: https://u.today/200000000-xrp-out-in-2-weeks-whats-going-on
Share
BitcoinEthereumNews2025/09/18 08:45
Smart investors earn $6,875 daily on ProfitableMining, the leading cloud mining platform.

Smart investors earn $6,875 daily on ProfitableMining, the leading cloud mining platform.

In the volatile cryptocurrency market, price fluctuations are becoming increasingly severe. Simply holding onto your coins and waiting for them to rise is no longer a safe strategy. More and more experienced investors are turning to a more stable approach—ProfitableMining cloud mining, with becoming their preferred platform. They aren’t waiting for market fluctuations; they’re generating […]
Share
Cryptopolitan2025/09/18 01:00
Worldcoin price at risk of $0.20 breakdown amid rising exchange inflows and bearish setup

Worldcoin price at risk of $0.20 breakdown amid rising exchange inflows and bearish setup

Worldcoin price has dropped over 30% this month as market sentiment remains risk-off amid geopolitical tensions in the Middle East. According to data from crypto
Share
Crypto.news2026/03/27 18:24