How help are free AI tools for electronic design?

,

For the past couple of years, I’ve been using AI to assist in the design of my hardware and firmware projects. The experience has generally been good, even though the outcome isn’t always useful. So, I’m presenting a short summary of a few of the tasks I have attempted and providing my unscientific grade to the outcome. The grades will be averaged at the end. Note: I do not have any paid AI subscriptions – I only used free AI tools, mostly Microsoft Copilot and ChatGPT (although I have tried a few others). These are just a few of my experiences using online AI.

How help are free AI tools for electronic design?

Converting voltage to percent charge

Grade: A

I wanted to show the charge remaining in a lithium polymer battery used to power a design. This is not straightforward as the function to convert voltage to percent charge for a lithium polymer battery is not a linear function. I asked Copilot to make a table of 20 voltages from 3.2 V to 4.2 V and their respective charge percentages. Then I asked it to create a C function to do this conversion. It created this nicely, including linear interpolation.

Finding the median without sorting

Grade: D

A while back, I wrote a Design Idea (DI) article on non-linear filters (Ref. 1). While doing this, I queried Copilot to create a C program that can find the median of 5 numbers and do this without sorting. (No sorting for a small number of points is useful for increasing speed.) It created a nice-looking program – nice formatting and good comments. It also compiled fine. The problem was that the program didn’t work – it found the wrong value for the median in some cases.

Initializing an ADC

Grade: C+

Another project required me to write code for the SAMD51 MCU to initialize the ADC for high-speed sampling. As I was trying to get maximum speed from the ADC, it was a somewhat complex setup, especially the clocking system. I tried creating the code in both Copilot and ChatGPT multiple times.

Some code would not compile due to things like bad register names, and some code would just not work, giving no ADC readings. After some back and forth, those issues were corrected. A few of the comments in code were misleading or just plain wrong as it applied to clock frequencies. As the code got close to a working function, I took over the code and reworked parts of it to make it work.

Graphic design

Grade: C+

I was doing some LCD graphics design for a project, and one part was a battery charge indicator. This symbol, for battery percent of charge, was to be displayed on an LCD with an ILI9321 controller. (This standard figure looks like an AA battery with a green interior representing the percent charge.)

I asked Copilot to write C code for this using the GFX graphics library. The length of the green fill worked well, but the battery figure looked nothing like a battery. It was a rectangle with two large circles on both ends. I had to rewrite portions of the code myself.

Grade: F

In the same project, I asked Copilot for a USB symbol written using the GFX graphics library, as above. This didn’t look like the trident-like, universal USB symbol. I was essentially three sticking out from a central point at various angles. It was unusable.

Enclosure design

Grade: D-

Next, I tried to have Copilot and ChatGPT design an enclosure that would work on a workbench, allowing the user to see the LCD and to easily connect BNC cables. All I got were images of rectangular boxes. No matter how I asked for a more unique shape, it never went much beyond a rectangular enclosure. Then, even the rectangular box could not be delivered as a usable 3D file “step”, “stl” file without using other programs.

Filter design

Grade: C-

I asked ChatGPT, “Can you design and display a circuit that takes in a signal, AC couples it to a gain stage of 5, and then filters it at 120 kHz before outputting it?” Instead of explaining the result, the image in Figure 1 will speak for itself.

ChatGPT's output for a filter design that takes in a signal, AC couples it to a gain stage of 5, and then filters it at 120 kHz before outputting it.
Figure 1. ChatGPT’s output for a filter design that takes in a signal, AC couples it to a gain stage of 5, and then filters
it at 120 kHz before outputting it.

It did include a nice explanation of how components were selected, but the schematic was mostly unreadable. Dedicated tools such as TI’s Webench filter design tool, Analog Devices’ Filter Wizard, and ST’s eDesign Suite are the right tools for filter circuit design and are actually easier to use.

Grade: Ungraded

I tried to create C code, in both Copilot and ChatGPT, for calculating coefficients for a digital Sallen-Key 2-pole high-pass, low-pass, band-pass, and band-stop filters. I tried many times and could not get a good working algorithm. The code was close, but the filters did not function correctly. Eventually, I found the code after an extensive Google search. It’s possible my testing may have been part of the problem – unsure.

Grade: B

Along the way, I tried lots of smaller queries, many of which were very helpful.

A lab notebook

I’m sure some of the issues are my skill in creating the AI prompts. This certainly made my attempts take longer as I had to add more detail in follow-up prompts. I actually found this conversational style more engaging than using search engines. It’s not like a Google search, where you can’t typically do follow-ups to your query – you have to re-enter your original query with a modification.

The AI systems work much more like a conversation with a colleague. You can tell it that the code it gave you did not compile, as it didn’t recognize a register name. Or you can ask it to give you faster code, or change a resistor value in a circuit, and recalculate the remaining components.

One thing I learned when writing this article is that both ChatGPT and Copilot keep a complete history of conversations we had. It’s sort of like a lab notebook, showing your path to a certain design – very helpful.

A C rating

Looking at the average grade, it comes in between a C and a C-. I’ll give it the benefit of the doubt and call it a C. The C rating matches my gut feel also. The interaction is fairly easy – it feels like interacting with a coworker. The conversation goes on, attempting to fine-tune the final answer. The interaction process is much better than doing a Google search and getting a list of things to pick from, without an easy way to refine the search.

Does it save time? That’s hard to judge as I’m still learning how to create better prompts. Sometimes I get a useful answer right away. On more complex queries, I’ve gotten pulled down a rabbit hole and wasted time while the solution diverged from what I was looking for. There have been times when it had me trying to finetune the result, and I turned to Google and got an answer much faster.

You can easily be lulled into the feeling that you’re conversing with a savant, but it may be more like AI-splaining. Every answer exudes confidence, but it could be the confidence of ignorance. Remember that these answers have not been checked or tested.

Will I continue to use it? Certainly… I’ll get better at using it, and the tools will continue to improve. What I would like to see is an AI tool focused specifically on electrical engineering (hardware, firmware, and system design). This may focus its skills on finding or creating circuits, and being able to dig down deep into data sheets, etc. It would also be nice if it could test its results through simulation or by executing the code in a series of tests. Maybe in the future.

All in all, it’s worth using and everyone should give it a try, just check the answer closely.

Reference

  1. Damian Bonicatto, Phoenix Bonicatto."Non-linear digital filters: Use cases and sample code."

EDN