Skip to the content
PCBKitNew board
2 layers63 × 81 mmEspLora, the printed circuit board in 3D

A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

Size
63 × 81 mm
Copper layers
2
Thickness
1.6 mm
Parts
105
Nets
77
Pads
420
Tracks, vias
731, 184
Pours
6
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
9 Jul 2020
Updated
2 Nov 2026

Overview

EspLora is an open-source printed circuit board by BerkeleyHCI, from the BerkeleyHCI/PolymorphicBlocks repository on GitHub, published under the BSD-3-Clause licence. It is a 2-layer board of 63 × 81 mm with 105 parts on 77 nets, routed with 731 tracks and 184 vias.

It is built around the ESP32-S3-WROOM-1-N16R8, PE4259-63 and SX1262IMLTRT, with the AFC01-S30FCA-00, LDL1117S33R and PESD5V0X1BT among its other parts. It belongs with the ESP32 boards of this library.

Main components

7

README

README.md

Polymorphic Blocks

Python

subcircuit generator library based hardware description language for circuit board design

Polymorphic Blocks is an open-source, Python-based hardware description language (HDL) for schematic-equivalent design of printed circuit boards (PCBs). Its library of components provide a high-level abstraction for circuit design while subcircuit generators automate the calculation of fine details. Abstract component interfaces enable these libraries to be general across applications and component vendors.

Generates stable KiCad netlists to be routed in the KiCad PCB Editor.

Built Boards

Many boards have been built with this system, from a mechanical keyboard macropad, to battery-powered IoT devices, to a USB source-measure unit. Check out the examples page!

Example: from HDL to Keyboard

Overall flow: write HDL -> generate netlist -> import into KiCad PCB editor -> place and route (optionally iterating with HDL) -> export BoM and Gerbers -> optionally generate JLC PCBA data

A simplified version of the getting started tutorial is this snippet for a 3x4 mechanical keyboard:

python
from edg import *

class Keyboard(SimpleBoardTop):
    def contents(self) -> None:
        super().contents()

        self.usb = self.Block(UsbCReceptacle())
        self.reg = self.Block(LinearRegulator(3.3 * Volt(tol=0.05)))
        self.connect(self.usb.gnd, self.reg.gnd)
        self.connect(self.usb.pwr, self.reg.pwr_in)

        with self.implicit_connect(
            ImplicitConnect(self.reg.pwr_out, [Power]),
            ImplicitConnect(self.reg.gnd, [Common]),
        ) as imp:
            self.mcu = imp.Block(IoController())
            self.connect(self.usb.usb, self.mcu.usb.request())

            self.sw = self.Block(SwitchMatrix(ncols=3, nrows=4))
            self.connect(self.sw.cols, self.mcu.gpio.request_vector("sw_col"))
            self.connect(self.sw.rows, self.mcu.gpio.request_vector("sw_row"))

            self.enc = imp.Block(DigitalRotaryEncoder())
            self.connect(self.enc.a, self.mcu.gpio.request("enc_a"))

The system:

  • provides a library of subcircuit generators, like switch matrices and USB-C ports, that automatically include supporting components like decoupling capacitors and pullup resistors
  • automatically selects generic parts like resistors and diodes against builtin parts tables
  • performs basic electrical checks on the design, including voltage and current limits, automating some common datasheet parameter checking
  • runs fully locally

This generates:

  • a netlist that can be imported into the KiCad PCB editor
    • ... including hierarchical data, allowing subcircuit replication / channelization
    • ... and have stable tstamps, allowing incremental updates to in-progress board layouts
  • a JLCPCB-compatible BoM
    • including a postprocessing script to shift part rotations from KiCad-generated component placements for JLC PCBA
  • a JSON representation of the full design, including connectivity and solved circuit values, to integrate with custom / third-party tooling

macropad.webp

Advanced capabilities include:

  • multi-board support including connector-pair management
  • cross-hierarchy packing of multi-pack devices like dual op-amps and quad resistors
  • standard abstract component interfaces, allowing for custom implementations of parts like resistors (including from a parts table), and microcontrollers
  • full support for user component definition; very little is hard-coded into the infrastructure

