Specifications
| Type | A keyboard key and an RGB LED on one block, as two separate circuits: pressing the key does not light the LED |
|---|---|
| Switch | MX-style keyboard switch, blue stem, clear housing, under an 18 mm frosted clear keycap. The parts list names no maker or model |
| Key output | BUTTON reads HIGH while the key is down and LOW while it is up, through a 10 kΩ pull-down on the board. Set the pin to INPUT |
| LED | One XINGLIGHT XL-2020RGBC-WS2812B under the switch: 24 bits a colour, green first, 256 levels per colour, on its own data pin |
| Supply | Your board's logic voltage on VCC: 5V on an Uno, 3V3 on an ESP32, ESP32-S3 or Pico. A press puts VCC on the BUTTON pin. The LED is rated 3.5 to 5.5 V, so on 3V3 it runs under its rating |
| Current | 0.5 mA dark and up to 5 mA per colour for the LED, about 15.5 mA at full white; 0.5 mA at 5 V through the pull-down while the key is held |
| Pins to wire | All 4: GND, VCC, WS2812 and BUTTON. There is no NC pin |
| Header | 4-pin right-angle male, 2.54 mm pitch: GND, VCC, WS2812, BUTTON, with GND on the square pad |
| Board | 22.4 × 30.4 mm, two 4.8 mm mounting holes 16 mm apart beside the header. The back prints TK96 MECHANICAL KEY AND LED |
| Height | 24.06 mm from the bottom of the board to the top of the keycap (the mechanical drawing) |
| In the box | 1 × TK96 block with its keycap fitted. It also ships inside the TinkerBlock kits |
What it does
A keyboard key and a colour light on one block. The key is an MX-style switch under a frosted clear keycap: pressed, it joins BUTTON to VCC, and a 10 kΩ resistor holds BUTTON at GND the rest of the time, so the pin reads HIGH while the key is down. Under the switch sits one WS2812, an RGB LED with its own controller, on a separate data pin.
The two are not connected to each other. Pressing the key does not light the light; your sketch reads the key and decides what colour to send. That is what makes it useful: the colour can show a mode or a state, not only that a finger is on the key.
The page this replaces got the board backwards in places. It said the key reads LOW when pressed (HIGH), put VCC on 5V for every board (a press would put 5 V on a 3.3 V pin), described the light as a plain LED behind a resistor (it is a WS2812, with no resistor), and its sketches drove pin 13 instead of the LED.
Two things to know before wiring
- VCC is your board's logic voltage. A press puts VCC on the BUTTON pin: 5V on an Uno, 3V3 on an ESP32, ESP32-S3 or Pico. On 3V3 the LED runs under its 3.5 V rating; red holds up best.
- A press is HIGH. Set the pin to
INPUT, notINPUT_PULLUP, and debounce it if a press has to count once.
Wiring, in four lines
- GND to your board's GND.
- VCC to 5V on an Uno; 3V3 on an ESP32, ESP32-S3 or Pico.
- WS2812 to an output pin: D6 on an Uno, GPIO 4 on an ESP32, GPIO 5 on an ESP32-S3, GP14 on a Pico.
- BUTTON to an input pin: D2 on an Uno, GPIO 25 on an ESP32, GPIO 4 on an ESP32-S3, GP15 on a Pico.
Then install Adafruit NeoPixel, and the key lights red while you hold it.
Where to start
The handbook below is nine short articles, each with a working figure. The first press is the whole build. A key that remembers steps through modes, one colour each, one step per press.
For how it works, read two circuits, one key and one VCC, two jobs. If it does not behave, when it misbehaves.
When it doesn’t work
- The LED does not light when I press the key.
- It is not meant to. The key and the LED share only GND and VCC: a press sets BUTTON HIGH, and the LED changes colour only when your sketch sends it data on the WS2812 pin. Read BUTTON, then set the colour in code, as the first press sketch does.
- Does a press read HIGH or LOW?
- HIGH. The board has a 10 kΩ pull-down from BUTTON to GND, and the switch joins BUTTON to VCC. Use pinMode(pin, INPUT) and treat HIGH as pressed. The page this replaced said LOW; that was wrong.
- Should VCC go to 3V3 or 5V?
- To your board's logic voltage: 5V on an Uno, 3V3 on an ESP32, ESP32-S3 or Pico, because a press puts VCC on the BUTTON pin. On 3V3 the LED is under its 3.5 V minimum; it usually still lights, red best, green and blue dimmer. For full colour on a 3.3 V board, VCC on 5V and a 10 kΩ and 20 kΩ divider on BUTTON.
- One press counts as several.
- Contact bounce: the switch makes and breaks a few times as it closes. Accept a change only after the reading has been steady for about 20 ms, as the modes sketch does.
- Can I chain several TK96s on one data pin?
- No. The LED's data output is connected to nothing on this board, so each TK96 needs its own WS2812 pin.
- What is the difference from the TK04?
- The key circuit is the same: a switch to VCC and a 10 kΩ pull-down, HIGH when pressed. The TK04's small red LED is wired to the button and lights on its own; the TK96's WS2812 is on its own pin and does only what the sketch tells it, in any colour.