Skip to the content
2 layers240 × 100 mmKha bgt extend, the printed circuit board in 3D

Kha bgt extend

kiu/kha5

Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

Size
240 × 100 mm
Copper layers
2
Thickness
1.6 mm
Parts
69
Nets
58
Pads
230
Tracks, vias
339, 49
Pours
1
Routed
Yes
KiCad
KiCad 7 (file 20221018)
Created
16 Apr 2023
Updated
1 Nov 2026

Overview

Kha bgt extend is an open-source printed circuit board by kiu, from the kiu/kha repository on GitHub. It is a 2-layer board of 240 × 100 mm with 69 parts on 58 nets, routed with 339 tracks and 49 vias.

It is built around the DMG2302U. Its parts include 22 resistors, 12 diodes, 10 transistors and 9 connectors. It belongs with the interfaces and adapters boards of this library.

Main components

1

README

README.md

kha

Overengineered Modular RS-485 Multi-Master 19" Subrack Home Control

Repository

Hint: "bgt" is German for Baugruppenträger translating to subrack assembly

Protocol

RS-485 at 500 kbaud (8N1), half duplex, every node may send. Commands, addresses and registers are listed in kha-protocol.ods.

Frame

text
0x42 0x99 <len> <from> <to> <cmd> <payload ...> <crc>
  • 0x42 0x99 starts a frame. Inside a frame every 0x42 is followed by an extra 0x66, so 0x42 0x99 is always a start. The escape bytes are not counted and not part of the CRC.
  • len counts len, from, to, cmd, payload and crc: 5 + payload, payload up to 67 bytes.
  • CRC-8 (polynomial 0x31, init 0xFF, no final XOR) over all bytes from len to the last byte before the CRC.

Bus access

  • The stack counts 100 µs ticks on TCB2, which is reserved for the stack. Every falling edge on RX resets the count.
  • A node sends once the bus has been quiet for 10 + its own address ticks (1 ms + address × 100 µs). Addresses are unique, so no two nodes wait for the same slot.
  • After sending, a node waits once for the longest slot (10 + 0xF0 ticks), so the others get their turn first.
  • The bootloader commands F9–FC skip the slot wait to keep flashing fast: send TX off (F0) to the other nodes before flashing.

Firmware

  • Flash: bootloader at 0x0000–0x3FFF, app at 0x4000–0xFFFF. At every boot a node computes a CRC-32 over 0x4000–0xFFFF (without the final XOR) and reports it with the boot and app versions in its UP (E2) and ident (E1).
  • Bootloader: after a reset it waits 4 s for bootloader commands (FD keeps it there), then starts the app. Brown-out detection at 2.85 V. No lock bits, so UPDI can read and write a node.
  • Flashing over the bus: kha_fw.py; via UPDI: kha_updi.py.

Bus health page

kha-web shows the state of every node on a static web page: missing nodes, error counters, days since the last reboot, and whether nodes of the same board type run the same firmware. A collector follows the gateway's log passively, keeps the state in SQLite and exports a JSON file for the page. Screenshot with mock data:

Videos

Two hour deep dive lecture style video on youtube: https://youtu.be/BUSnTUGKZzc

kha on youtube

Photos

Misc

  • All PCBs use eAVR as connector for AVR flashing
  • It all started simple with lightdesk

Todo

  • Node: LED marquee node
  • Node: IrDA bridge (bridging the bus through a window)
  • Stack: Combine queued TX commands into single burst?
  • Stack: Merge similiar queued TX commands into single command?
  • Stack: Process TX commands as incoming RX commands?

Regrets

  • Terrible collision detection / avoidance
  • Buck converter capacitor generates audible noise

License

This project is licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0) license.

Parts

69
QtyValueFootprintReferences
16TestPointTestPoint:TestPoint_Keystone_5010-5014_MultipurposeTP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16
12RResistor_SMD:R_0805_2012MetricR1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12
1010RResistor_SMD:R_0805_2012MetricR13, R14, R15, R16, R17, R18, R19, R20, R21, R22
10DMG2302UPackage_TO_SOT_SMD:SOT-23Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10
10yellowLED_SMD:LED_0805_2012MetricD3, D4, D5, D6, D7, D8, D9, D10, D11, D12
2Conn_01x02Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ6, J7
2Conn_02x02_Odd_EvenConnector_PinHeader_2.54mm:PinHeader_2x02_P2.54mm_VerticalJ1, J2
2DIN41612_02x16_ACConnector_DIN:DIN41612_C2_2x16_Male_Horizontal_THTJ3, J4
2RJ45_Shieldedkiu:GDLX-S-88KJ8, J9
2greenLED_SMD:LED_0805_2012MetricD1, D2
1Conn_02x06_Odd_EvenConnector_PinHeader_2.54mm:PinHeader_2x06_P2.54mm_VerticalJ5