Getting Started

text
pip install edg

On first run, the system will automatically download a compatible Java runtime for the core compiler.

Then, work through building a mechanical keyboard (including subcircuit layout replication) in the getting started tutorial.

Also check out the reference documentation for a concise list of capabilities.

Some documentation is available for library parts construction. Be warned, this is more complex and less polished. See the library block definition tutorial using KiCad schematic import and the library construction reference.

Compared to Hierarchical Schematics

The main goal of this HDL is to enable the creation of general subcircuit libraries that can be reused across many applications.

While graphical schematic tools support hierarchical sheets, direct re-use is limited because the sheets encode a lot of per-design information, like a specific resistor values or footprints. Different users may have different requirements (e.g., different resistor values for a LED based on its input voltage, or preference for through-hole vs. surface-mount components).

This HDL addresses those limitations with two mechanisms:

  • Generators allow the implementation of the subcircuit to depend on high-level parameters. A LED circuit could automatically size its resistor based on the input voltage.
  • Abstract parts allow the subcircuit to use generic parts with generic interfaces, which many parts can implement. An abstract resistor interface could be implemented by through-hole and surface-mount resistors, enabling a generic LED circuit and deferring the choice. The top-level designer can then specify refinements to make the specific choice of parts.

Both of these combined also present a higher level of abstraction for the board designer, more at the system architecture level-of-design than schematics. We suspect this will also make it easier for novices to design boards, reducing the knowledge barrier to entry.

Graphical Tooling

The fundamental design structure is the hierarchical block diagram, and we expect graphical tooling can layer cleanly on top of the HDL core. Our current focus is on the HDL core and parts libraries, but we are open to collaborations with those interested in building graphical tooling. We suspect this may be particularly useful for novice users.

We built a proof-of-concept mixed textual / graphical IDE plugin for IntelliJ / PyCharm. It has some nifty concepts (including a block diagram visualizer and design space sweep) but is rough around the edges and only sees basic maintenance. It could be a good source for ideas for community developers.

Additional Notes

Project Status

This is functional has been used to produce a wide variety of boards over the years. While the core is reasonably stable, as a pre-v1.0-release there are no formal guarantees of API stability. In practice, deprecation shims are / will be maintained for common features if APIs change.

This started as an academic research project and continues to be developed as a personal project post-graduation, including for designing boards for fun.

(Some) Dragons Be Ahead

Many functional boards have been built with this system and most of the library parts have been physically tested (some across many designs), but there may still be bugs and edge cases. You are recommended to sanity check generated designs during layout.

Be prepared for things to be rough around the edges. The error messages in particular are not great and need work.

Building boards with the included libraries should be relatively straightforward, but building custom library parts is a more complex process.

Scope

The current libraries best support intermediate-level (and simpler) PCB designs. This includes circuits with discrete microcontrollers, microcontroller modules (like ESP32s), and socketed dev boards. Libraries include common subcircuits like switch matrices, digitally attached peripherals like I2C sensors, voltage converters, and some analog signal conditioning circuits. Check out the subcircuits library folder and parts library folder.

There is no prescribed architecture and microcontrollers are not required.

ESPHome boards are a great fit.

Designs that do not decompose neatly(ish) into subcircuits blocks are a poor fit.

There is no support for high-speed digital design (like DDR memories). There are some experimental RF subcircuits.

The electrical checks are not a design assurance tool and only automate some of the most common datasheet checks. More advanced parameters, especially performance characteristics not related to maximum ratings, are currently out of scope of the electronics model.

Parameter Engine

This system has a concept of parameters (variables, think voltages and currents) that can be attached to blocks and propagate through ports. This is limited to directed assignments, with the goal of deterministic, predictable compilation.

Assertions are supported on parameters to enforce electrical correctness checks.

Solving may happen within a single block with arbitrary Python code (for example, find the best set of E12 resistor values to implement a divider), but not across multiple blocks. Search involving multiple blocks must be handled by the block exposing tuning knobs and the user turning those knobs with recompilation.

Parts Data

Most passive parts / discretes are selected from a 2022 JLCPCB parts table (included in this repository). JLC no longer makes parts tables publicly available.

