GPT-4o on an ESP32 MicroController
date
May 15, 2024
type
Post
year
slug
gpt4o-microcontroller
status
Published
tags
AI
GPT
OpenAI
Microcontroller
ESP32
Research
summary
A guide for how to use OpenAI’s GPT-4o model on a microcontroller
After I got GPT-4o to run in Unity, I wanted to try and see if I could get it to talk to an ESP32 microcontroller!
I wrote the code in VSCode+PlatformIO, but it should work the same in the Arduino IDE.

- Go to https://platform.openai.com/api-keys and create an OpenAI API key
- Connect an ESP32 microcontroller, create a new project, set it all up
- Install the ArduinoJson library
- create
config.h
- create
main.cpp
(orwhatever.ino
if you’re using the Arduino IDE)
- Upload and run! First it connects to the WiFi, then it sends one request and prints the response to serial (Open the Serial Monitor to see it!)

Done! GPT-4o on an ESP32! Now what to do with this power… 🤔
Here’s a picture of a
TTGO LoRa32-OLED V1
with GPT-response on screen: