Skip to content

m66

m66 - the lego keyboard

m66 rev 4

m66 rev 4

m66 rev 4

this is a 5 rows 13 columns ortholinear keyboard plus an extra clickable rotary encoder intented to allow all the keycaps that you will find on an iso layout.

current iteration... this is a departure from the normal matrix keyboard. I am using rp2040 pro micro compatible footprint, rgb per key leds and backlight part of the chain, support for clickable rotary encoder, and oled screen, sharp memory screen, eink and ips screens.

status: rev 4 done and tested

  • gerbers designed
  • firmware
  • breadboard tested
  • gerbers printed
  • board tested

revisions

  • m66 rev4 (formerly m65 rev12) rp2040 promicro pinoout with 2 shift registers HC595, oled/lcd(ST7735 tested)/sharp/eink ssd1680 weact', clickable encoder, per key rgb, rgb backlight
  • m66 rev3 (formerly m65 rev11) xiao rp2040 with 3 shift registers 2xHC595 and 1xHC589, oled/eink(ssd1680 weact) and push rotary encoder with qmk ( actively looking into zmk firmware support for both rp2040 and nrf52840)
  • m66 rev2 (fornerly m65 rev10) xiao rp2040 with 3 shift registers 2xHC595 and 1xHC589, oled and push rotary encoder with qmk ( actively looking into zmk firmware support for both rp2040 and nrf52840)
  • m66 rev1 (formerly m65 rev9) xiao rp2040 with 3 shift registers 2xHC595 and 1xHC165, oled and push rotary encoder with qmk ( actively looking into zmk firmware support for both rp2040 and nrf52840)
  • m65 rev7/8 xiao rp2040 and nrf52840 with 2 shift registers HC595, rotary encoder and no oled, for rp2040 version both qmk and zmk firmware
  • m65 rev5/rev6 - rp2040 support, rpico, weact and other compatible clones, encoder non push, oled
  • m65 rev4 stm32f401/411, encoder non push , oled,
  • m65 rev3 stm32f401/411, encoder non push
  • m65 rev2 GD32F303 aka bluepill plus, usb C f103 equivalent, https://github.com/WeActStudio/BluePill-Plus
  • m65 rev1 STM32F103/APM32F103 or stm32f303

bom

mcus

i used few mcus over the time based on some reference boards. this makes life easier to design a keyboard since all the complicated electronics is on the mcu board. it is a great way to get into diy keyboards. while I have done handwire projects with avr, atmega32u4 i strongly advise against using them.

both these are great nice little boards, unfortunately they are micro usb and need you to burn a stm32duino bootloader on them.

all above boards have enough pins not to need any magic to get you a nice keyboard

all the mcus are qmk compatible

rev 4

revision 4

  • rp2040 promicro comptatible pinout, tested with splinky and helios like mcus.
  • or, nice!nano ble mcus

rev 3

revision 3
  • formerly was m65 rev 11

  • lego: suggested 1x2 plates(46) or 1x4 plates some colours fit better than others. bricks of same sizes if you want to use battery

  • double sided plate 16x32 studs or 2 16x16 (helps with pcb bending).... you will need to live with a compatible since lego does not make them in this size, one thing i noticed is some plates may make the pcb to slightly bend... seems gray coloured ones are ok... no idea why.
  • 4 1x1 lego tiles or eyes.(optionally)
  • optional 4 2x2 corner plates(optionally)
  • 66 signal diodes 1N4148 , do 35 or sod 123
  • 5 10KΩ tht or smd 1206 resitors
  • 1 5.1KΩ tht or smd 1206 resitors
  • xiao rp2040( and soon I hope or nrf52840), see links above.
  • 2 shift registers 74HC595, soic16 surface mount
  • 1 shift registers 74HC589, soic16 surface mount
  • 1 2n7002 FET - sot23 surface mount
  • optional, decoupling capacitors 3, 100nf
  • optional but recommended female headers for socketing the mcu.
  • pogo pins if you want a battery
  • lipo battery if you want to power it by battery.
  • socket for battery, 2 pin PH 2.0
  • rotary encoder (I got this ec11 Bourns 24 Pulse Incremental Mechanical Rotary Encoder with a 6 mm Flat Shaft but any similar shall do)
  • micro switch on/off 1p2t 4mm.
  • optional, oled 128x32 i2c (4 pins)
  • optional, dil socket 1x4 row for oled.
  • optional, eink ssd1680 from weact, 2x4 header and socket

rev 2

