Preface
It can be used for daily office work and audio and video games. The total cost can be controlled within 10 yuan.
Currently, only the 1x5 version has been made, and the 5x5 version has not been completed due to time reasons. Therefore, the current firmware only supports the 1x5 version, and there are no BUGs after testing.
Firmware burning and welding instructions
The firmware is included in the attachment, and the burning method is the same as that of general STC microcontrollers.
Firmware upgrade requires the use of a firmware upgrade tool, and the host must support serial communication (usually using a USB to serial port module). Find the UART1 interface (2.54mm pin header soldered) on the back of the product PCB, as shown on the right, starting from the square pad, connect it to the host VCC (requires 3.3v), TXD, RXD, and GND from left to right. Click to start burning and wait for completion.
IO2 of CH9328 is connected to GND, and the rest are connected to high level.
About source code
It took me two days and two nights to write the code. We are not considering publishing the source code for now. If you are interested, you can contact me at QQ1901667220 so that we can communicate and make progress together.
Features
1. Adopt STC8G (1T) high-performance main control.
2. Compatible with all mainstream operating systems, no need to manually install drivers.
3. The key scanning algorithm is optimized to ensure no accidental touches.
4. It is equipped with 4kEEPROM on the chip, which can save user configuration data when power is turned off.
5. Completely offline key editing, users can freely configure all keys.
6. Supports multiple key mapping modes, including special key-value mapping.
7. USB1.1 compatible, USB2.0 full speed mode compatible.
8. The PCB retains the UART firmware upgrade interface to facilitate future upgrades.
Instructions
◇Indicator light
The indicator light of this product is divided into two areas:
The three user indicators in the upper left corner are used to prompt the user, provide user operation feedback and display the current working mode and status of the system. See below for specific instructions;
The three in the upper right corner, from left to right, are:
◽ TLED: This light keeps flashing quickly when the device is transmitting data with the USB host.
◽ ACT: This light stays on when the USB handshake between the device and the USB host is successful.
◽PWR: This light stays on when the device is connected to the power supply.
◇ Layout
As shown in the picture below, there are 5 mechanical buttons on the front of the device, which are called ABCDE from left to right (the markings on the specific keycaps may not match, for convenience, this description will always be called ABCDE). The three LEDs in the upper left corner are LED1, LED2, and LED3.
◇Startup options
Connect the device to the host via a Micro-USB data cable, and power on the device. If you power on directly without pressing any keys, the device automatically enters keyboard mode and corresponds to different keys according to the internally stored key mapping relationships. If you power on while pressing a certain button, you will enter a certain function, as shown in the following table:
button |
Function |
illustrate |
LED prompt |
Button A |
edit mode |
Entering edit mode, users can freely edit key mappings. |
The 3 LEDs light up in sequence from left to right, and then all go off. |
Button B |
Switch preset 1 |
Switch to the preset of the corresponding label, and it will be automatically saved when the power is turned off. There is no need to switch again when the power is turned on next time. If the power is turned on again and the edit mode is entered, the corresponding preset will be edited. |
After 3 LEDs light up briefly, LED1 lights up continuously. |
Button C |
Switch preset 2 |
After the 3 LEDs light up briefly, LED2 lights up continuously. |
|
Button D |
Switch preset 3 |
After 3 LEDs light up briefly, LED 3 lights up continuously. |
|
Don't press |
keyboard mode |
Normal working mode. |
After the 3 LEDs light up briefly, the corresponding preset lights turn on continuously. |
◇Default
When you use the device for the first time, there are three sets of button presets built into the device, namely Preset 1, Preset 2, and Preset 3. Each button in each preset can be mapped to up to 5 HID codes, and each preset is independent of each other. Users can change and save it as needed. After the preset is edited, the user can press and hold any of the buttons B, C, and D when powering on to quickly switch between different presets.
◇ Edit mode
When powering on, press and hold button A to enter edit mode and edit the current preset. When entering the editing mode, the three LEDs will light up in sequence from left to right, and then turn off, indicating the current editing mode. When the 3 LEDs are off, press and hold a button until the 3 LEDs light up one after another and then flash. At this time, release the button to enter the editing state of the button. At this time, the corresponding functions of the 5 buttons are as follows:
button |
Function |
Button A |
Enter next digit or complete input |
Button B |
The first digit of the BCD code (the highest digit) |
Button C |
The second digit of BCD code |
Button D |
The third digit of BCD code |
Button E |
The fourth digit of the BCD code (the lowest digit) |
Note: The HID scan code of a button usually consists of three decimal digits (0-255). The button is bound by converting each digit into an 8421BCD code (hereinafter referred to as the BCD code) and inputting it three times from high to low. Please refer to Appendix 1 and 2 for the specific HID code table.
1. Clearing the key mapping table
In the edit mode with all three LEDs turned off, press and hold a button until the three LEDs light up and flash one after another, and then until the three LEDs turn off, stay on, and then turn off one after another, the button is cleared. At this time, the button is not bound to any HID code.
Note: If you release the button before all three LEDs go out, you can press button A three times (i.e. enter 000) to avoid operating the button mapping table.
2.Input of BCD code
3 LEDs indicate which digit of the 3-digit decimal number is currently input. LED1, 2, and 3 correspond to the hundreds, tens, and ones digits respectively. Before each round of inputting the BCD code, all bits default to 0. When one of the BCDE buttons is pressed, the corresponding bit changes to 1 (no matter how many times it is pressed, it is 1 and cannot be changed to 0. Please clear it if it is accidentally operated. operation again later). If you want to enter the decimal number 5 (corresponding BCD code is 0101), just press button C and button E and then press button A to confirm. When the last digit (units digit) of the three-digit decimal number is input, press button A, and then the three LEDs will light up and go out in sequence, indicating that the key binding has been completed, and you can edit the next key or exit editing.
Examples of input operations are as follows:
Example |
Key operation sequence |
Enter 9 (corresponds to F key) |
LED1 flashes and then stays on > Button A > LED2 flashes and then stays on > Button A > LED3 flashes and then stays on > Buttons B and E > Button A > 3 LEDs light up in sequence and then turn off > Complete |
Enter 40 (corresponds to Enter key) |
LED1 flashes and then stays on > Button A > LED2 flashes and then stays on > Button C > Button A > LED3 flashes and then stays on > Button A > 3 LEDs light up in sequence and then turn off > Complete |
Enter 240 (Corresponding to LCtrl key) |
LED1 flashes and then stays on > Button D > Button A > LED2 flashes and then stays on > Button C > Button A > LED3 flashes and then stays on > Button A > 3 LEDs light up in sequence and then turn off > Complete |
3. Single key and multi-key binding
Single-key and multi-key binding operations are similar. The difference is that the former only binds once, while the latter binds multiple times.
Each key can accommodate 5 mapping relationships. When cleared, all mapping relationships of the key will be cleared at the same time, so it is recommended to clear it first and then bind it. If you forget the key mapping relationship, you can use the Keyboard Test Utility software in the supporting documentation to check it in the normal working mode of the keyboard.
4. Exit edit mode
When the three LEDs are all off, press and hold buttons A and B at the same time until the three LEDs flash and the normal buttons are restored.
disk mode, then the corresponding preset indicator light will remain on.
Appendix 1: HID general button scanning code table (refer to USB-HID data packet transmission specification)
button |
Scan code |
button |
Scan code |
button |
Scan code |
button |
Scan code |
A |
4 |
U |
twenty four |
Space |
44 |
F7 |
64 |
B |
5 |
V |
25 |
-/_ |
45 |
F8 |
65 |
C |
6 |
W |
26 |
=/+ |
46 |
F9 |
66 |
D |
7 |
X |
27 |
[/{ |
47 |
F10 |
67 |
E |
8 |
Y |
28 |
] / } |
48 |
F11 |
68 |
F |
9 |
Z |
29 |
/ | |
49 |
F12 |
69 |
G |
10 |
1 |
30 |
... |
50 |
rtSr |
70 |
H |
11 |
2 |
31 |
; / : |
51 |
ScrollLock |
71 |
I |
12 |
3 |
32 |
'/ " |
52 |
Pause |
72 |
J |
13 |
4 |
33 |
`/~ |
53 |
Insert |
73 |
K |
14 |
5 |
34 |
, / < |
54 |
Home |
74 |
L |
15 |
6 |
35 |
./> |
55 |
PgUp |
75 |
M |
16 |
7 |
36 |
/ / ? |
56 |
Delete |
76 |
N |
17 |
8 |
37 |
Caps Lock |
57 |
End |
77 |
O |
18 |
9 |
38 |
F1 |
58 |
htK |
78 |
P |
19 |
0 |
39 |
F2 |
59 |
Right |
79 |
Q |
20 |
Enter |
40 |
F3 |
60 |
Left |
80 |
R |
twenty one |
Esc |
41 |
F4 |
61 |
Down |
81 |
S |
twenty two |
BackSpace |
42 |
F5 |
62 |
Up |
82 |
T |
twenty three |
Tab |
43 |
F6 |
63 |
NumLock |
83 |
Note 1: A scan code of 0 means no key binding operation is performed. Note 2: This table is for reference only, please correct me if there are any errors.
Appendix 2: HID control button scanning code table (this table is specially specified by the software)
button |
Scan code |
button |
Scan code |
button |
Scan code |
button |
Scan code |
L Ctrl |
240 |
L Alt |
242 |
R Ctrl |
244 |
R Alt |
246 |
L Shift |
241 |
L GUI |
243 |
R Shift |
245 |
R GUI |
247 |
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet