AI/ChatGPT for electronics

Regarding the use of AI in electrical engineering from your most recent podcast:

  1. Nvidia recently revealed they have trained a set of LLMs on all their chip-design knowledge to create design assistants for their engineers. So the AI is helping to design the next set of AI chips. <Insert tired Skynet joke here>
  2. Earlier this year, I used ChatGPT to design a simple relay driver and to create KiCad part symbols. At the time, it wasn’t a smooth journey but it was getting there. I expect things have improved since then.
  3. VSCode with Copilot and Copilot Chat is surprisingly good for writing code. I used it quite a bit when I was developing RepoRecon. There were more than a few times when I said “How did it even know that?” And you can get it for free if you contribute to open-source stuff on Github.
1 Like

I haven’t tried copilot yet I do want to experiment with it.

With how useful it has been to me recently, I am starting to put AI questions in my interview packets. These language models are more powerful then initially thought and is a useful tool for thinking about problems. Engineer’s that write off AI will be left in the dust I think.

One of my friends was told: “AI won’t beat you, but someone using AI will.”

Lots of negativity about AI on other forums. I point out that compilers were poo-poo’ed back in 1980…

1 Like

I 100% agree, instead of viewing AI as something that is going to “take” your job. View it as a way to augment and improve your job. It is a tool to be used. If anything it raises the floor of everyone by being able to more quickly gather and display information.

It goes without saying that automation and software has improved the productivity of engineers of most disciplines and will continue to do so for the foreseeable future. The question is not whether we should have more automation, of course we should, the question is: are LLMs the correct algorithm and the proper mechanism? That is much less clear. I see the value in using natural language for the causal user who wants to avoid investing in learning the interface. But, natural language communication in EDA could be too slow for the professional who uses the tool daily.

I looked through the nVidia paper, and the listed benefits are questionable. For example, they trained the LLM to add comments to existing code on “tool1” and “tool2” which are internal-use-only python library and probably Synopsys Prime Time. The claim is the comments are useful because internal auditors noted they were not wrong. Is that useful? Maybe. Probably? Hard to say. Does it mean nVidia’s productivity will swamp all the other ASIC vendors? I suppose time will tell. :slight_smile:

Agree on all fronts! I don’t think LLMs are the end all be all but for exploratory R&D work it has been a great to throw ideas at and see what sticks in a faster manner.

This is the output of chatgpt4 when I asked the following:

I am designing a new circuit board that needs to read humidity and temperature of the environment can you recommend some IC sensors to get me started on picking a sensor? If you can, provide some basic specifications for the sensors and costs.

Output:

Designing a circuit board that can read both humidity and temperature requires sensors that are accurate, reliable, and compatible with your specific application. Here are a few Integrated Circuit (IC) sensors that are popular in the market for such purposes, along with their basic specifications:

  1. DHT11 or DHT22 (AM2302) Sensor:
  • Type: Digital
  • Temperature Range: DHT11 (-20°C to +60°C), DHT22 (-40°C to +80°C)
  • Humidity Range: DHT11 (20% to 80% RH), DHT22 (0% to 100% RH)
  • Accuracy: DHT11 (±2°C, ±5% RH), DHT22 (±0.5°C, ±2-5% RH)
  • Interface: Single-wire digital
  • Cost: DHT11 is cheaper (around $2-5 USD), DHT22 is slightly more expensive (around $5-10 USD)
  1. Si7021 Sensor:
  • Type: Digital
  • Temperature Range: -40°C to +85°C
  • Humidity Range: 0% to 100% RH
  • Accuracy: ±0.4°C (temperature), ±3% RH (humidity)
  • Interface: I2C
  • Cost: Around $3-7 USD
  1. BME280 Sensor:
  • Type: Digital
  • Temperature Range: -40°C to +85°C
  • Humidity Range: 0% to 100% RH
  • Pressure Sensing: 300 to 1100 hPa
  • Accuracy: ±1°C (temperature), ±3% RH (humidity), ±1 hPa (pressure)
  • Interface: I2C/SPI
  • Cost: Around $10-20 USD
  1. HDC1080 Sensor:
  • Type: Digital
  • Temperature Range: -40°C to +125°C
  • Humidity Range: 0% to 100% RH
  • Accuracy: ±0.2°C (temperature), ±2% RH (humidity)
  • Interface: I2C
  • Cost: Around $5-10 USD

When selecting a sensor, consider factors such as the operating temperature and humidity range of your environment, the required accuracy, the digital interface (I2C or SPI), and the cost. The DHT11/DHT22 are great for hobbyist projects due to their ease of use and low cost, while the Si7021, BME280, and HDC1080 offer higher precision and are more suitable for professional applications.

