Skip to content
A coarsely pixelated spacecraft with gold panels beside the pale edge of a moon, on black

GPT for hardware engineering

A workflow study

Generative artificial intelligence (GenAI) has kick-started 2023 with a bang. But it has yet to prove its value for hardware engineers.

The limitation? Math and logic.

Although LLM-based tools like OpenAI’s ChatGPT, Microsoft Bing, and Google’s Bard are proving the first mass use of AI’s generative powers, they have proven already that what they say is not to be trusted.

Bard's answer to a question about James Webb Space Telescope discoveries, its claim that JWST took the very first pictures of a planet outside our solar system boxed in red
Screenshot from Google's Bard announcement embarrassingly claiming that JWST took the first pictures of an Exoplanet. There are two mistakes in this sentence.

From what we can see, these tools still don’t work well with maths, logic and facts. However, I have isolated three main abilities for engineering work:

  • Generating good enough quality text, tables, lists and very basic code (reliably).
  • Analyzing bodies of text. This is great for: summarizing text, tagging, semantic analysis, interconnecting information, and much more.
  • Transforming text. That being style transfer (change the writing style, personality, cadence, language, etc. of a text), turning text into bullet points, tables, etc. Merging multiple sources of text.

Ok, I’m being exhaustive here, but this will be useful for the account below.

Cheaper APIs

Recently, OpenAI announced their GPT 3.5 turbo API. They called it the ChatGPT API, and it can be found here: https://openai.com/blog/introducing-chatgpt-and-whisper-apis

Why is this important? Well: price.

The pricing section of that announcement: $0.002 per 1K tokens, ten times cheaper

Not only is this API accessing the same model used in the ChatGPT product, it is 10x cheaper than the other existing GPT-3.5 models.

GPT + Google Sheets

Turns out, the new API is already available in the GPTforWork Google Docs Add-On that you can find here: https://gptforwork.com/.

The GPT for Work add-on page: use ChatGPT in Google Sheets and Docs
OpenAI's announcement of the ChatGPT and Whisper APIs

To get started, you need to:

  1. Create an account at OpenAI
  2. Click View API key
  3. Create a new secret key
  4. Install the GPTforWork add-on on Google Sheets and Docs
  5. Add the key

There are a few GPT Google Sheets functions. But we will mainly be using two: GPT() and GPT_TABLE().

The menu that opens after typing =GPT in a cell, listing GPT, GPT_MAP, GPT_TAG, GPT_CODE, GPT_EDIT, GPT_FILL, GPT_LIST, GPT_TREE, GPT_TABLE and GPT_FORMAT
All the available functions from GPTforWork Google Sheets add-on.

Designing a space mission with GPT and Google Sheets

Be advised that this mission is a simplified version and would require many more iterations and detail. However, it can give you a glimpse of how fast one can build this kind of document.

So let’s begin. First let me be clear on the goals of this article, in fact there are two goals:

1. Design a space mission – an Orbiter Spacecraft that will search for landing and drilling sites on Jupiter’s Moon Europa.

So basically, we will be designing something close to the Europa Clipper mission, with one difference: Clipper orbits Jupiter and flies past Europa many times, while ours would orbit Europa. More on this real life mission here: https://europa.nasa.gov/.

A spacecraft with long solar panels and a dish antenna above the cracked icy surface of Europa, its flyby tracks drawn as blue lines and Jupiter in the distance
Artist's illustration of NASA’s Europa Clipper spacecraft, which will perform multiple flybys of the ocean-harboring Jupiter moon. (Image credit: NASA/JPL-Caltech)
Cutaway diagram titled A peek inside Europa: plumes and surface features over a 10 km ice shell, a 100 km liquid ocean with currents and hydrothermal vents, and a rocky interior
Heat and materials from Europa’s interior might be released through hydrothermal vents on the moon’s ocean floors. Warm water rising toward the base of the icy shell could cause cracks and other features, such as diapirs, while large chunks of the surface, ice rafts, may detach and float to new locations. Plumes could spout the ocean’s contents high above the moon, while radiation, impacts, and sunlight can all cause changes on the ice from above. Astronomy: Roen Kelly
A gold four-legged lander with a dish antenna and a sampling arm on reddish ice, a plume rising behind it and Jupiter in a black sky
A concept for a Europa lander samples the moon’s surface in this artist’s rendering, which also shows a plume erupting in the background and the gas giant Jupiter hanging in the sky. NASA/JPL-Caltech

This way, the Clipper Mission will serve as a reference for what this new mission could be. This will serve as the “source for fact control” for this AI experiment.


2. Create a reusable workflow – This one is important as ideally this workflow should be useful not only in other space mission designs but in other hardware industry projects such as:

  • space engineering
  • consumer electronics
  • automotive
  • robotics
  • construction.

The template

The Project Overview

This page will work as a way to write in the context of the project. It will have a summary cell that will be inserted in every query we do to GPT. Yes, you read that well, since we are using GPT’s API, it doesn’t save context, so you need to explain everything in each query.

The cool part about using GPT is that we don’t need to preserve any type of data structure, as long as we provide enough information on the project. This is helpful if we want to use this page to describe a consumer electronics product, a robotic submarine, the design plan for a house with 3 bedrooms, etc.

The Engineering Project Overview sheet: rows for industry, design goal, cost, launcher, payload and mission durations of a Europa orbiter, with notes that the rows can be changed and that a summary cell feeds every query
The Project Overview page with the Summary cell below.

Architecture

Let’s use all that context from the project to ask GPT’s API to create an architecture layout for us.