More from kiu/kha

12
  • 2 layers425.5 × 128.3 mmKha bgt backplane, the printed circuit board in 3D

    Kha bgt backplane

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    67 parts5
  • 2 layers426.7 × 128.3 mmKha bgt backplane, the printed circuit board in 3D

    Kha bgt backplane

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    67 parts5
  • 2 layers70 × 58 mmKha led ikea node, the printed circuit board in 3D

    Kha led ikea node

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    33 parts5
  • 2 layers320 × 11 mmKha led ikea kallax, the printed circuit board in 3D

    Kha led ikea kallax

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    32 parts5
  • 2 layers48 × 50 mmKha led ikea node, the printed circuit board in 3D

    Kha led ikea node

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    31 parts5
  • 2 layers160 × 100 mmKha bgt generic base, the printed circuit board in 3D

    Kha bgt generic base

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    30 parts5
  • 2 layers350 × 33 mmKha led ikea oxberg40, the printed circuit board in 3D

    Kha led ikea oxberg40

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    30 parts5
  • 2 layers50 × 50 mmKha led ikea node, the printed circuit board in 3D

    Kha led ikea node

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    30 parts5
  • 2 layers50 × 53 mmKha remote, the printed circuit board in 3D

    Kha remote

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    29 parts5
  • 2 layers48 × 50 mmKha led ikea node, the printed circuit board in 3D

    Kha led ikea node

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    28 parts5
  • 2 layers200 × 10.2 mmKha led ikea rx4, the printed circuit board in 3D

    Kha led ikea rx4

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    28 parts5
  • 2 layers160 × 100 mmKha bgt audio base, the printed circuit board in 3D

    Kha bgt audio base

    kiu/kha

    Overengineered Modular RS-485 Multi-Master 19" Subrack Home Automation / Control

    25 parts5

Similar boards

  • 2 layers69 × 72 mmMMv3, the printed circuit board in 3D

    MMv3

    MrCroesus/MMv3

    MMv3 is the 3rd generation robot platform used to teach the IEEE Micromouse DeCal at UC Berkeley. It was designed with usability, manufacturability, size, and cost in mind.

    47 parts16Apache-2.0
  • 4 layers40 × 19 mmRom2k40, the printed circuit board in 3D

    Rom2k40

    mengstr/Rom2k40

    EPROM emulator based on RP2040

    28 parts12
  • 4 layers45.7 × 90.3 mmIo v2-Board, the printed circuit board in 3D

    Io v2-Board

    Maeswoon/UNHSEDS

    great people building dream rockets

    81 parts11
  • 2 layers101.6 × 31.8 mmPico 12vrgb controller, the printed circuit board in 3D

    Pico 12vrgb controller

    bluekeyes/pico-12vrgb-hid-controller

    4-pin RGB controller using the Pi Pico and USB HID

    20 parts9MIT
  • 2 layers54.1 × 48.6 mmE Fidget V3, the printed circuit board in 3D

    E Fidget V3

    miameows/E-Fidget

    Hi there! There's a lot of moving parts with this project right now, so why don't you check out my latest blog post for more info?

    29 parts6MIT
  • 2 layers75.1 × 100 mmZamkonator, the printed circuit board in 3D

    Zamkonator

    alufers/Zamkonator

    RFID access-control board with PoE and Wiegand

    182 parts5
  • 2 layers22 × 44.1 mmSao candle, the printed circuit board in 3D

    Sao candle

    exclamationMarek/skeuomorphicer-candle-sao

    A more skeuomorphic, electronic candle, that you turn on using a flame and turn off by blowing on it. A SAO version of my standalone skeuomorphicer candle.

    12 parts4
  • 2 layers68.8 × 30 mmVacuumPick, the printed circuit board in 3D

    VacuumPick

    hexeguitar/VacuumPick

    Vacuum Pick-up project

    68 parts4GPL-3.0

Questions

How big is the Kha bgt extend PCB?

It measures 240 × 100 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Kha bgt extend use?

69 parts, built around the DMG2302U. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Kha bgt extend KiCad files?

From the kiu/kha repository on GitHub, at the commit this page was made from: the board is kha-bgt-misc/kha-bgt-extend/kicad/kha-bgt-extend.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Kha bgt extend design in my own project?

Its repository states no licence, so its author keeps all rights: ask kiu before reusing the design.