Prices may vary based on the supplier and quantity purchased. It’s also recommended to check for any additional features you might need, such as weather resistance, if the sensor is to be used outdoors.

No Idea if this code works but I asked Chatgpt 4 to write some example arduino code for the BME280 sensor.

Certainly! To use the BME280 sensor with an Arduino, you’ll need to have the sensor, an Arduino board (like Arduino Uno), and the necessary libraries installed. The BME280 sensor can communicate over I2C or SPI, but for simplicity, we’ll use I2C in this example.

First, you’ll need to install the Adafruit BME280 library and the Adafruit Unified Sensor library. You can install these through the Arduino Library Manager in the Arduino IDE:

  1. Open Arduino IDE.
  2. Go to Sketch > Include Library > Manage Libraries.
  3. Search for “Adafruit BME280” and install it.
  4. Do the same for “Adafruit Unified Sensor.”

Once the libraries are installed, you can use the following code to read temperature, humidity, and pressure from the BME280 sensor and print it to the serial monitor:

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

Adafruit_BME280 bme; // I2C

unsigned long delayTime;

void setup() {
    Serial.begin(9600);
    Serial.println(F("BME280 test"));

    bool status = bme.begin(0x76);  // 0x76 is the default I2C address for the BME280 module
                                    // Change to 0x77 if needed
    if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring!");
        while (1);
    }

    delayTime = 1000; // Delay between updates
}

void loop() { 
    printValues();
    delay(delayTime);
}

void printValues() {
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" °C");

    Serial.print("Pressure = ");
    Serial.print(bme.readPressure() / 100.0F);
    Serial.println(" hPa");

    Serial.print("Humidity = ");
    Serial.print(bme.readHumidity());
    Serial.println(" %");

    Serial.println();
}

This code initializes the BME280 sensor and then repeatedly reads and prints the temperature, humidity, and pressure.

Important Notes:

  • Ensure your BME280 module is connected properly to the Arduino. For I2C, typically SDA goes to A4, SCL goes to A5 on an Arduino Uno.
  • The I2C address can be either 0x76 or 0x77, depending on your module. If the sensor is not detected at 0x76, try changing it to 0x77.
  • The Serial.begin(9600); command starts serial communication, which is used to print the readings to the Arduino IDE’s Serial Monitor. Ensure the Serial Monitor’s baud rate matches the rate set in your code (9600 in this case).

You can modify the delayTime variable to change how often the sensor readings are taken and printed.

What would be more interesting is if it could write a library/module given a PDF or similar specification.

On the other hand there is: https://github.com/adafruit/Adafruit_BME280_Library/blob/master/examples/bme280test/bme280test.ino

Which has the same information and I found it with Google at probably the same speed as what you found with Chatgpt4. Hopefully their demo works. :slight_smile:

LLM for a front end for search definitely makes sense. It’s easy to Google terms and find things when one knows what they’re looking for. Much less so when you don’t know the correct keyword. There I can see LLM being a large value add for sure.

When I google what I asked chatgpt I get these 2 top results. First link is ok but has ads all over it and a popup! The first direct to code link is 9 links down, past 3 video suggestions and is this. GitHub - bolderflight/bme280: Arduino and CMake library for communicating with the Bosch Sensortec BME280 environmental sensor.

One interesting idea I heard was to regard some LLM hallucinations as potential enhancements rather than mistakes. So if the LLM uses a non-existent function, then maybe that’s a function that should be added to a library or API.

I get your point for sure and totally agree that LLM could very well be a better front end to search because terms totally matter and it’s not obvious what to use. Here’s what I did

I have trouble trusting LLMs given their propensity to hallucinate or simply deliver outright incorrect information. I don’t know what’s going to make me finally trust them, honestly. I think any and all attempts to automate end-to-end design and layout are deeply misguided. (Insert autorouter joke here) That having been said, they seem like promising tools to augment productivity. Summarizing datasheets and providing an intuitive way to query critical specifications in an enormous and poorly-ordered datasheet would be enormously helpful functionality. I also agree that they could be potent tools to improve the SNR of search engines. I think we’ve all observed the enshittification of Google in real-time. As well as experienced the infuriation that results.

With ChatGPT (paid) I’ve had good luck pasting a url of a documentation page for specific function in a tool I’m using along with some instructions and having it spit out something usable in the correct syntax. Sometimes it takes a little coaxing as it’s subtlety wrong, but it’s been a boon when I’ve been stuck.

I’ve been using it for regular expressions and specifically asking the clarifying question “will that work in Snowflake” has been quite useful.

I’ve also asked it about where a particular setting is found in the preference tree of some obscure ZPL printer tool I was working with and, by George, it did me well.