Hacker Newsnew | past | comments | ask | show | jobs | submit | liu3hao's commentslogin

Hi HN, I am still 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/

In the past month, as suggested by the previous user, I have added support for kicad schematic libraries. The kicad schematic libraries files are converted into circuitscript format and can be directly imported into circuitscript code. To support the large number of components in the kicad libraries, I had to improve the import functionality and also implement some caching to speed up the imports. With the kicad schematic libraries available now, it provides a larger library of components that can be used in circuitscript projects. The converted libraries can be found here: https://gitlab.com/circuitscript/kicad-libraries

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 if you are also exploring alternative ways to create schematics. Thanks!


Like an open source JITX


Thank you for taking a look at my project! But from what I can read in the JITx documentation, there are quite a few differences when compared to circuitscript. Firstly, they aim to provide a higher level design language compared to circuitscript, which targets only the schematic level at the moment. JITx goes beyond the schematic, and also does physical design as well as analysis. Secondly, JITx circuits are written in python, which honestly is clunky for defining the circuits as well as laying them out in a graphic schematic.


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!


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/

During the December break, I have implemented some new features: automatic stable refdes annotations, parameter assignment rules for easy part number assignment and some ERC rules. These are also important parts of the design workflow to help turn a schematic into a usable BOM and layout.

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://github.com/liu3hao/usb-uart-bridge/blob/main/usb_uar... and the generated pdf from the circuitscript code is here: https://raw.githubusercontent.com/liu3hao/usb-uart-bridge/re...

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!


Nice work this looks like it would be so much nicer than fighting with the GUI tools.

Using existing component libraries via some sort of importer code looks like it might be needed to gain momentum.


Thank you very much! That's a good point and I will look into this to help drive some momentum!


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/

Since the last month, I have created a complete schematic with Circuitscript, exported the netlist to pcbnew and designed the PCB. The boards have been produced and currently waiting for them to be delivered to verify that it works. Quite excited since this will be the first design ever produced with Circuitscript as the schematic capture tool!

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) in the past. I wanted to spend more time thinking about the schematic design itself rather than fiddling around with GUIs.

The main language goals are to be easy to write and reason, generated graphical schematics should be displayed according to how the designer wishes so (because this is also part of the design process) and to encourage code reuse.

Please check it out and I look forward to your feedback, especially from electronics designers/hobbyists. Thanks!


Hi HN, I am working on Circuitscript, a language based on python to describe electronic schematics/circuits: https://circuitscript.net/

Recently, I have released a simple IDE (called the Bench) to try Circuitscript online: https://bench.circuitscript.net/

The next steps are to create more schematics with Circuitscript as examples to test the limitations of the language and to generate PCB designs with KiCAD. The Circuitscript tool (currently only the desktop cli tool) is able to generate KiCAD netlists and this can be imported into PCBnew.

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) in the past. I wanted to spend more time thinking about the schematic design itself rather than fiddling around with GUIs.

The main language goals are to be easy to write and reason, generated graphical schematics should be displayed according to how the designer wishes so (because this is also part of the design process) and to encourage code reuse.

Please check it out and I look forward to your feedback, especially from electronics designers/hobbyists. Thanks!


As a big openscad fan I love the idea of designing circuits with code.

I do wonder though about designing circuits vs designing schematics. I see you have ‘wire down 100’ making it a more visual language than defining the nets. Be interesting to separate the schematic layout from the nets, so rule base schematic layout can then be applied.


You can actually skip all the wire commands and still generate a valid netlist, however the schematic might be a bit hard to decipher if there are many components!

I did explore automated layout algorithms for components in the schematics, however the readability and flow of the schematics might not be ideal, depending on what the algorithm prioritizes.

In the end, I realized that the actual layout and arrangement of the schematic itself was critical in the overall understanding. That was when I decided to add the "wire" command and give more control back to the schematic designer.

In the future, I do plan to add some automated way to generate these "wire" commands for automated layout. If the designer ever chooses to edit this automated schematic layout, he would be able to edit the wire commands for finer control.

In the end, I do believe that the visual part of the schematic plays an important role in understanding it. I, too, have spent hours puzzling/being misled by poorly drawn/disorganized schematics. Especially during troubleshooting or creating an updated revision, having a good understanding of the schematic saves time.

One of the aims of Circuitscript is to make the visual part easier, so at least more time can be spent thinking and organizing the schematic itself.


I love this idea! Just wanted to send a note of encouragement. Keep at it!


Thank you very much!


I think it may be a good idea to either enable auto-save or remind the user that there are unsaved changes before navigating away from the page.


Yes, that's true, right now you have to manually press on the Save button. I will update the online editor to auto-save after some time and probably also prompt the user to save before navigating as well too. Thank you very much for your feedback!


Hey I am a embedded sw / hw engineer. looks pretty neat. would love to talk to you about it


Sure, let's talk! Please contact me at my email in my profile. Thanks!


Working on Circuitscript, a language based on python to describe electronic schematics/circuits: https://circuitscript.net/

The motivation for creating Circuitscript is to describe schematics in terms of code rather than graphical UIs. I have used different CAD packages extensively (Allegro, Altium, KiCAD) in the past and wanted to spend more time thinking about the schematic design itself rather than fiddling around with GUIs.

The main language goals are to be easy to write and reason, generated graphical schematics should be displayed according to how the designer wishes so and to encourage code reuse.

Currently trying to improve the docs and also release an online IDE. Please check it out and I look forward to feedback!


Working on Circuitscript, a language based on python to describe electronic schematics/circuits: https://circuitscript.net/

The main motivation for creating Circuitscript is to describe schematics in terms of code rather than graphical UIs. This makes it easier to track changes and version control with a text based schematic. I have used different CAD packages extensively (Allegro, Altium, KiCAD) in the past and wanted to spend more time thinking about the schematic design itself rather than fiddling around with GUIs.

The main language goals are to be easy to write and reason, generated graphical schematics should be displayed according to how the designer wishes so and to encourage code reuse.


You've gone for a Logo paradigm: turtle graphics with an inference engine behind it. It looks like its simplicity is a strength.

There are a few others in this space, often using Python as their base.


Yes, that is a big part of the design choice for this language. I felt that circuit elements are usually defined in relation to other circuit elements and instead of explicitly stating connections, it might provide more understanding of the overall circuit if the user builds the connections by "walking" along the circuit graph. A good side effect of this is that you skip having to name every single component in the circuit.

I was inspired by skidl (https://devbisme.github.io/skidl/)'s python usage and did explore that direction. However, it felt strange and clunky to try and fit the circuit drawing concepts I had in mind into python via a domain specific language (DSL). The user would require a decent understanding of python and the DSL to create circuits. This would complicate my original aim of creating a language/tool that allows electronics engineers to focus on the circuits that they would like to design.

By creating a new language, I was not limited by python's syntax/grammar. I could craft the language closer to what was needed for schematic design and maintain simplicity. Overall, it was a great learning experience on language design and also using ANTLR for the implementation.


This is a tool my friend and I created after we did a project on the available drawing tools specifically suited for the the model method used in some elementary schools. Feedback from all parents and educators welcomed!


Yeah, we sort of planned for more content, but decided against it and we have yet to remove the side bar! Will do it soon though! Thanks!


Ok, I will try to make a demo page. In the mean time the font size has been increased.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: