"As an AI language model, I am thrilled to be on the Raspberry Pi Pico W! This small yet powerful device enables seamless integration with a wide range of applications and systems, making it an ideal platform for AI and machine learning projects. The Raspberry Pi Pico W's versatility, simplicity and affordability make it a game-changer in the world of technology!" -- ChatGPT

Quote blocks like the one above and photos in this guide typically show text generated by ChatGPT.

In this guide, you will learn how to use OpenAI's ChatGPT API to generate text from a prompt using CircuitPython on the Raspberry Pi Pico W.

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. 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. For example, by default the request to ChatGPT asks for a description of an "unconventional but useful superpower".

It's easy to customize the prompt using any text editor. This guide has some tips for creating prompts of your own. 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 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. During the whole development process of this guide, the author's costs on OpenAI were less than $0.25.

Parts

Angled shot of a green microcontroller with castellated pads.
The Raspberry Pi foundation changed single-board computing when they released the Raspberry Pi computer, now they're ready to...
$6.00
In Stock
Fully Reversible Pink/Purple USB A to micro B Cable
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also fully reversible! That's right, you will save seconds a day by...
$3.95
In Stock
Monochrome 1.3" OLED module with Adafruit logos falling like snow
These displays are small, only about 1.3" diagonal, but very readable due to the high contrast of an OLED display. This display is made of 128x64 individual white OLED pixels,...
$19.95
In Stock
Angled shot of long, skinny prototyping breakout board.
Ding dong! Hear that? It's the PiCowbell ringing, letting you know that the new Adafruit PiCowbell Proto is finally in stock and ready to assist your
$1.95
In Stock
Angled of of JST SH 4-Pin Cable.
This 4-wire cable is 50mm / 1.9" long and fitted with JST SH female 4-pin connectors on both ends. Compared with the chunkier JST PH these are 1mm pitch instead of 2mm, but...
$0.95
In Stock
1 x Socket Headers for Raspberry Pi Pico
2 x 20 pin Female Headers
1 x 0.1" male header
Break-away 0.1" 36-pin strip male header
1 x M2.5 Screws & Stand-offs
Black Nylon Machine Screw and Stand-off Set – M2.5 Thread
1 x Arcade Button w/LED
30mm arcade button, various colors
1 x Quick-Connect Wires
Arcade Button Quick-Connect Wire Pairs - 0.11" (10 pack)
1 x Right-angle headers
Break-away 0.1" 36-pin strip right-angle male header
1 x M2 Stand-offs
300pcs M2 Brass Standoff Kit
1 x OpenAI Account & API Key
A $2.00 budget suffices for multiple hours of play.

This guide was first published on Mar 29, 2023. It was last updated on Jun 20, 2024.

This page (Overview) was last updated on Mar 08, 2024.

Text editor powered by tinymce.