Lurker News
Hey HN! We are the founders of atopile. We’re building a tool to describe electronics with code. Here is a quick demo: https://youtu.be/7-Q0XVpfW3Y

Could you imagine the pain of building an entire software product using only assembly code? That’s about how we felt designing hardware. We don’t currently have good ways to describe what we need, reuse existing designs and compile that description down to a product.
We started atopile to fix this. atopile is an open-source language and toolchain to describe circuits with code. The compiler is here: https://github.com/atopile/atopile Docs are here: https://atopile.io/getting-started/ . For a detailed deep dive designing an ESP32 module, see this video: https://youtu.be/eMWRwZOajdQ
We realized this was a problem in our previous jobs. Narayan and I (Tim) had to manually, draw and export all our electronic circuit boards. This lasted until our friend Matt, a software engineer, showed us his development workflow. All his projects were built, tested, and merged automatically via GitHub. So we asked: Can we build the same for hardware?
We observed that the ability to abstract electronics effectively hinged on using a language to describe the requirements, so we came up with the “ato” language. In ato, you can break down circuits into modules, components and interfaces. You can nest and connect those blocks with each other. Here is an example with an RP2040 microcontroller:

  import RP2040Kit from "rp2040/RP2040Kit.ato"
  import LEDIndicatorBlue from "generics/leds.ato"
  import LDOReg3V3 from "regulators/regulators.ato"
  import USBCConn from "usb-connectors/usb-connectors.ato"

  module Blinky:
    micro_controller = new RP2040Kit
    led_indicator = new LEDIndicatorBlue
    voltage_regulator = new LDOReg3V3
    usb_c_connector = new USBCConn

    usb_c_connector.power ~ voltage_regulator.power_in
    voltage_regulator.power_out ~ micro_controller.power
    micro_controller.gpio13 ~ led_indicator.input
    micro_controller.power.gnd ~ led_indicator.gnd

    led_indicator.resistor.value = 100ohm +/- 10%

From there, the compiler produces a netlist that describes how the circuit is connected and selects jelly-bean components for you (https://atopile.io/blog/2024/01/31/cloud-components/). Our next focus will be to add layout reuse, mathematical relations between values and define circuits by traits (similar to Rusts’).

At the moment, atopile is intended to design all types of printed circuit boards (PCB) with low to medium complexity. The circuit complexity that the compiler can handle will steadily increase until it becomes suited for production usage. We often get asked if the compiler is meant for chip design rather than PCBs, but that is not the case. The language is exclusive to PCBs. At least for now..!
A big part of why the software community is so prolific is thanks to open source and open core technology. The ability to share software packages with each other and efficiently chain tools together has made the software world an awesome place for developers. As hardware engineers, we would love our field to benefit from this as well. That’s why we’ve made atopile’s core open source (Apache 2.0). We plan to generate revenue by selling entreprise targeted features, similar to GitLab.
We would love to have your thoughts on the compiler! What’s your story in electronics? What would you want us to build?

Comments (292) 77 threads

Earlier comments
cyberax2 replies#
LOVE IT LOVE IT LOVE IT!!!

I'm doing a lot of home automation work, and I absolutely hate that I need to use breadboards, hunt for pre-assembled components, or to spend days designing a PCB for simple things like relay modules with customized IO.
E.g. I have ratgdo for my garage door opener, but its power supply is an ugly buck convertor taped to the box. I'd love to just re-make the ratgdo board, but with a built-in 12V-to-3V buck convertor.
I tried that, but PCB manufacturing with custom component placing requires just too much work.
Is there a way to donate to the project? I'd love to support it.

Timot05#
That’s exactly what we are going for!

Have a look at packages.atopile.io. We have a package with power supplies that you can just add to your board with

  ato install regulators
https://gitlab.atopile.io/packages/regulators
Timot05#
Forgot to reply to the support aspect:

Best way to support us right now is to try the project and give feedback on where you'd like to see this going. The project is open source so feel free to raise issues or contribute as well :)

Taig4 replies#
`import Y from X` is a terrible language design decision, established by the JavaScript ecosystem. It should be along the lines of `import X.Y` or `from X import Y` so that autocomplete tools can assist you.
napowderly#
Agreed, we need to flip this.
amonith#
Disagree. I rarely remember what lib has the class/function/whatever I need. Doesn't help that some libs often use "proprietary" names (e.g. "Uno", "Avalonia", "Rotativa"). I often don't even write "imports" myself. I use stuff in code and let my IDE autoimport stuff.
Timot051 reply#
Aspects of the python lexer and parser implementation were borrowed from python, which is partly why we ended up here. I do agree though.
echoangle1 reply#
Python does from x import y though.
Timot05#
Yeah, I think we only allow import x from y for the minute. And because we don't have a language server yet, it wasn't obvious that it was an issue. That'll change soon when the server is up though!
mplewis#
Really? When I type import { someVal in JS, VSCode autocompletes it to import { someValue } from “somePackage”. I haven’t had issues here.
Liftyee2 replies#
Looks really useful! As a hardware designer I've had plenty of copy pasting bits of schematics to duplicate common functionality. Seems like this could be really helpful in preventing mistakes and increasing quality once used to it.

Have you got any plans for defined interfaces/modularity so devices using SPI, I²C, etc. can be chained together without manually defining pin connections? Also, will there be support for importing schematics from other formats?

napowderly1 reply#
We do have interfaces! They are super useful, I am very stoked that I dont have to remember which way around MISO/MOSI go any more.

Interfaces are just a collection of signals eg

  interface I2C:
    signal sda
    signal scl
    signal gnd
you can connect two together like so: micro.i2c ~ sensor.i2c

Importing schematics would be possible, but IMO not super valuable as all we could import would be the raw connectivity, a big benefit of our language is being able to add a layer of abstraction on that.

xnzakg1 reply#
How does this handle connecting two microcontrollers with one being a SPI master and one being a slave? Or connecting UART between two devices?
napowderly#
Today, poorly. We just do a dumb matching of signal names. I imagine we will do something like add a property to the interfaces on each device.
wildzzz1 reply#
Kicad allows you to keep a library of projects containing layouts and schematics of small circuits that you may wish to reuse in other circuits by just simply importing them to the current design. You can then modify as needed.
napowderly#
Indeed, Altium has similar features also. I think what has been missing is an effective way to collaborate on hardware projects as a community and be able to share them like you would packages on pypi or npm.
syedkarim2 replies#
Could you please explain the difference between Atopile and Jitx (https://www.jitx.com/)? Both seem to provide software-defined hardware development.
napowderly#
We are taking the open-source route (eventually moving to open-core). We think a big part of moving the industry in this direction is building a community around it, much like the way Github started out.
Timot051 reply#
Our language is also a markup language more than a programing language. The goal here is that we would want the code to become a description of what the circuit is, instead of how to obtain it. The obtaining part is the job of the compiler. Not the human.
yoz1 reply#
Please forgive me if you know this already, but just in case: the terms Declarative and Imperative may be useful here.

Declarative: the code describes the desired result.
Imperative: the code describes the operations to take.
Most programming languages are Imperative, but some are Declarative, and some allow a mix of the two. More here: https://www.educative.io/blog/declarative-vs-imperative-prog...

Timot05#
Thanks for sharing the docs! Our language is mostly declarative at the moment. There are some features we discussed that would be imperative and we might introduce them in future versions of the compiler.

Load more comments