Who is this for?

This is an introductory project for developers interested in integrating a Chatbot (namely ChatGPT) into Raspberry Pi projects.

What will you learn?

Upon completion of this Learning Path, you will be able to:

  • Run a bot on a Raspberry Pi that will listen to you and respond to what you say
  • Learn how to listen for a keyword and wake a program when the keyword is heard
  • Convert speech from the microphone to text using Google Speech Recognition
  • Send text created from speech to ChatGPT's gpt-4-turbo-preview model via API and receive a text reply
  • Convert the text reply to speech using ChatGPT's text-to-speech model via API
  • Play the received speech file

Prerequisites

Before starting, you will need the following:

  • A Raspberry Pi 4 or 5 (earlier models may also work)
  • A microSD card with at least 16GB of storage
  • A Linux compatible USB microphone and USB speakers or a USB audio device with a microphone and speakers

Summary

AI-assisted

This summary was drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.

Close
?
You’ll build a voice-driven assistant on Raspberry Pi. First, you’ll install 64-bit Raspberry Pi OS, configure USB audio, and create a Python virtual environment. Then, you’ll run a script that detects the “computer” wake word, transcribes speech, sends text to ChatGPT, and plays the reply. You’ll validate audio recording and output before running the assistant continuously.

Frequently asked questions

AI-assisted

These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.

Close
?
How do I know the microphone recording worked?
After recording by running arecord -d 5 test.wav, a file named test.wav should appear in your current directory. Its size should be non-zero.
Which wake word should I use, and how do I know the bot is listening?
Say “computer”, pause for about a second, then ask your question. The terminal displays output indicating it’s waiting for the keyword before it detects the wake word.
How do I re-activate the Python virtual environment in a new terminal?
Run cd $HOME/assistant followed by source env/bin/activate. Then run python main.py to start the assistant.
How do I find the card and device numbers for my USB audio hardware?
Run arecord -l to list recording devices and aplay -l to list playback devices. Use the card and device numbers in commands such as arecord -D plughw:3,0 -d 5 test.wav and aplay -D plughw:2,0 test.wav, replacing the values with your hardware’s numbers.
How do I stop the application when I am done testing?
Press Ctrl+C in the terminal where python main.py is running. The process exits and the prompt returns.
Next