Skip to main content

earthground: A Python Library for Creating Software-Defined Electrical Designs

Overview

Earthground encompasses a comprehensive suite of tools and libraries aimed at facilitating software-defined electronic schematics.

Documentation

Getting Started

Setup

pip install -r requirements.txt

Simple Example - Resistor Divider

import common.components as cmp
import common.schematic as sch_lib
import common.standard_values as sv
import library.headers.connectors as conn_lib

# Setup the schematic page
schematic = sch_lib.Design("Resistor Divider Example")
schematic.default_passive_size = "0603"

# Create the components
r1, r2 = sv.find_closest_ratio(5 / 3.3)  # finds closest values in E24
r_top = schematic.add_component(cmp.Resistor(f"{r1}k"))
r_bottom = schematic.add_component(cmp.Resistor(f"{r2}k"))
input_connector = schematic.add_component(conn_lib.standard_0_1_inch_header(pin_count=2))
output_connector = schematic.add_component(conn_lib.standard_0_1_inch_header(pin_count=2))

# Connect them and print schematic to console
schematic.connect([r_top.pins[1], input_connector.pins[1]], "SIG_5V0")
schematic.connect([r_top.pins[2], r_bottom.pins[1], output_connector.pins[1]], "SIG_3V3")
schematic.connect([input_connector.pins[2], r_bottom.pins[2], output_connector.pins[2]], "GND")
schematic.print()

Project Walkthrough - 32 Port I/O Expander

Read the example

  • Located in examples/io_expander_example.py
  • Run using: python3 -m examples.io_expander_example

Advantages of Software-Defined Circuits

Extensive Tooling

Text-based schematics means engineers can leverage existing software engineering tooling to create error-free designs faster

  • Use version control software to save progress, create easy-to-read diffs between versions, and do design review
  • Use dev tooling like CI/CD tools to automatically run design rule checkers and application-specific validators to ensure a correct design
  • One-click releases - Automatically generate Gerbers, pick-n-place files, cost rollups, power budgets, bringup test plans

Modular

Finally have stable and correct part libraries and circuits that you can quickly piece together to create complex projects quickly

Extendable

Earthground can be extended to many purposes because it's written in Python

  • If your PCB being connecting to another PCB via harness, you could write an exporter so your favorite harness program always has the latest design
  • If there's a microcontroller in your design, you could add an exporter to generate a BSP package or Micropython definition from the schematic that will automatically create a new file on every revision
  • If you are concerned about supply chain and components going out-of-stock, you could have your schematic track which components are in stock and define part variations

Powerful

With a Python backend, it's simple to create powerful component libraries that allow you to create complex designs quickly. Just read the datasheet once and you are good to go

  • Abstract complex hardware configuration pins to the component library so your schematics are highly readable (and therefore easily reviewable)
  • Rather than noting the position of every configuration on a microcontroller and matching it to the datasheet for every design review you do. You could review your component definition once then in every design do readable things like mcu.set_boot_location(mcu.EXTERNAL_FLASH) to easily catch issues
  • Quickly set addresses are know they are right:
    for i, device in enumerate(i2c_devices):
    device.set_i2c_address(i)
    
  • Add validators for datasheet errata and buried issues so if anyone uses a component in a nonrecommended way on the current design or any future design, Earthground will flag it.
  • Parameterize passive component selection for ICs
  • For buck converters, Earthground can automatically size inductors based on datasheet parameters
  • For LDOs, given an output voltage, Earthground will select the feedback resistors, round them to E24 values, and warn you if the result output voltage is beyond a specified percentage

State of the Project

This an actively worked on project. Currently there's no way to finish layout. I'm working on a KiCAD exporter so you can import the netlist and footprints to KiCAD and do layout there. The final goal is to incorporate a layout editor into the project.

Metadata

Release files for earthground 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for earthground 0.1.0
File Size Uploaded Provenance Actions
earthground-0.1.0.tar.gz 24.4 kB Without provenance Details for earthground-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for earthground 0.1.0
File Interpreter ABI Platform Actions
earthground-0.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for earthground-0.1.0-py2.py3-none-any.whl

Total release size: 58.6 kB

Release files / earthground-0.1.0.tar.gz

Download URL earthground-0.1.0.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
184aa8883d51c78ddf36417942e30285f144bf07b4adc1c5b8552136564dff46
BLAKE2b-256 checksum
How to use checksums
866c78460a1c275dcd86b0bcd3ae93fe4879875af8ff6c656cdf71c23a347af5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / earthground-0.1.0-py2.py3-none-any.whl

Download URL earthground-0.1.0-py2.py3-none-any.whl
Size 34.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c9f1870ea03b156f28e8cfc503d1eae90ce1f8a4ce0afba790d3820808e968ba
BLAKE2b-256 checksum
How to use checksums
dd75df91997172bc5ce046e252890cb1201eaf1bf28ed3888dd6f440bf92c56d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Security for earthground 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page