Dec 23, 2023

P2PPCB mainboard mainly for bespoke / handmade keyboards?

P2PPCB mainboard Bob / Charlotte are mainly for prototyping. We can imagine mainboard mainly for bespoke / handmade keyboards. I think it should be wireless and small at any cost.

About small, I have an idea. Bottom entry surface mount female header is it (http://www.yinghuachina.com/Products/973.html). The header is 2 mm height and this is nearly equal to the height of Bluetooth module. The mating connector is 5 mm height from PCB surface. Surface mount header is fragile, but low profile worth the price in this case. Soldering IDC connector to PCB is an option, but I feel it doesn't worth because such IDC connectors have 2 mm through hole wire leads (I haven't seen surface mount IDC connector with 2.00 mm pitch) so the actual saving from bottom entry surface mount female header is just 1 mm if the PCB thickness is 1.00 mm.

About wireless, this is much harder problem than everyone expects.

The stumbling block 1: shipping

Bespoke / handmade keyboards should be shipped as complete products. Li-ion battery is almost impossible to ship with air service. NiMH battery is not impossible but notorious. Non-rechargeable battery is preferable.

The stumbling block 2: battery enclosure

We need an embedded-style battery enclosure. It should be 2xAAA and single row. Sadly, there is no such product on the market now. All available products are two row and it makes keyboards unacceptably bulky. Bespoke / handmade keyboards should not be cumbersome.

How about integrating battery enclosure to keyboard's cover, just like common products? IMHO there is little hope to make it durable, reliable, compact, toolless, rattle-less, and easy-to-use. 3D-printed resin is much more fragile than engineering plastics (usually ABS).

If 2xAAA, single row, embedded-style battery enclosure once becomes available for purchase, I will return to the idea of mainboard mainly for bespoke / handmade keyboards.

Oh, one more problem...

The stumbling block 3: first touch lag in power saving state

This is unacceptable for bespoke / handmade keyboards. I believe Bluetooth 5.3's connection subrating resolves this problem. But the majority of PC now don't have Bluetooth 5.3 yet.

Dec 22, 2023

Design of mainboards, or thank you Raspberry Pi Foundation!

P2PPCB platform is mainly for prototyping, partly for bespoke / handmade keyboards, and never for mass production. So the production quantity of P2PPCB components will be quite small. It makes the cost math very different from mass production.

The symbol of the small quantity cost math is Raspberri Pi Pico on mainboard Bob / Charlotte. It may look odd from the viewpoint of mass production, but it is reasonable for P2PPCB.

The unit price of Raspberry Pi Pico is 4.00 USD (Digikey). It has micro USB type B connector, tactile switch, 2MB external flash memory, power regulator, LED, and RP2040 (MCU). The BOM cost exceeds 4.00 USD for small quantity production.

Another merit is 2-layer PCB. Mainboards of full size keyboards require a lot of matrix wires. 12 wires for column and row each at least. More wires can be required for many reasons. So mainboard Bob / Charlotte have 12 and 16 wires for normal column and row. And such many lines often require expensive 4-layer PCB. To accommodate such many wires in smallest 2-layer PCB, we must have careful planning and clever hacks. Raspberry Pi Pico helps the job much because it shoulders USB and power regulator circuits. Thank you Raspberry Pi Foundation!

The figure below shows a hack.

74HC164 is an 8-bit parallel-out serial shift register. The order S6-S4-S2-S0-S1-S3-S5-S7 looks odd. This is for minimizing PCB. The figure below tells it.

As you can see, through hole connector header is not very good to minimize PCB. However surface mount connector header easily comes off when you pull a connector.

Dec 20, 2023

I2C split of P2PPCB mainboard Charlotte

QMK split keyboard interface is usually UART except AVR. But I chose I2C to mainboard Charlotte.

Qwiic (3.3V 4-pin I2C connector) is necessary for many accessories like OLED display or rotary encoder. If I adopt UART, the mainboard should have another connector. The connector occupies a certain area and makes the mainboard bigger. But mainboads should be small, really small, and of course, really really cheap (this is a big lesson of mainboard Alice).

This is a story of I2C split implementation on RP2040.

Structure

I2C is a protocol between single master and multiple slave. Master-to-master is not available. So a hand (usually connected to PC via USB) should be a master and the other hand should be a slave.

P2PPCB mainboard Charlotte has RP2040. QMK on RP2040 uses ChibiOS. ChibiOS doesn't support I2C slave. So the implementation of I2C slave is inevitably a dirty hack.

ChibiOS build system has "Community HAL" mechanism. "keyboard/p2ppcb/charlotte/hal_community.h"  (https://github.com/hajimen/qmk_firmware/blob/p2ppcb/keyboards/p2ppcb/charlotte/hal_community.h) can be included from the tail of "hal.h"  (https://github.com/qmk/ChibiOS/blob/0062927e3058a8b5ef587234bbd98d42fb4e595e/os/hal/include/hal.h#L344). The "hal_community.h" includes "charlotte_i2c.h" (https://github.com/hajimen/qmk_firmware/blob/p2ppcb/keyboards/p2ppcb/charlotte/charlotte_i2c.h). "charlotte_i2c.h" includes "hal_i2c.h" (https://github.com/hajimen/qmk_firmware/blob/p2ppcb/keyboards/p2ppcb/charlotte/charlotte_i2c.h#L61), but it is already once included in "hal.h"! (https://github.com/qmk/ChibiOS/blob/0062927e3058a8b5ef587234bbd98d42fb4e595e/os/hal/include/hal.h#L313). Yeah, this is a dirty hack.

"charlotte_i2c.c" and "charlotte_i2c_lld.c" structure are mimics ChibiOS's. "keyboards/p2ppcb/charlotte/i2c_master.c" (https://github.com/hajimen/qmk_firmware/blob/p2ppcb/keyboards/p2ppcb/charlotte/i2c_master.c) is not far from "platforms/chibios/drivers/i2c_master.c" (https://github.com/hajimen/qmk_firmware/blob/p2ppcb/platforms/chibios/drivers/i2c_master.c). "keyboards/p2ppcb/charlotte/i2c_slave.h" is almost a copy of "platforms/avr/drivers/i2c_slave.h" (https://github.com/hajimen/qmk_firmware/blob/p2ppcb/platforms/avr/drivers/i2c_slave.h).

In short, the structure is a patchwork from existing codebase.

Hardware

RP2040 has dedicated hardware for I2C. It is IP of Synopsys, DesignWare DW_apb_i2c. This is a big state machine and (needless to say) the states can be changed by inputs from I2C lines. Writing bitbang I2C code is a piece of cake because the states never fluctuate unless CPU changes them. But DW_apb_i2c is... a hell. Of course it raises interrupts too. ISR is another hell. "__not_in_flash_func" macro is fatally important to make ISR efficient enough.

Synopsys DesignWare DW_apb_i2c Databook describes everything in 292 pages PDF. If you need to debug "charlotte_i2c_lld.c", you should fully know the 292 pages. It might look roundabout, but "Haste makes waste" in this case.

Other MCUs

DW_apb_i2c may be used by other MCUs someday. Actually this post is mostly for the day and for the person who is going to implement I2C split.

The code in keyboard/p2ppcb/charlotte itself is dedicated for RP2040. But the dependency is not deep. Just find equivalents of "I2C_IC_*", "PAL_MODE_*", and "GP*" and replace. ChibiOS dependency is deep. In this case, it might be better to consider bitbang I2C. I haven't seen non-blocking I2C code of DW_apb_i2c except mine.

Dec 19, 2023

Tidbits of Junana

1u / Convex 1u can do 16 mm pitch

The figure below is the footprint of Junana 1u. Yes you can make 16 mm pitch keyboards with Junana 1u.

Common 1u keycaps' width is 18 mm. 1 mm gap is normal. Junana's 1.7 mm gap is large. This design is partly for 16 mm pitch, and partly for ergonomic-looking keyboards. You can rotate neibouring two 1u keycaps up to 10° on 17 mm pitch keyboards.

Why 17 mm pitch?

It comes from the stiffness of P2PPCB frame. Narrower pitch means less stiffness. With Kailh Choc V2 17 mm pitch, the gap between switches is 3.05 mm. It is almost the limit. So you can make 16 mm pitch keyboards by common way (steel plate or PCB mount).

Spheroid-ish top

Have you carefully looked at common keycaps? Sherlock Holmes said "You see, but you do not observe." Please pick up an Cherry or OEM profile ZXCV row keycap, and look at the left / right sides. Is it straight? No, it is curved. Have you ever recognized it?

Keycaps' shape is a large and deep domain.

Cherry and OEM profile has cylindrical top. It is good for dye sublimation (IBM Model F is the earliest one). The trend went to cylindrical top in 1980s, and 40 years later (now), spherical top is in fashion.

If you have cylindrical and spherical ones both, please compare the curve. Cylindrical top has much larger curvature than spherical top. It comes from the shape of human fingers. Human fingers are alike cylinder. If spherical top has large curvature like cylindrical top, the near edge of keytops bites your finger.

Is small curvature OK? Almost everything is OK in this industry because you will adapt almost everything soon, hahaha... Yes, OK, but I am not happy enough with it. It makes the look of keyboards dull.

The top shape of Junana is not spheroid, spheroid-ish. It has another long story. BTW in P2PPCB parts model it is modelled as spheroid for faster computation.

Dec 18, 2023

The objectives, achievements, and pros / cons of Junana

Junana is not an one-size-fits-all thing.

Making PBT keycaps requires injection molding. The technology is for mass (usually several millions) production. The molds are quite expensive. By producing millions of pieces from a set of molds, the price per piece becomes quite cheap. So we live among billions of one-size-fits-all things which are produced by injection molding.

In most cases, it makes us happy enough. In some cases, not. I was not happy enough with one-size-fits-all thing in this case.

The objectives of Junana:

  • 17 mm pitch
  • low profile
  • dye sublimation printable on all sides (except bottom) with reasonable price

These objectives have a price. Not only money, but also the feeling of touch and look. Honestly speaking, Junana keycap is filmsy. Low profile unavoidably results low stiffness. Sink mark is visible. It comes from thin top.

I will explain why these objectives worth the price.

17 mm pitch

Narrow pitched keycap is also good for common 19 mm pitch keyboards. The figure below shows a common case when you are making ergonomic-looking keyboards:

The center-to-center distance is 19 mm, but the keycaps interfere with each other.

Of course 17 mm pitch keyboards are also good. 19 mm pitch comes from the age of non-electric typewriters. In the age, professional typists should hit keys with adequate and even force. 19 mm pitch is good for such pianist-like manipulation. Many studies suggest a bit narrower pitch is better in current situation. Moreover, 17 mm pitch reduces the occupying space 20%!

Other cons of 17 mm pitch:

It looks sparse on 19 mm keyboards. On 17 mm:

On 19 mm:

Low profile

Smaller, lower, cheaper... They are good things as far as they don't cost much.

Low profile switches are available on the market. Kailh Choc V1 / V2, Gateron Low Profile, etc. But I didn't have white blank PBT keycaps to fit with them!

Many low profile switches have manufacturer's own mating system. Such system lacks an ecosystem which is large enough to pay the initial cost of injection molding. But Kailh Choc V2 and Gateron Low Profile have Cherry MX stem, so the keycaps fittable with them are also fittable with Cherry MX compatible keycaps. This is the choice of Junana.

(BTW I didn't check Cherry MX Low Profile yet)

Other cons of low profile:

It is irrelevant on Cherry MX compatible switches, and they are the majority of the market now.

Dye sublimation printable on all sides (except bottom) with reasonable price

I have ran DecentKeyboards for years. Again and again I asked white legends on colored keycap. You may not be interested in such thing, but I know the value.

With usual way (double shot), it requires 20,000 USD as initial cost. 3D dye sublimation can print on all sides, so it can make white legends on colored keycap. But the price per piece is 10 USD at least (if the keycap is common thing and the misalignment tolerance is under 0.5 mm).

Junana is carefully designed to achieve the objective.

Junana's height is low. This is partly because the low profile switches, and partly for the objective. Higher profile requires higher running cost.

The price of achievement is not limited to money. The feel of use can be a sacrifice. Junana has long skirt on the front side. This is for the feel of use. The figure below is a cross section of a keyboard with Junana:

When your finger moves from near to far (from left to right in the figure), sometimes your fingertip rubs the front side of keycap. I tested many 3D-printed prototypes and found the phenomenon. Without the skirt, the fingertip rubs the edge of a keycap and it is uncomfortable. If the keyboard is flat, it may be not a serious problem. But my P2PPCB is for 3D-shaped keyboards!

Moreover, the skirt is good to show front side color or legend, instead of showing switches. I am a maker of keycaps, not switches:-)

Other cons:

Front side printing is not very accurate. Look at the photos below:

It is the balance of accurary and running cost. If you are willing to pay much, I can do much better.

New products from DecentKeyboards

I am excited to announce the new products from DecentKeyboards.

Brand new and original profile keycap, Junana

I am a big fan of low profile switches. But on the market before, there was no suitable keycap for me. So I decided to produce one myself. It is Junana.

The main features of Junana MX:

  • MX stem
  • fits with Cherry MX compatibles, Gateron Low Profile, and Kailh Choc V2
  • PBT
  • designed for 17 mm key pitch
  • spheroid-ish top and geeky look
  • convex and concave
  • width variation: 1u, 1.5u, and 2.25u
  • dye sublimation printable on all sides seamlessly (except bottom)

Blank and printed Junana MX keycaps are now available for purchase!

Keycap set design tool, keycap-designer

The design process of keycap sets has some unique problems. keycap-designer offers the solution. Junana is of course the main target. XDA (9.5 mm height) is also available.

The learning curve is a bit steep. If you are not going to design a keycap set or very elaborate thing, not worth a look.

You can order custom printing by just sending me the preview PDF of keycap-designer.

Windows PC or Mac is required.

Download from here: https://github.com/hajimen/keycap_designer

Software / hardware complex for rapid prototyping of 3D-shaped keyboards, P2PPCB

P2PPCB platform helps you to create 3D-printed 3D-shaped keyboards.

The main features of P2PPCB:

  • all softwares are open-source or charge-free for hobbyists
  • hand-soldering free
  • MX / Choc V1 / Choc V2 / Gateron LP switches are available
  • XDA (9.5 mm height) / DSA / Cherry / OEM / Kailh Choc V1 / Junana MX keycaps are available
  • switch LED available
  • the firmware is QMK
  • Windows PC (recommended) or Mac is required

This is an example of P2PPCB artifact:

Start from here: https://github.com/hajimen/p2ppcb_software

Jan 31, 2020

Color management for dye sublimation

Now I can print very precise color on Cherry MX OEM profile keycaps. (Not for Model M keycaps, sorry)

I made a general solution. You can use it too. It is very good for common photo printing too. Do your printer and its ICC profile play like this?

Moreover, you don't need a colorimeter for the solution. Instead, just a flatbed photo scanner.
It is an online service. What you should do is, download, print, scan, and upload.
The solution is Zygomatic Color.

Spend $50 get your ICC profile!