Live data from Hacker News

A hand-wired USB and Bluetooth keyboard powered by Python

github.com

11–20 of 29 posts

Re: A hand-wired USB and Bluetooth keyboard powered by Python

#11
post #8

Honestly, why Python? Writing a much faster equivalent in C really isn't any more complicated...

Just for fun :)

The hardware includes a QSPI flash which presents as an USB storage that stored Python source code, and you can modify Python directly.

BTW, It provides a new way to validate your hardware product ideas quickly.

Re: A hand-wired USB and Bluetooth keyboard powered by Python

#13
post #11
post #8

Honestly, why Python? Writing a much faster equivalent in C really isn't any more complicated...

Just for fun :) The hardware includes a QSPI flash which presents as an USB storage that stored Python source code, and you can modify Python directly. BTW, It provides a new way to validate your hardware product ideas quickly.

Solid answer. I just realised my question sounded cynical - which wasn't my intention.

Re: A hand-wired USB and Bluetooth keyboard powered by Python

#14
post #7
post #6

Earlier quoted context omitted.

It is a bit slow. It takes 4 ms to scan the matrix once right now. With some optimizations, it may be faster.

Would Numpy be of use? Haven't looked at the source yet, but for a keyboard, 4 ms per matrix would be noticeably laggy, especially if you add debouncing (is that even a thing in keyboards?)

It's a microcontroller. It has maybe 512k of storage and 128k of memory. The Numpy package probably is ~100Mb

The controller is running CircuitPython which is a fork of MicroPython - a tiny re-implementation Python for microcontrollers.

Re: A hand-wired USB and Bluetooth keyboard powered by Python

#15
post #7

Earlier quoted context omitted.

Would Numpy be of use? Haven't looked at the source yet, but for a keyboard, 4 ms per matrix would be noticeably laggy, especially if you add debouncing (is that even a thing in keyboards?)

It's a microcontroller. It has maybe 512k of storage and 128k of memory. The Numpy package probably is ~100Mb The controller is running CircuitPython which is a fork of MicroPython - a tiny re-implementation Python for microcontrollers.

Valid point! Might still be able to get a speed up if you can write and import your own C code though.

Re: A hand-wired USB and Bluetooth keyboard powered by Python

#16
post #7

Earlier quoted context omitted.

Would Numpy be of use? Haven't looked at the source yet, but for a keyboard, 4 ms per matrix would be noticeably laggy, especially if you add debouncing (is that even a thing in keyboards?)

How would 4ms be noticeably laggy?

I read it first as 4ms per row, but yeah 4ms per scan wouldn't be too bad. There is of course additional time taken for communication etc, which might take another 4-10ms, which could make it almost a frame behind. Not terrible still.

Re: A hand-wired USB and Bluetooth keyboard powered by Python

#17
post #9
post #7

Earlier quoted context omitted.

Would Numpy be of use? Haven't looked at the source yet, but for a keyboard, 4 ms per matrix would be noticeably laggy, especially if you add debouncing (is that even a thing in keyboards?)

The best usb keyboard should have 1ms latency due to USB HID interrupt interval. 4 ms is not that bad.

Yeah, read it as 4ms per row at first. Should be fine for general use, and rather impressive as is :)

Re: A hand-wired USB and Bluetooth keyboard powered by Python

#19

Nice, if I made it I would replace the capslock with control and "~" with escape. Make the least used keys require combinations, not the often used ones.

CAPS -> control I can follow, but the ~ key ... Man, that would be annoying as hell.
Post reply on HN