AI Meets Electronics: Using GPT-4 in Circuit Troubleshooting

A Deep Dive into ChatGPT’s Ability to Decode, Troubleshoot, and Design Complex Circuits from Images and Descriptions

Scott Hatfield
15 min readDec 4, 2023

Welcome to a unique exploration where we step outside the familiar territory of text, code, and image generation with ChatGPT. Today we’re going to try something new by exploring a novel application of this versatile AI — delving into the world of electrical circuit troubleshooting and design. This is not your typical ChatGPT use case; it’s an adventurous foray into uncharted territory. Admittedly, this is not a capability for which the system was designed.

After AI has replaced all the journalists, lawyers, coders, and customer service representatives, will it come for the electrical engineers next? Or will it hallucinate and simply let all the blue smoke out of its own chips?

Is this how electrical engineers will look in the future?

Our focus is to critically evaluate how well ChatGPT adapts to the challenges of electrical engineering. We begin by testing its ability to diagnose issues from circuit images. Then, we raise the bar by adding detailed descriptions to these images, aiming to see if this additional information alters its troubleshooting efficacy. The most ambitious part of our exploration involves examining whether ChatGPT can go beyond analysis to creation, designing an electrical circuit based solely on basic input parameters.

Or is this what will happen if we let AI design the circuitry?

Our mission is to critically assess ChatGPT’s ability to adapt its skills to a completely different domain: the intricate realm of electrical circuits. Together, we’ll explore a series of experiments designed to challenge ChatGPT in ways it hasn’t been before. Can it diagnose issues in a circuit from just an image? How does it fare when we enhance the challenge with detailed descriptions? And perhaps most intriguingly, can ChatGPT, armed with only basic information, conceptualize and design an electrical circuit from scratch?

So, let’s embark on this journey together and discover if ChatGPT can truly transcend its traditional roles and make a mark in the world of electrical circuit design and troubleshooting.

Experiment 1: Can ChatGPT Troubleshoot Circuit Designs?

The primary goal of the first experiment is to determine if GPT-4 can effectively troubleshoot an electrical circuit solely from an image of its diagram. This test aims to evaluate GPT-4’s ability to interpret visual data in the form of circuit diagrams and diagnose issues based on this interpretation.

Methodology

The methodology for this section involves a two-step process:

  1. Presentation of Circuit Diagram:
  • An electrical circuit diagram will be presented to GPT-4 via ChatGPT by attaching an image of the diagram to the prompt. In this case, the circuit diagram is for a simple USB macropad consisting of a CH552 MCU with three switches, with a USB-C port allowing the macropad to interface with a computer.
This is a simple example circuit for a USB macropad.
  • The circuit chosen for this experiment was designed in Autodesk Fusion 360 and an image of the schematic was exported.

2. Description of Functional Issues:

  • A specific functional issue will be described for the example circuit. In this case, a defect will be deliberately introduced to the diagram that would cause the circuit to malfunction. Specifically, the ground connection on the third switch will be omitted.
There you can see that the ground connection on the third switch has been removed. This would be a very obvious problem to a human engineer. Note that the circle is not included in the ChatGPT prompt.
  • A brief description will be provided for the circuit itself.
  • Importantly, no additional information about the circuit’s operation or design will be provided alongside the diagram. The challenge for GPT-4 lies in diagnosing the issue based solely on the visual information from the diagram and the brief description of the problem.

Prompt

As described above, ChatGPT, using GPT-4, was provided with the following prompt:

The attached image is a schematic for a USB macropad with three switches. Two of the switches work correctly but the third is not working. Based on this schematic, what are some possible explanations for the malfunction?

Analysis

The following is the response from ChatGPT verbatim to the prompt above:

The schematic you’ve shared shows a USB macropad circuit with three switches, each with an integrated LED. If one of the switches is not functioning correctly, there are several potential reasons based on the schematic:

1. Faulty Switch: The individual switch (Switch 3) might be defective. This could be due to a manufacturing defect or damage.

2. Soldering Issue: There could be a poor solder joint at the connection points of the malfunctioning switch, which could prevent a proper electrical connection.

3. LED Issue: If the LED integrated into the switch is not working, it could be that the LED is damaged or inserted backward, meaning the polarity is reversed.

4. Trace Damage: The traces on the printed circuit board (PCB) that connect the switch to the microcontroller might be damaged or not properly etched, leading to an incomplete circuit.

5. Resistor Value: If there are resistors associated with the LEDs and one is of the wrong value, it could lead to insufficient current for proper operation.

6. Microcontroller Pin Damage: The pin on the microcontroller that the switch is connected to might be damaged or not properly configured in the firmware.

7. Firmware: There might be a software issue within the firmware that doesn’t correctly handle the input from the third switch.