revision 2 superseeded by rev3
  • formerly was m65 rev 10

  • lego: suggested 1x2 plates(46) or 1x4 plates some colours fit better than others. bricks of same sizes if you want to use battery

  • double sided plate 16x32 studs or 2 16x16 (helps with pcb bending).... you will need to live with a compatible since lego does not make them in this size, one thing i noticed is some plates may make the pcb to slightly bend... seems gray coloured ones are ok... no idea why.
  • 4 1x1 lego tiles or eyes.(optionally)
  • optional 4 2x2 corner plates(optionally)
  • 66 signal diodes 1N4148 , do 35 or sod 123
  • 5 10KΩ tht or smd 1206 resitors
  • 1 5.1KΩ tht or smd 1206 resitors
  • xiao rp2040( and soon I hope or nrf52840), see links above.
  • 2 shift registers 74HC595, soic16 surface mount
  • 1 shift registers 74HC589, soic16 surface mount
  • 1 2n7002 FET - sot23 surface mount
  • optional, decoupling capacitors 3, 100nf
  • optional but recommended female headers for socketing the mcu.
  • pogo pins if you want a battery
  • lipo battery if you want to power it by battery.
  • socket for battery, 2 pin PH 2.0
  • rotary encoder (I got this ec11 Bourns 24 Pulse Incremental Mechanical Rotary Encoder with a 6 mm Flat Shaft but any similar shall do)
  • micro switch on/off 1p2t 4mm.
  • oled 128x32 i2c (4 pins)
  • dil socket 1x4 row for oled.

rev 1

revision 1
  • formerly was m65 rev 9

  • lego: suggested 1x2 plates(46) or 1x4 plates some colours fit better than others. bricks of same sizes if you want to use battery

  • double sided plate 16x32 studs or 2 16x16 (helps with pcb bending).... you will need to live with a compatible since lego does not make them in this size, one thing i noticed is some plates may make the pcb to slightly bend... seems gray coloured ones are ok... no idea why.
  • 4 1x1 lego tiles or eyes.(optionally)
  • optional 4 2x2 corner plates(optionally)
  • 66 signal diodes 1N4148 , do 35 or sod 123
  • 5 10KΩ tht resitors
  • xiao rp2040( and soon I hope or nrf52840), see links above.
  • 2 shift registers 74HC595, tht style and dip 16 sockets
  • 1 shift registers 74HC165, tht style and dip 16 socket
  • optional, decoupling capacitors 3, 100nf, or sockets with them already installed
  • optional but recommended female headers for socketing the mcu.
  • pogo pins if you want a battery
  • lipo battery if you want to power it by battery.
  • socket for battery, 2 pin PH 2.0
  • rotary encoder (I got this ec11 Bourns 24 Pulse Incremental Mechanical Rotary Encoder with a 6 mm Flat Shaft but any similar shall do)
  • micro switch on/off 1p2t 4mm.

case

3d render

the case render

parts for case

parts for case

case front

case front

case back

case back

case side

case side

assembly

this is a very rushed assembly guide but shall give you the main idea.

thickness

depending on what you want the box can come out very thin.. 1 base plate(single or double, flat or angled usage) plus pcb(1.6mm) plus one plate intermediate(3.2mm). that is thin. This shall allow you to put in a sheet of foam for sound dampening.

1 double base plate, 1 intermediate plate and pcb. 8 mm

2 layers of intermediate plates, for thicker foam sheet or for led strip which is connected by hand to the pins or holes... no jst header.

1 double base plate, 2 intermediate plate and pcb. 11.2 mm

1 full brick if you want a jst header.

1 double base plate, 1 intermediate brick and pcb. 14.4  mm

3d render

m66 rev4 splinky rp2040

m66 rev4 splinky rp2040

m66 rev3 xiao rp2040

m66 rev3 xiao rp2040

m66 rev2 xiao rp2040

m66 rev2 xiao rp2040

the 3d render rev1

m66 rev1 xiao rp2040

m66 rev1 xiao rp2040

schematic

schematic

schematic

schematic

schematic

pcb

m66 rev4 pcb

m66 rev3 pcb

m66 rev3 pcb

m66 rev3 pcb

m66 rev2 pcb

m66 rev2 pcb

m66 rev2 pcb

the pcb for rev1

m66 rev1 pcb

m66 rev1 pcb

m66 rev1 pcb

gerbers

gerbers ready to be printed at jlcpcb are available

full kicad project if you want to generate your own or modify is available here to get a specific revision see below... please note the head of the default branch is always work in progress.

kicad

  git clone https://gitlab.com/m-lego/m65.git
  cd m65
  git checkout m66-rev4
  git clone https://gitlab.com/m-lego/m65.git
  cd m65
  git checkout revision11
  git clone https://gitlab.com/m-lego/m65.git
  cd m65
  git checkout revision10
  git clone https://gitlab.com/m-lego/m65.git
  cd m65
  git checkout revision9

firmware

is qmk or zmk, I assume you already have qmk environment configured. can be downloaded, depending on the revision from list below or build by yourself

zmk

you can get the latest firmware from the repo actions just look for Build mlego workflow and the latest successful artefacts.

source for is available

qmk

you can get the latest firmware from the repo actiona just look for the latest successful artefacts.

qmk source