We will use the GPT_TABLE() function. Here’s how it will work:

The Architecture sheet: a GPT_TABLE formula fed by the Project Overview summary cell, and the table it returned of ten spacecraft subsystems from Propulsion to Launch and Deployment
The Architecture page with the AI generated table. We will reuse this information later.
The GPT_TABLE formula expanded into its prompt: the main query on top, then the Project Overview text as context between ### separators
Here's the GPT's API query breakdown. You need to “talk” to GPT in an organized manner to get the best generation possible.

Requirements

One of the first activities that is needed for a Preliminary mission design report is a “System concept and requirements document”. We will go through this in a simplified way for illustrative purposes.

For a more detailed workflow, you can check out Valispace’s features here: https://www.valispace.com/ai/

The Requirements sheet: requirement codes SR-01 to SR-06 with descriptions, a tradeoff column and lists of generated sub-requirements
The Requirements page. Each “sub-requirement” is generated based on the main table and the Project Overview.
The sub-requirement formula expanded into its prompt: the main query with the requirement code and text pulled from other cells, then the Project Overview between ### separators
Yep, that's a long query. To keep things tidy, try writing the query before in a structured way. In this case, we are referencing three data sources + binder text to ask GPT a very composed question.

Semantic matching

In my experience, this is a major GPT use-case: matching data with semantics.

The Subrequirements sheet: each sub-requirement beside the subsystem GPT assigned to it, such as Payload, Communications, Data Handling or Thermal
The end result: a table of 125 subsystem requirements with the matching subsystem assigned.
The subsystem-matching formula expanded into its prompt: one requirement, the list of subsystems from the Architecture sheet, then the Project Overview between ### separators
Here's how to build a page like this. See that in this case we are referencing two lists generated from tables.

Concept of operations

Now, as I mentioned before, GPT is not a source of science. And asking it for a CONOPs took some time, and many iterations. It would sometimes hallucinate strange actions like “Aero-break capture in Europa’s Atmosphere”. In the end, this type of data should not be generated by an AI (yet).

The Concept of operations sheet: a GPT-generated table of mission phases from launch to end of mission, annotated with what it got right about the gravity assists and what it got wrong
Here's the final CONOPs. Its route passes Venus and then Earth once each, a VEGA rather than a VEEGA. Yep, GPT is good at presentation, but it is no scientist.

Sidenote

However, I have some ideas on how eventually training a GPT analog with libraries such as Poliastro can turn astronavigation into an automated task (Space Autopilot?).

Here’s a plan I made in Poliastro, starting from its Juno example, using ChatGPT as a reviewer for a flight plan to Jupiter using an Earth flyby for gravity assist (the dates are the Juno mission’s).

You can check out the Colab document here: https://colab.research.google.com/drive/1fU0VNmFFJk5wxjwE2L0teErH3ur7r--I?usp=sharing

The poliastro logo above a plot of the flight plan to Jupiter: three cruise arcs between impulse marks, from Earth's position at the 2013 flyby to Jupiter's position at arrival in 2016
The flight plan to Jupiter, plotted in Poliastro.
The Colab notebook Astrodynamics with Poliastro and google colab: plotting code for the cruise legs above the resulting trajectory plot
The Google Colab notebook I used to create this flight plan.

Project plan

Alright, let's wrap this in a nice plan. This was the most expensive single query. Also, I did misspell “apparatus” and GPT just trusted me and replicated that word everywhere.

The Project plan sheet: a requirements summary above a generated table of phases, tasks, resources, deliverables, dependencies and durations, with a total of 1946.25 days and a note on the misspelled apparatus
The final table for the Project plan. It breaks the work into semi-realistic phases, but its rows add up to about 3,228 days while its total reads 1,946.25, the mission's length.
The project-plan formula expanded into its prompt: the main query, then the Project Overview and the requirements list, each between ### separators
Here's the decent prompt to generate the Project Plan table.

Cost analysis

Although OpenAI is doing an amazing job in scaling the GPT API and therefore lowering the price, it is still somewhat expensive.

In the end, working on this file cost me not much less than $1. Mainly because I used a few dozen prompts, and because the prompts refresh when the document is reloaded.

As you can see below, the number of requests grew exponentially as the document grew in number of cells and iterations.

Ways to reduce cost:

  • “Bake” your generations and add your prompt as a comment. This avoids the queries firing every time the document is reloaded or opened.

  • Avoid “drag and drop”, especially when using linked queries (like the ones I did above), as your token usage will exponentiate.

The OpenAI usage page for March: cumulative spend rising from $0 to about $0.84 between 5 and 7 March, and hourly requests growing from 10 to 87, 239 and 580, traced by a red curve
Here's the cost breakdown for this document. See the amount of requests per hour increasing exponentially.

Conclusion

GPT can definitely be used for engineering projects as a “delta” increase in productivity. It is great at extrapolating explanations from data and organizing explanations into data. However, we still need a mix between GPT and a rigid scientific, logical, and mathematical engine.

In the meantime, be my guest to copy this template, I’m looking forward to seeing if you find it useful and what you will use it for.

Template link: https://docs.google.com/spreadsheets/d/1ukF0TIF17nZ7e3yN3yZCqw8Y7xu3-DT-k-tPcdmZjzk/edit?usp=sharing

Oh, and feel free to reach out!

A render of the Sun rising over the Earth's limb, seen from orbit, with city lights on the night side

Let’s talk

I take 20-minute calls on weekdays, 09:30 to 18:00 in Lisbon. Pick a day and an hour.

Book 20 min