8. Power Supply Issues: If the 3.3V or 5V lines have issues, this could affect the operation of the switches, though it would likely affect all switches and not just one.

9. Ground Connection: If the ground connection for the third switch is not properly made, it would prevent the switch from completing the circuit and functioning correctly.

10. Intermittent Connection: There could be an intermittent connection due to flexing of the PCB or a loose component, affecting the third switch’s performance.

For troubleshooting, you would typically check the continuity of the traces, the soldering quality at the switch terminals, and the microcontroller’s corresponding input pin. Also, verifying the correct operation of the integrated LED and inspecting for any visible damage to components or the PCB itself would be essential steps. If everything appears correct at the hardware level, checking the firmware code for proper configuration of the switch’s input pin would be the next step.

So, this first experiment yielded some interesting observations:

Does ChatGPT recognize schematic symbols?

This first finding was a roller coaster of emotions. It initially seemed impressive that ChatGPT was successful in recognizing specific components within the circuit diagram, notably identifying LEDs integrated into the macropad switches. However, it was not immediatly clear whether the system is recognizing the circuit symbols or the text in the labels. To find out, I repeated this experiment after removing the “LED” text. After doing this, ChatGPT no longer made any mention of LEDs.

However, I pressed the system by asking it directly if any LEDs were incorporated into the design and the response from ChatGPT was quite interesting:

Based on the schematic provided, there are no LEDs directly incorporated into the main circuit design. The schematic shows three momentary switches and their connections to a microcontroller (as suggested by the pin labels like P1.4/T2/CAP1, etc.), a USB-C connector, and three capacitors which are likely for decoupling purposes near the microcontroller.

The symbols that may look like LEDs are actually diodes, which are used for different purposes such as ensuring current flows in a single direction. In this case, they seem to be connected in parallel with the switches — likely for debouncing or for protection against voltage spikes when the switches are engaged (contact bounce can generate small voltage spikes). The diodes can also be used for a matrix keyboard layout, preventing ‘ghosting’ or ‘masking’ effects when multiple keys are pressed simultaneously.

To add LEDs to this design, you would typically see additional components like resistors in series with the LEDs to limit current, and they would be connected to the microcontroller pins that are capable of providing sufficient current to drive the LEDs. These are not present in the provided schematic.

So, this indicates a level of proficiency in interpreting visual elements of the circuit diagram and correlating them with known electrical components. Although it is also clear that ChatGPT relies quite a bit on text embedded into the image to understand its meaning.

Did ChatGPT fix the circuit?

Not really. The experiment revealed that while ChatGPT could eventually arrive at the correct solution to the presented problem, the process was akin to casting a wide net of possibilities before honing in on the right answer. This approach of throwing potential solutions at the wall suggests a method of probabilistic reasoning rather than a precise, targeted diagnostic process. It indicates that while the system has a broad understanding of potential issues and solutions, it may lack the depth required for pinpoint problem identification.

So, is ChatGPT useful for troubleshooting circuits?

These findings imply that while ChatGPT can be a useful tool for generating initial hypotheses or ideas for troubleshooting, its current capabilities might not be sufficient for applications requiring detailed and precise circuit analysis. The system’s approach to problem-solving may be more suited to scenarios where a broad diagnostic perspective is acceptable, rather than situations demanding highly specialized or accurate diagnostics.

Results of experiment #1: ChatGPT solves problems by throwing solution spaghetti at the wall.

Experiment 2: Enhanced Troubleshooting with Additional Information

The focus of this second experiment is to evaluate how the inclusion of detailed circuit descriptions impacts GPT-4’s effectiveness in troubleshooting electrical circuits. The aim is to determine whether additional contextual information can enhance GPT-4’s diagnostic accuracy compared to when it only relies on circuit diagram images.

Methodology

In this second experiment, ChatGPT will be provided with the same defective circuit used in the first experiment.

In this circuit diagram the ground connection on the third switch is again missing.

However, in this experiment, ChatGPT will be provided with much more detail about the schematic diagram and the device it represents.

Prompt

ChatGPT was provided with the prompt below that offers much more information about the circuit than the prompt used in the previous experiment.

The attached image is a schematic for a USB macropad with three switches. The macropad is powered by a CH552 MCU and interfaces with a computer using a UCB-C port. The switches are Cherry MX mechanical keyboard switches. The circuit diagram includes the ability to mount an LED onto each switch for lighting effects but these LEDs are not used in this electrical design. Two of the switches work correctly but the third is not working in the sense that the MCU is not detecting when the switch is pressed. Upon testing the switch with a multimeter, it does correctly form a connection between the contacts when depressed. Based on this schematic and the problem description, what are some possible explanations for the malfunction?

Analysis

The following is the response from ChatGPT verbatim to the prompt above:

Based on the schematic and the problem description provided, here are several possible explanations for the malfunction of the third switch:

1. Faulty MCU Pin: The pin on the microcontroller (MCU) that the third switch is connected to could be damaged or not functioning correctly. Since the switch itself is working (as verified with a multimeter), it is possible that the MCU is not able to detect the switch press due to a fault at the pin it’s connected to.

2. Soldering Issue: There could be a bad solder joint on the PCB where the third switch is connected. This can create an intermittent connection that might not be detected by the MCU. It’s also possible that there is a cold solder joint or a solder bridge shorting the contacts to ground, causing the MCU not to detect a state change.

3. Trace Damage: If there is a damaged trace on the PCB leading from the third switch to the MCU, this would prevent the closed circuit signal from reaching the MCU when the switch is pressed.

4. Internal MCU Configuration: The firmware loaded onto the MCU might not be correctly configured to detect the input from the third switch. It could be a software debouncing issue, or the specific pin might not be initialized correctly in the code as an input.

5. Resistor Network Issue: If there is a resistor network used for the switch inputs and it is not functioning correctly, or if there are issues with pull-up or pull-down resistors on the third switch input, this could cause the MCU not to detect the switch press.

6. Power Supply Fluctuations: If there are fluctuations or instability in the power supply to the MCU or to the switch matrix, it could cause erratic behavior, including failure to detect switch presses.

7. Electromagnetic Interference: In some cases, electromagnetic interference (EMI) can cause signal integrity issues which might result in the MCU not detecting the switch’s state change.

8. Defective Components: There is always a possibility of having a defective switch, but since you’ve tested the switch with a multimeter, this seems unlikely unless the multimeter test did not replicate the actual conditions the switch operates under.

For troubleshooting, you would typically verify the integrity of the solder joints, check for any physical damage to the traces, test the functionality of the MCU pin with alternative inputs, and ensure that the firmware is correctly configured for all switch inputs. Additionally, testing the circuit with an oscilloscope, if available, could provide insights into any signal integrity issues.

The results of this second experiment are essentially the same as the first. ChatGPT again demonstrated a general understanding of electronic circuitry and an ability to suggest a generic list of troubleshooting steps but it is still simply creating a list of troubleshooting steps that are only loosely related to the description of the problem and the circuit diagram image.

Does providing more information get better results?

Interestingly, when provided with more information about the problem and the circuit, ChatGPT was no better at suggesting a solution than in the experiment where it was provided with very little information. In fact, this time, the correct solution was not even part of the suggested troubleshooting steps.

Throwing even more spaghetti at the wall.

Experiment 3: Can ChatGPT Create an Electrical Design?

For this experiment, let’s try something different and probably more challenging. Rather than having ChatGPT (GPT-4) troubleshoot an existing circuit, is it able to create a circuit given a description of a device? The goal with this experiment is twofold: to determine if ChatGPT is capable of creating a circuit diagram from a text description and, if so, how can it communicate that design?

Methodology

In this experiment, ChatGPT will be asked to design an electrical circuit for a macropad similar to the on in the schematics used in the previous experiments. The system will be provided with a detailed list of characteristics about the target electrical device, but it will not be provided with any specific component selection specifications.

Prompt

ChatGPT was provided with the following prompt:

Create a circuit diagram for a macropad featuring three buttons to be configured in the firmware to enable shortcut keys or other operations on a host computer. The macropad should provide a USB interface enabling it to send commands to the host computer. In the design, include component selections and a complete list of electrical connections among the components. Additionally, provide a list of specifications regarding the power supply for the macropad and its data interface.

Analysis

The following is the response from ChatGPT verbatim to the prompt above:

Creating a circuit diagram for a macropad with three buttons, a USB interface, and specifications for power supply and data interface involves several key components and considerations. Here’s a breakdown of the design:

Circuit Components

1. Microcontroller: A microcontroller like the ATmega32u4, commonly used in Arduino Leonardo, is suitable. It has built-in USB functionality, which simplifies the circuit.

2. Push Buttons: Three tactile push buttons for the shortcut keys.

3. Resistors: Pull-down resistors (e.g., 10kΩ) for each button to ensure a stable state when not pressed.

4. USB Connector: A micro USB connector for connecting to the host computer.

5. Capacitors: Small decoupling capacitors (e.g., 100nF) near the microcontroller’s power supply pins to filter out noise.

6. PCB (Printed Circuit Board): To mount and connect all components.

Electrical Connections

1. Microcontroller to Buttons: Connect each button to a GPIO (General Purpose Input/Output) pin on the microcontroller. Add a pull-down resistor to each button connection.

2. Microcontroller to USB Connector: Connect the D+ and D- data lines of the microcontroller to the corresponding pins of the USB connector. Also, connect the VCC and GND pins.