This parts table still works well and boards have been built using this table as recently as 2026. Some basic parts have drifted and some parts may be no longer stocked.

Contributing

We take pull requests and would love to see contributions and collaborations!

See CONTRIBUTING.md for details.

Papers

This started as an academic project, though with the goal of broader adoption. Check out our papers (all open-access), which have more details:

Misc

  • What is EDG?: Embedded Device Generation (or more generally Electronic Device Generation) was a prior version of this project that focused on algorithms and models for embedded device synthesis, though it lacked a user-facing component. This project is a continuation of that work focusing on an end-to-end system, and for most of its development cycle has been called edg. But, for the purposes of writing research papers, naming collisions are confusing and bad, and we chose to keep the repo and paper name consistent.

Parts

105
QtyValueFootprintReferences
750V 1uF X5R ±10% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC5, LC8, LC19, LC20, LC22, LC23, LC32
5250V 3pF C0G ±5% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC14, LC15, LC16, LC17, LC18
550V 100nF X7R ±10% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC1, LC4, LC7, LC27, LC33
550V 47pF C0G ±5% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC9, LC11, LC12, LC42, LC43
425V 4.7uF X5R ±10% 0805 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0805_2012MetricLC2, LC21, LC25, LC26
450V 2.2uF X5R ±10% 0805 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0805_2012MetricLC28, LC29, LC30, LC31
3edg:JlcToolingHole_1.152mmLH1, LH2, LH3
3100mW Thick Film Resistors 75V ±100ppm/? ±1% 820? 0603 Chip Resistor - Surface Mount ROHSResistor_SMD:R_0603_1608MetricLR4, LR5, LR6
350V 10pF C0G ±5% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC34, LC35, LC44
2100mW Thick Film Resistors 75V ±1% ±200ppm/? 2.49? 0603 Chip Resistor - Surface Mount ROHSResistor_SMD:R_0603_1608MetricLR15, LR16
2100mW Thick Film Resistors 75V ±100ppm/? ±1% 10k? 0603 Chip Resistor - Surface Mount ROHSResistor_SMD:R_0603_1608MetricLR3, LR12
2100mW Thick Film Resistors 75V ±100ppm/? ±1% 1k? 0603 Chip Resistor - Surface Mount ROHSResistor_SMD:R_0603_1608MetricLR7, LR8
2100mW Thick Film Resistors 75V ±100ppm/? ±1% 2.2k? 0603 Chip Resistor - Surface Mount ROHSResistor_SMD:R_0603_1608MetricLR13, LR14
2100mW Thick Film Resistors 75V ±100ppm/? ±1% 4.7k? 0603 Chip Resistor - Surface Mount ROHSResistor_SMD:R_0603_1608MetricLR9, LR10
2100mW Thick Film Resistors 75V ±100ppm/? ±1% 5.1k? 0603 Chip Resistor - Surface Mount ROHSResistor_SMD:R_0603_1608MetricLR1, LR2
2500mA 8.2nH ±5% 350m? 0603 Inductors (SMD) ROHSInductor_SMD:L_0603_1608MetricLL4, LL6
250V 150pF X7R ±10% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC40, LC41
250V 1nF X7R ±10% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC36, LC37
250V 560pF X7R ±10% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC38, LC39
2900mA 220nH ±5% 200m? 0603 Inductors (SMD) ROHSInductor_SMD:L_0603_1608MetricLL7, LL8
1Connector:Tag-Connect_TC2030-IDC-FP_2x03_P1.27mm_VerticalLJ2
1board:an13219LANT1
1-40?~+85? Red 0603 LED Indication - Discrete ROHSLED_SMD:LED_0603_1608MetricLD2
1100mA 15uH ±20% 650m? 0805 Inductors (SMD) ROHSInductor_SMD:L_0805_2012MetricLL1
1100mW Thick Film Resistors 75V ±100ppm/? ±1% 470k? 0603 Chip Resistor - Surface Mount ROHSResistor_SMD:R_0603_1608MetricLR11
1104031-0811Connector_Card:microSD_HC_Molex_104031-0811LJ5
1200mA 47nH ±5% 1? 0603 Inductors (SMD) ROHSInductor_SMD:L_0603_1608MetricLL2
120mA Colorless transparent lens -40?~+85? 585.5nm~591.5nm Yellow 120° 60mW 0603 LED Indication - Discrete ROHSLED_SMD:LED_0603_1608MetricLD3
1250V 2.2pF NP0 ±5% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC13
125V 10uF X5R ±10% 0805 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0805_2012MetricLC24
125V 22uF X5R ±10% 1206 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_1206_3216MetricLC3
125V 470nF X7R ±10% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC6
127.12MHz SMD Crystal Resonator 10pF ±10ppm ±30ppm -40?~+85? SMD3225-4P Crystals ROHSCrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmLX2
13.6V~3.8V 200mW 3.6V SOD-323 Zener Diodes ROHSDiode_SMD:D_SOD-323LD1
1300mA 12nH ±5% 450m? 0603 Inductors (SMD) ROHSInductor_SMD:L_0603_1608MetricLL5
130MHz SMD Crystal Resonator 20pF ±10ppm ±30ppm -40?~+85? SMD3225-4P Crystals ROHSCrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmLX1
15.1mm switchButton_Switch_SMD:SW_SPST_SKQG_WithoutStemLSW1
150V 47nF X7R ±10% 0603 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHSCapacitor_SMD:C_0603_1608MetricLC10
1700mA 3.3nH ±5% 0603 Power Inductors ROHSInductor_SMD:L_0603_1608MetricLL3
1901-143Connector_Coaxial:SMA_Amphenol_901-143_HorizontalLJ3
1AFC01-S30FCA-00Connector_FFC-FPC:Hirose_FH12-30S-0.5SH_1x30-1MP_P0.50mm_HorizontalLJ4
1APX803S-29SA-7Package_TO_SOT_SMD:SOT-23LU7
1COM-15111Connector_USB:USB_C_Receptacle_XKB_U262-16XN-4BVC11LJ1
1ER-OLED-0.96-1.1edg:Lcd_Er_Oled0.96_1.1_OutlineLU6
1ESP32-S3-WROOM-1-N16R8RF_Module:ESP32-S3-WROOM-1LU2
1G***edg:Symbol_DucklingSolidsvg2mod
1LDL1117S33RPackage_TO_SOT_SMD:SOT-223-3_TabPin2LU1
1PE4259Package_TO_SOT_SMD:SOT-363_SC-70-6LU5
1PESD5V0X1BTPackage_TO_SOT_SMD:SOT-23LU3
1PN7160A1HN/C100YPackage_DFN_QFN:HVQFN-40-1EP_6x6mm_P0.5mm_EP4.1x4.1mmLU8
1SX1262IMLTRTPackage_DFN_QFN:QFN-24-1EP_4x4mm_P0.5mm_EP2.6x2.6mmLU4
1White 0603 LED Indication - Discrete ROHSLED_SMD:LED_0603_1608MetricLD4
1gndedg:TestPoint_TE_RCT_0805LTP1
1i2c.scledg:TestPoint_TE_RCT_0805LTP10
1i2c.sdaedg:TestPoint_TE_RCT_0805LTP11
1lr.misoedg:TestPoint_TE_RCT_0805LTP6
1lr.mosiedg:TestPoint_TE_RCT_0805LTP5
1lr.sckedg:TestPoint_TE_RCT_0805LTP4
1lr_csedg:TestPoint_TE_RCT_0805LTP7
1lr_diedg:TestPoint_TE_RCT_0805LTP9
1lr_rsedg:TestPoint_TE_RCT_0805LTP8
1pwredg:TestPoint_TE_RCT_0805LTP2
1v3v3edg:TestPoint_TE_RCT_0805LTP3
1±25% 100?@100MHz 0805 Ferrite Beads ROHSInductor_SMD:L_0805_2012MetricLFB1

