geekhack
geekhack Projects => Making Stuff Together! => Topic started by: Yihui on Mon, 22 June 2020, 04:09:24
-
Two month ago I made a hand-wired keyboard powered by Python (CircuitPython). After spending some time to improve the python keyboard,
it has similar features like TMK/QMK based keyboards now.
(https://github.com/makerdiary/python-keyboard/blob/zh-cn/img/python-inside-keyboard.jpg?raw=true)
While, with python inside, the keyboard has some unique features. When connected to a computer, it is not just a keyboard, but also a USB drive.
The python code is in the USB drive, which make it super easy to modify keyboard code and add a extension.
To configure the keyboard's keymap, we can just edit keyboard.py in the USB drive with any text editor.
For example, use d key as a Tap-key to activate navigation functions (similar to vim).
(https://github.com/makerdiary/python-keyboard/raw/master/img/d-for-navigation.png)
The keymap is:
L1D = LAYER_TAP(1, D)
KEYMAP = (
# layer 0
(
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, '-', '=', BACKSPACE,
TAB, Q, W, E, R, T, Y, U, I, O, P, '[', ']', '|',
CAPS, A, S, L1D, F, G, H, J, K, L, ';', '"', ENTER,
LSHIFT, Z, X, C, V, B, N, M, ',', '.', '/', RSHIFT,
LCTRL, LGUI, LALT, SPACE, RALT, MENU, L1, RCTRL
),
# layer 1
(
'`', F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL,
___, ___, ___, ___, ___, ___, ___,PGUP, ___, ___, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___,LEFT, UP,DOWN,RIGHT, ___, ___, ___,
___, ___, ___, ___, ___, ___,PGDN, ___, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___, ___, ___
)
)
The project is at https://github.com/makerdiary/python-keyboard (https://github.com/makerdiary/python-keyboard)
As hand-wiring a keyboard is hard and is not for everyone, so I'm preparing a new keyboard pcb which will be powered by python.
What's your idea of a keyboard powered by python?
-
Being able to change the keymap anywhere there's a text editor sounds great :thumb:
-
BTW. I see that you are also the ones selling the microcontroller board in this keyboard.
It looks similar to a Feather board, but the pinout is not compatible. Why did you choose not to? I haven't seen any requirement for a license fee.
-
BTW. I see that you are also the ones selling the microcontroller board in this keyboard.
It looks similar to a Feather board, but the pinout is not compatible. Why did you choose not to? I haven't seen any requirement for a license fee.
Feather form factor is cool. However, when designing the board, Feather was not as popular as today. Besides, Feather is a little small to place three antennas (NFC/Bluetooth/WiFi).
-
The design of the keyboard PCBA is finished.
(https://github.com/makerdiary/python-keyboard/blob/master/img/hotswappable.jpg?raw=true)
It has modular design with nRF52840 M2 module and is hot-swappable.
-
Cool! Who are you going to get to make the PCB?
-
Cool! Who are you going to get to make the PCB?
As I'm in Shenzhen, finding a factory to make the PCB is quite easy.
-
Have been tested the keyboard PCBA. It works well. With Python firmware, its latency is about 8 ms at the moment. It's OK for daily use.
While, there are a lot to improve. Still working hard to decrease the latency and to improve power efficiency.
If you are interested, you can check our github repo https://github.com/makerdiary/python-keyboard (https://github.com/makerdiary/python-keyboard),
you can also pre-order the keyboard PCBA at https://makerdiary.com/collections/frontpage/products/m60-mechanical-keyboard-pcba (https://makerdiary.com/collections/frontpage/products/m60-mechanical-keyboard-pcba) now.
(https://cdn.shopify.com/s/files/1/0066/0865/0355/files/m60_hero_2048x_168dcced-db74-498b-94f3-01b98f24ada0.jpg?v=1593771860)
(https://github.com/makerdiary/python-keyboard/raw/main/img/m60.jpg)
(https://cdn.shopify.com/s/files/1/0066/0865/0355/files/m60-keyboard_parts_1200x_265a24a9-56ff-4904-b1f7-a59c6377a229.jpg?v=1594110086)
-
Working on reducing power consumption of the python keyboard. Right now, its current is 400 uA when Bluetooth is connected an no key is pressed.
(https://user-images.githubusercontent.com/948283/88674932-fa7ce500-d11c-11ea-93f5-50e8ac994ba4.jpeg)
When holding a key down, the current is 550 uA
(https://user-images.githubusercontent.com/948283/88674972-01a3f300-d11d-11ea-8dce-20ac94c16f51.jpeg)
It is not final result yet. With further optimizing, it can be better.
-
This is really interesting, excited to see how the performance increases go:)
-
I love that. But what are the benefits of the nRF52840 over ESP32? I will follow this project.
-
I love that. But what are the benefits of the nRF52840 over ESP32? I will follow this project.
IMHO, using ESP32 on a keyboard is not a good idea, as ESP32 doesn't have USB and is power hungry。
-
With further works, the power consumption of the keyboard is lower. 0.05mA in sleep mode. 0.16mA when bluetooth is connected.
With a 1200mAh battery, the keyboard can be standby for several months.
(https://user-images.githubusercontent.com/948283/90957345-918c5100-e4bf-11ea-896c-a65c1b0efb77.jpg)
(https://user-images.githubusercontent.com/948283/90957346-94874180-e4bf-11ea-9f2c-ef9a3ed54e38.jpg)