qmk build instructions

  # oled version
  git clone --recurse-submodules -b mlego_dev https://github.com/alinelena/qmk_firmware.git qmk-alin
  cd qmk-alin
  qmk compile -kb mlego/m66/rev4 -km uk
  qmk compile -kb mlego/m66/rev4 -km default
  # oled version
  git clone --recurse-submodules -b mlego_dev https://github.com/alinelena/qmk_firmware.git qmk-alin
  cd qmk-alin
  qmk compile -kb mlego/m66/rev3 -km uk
  qmk compile -kb mlego/m66/rev3 -km default


  #or
  make mlego/m66/rev3:uk
  make mlego/m66/rev3:default
  # copy the resulting uf2 on the mcu as per instructions.

  # eink version

  git clone --recurse-submodules -b mlego_eink https://github.com/alinelena/qmk_firmware.git qmk-alin
  cd qmk-alin
  qmk compile -kb mlego/m66/rev3 -km uk
  qmk compile -kb mlego/m66/rev3 -km default
  git clone --recurse-submodules -b mlego_dev https://github.com/alinelena/qmk_firmware.git qmk-alin
  cd qmk-alin
  qmk compile -kb mlego/m66/rev2 -km uk
  qmk compile -kb mlego/m66/rev2 -km default


  #or
  make mlego/m66/rev2:uk
  make mlego/m66/rev2:default
  # copy the resulting uf2 on the mcu as per instructions.
  git clone --recurse-submodules -b mlego_dev https://github.com/alinelena/qmk_firmware.git qmk-alin
  cd qmk-alin
  qmk compile -kb mlego/m66/rev1 -km uk
  qmk compile -kb mlego/m66/rev1 -km default


  #or
  make mlego/m66/rev1:uk
  make mlego/m66/rev1:default
  # copy the resulting uf2 on the mcu as per instructions.

pictures

m66 rev 4

m66 rev 4

m66 rev 4

m66 rev 3

m66 rev 3

m66 rev 2

m66 rev 2

m66 rev 2

m66 rev 2

m66 rev 1

keymaps/layout

layout is bellow, but since is qmk can be whatever one likes. all revisions for m66 share the same layout and keymaps, below, the ones for rev4.

layout

m66 rev4 layout

summary keymap

this is rev4 uk keymaps various layouts, except mouse keys qmk and zmk are identical.

m66 keymaps

layer 0, central legend, layer 1 left legends, layer 2 right legends, layer 3 bottom legends.

l: lighting u: unicode d: debug b: boot mcu e: erase eeprom r: reset mcu

keymap default

m66 rev4 layer 0

m66 rev4 layer 1

m66 rev4 layer 2

m66 rev4 layer 3

keymap uk

m66 rev4 layer 0

m66 rev4 layer 0

m66 rev4 layer 1

m66 rev4 layer 1

m66 rev4 layer 2

m66 rev4 layer 2

m66 rev4 layer 3

m66 rev4 layer 3

matrix-pins

rev4 rp2040 promicro footprint

m66 rev4 matrix

more to be added

rev3 seeeduino xiao rp2040

m66 rev3 matrix

more to be added

rev2 seeeduino xiao rp2040

m66 rev2 matrix

more to be added

rev1 seeeduino xiao rp2040

m66 rev1 matrix

ShiftRegister SN74HC595N

1
QB |1    16| VCC
QC |2    15| QA
QD |3    14| SER data
QE |4    13| OE
QF |5    12| RCLK latch
QG |6    11| SRCLK clock
QH |7    10| SRCLR
G |8    9 | QH*

2
QB |1    16| VCC
QC |2    15| QA
QD |3    14| SER
QE |4    13| OE
QF |5    12| RCLK
QG |6    11| SRCLK
QH |7    10| SRCLR
 G |8    9 | QH*

shift register 74HC165N

3
nPL |1    16| VCC
 CP |2    15| nCE
 D4 |3    14| D3
 D5 |4    13| D2
 D6 |5    12| D1
 D7 |6    11| D0
nQ7 |7    10| DS
  G |8    9 | Q7
Rows C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 Pins
R0 Esc 1 2 3 4 5 6 7 8 9 0 - Bksp MUTE 3D0
R1 Tab q w e r t y u i o p [ ] X* 3D1
R2 # a s d f g h j k l ; ' Enter X* 3D2
R3 Shift \ z x c v b n m , . Up / X* 3D3
R4 Ctrl Menu Lower Alt Raise Space Space Space AltGr Shift Left Down Right X* 3D4
2QB 2QC 2QD 2QE 2QF 2QG 2QH 2QA 1QH 1QG 1QF 1QE 1QA 1QD

X* not connected in circuit

Encoders

  • Pad_A: GP27
  • Pad_B: GP26

OLED

  • I2C SCL: GP7
  • I2C SDA: GP6

Leds

Leds Pin
CAPS_LOCK GP25
Lower GP16
Raise GP17
RGB DI GP12
RGB on GP11

^ only on rp2040

** 74HC595N **

  • data out MOSI: 11 - GP3
  • latch: 8 - GP1
  • clock: 9 - GP2

** 74HC165N **

  • latch: 8 - GP1
  • clock: 9 - GP2
  • data in MISO: 10 - GP4

SPI_DIVISOR 8 SPI_DIVISOR 3