Raspberry Pi Storybook Writes Stories On Demand Using ChatGPT

Raspberry Pi
(Image credit: Adafruit, Erin St Blaine)

There’s nothing quite like delving into an unknown story inside of a brand new book. But what if you could find a new adventure every time you opened the cover? That’s exactly what this Raspberry Pi project, created by Erin St Blaine for Adafruit, does and it’s beyond magical. This Raspberry Pi-powered storybook writes new stories on demand using ChatGPT, merging the creative potential of AI with the fun of microelectronics.

When you open the cover, you’re met with a touch screen display. It has a microphone integrated that listens for you to say a story prompt out loud. Inside is a Raspberry Pi that processes the speech to text and parses it to Open AI. From there, a new story is written on the spot using your own parameters—much like Roald Dahl’s short story The Great Automatic Grammatizator.

In addition to writing stories on the spot, it also has a special prompt file that you can use to edit in specific features. For example, you can create a list of character names that will insert into the stories it creates. You can also choose how long the stories are and even specify a specific writing style for ChatGPT to emulate.

For this tutorial, St Blaine recommends using a book that measures in at 8 x 6 x 2.5in. She used a jig saw and drill to hollow out a cavity for the electronics. Inside is a Raspberry Pi 4B with 8GB of RAM, a USB microphone, and a 7-inch touchscreen display. A magnetic contact switch is used to trigger the startup script so it knows when the cover has been opened.

Because this project uses OpenAI, it helps to have plenty of processing power so the 8GB Raspberry Pi 4B is an optimal choice but you might get away with a lesser Pi model—as long as it can run the 64-bit version of Raspberry Pi OS.

You can find a detailed tutorial on how to recreate this project over at the Adafruit website. This Raspberry Pi project looks great on paper but we definitely recommend checking out the live demo. You can see it in action over at YouTube

Ash Hill
Freelance News and Features Writer

Ash Hill is a Freelance News and Features Writer with a wealth of experience in the hobby electronics, 3D printing and PCs. She manages the Pi projects of the month and much of our daily Raspberry Pi reporting while also finding the best coupons and deals on all tech.