Owners of the Xiaomi ecosystem often face the desire to unify their devices, but the brandβs standard periphery may seem limited in functionality.The question of how to make Xiaomi a keyboard from a regular Bluetooth device or how to completely reflash the existing model is becoming increasingly relevant for enthusiasts.
There are two main ways to do this: software emulation via a smartphone and hardware flashing of the controller. The first option is available to everyone and does not require soldering, the second makes the device a unique tool for automation. We will examine both methods, paying special attention to technical nuances and risks.
Before you start modifying hardware, you need to clearly understand the architecture of the connection. Bluetooth Low Energy (BLE) protocols used in smart home devices have their own encryption and data transfer features. Incorrect interference can lead to the device becoming a βbrickβ, so carefully study each step of the instructions.
Software emulation of the keyboard through a smartphone
The safest way to turn a Xiaomi phone into a full-fledged keyboard for a PC or TV is to use specialized emulator applications, which do not require opening the cases and allows you to test various key configurations without risking damage to the electronics.
To implement it, you will need an Android smartphone and an application that supports the HID (Human Interface Device) profile. Popular solutions like Serverless Bluetooth Keyboard & Mouse or Remote Mouse allow you to stream clicks over Bluetooth. It is important to note that for stable operation, you need to provide the application with appropriate permissions in the system.
β οΈ Note: When using third-party keyboards via Bluetooth, make sure you do not enter sensitive data (passwords, bank codes) on untrusted devices, as traffic may be vulnerable.
Set up the emulation takes only a few minutes. After installing the application, go to Settings β Connected devices β Pair a new device on the receiving gadget (PC or TV).
- π± Download the emulator app from Google Play or APK-repository.
- π Turn on Bluetooth on both devices and pair.
- βοΈ Configure the key layout in the application interface for your needs.
- π Check the multimedia keys and volume.
However, this method has its limitations related to input lag. This is not critical for office work, but in games or fast typing, the delay can be anywhere from 50 to 150 ms, which is palpable for the user.
Hardware flashing of the keyboard controller
Those who want to make a real Xiaomi-like keyboard with Mi Home support or custom macros will need hardware intervention. JD640 or BK3231, quiz UART-interface.
The process starts with disassembling the device and finding test points on the board. You will need a USB-TTL adapter (for example, based on the CH340 chip) to connect to TX, RX and GND contacts. The main task is to find the dataset on the controller and find the appropriate firmware damper.
sudo flashrom -p ch341a_spi -w custom_xiaomi_firmware.binThis command (conditional, depending on the programmer) demonstrates the principle of writing new code to the device memory. After successful firmware, the keyboard can begin to be defined in the system as a device with Vendor ID from Xiaomi, which will allow you to use specific drivers.
- π Find contacts. UART on the board (usually marked as TX, RX, GND, VCC).
- π» Connect the programmer while observing polarity (VCC plug in!).
- πΎ Consider the current firmware to create a backup before writing a new one.
- β‘ Write a modified binary file with support for the desired functions.
The complexity of the method lies in the variety of controllers. There is no one universal firmware for everyone, so often enthusiasts have to adapt the open source code of QMK or ZMK to a specific hardware.
βοΈ Checklist for reflashing preparation
Using Mi Home to Automate Entry
If your goal is not physical flashing, but the integration of the keyboard into the smart home, then the Mi Home app will be a key element. Xiaomiβs standard keyboards (such as the BM30 or LYY9004 model) support the creation of scenarios where pressing a certain keyboard combination triggers action in the smart home.
To set up, go to the device profile in the app and select the Smart Scenarios section, where you can trigger the press of any button, for example, Fn + F1 can turn on the light in the living room, and Fn + F2 can start the robot vacuum cleaner.
However, standard functionality is limited. To expand the capabilities, users often use a bundle of Home Assistant and integration Xiaomi Gateway 3. This allows you to throw keystroke events into the local network, bypassing cloud servers.
| Keyboard model | Type of connection | Support for Mi Home | Possibility of macros |
|---|---|---|---|
| Xiaomi Wireless Keyboard | Bluetooth 3.0 | No. | Only through the LA. |
| Mi Smart Keyboard Folio | Pogo Pin / BT | Partially. | Through applications |
| Xiaomi BM30 | Bluetooth 5.0 | Yes. | Yes (scripts) |
| Yeelight Mechanical Keyboard | USB / BT | Yes. | Complete (RGB + Macro) |
It is important to understand the difference between on-premises and cloud-based scripting, and if the Internet goes down, cloud scripting wonβt work, so itβs better to use on-premises integrations for mission-critical functions (such as calling an alarm).
Why is the keyboard not visible in the Mi Home?
Creating custom macros and reassignment
Turning a regular keyboard into a professional tool is possible through reassignment of keys at the operating system level. In the Android and Windows environment, there are powerful tools that allow you to emulate the behavior of the branded Xiaomi peripherals.
And on Android, the Button Mapper or MacroDroid app is perfect for this, and it lets you intercept keyboard events and swap them for any other action you want: launching apps, changing volume, emulating swipes, which is especially useful if your keyboard has extra buttons.
In Windows, the analogue is AutoHotkey or PowerToys Keyboard Manager. AutoHotkey can completely change the logic of the device, for example, you can make the keyboard work like a media player control panel when you press the right mouse button.
Example of AutoHotkey script for multimedia emulation
F1::Send {Media_Play_Pause}
F2::Send {Volume_Up}
F3::Send {Volume_Down}
CapsLock::Send {Esc}This approach allows you to adapt any Bluetooth keyboard to the tasks of the media center or game console, the main advantage is that there is no need for soldering and the ability to roll back changes at any time.
- π Install a scripting manager (AutoHotkey, Tasker, MacroDroid).
- π Identify the Key Codes of your keys for precise mapping.
- π§© Create a profile for a specific application or global profile.
- π Test macros for conflicts with system hotkeys.
Eliminating delays and optimizing Bluetooth
One of the major problems with custom keyboard design or emulators is the latency of input, which becomes critical in games or in fast printing, and delays are often caused by energy-saving Bluetooth stack algorithms.
To minimize lags on Android, you can try turning off the βBluetooth MAPβ option in the developer settings, although this is not always available. On Windows, it is worth checking in which mode the adapter is running: sometimes switching from power saving mode to high performance mode gives a noticeable increase.
β οΈ Attention: Interference between Wi-Fi (2.4GHz) and Bluetooth signals can cause cursor jerks. USB-Wi-Fi and Bluetooth adapters are farther apart or use an extension cord for the adapter.
Also worth paying attention to is the Bluetooth version. Devices with Bluetooth 5.0 and higher support have a more stable communication channel and lower latency compared to the older versions of 3.0 or 4.0. If you build a keyboard from scratch, choose modules with BLE 5.x support.
π‘
To reduce delays in games, disable background applications that use Bluetooth (earphones, fitness trackers) to free up the communication channel for the keyboard.
FAQ: Frequently Asked Questions
Can I reflash the regular Logitech keyboard in Xiaomi?
Is it safe to use modified firmware?
Do Mi Home macros work without the internet?
Which adapter is better for reflashing controllers?
π‘
Creating a full-fledged Xiaomi keyboard from a third-party device is a complex process that requires knowledge in electronics. For most users, software emulation and macro tuning will be the optimal solution.