Questions

How big is the EspLora PCB?

It measures 63 × 81 mm and has 2 copper layers, 1.6 mm thick.

What parts does the EspLora use?

105 parts, built around the ESP32-S3-WROOM-1-N16R8, PE4259-63, SX1262IMLTRT and AFC01-S30FCA-00. 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 EspLora KiCad files?

From the BerkeleyHCI/PolymorphicBlocks repository on GitHub, at the commit this page was made from: the board is examples/EspLora/EspLora.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the EspLora design in my own project?

Its repository publishes it under the BSD-3-Clause licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

More from BerkeleyHCI/PolymorphicBlocks

12
  • 4 layers168 × 52 mmUsbSourceMeasure, the printed circuit board in 3D

    UsbSourceMeasure

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    319 parts94BSD-3-Clause
  • 2 layers115 × 72 mmFcmlPanel, the printed circuit board in 3D

    FcmlPanel

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    246 parts94BSD-3-Clause
  • 2 layers30 × 95 mmIotThermalCamera, the printed circuit board in 3D

    IotThermalCamera

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    120 parts94BSD-3-Clause
  • 2 layers226 × 74.4 mmSevenSegment, the printed circuit board in 3D

    SevenSegment

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    119 parts94BSD-3-Clause
  • 2 layers60 × 80 mmRobotCrawler, the printed circuit board in 3D

    RobotCrawler

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    118 parts94BSD-3-Clause
  • 4 layers136 × 18 mmMultimeter, the printed circuit board in 3D

    Multimeter

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    111 parts94BSD-3-Clause
  • 2 layers110 × 97.2 mmPcbBot, the printed circuit board in 3D

    PcbBot

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    109 parts94BSD-3-Clause
  • 2 layers100 × 36 mmIotIron, the printed circuit board in 3D

    IotIron

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    98 parts94BSD-3-Clause
  • 2 layers64.1 × 103.2 mmKeyboard, the printed circuit board in 3D

    Keyboard

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    85 parts94BSD-3-Clause
  • 2 layers38.6 × 38.6 mmIotLedDriver, the printed circuit board in 3D

    IotLedDriver

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    81 parts94BSD-3-Clause
  • 2 layers50 × 62 mmIotDisplay, the printed circuit board in 3D

    IotDisplay

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    78 parts94BSD-3-Clause
  • 2 layers142 × 20 mmDeskController, the printed circuit board in 3D

    DeskController

    BerkeleyHCI/PolymorphicBlocks

    A Python-based hardware description language for PCBs for higher-level (block-diagram / system-architecture level) PCB design through libraries of directly reusable subcircuit generators.

    69 parts94BSD-3-Clause

