Author Topic: keyboard powered by python  (Read 4592 times)

0 Members and 1 Guest are viewing this topic.

Offline Yihui

  • Thread Starter
  • Posts: 9
keyboard powered by python
« 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.



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).



The keymap is:

Code: [Select]
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

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?



Online suicidal_orange

  • * Global Moderator
  • Posts: 3896
  • Location: England
Re: keyboard powered by python
« Reply #1 on: Mon, 22 June 2020, 04:49:29 »
Being able to change the keymap anywhere there's a text editor sounds great :thumb:
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod
MX Brown 30g, HHKBish
Vortex OEM PBT
for See how the other half lives challenge!

Online Findecanor

  • Posts: 4624
  • Location: Koriko
Re: keyboard powered by python
« Reply #2 on: Mon, 22 June 2020, 05:09:51 »
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.
Man must shape his tools lest they shape him
-- Arthur Miller

Offline Yihui

  • Thread Starter
  • Posts: 9
Re: keyboard powered by python
« Reply #3 on: Mon, 22 June 2020, 06:15:18 »
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).

Offline Yihui

  • Thread Starter
  • Posts: 9
Re: keyboard powered by python
« Reply #4 on: Sun, 05 July 2020, 22:16:06 »
The design of the keyboard PCBA is finished.



It has modular design with nRF52840 M2 module and is hot-swappable.


Offline JCraftCables

  • Posts: 52
    • Instagram
Re: keyboard powered by python
« Reply #5 on: Mon, 06 July 2020, 09:30:22 »
Cool! Who are you going to get to make the PCB?

Offline Yihui

  • Thread Starter
  • Posts: 9
Re: keyboard powered by python
« Reply #6 on: Mon, 06 July 2020, 19:48:06 »
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.

Offline Yihui

  • Thread Starter
  • Posts: 9
Re: keyboard powered by python
« Reply #7 on: Tue, 14 July 2020, 10:42:21 »
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,
you can also pre-order the keyboard PCBA at https://makerdiary.com/collections/frontpage/products/m60-mechanical-keyboard-pcba now.








Offline Yihui

  • Thread Starter
  • Posts: 9
Re: keyboard powered by python
« Reply #8 on: Tue, 28 July 2020, 09:11:41 »
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.



When holding a key down, the current is 550 uA



It is not final result yet. With further optimizing, it can be better.

Offline -Jerry-

  • Posts: 282
  • Location: Bath, UK
  • OR '1'='1'
    • Jerry Talks Tech
Re: keyboard powered by python
« Reply #9 on: Tue, 28 July 2020, 09:36:57 »
This is really interesting, excited to see how the performance increases go:)
     
     Hub16           HS60 + Tofu                  Melody96

Offline AngryCoder

  • Posts: 4
Re: keyboard powered by python
« Reply #10 on: Wed, 29 July 2020, 07:36:16 »
I love that. But what are the benefits of the nRF52840 over ESP32? I will follow this project.

Offline Yihui

  • Thread Starter
  • Posts: 9
Re: keyboard powered by python
« Reply #11 on: Fri, 31 July 2020, 10:33:22 »
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。

Offline Yihui

  • Thread Starter
  • Posts: 9
Re: keyboard powered by python
« Reply #12 on: Sat, 22 August 2020, 08:44:34 »
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.