Comment by liu3hao
17 days ago
Hi HN, I am working on Circuitscript, a language based on python to describe electronic schematics: https://circuitscript.net/. A basic IDE (called the Bench) to try Circuitscript is available online: https://bench.circuitscript.net/
I have created a usb-uart converter board with the CH340 chip. The complete schematic was coded with Circuitscript and then imported as a netlist into kicad pcbnew to do the pcb layout. The design was produced with JLCPCB and after receiving the boards I tested them and they do work! The design files are here https://github.com/liu3hao/usb-uart-bridge. The circuitscript code file is here https://raw.githubusercontent.com/liu3hao/usb-uart-bridge/re... and the generated pdf from the circuitscript code is here: https://github.com/liu3hao/usb-uart-bridge/blob/main/usb_uar...
The motivation for creating Circuitscript is to describe schematics in terms of code rather than graphical UIs after using different CAD packages extensively (Allegro, Altium, KiCAD) for work in the past. I wanted to spend more time thinking about the schematic design itself rather than fiddling around with GUIs.
Please check it out and I look forward to your feedback, especially from electronics designers/hobbyists. Thanks!
This looks awesome, great job.
How effective at circuit generation are LLM's with the language? I tried similar, and could get syntactically correct files, but the content always had errors: https://www.mikeayles.com/#tokn
What are your thoughts on atopile and tscircuit?
Thank you! I haven't tried circuitscript with LLMs yet, but I do plan to do so in the future. As the language is similar to python, hopefully it is able to work well syntactically. But of course, the correctness and accuracy of the circuit would be more challenging to get right. Your work at https://www.mikeayles.com/#tokn is very cool! This will be very useful when I try LLMs!
I have seen both atopile and tscircuit too and they are really complete it terms of the entire PCB design flow compared to circuitscript, which is just focused on the schematic part.
The ato language works well for specifying parts and parameters, but is very basic for defining connectivity. This means that the designer will have minimal control of how the final schematics will turn out. Of course, atopile focuses on the complete design flow, so having nice schematics could be a want rather than a need. For myself, especially in my professional job, clear and well-organized schematics are important not just for understanding and creation, but also troubleshooting the design and eventually improving the design.
I did try some automatic layout features for the schematic that balances giving the user some control over the overall schematic, but this was really hard to get right. In the end, I went with the logo/turtle approach and give full layout control to the user.
For tscircuit, I like typescript as a programming language and circuitscript itself is created in typescript. But typescript is really clunky to use for schematic design. Coupled with react, there is a lot of extra noise/symbols when looking at the code and for complex designs, it will be challenging to understand and troubleshoot. Moreover, I believe that typescript/javascript is less common among electronics engineers compared to python (which circuitscript is based on). The simplicity of python is one of the reasons it is popular and that is what I believe might help to lower the learning curve for circuitscript.
Hey, this is neat. It's pretty much Turtle for circuits. You could have called it CircuitTurtle!
I don't do a lot of circuit design, but I'm more of a visual person so I feel like I would be more likely to draw this in something like KiCad and then want to export it to this format to make diffs simpler.
Thanks! For laying out and connecting the schematic components, I found that a turtle/logo inspired flow does do the job well for relative placement. I guess you can imagine it as creating paths for the electrons to flow!
I do like the ease of visually drawing schematics, however for some parts of circuit design, it gets repetitive and the GUI (used Altium, Allegro and Kicad professionally) gets in the way. For more complex circuit changes, it can be much easier to diff text rather than graphics, since text can capture intent better.
This looks genuinely useful to my work. Is there a way to reach out for feedback?
Please reach out to my email listed in my profile. I will be glad to chat about how circuitscript can be useful for your work!