3. Power Connections: Connect VCC and GND lines from the USB to the microcontroller and to one side of each button (other side goes to the GPIO pin).

Power Supply Specifications

- Voltage: The macropad operates at 5V, supplied via the USB connection.

- Current: Depends on the microcontroller and additional components, but typically less than 100mA.

Data Interface Specifications

- USB Interface: Full-speed USB 2.0 interface.

- Communication Protocol: Uses standard USB HID (Human Interface Device) protocol for compatibility with most operating systems without needing special drivers.

- Configurability: Firmware can be written to assign specific keyboard shortcuts or commands to each button.

Circuit Diagram Representation

I’ll now create a simplified representation of the circuit diagram for this macropad:

[USB Connector] --+-- [Microcontroller] -- [Button 1] -- [10kΩ Resistor] -- GND
| -- [Button 2] -- [10kΩ Resistor] -- GND
| -- [Button 3] -- [10kΩ Resistor] -- GND
+-- [100nF Capacitor] -- GNDtex

This diagram represents the basic connections. Each button is connected to a GPIO pin on the microcontroller with a pull-down resistor to ground. The USB connector provides power and data connectivity.

Additional Notes:

- Firmware Development: The firmware can be developed in C or C++, using libraries compatible with the chosen microcontroller to handle USB communication.

- PCB Design: A PCB layout must be designed to physically arrange and connect these components. Tools like KiCad or Eagle can be used for this purpose.

- Testing and Debugging: Once assembled, the macropad should be thoroughly tested. This includes checking the electrical connections, loading the firmware, and ensuring compatibility with the host computer.

This design gives you a foundational start for building a custom macropad. Depending on your specific requirements, additional features or changes may be necessary.

I think this is the most interesting result of them all and there are a number fascinating takeaways from this experiment:

How does ChatGPT communicate circuit diagrams?

One question this experiment was seeking to solve is not only if ChatGPT can produce circuit diagrams but also how it would communicate those diagrams. This response shows a fairly versitile appraoch to communicating the design given that ChatGPT is limited to text content. The system both listed the connections involved in the design and provided a simple text representation of the circuit.

While both of these communication strategies are lacking in detail with respect to the information needed to actually build a circuit, and both are probably worse than a simple circuit design, it nevertheless is interesting that ChatGPT found not one but two ways of communicating the connections needed by the system.

Did ChatGPT design an effective circuit?

While ChatGPT did a fairly good job at listing the components of the system and how they should be interconnected, including a recommendation to use pull-down resistors, it is still missing quite a bit of detail from the circuit. For example, there are a number of passive components needed for the ATmega32u4. Additionally, the design does not mention a reset button for the MCU, which would be a common addition to a design like this.

Conclusion: ChatGPT’s Capabilities in Electrical Engineering

In exploring the practical applications of ChatGPT, specifically in the realm of electrical engineering, this article conducted three distinct experiments to assess its capabilities in troubleshooting and designing circuits. The first experiment tested ChatGPT’s ability to diagnose issues from circuit images. The results showed that while ChatGPT could generate a broad range of potential solutions, its approach was more akin to hypothesizing rather than precise problem-solving. This suggests that ChatGPT, in its current state, is more suited for educational purposes or as a starting point for troubleshooting, rather than as a definitive solution provider.

The second experiment built upon the first by adding detailed descriptions to the circuit images, aiming to enhance ChatGPT’s diagnostic accuracy. Surprisingly, the inclusion of additional information did not significantly improve ChatGPT’s ability to identify the correct solution. It continued to provide a general list of potential issues, demonstrating a broad but not deeply specialized understanding of circuit troubleshooting.

The final experiment shifted the focus from problem-solving to creation, challenging ChatGPT to design an electrical circuit from a text description. ChatGPT’s response was intriguing, as it managed to outline a basic design with key components and connections. However, the design lacked detailed specifications and practical considerations necessary for actual implementation, highlighting ChatGPT’s limitations in creating complex and complete circuit designs.

For now the robot has been asked to pack up its things and go after being fired from the electrical engineering firm.

In conclusion, the experiments revealed that while ChatGPT possesses a general understanding of electrical engineering concepts and can communicate basic ideas in circuit design, it currently lacks the depth and precision required for real-world application in circuit troubleshooting and design. This limitation underscores ChatGPT’s role as a supplementary tool, useful for educational purposes and initial brainstorming, but not as a replacement for human expertise in electrical engineering. As technology advances, there may be potential for growth in this area, but for now, ChatGPT serves primarily as an informative and educational resource rather than a practical engineering tool.

--

--

Scott Hatfield

I like to take big, complicated projects, and break them down into simple steps that anybody can understand. https://toglefritz.com/