Jeff Epler Puts a ChatGPT-Powered Text Generator on Your Desk with a Raspberry Pi Pico W
Maker Jeff Epler has penned a guide to getting started with OpenAI’s popular large language model (LLM) interface ChatGPT on embedded hardware, showing how to generate unique responses from a Raspberry Pi Pico W using CircuitPython.
“At startup, or when the arcade button is pressed, a new, original snippet of text will be generated on OpenAI’s servers and shown on the OLED screen connected to your Pico W,” Epler writes of the project. “Because of the random factor in the text ChatGPT generates, it’s unlikely that two responses would ever be the same. Since ChatGPT generates plausible text rather than making true statements, use this project only for situations where the truth is unimportant.”
How it works
Epler’s creation makes use of ChatGPT, an interactive interface to a large language model (LLM) developed by OpenAI. Designed as a chatbot, ChatGPT takes an input — including parsing instructions, such as how the output should be formatted or phrased — and generates a likely response. Its apparent creativity has spawned a large number of projects, but the model’s tendency to “hallucinate” and present nonsense as facts can hamper its broader use.
In Epler’s project, a Raspberry Pi Pico W running CircuitPython is connected to an OLED display and an arcade button in a custom housing. When connected to power and the network, the device waits for the button to be pushed. Then sends a predefined prompt to ChatGPT over OpenAI’s application programming interface (API), printing the response on the screen.
“It’s easy to customize the prompt using any text editor,” Epler says. “This works by writing a sentence or two in natural human language describing what you’d like ChatGPT to generate. No complicated coding is needed to get a description of an imaginary plant instead. Or even to generate text in French instead of English!”
The program can be adjusted for any prompt you like, even choosing from a list of prompts at random. (????: Jeff Epler)
“Using ChatGPT on a Raspberry Pi Pico W with a CircuitPython program can be a fun and educational project. It can allow you to experiment with natural language processing, text generation, and other AI applications in a hands-on way,”. ChatGPT told us in whatever the LLM equivalent of an “interview” would be, when prompted to comment on the project.
How to get started
“The Raspberry Pi Pico W is a low-cost microcontroller that can run CircuitPython. A beginner-friendly programming language, making it a great platform for learning about AI and machine learning. Jeff Epler’s guide can provide helpful insights and tips for getting started with this project.”
The full project write-up is now available on the Adafruit Learn portal. “The code in this guide does use a paid API at OpenAI, but based on the pricing in March 2023. The cost to access the API for this project is measured in fractions of a cent, not in dollars,” Epler notes. “During the whole development process of this guide, the author’s costs on OpenAI were less than $0.25.”
Read More: Jeff Epler Puts a ChatGPT-Powered Text Generator on Your Desk with a Raspberry Pi Pico W