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
spuz1 reply#
The final part of the demo shows the output of the automatic build as something you can upload directly to a PCB manufacturer. How does this work given the output of the compiler is a netlist, not a PCB layout or Gerber file?
Timot051 reply#
There are actually two steps to the design process:

- First, requirements. In ato, you define how your circuit is connected and the requirements for the components that sit within it. From there, we generate a netlist and a BOM.
- Second, the netlist is turned into an actual object during the layout operation. We use KiCAD's layout tool in our case. There are infinitely more dimensions in the real world than there are instructions in a computer. So we do need that second step to point the requirement to one implementation in the real world. But technically there could be a quasi infinite implementations that fit the requirements written in ato.
The manufacturing files are a combination of the ato output files, like the BOM and the KiCAD output files, like the gerbers.

spuz#
If there are effectively infinite ways to produce a PCB layout that fits the requirements written in Ato, how is the second step done automatically in the final part of the demo video? If it's not done automatically, then how do you ensure the output of the compiler is compatible with any pre-existing PCB layout?
smallpipe#
So your Ato language defines a schematic, but how do I go from a schematic to a layout? Is that auto-routed ? Or do I import the schematic into kicad?

An example of the produced layout would be interesting.

resters2 replies#
This is great! So many ways to improve upon the status quo approaches to circuit design -- notably allowing a single representation to be used for design through spice through layout.
Timot05#
Yeah, that would be great. We currently don't compile down to spice but we hope to get there one day.
napowderly1 reply#
For sure, its amazing how many places you need to write down basically the same information today. EDA tool, SPICE, requirements pages, documentation. SPICE is definitely an exciting one, particularly as the model can be versioned along with the package with parametrized tests that will automatically run in CI.
resters#
Exactly. A new level of modularity will be possible. Pretty incredible! Also parametric designs of modules (a function call with 3.3v vs 5v, or 8bit vs 12bit ADC) all the way down.
TobiasJacob2 replies#
I like the idea in general, but I absolutly hate it when people invent their own weird programming language instead of using a well defined existing one... Why not just use Python?
speed_spread#
Sir, this is Hacker News.
mawildoer#
Great question! We hope we have a few good reasons.

This iteration of the project actually came after first working with and then modifying another awesome project called SKiDL (https://github.com/devbisme/skidl).
It's based on Python - but we found that since it's procedural, turing complete and has a rich eco-system - people use to that and there aren't standard composable ways of designing things. Instead of describing your board, you (practically) write a script that generates your board. It entangles your targets with your source-code and can make it difficult to understand the ultimate outcome of what you've written.
Additionally, since it's a potentially very long program, it was hard to write good language support around (a language server for VSCode, a schematic visualiser etc...) that were snappy, responsive and lent to examining modules as well as the whole program.
There's a few operators and first-class language features we wanted as well, like units and tolerances (3.3V +/- 100mV) that just aren't the same when embedded in a string, or class init method.

Load more comments