Similar boards

  • 4 layers68.3 × 41 mmEsphome nfc, the printed circuit board in 3D

    Esphome nfc

    aeremin/firefly_zephyr

    Firmware (Zephyr RTOS / nRF Connect SDK, with Pigweed libraries), custom boards and KiCad hardware projects for a few small nRF52-based devices.

    51 parts
  • 2 layers148 × 30 mmUi board 1u, the printed circuit board in 3D

    Ui board 1u

    betz-engineering/ui_board_1u

    User interface PCB for 1U chassis front-panels

    85 parts1CERN-OHL-P-2.0
  • 2 layers40 × 27.6 mm1.02inch right, the printed circuit board in 3D

    1.02inch right

    shiqi-614/ErgoCai.modules

    25 parts
  • 4 layersDial me spinner main, the printed circuit board in 3D

    Dial me spinner main

    tyevco/dial-me-spinner

    A Bluetooth dial spinner about 70 mm across, built on the nRF52840. A heavy, balanced stainless flywheel ring spins around a stationary centre that holds a colour OLED and a ring of 48 addressable RGB LEDs.

    209 parts
  • 4 layers125 × 150 mmAA2380V1, the printed circuit board in 3D

    AA2380V1

    OneAudio/OSVA

    Open source versatible analyzer (24bits 1.536MSPS 2 Channels)

    440 parts11GPL-3.0
  • 6 layers160 × 100 mmHet68-core, the printed circuit board in 3D

    Het68-core

    fedurca/het68_pcb

    pcb design description

    134 parts
  • 4 layers25.6 × 38.6 mmDiff probe amplifier, the printed circuit board in 3D

    Diff probe amplifier

    devEmbedded/differential_probe

    Modular differential probe (DEDP-100)

    83 parts32