# Create a ChatGPT voice bot on a Raspberry Pi

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/raspberry_pi_chatgpt_bot/)
- [Initial setup](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/raspberry_pi_chatgpt_bot/2setup/)
- [Configure and test audio](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/raspberry_pi_chatgpt_bot/3audio/)
- [Create the Python application](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/raspberry_pi_chatgpt_bot/4python-code/)
- [Run and test the bot](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/raspberry_pi_chatgpt_bot/5run/)
- [Next Steps](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/raspberry_pi_chatgpt_bot/_next-steps/)

## About this Learning Path

| Skill level:      | Introductory         |
|-------------------|----------------------|
| Reading time:     | 1 hr                 |
| Last updated:     | 13 Aug 2026          |

| Author:           | Gabriel Peterson, Arm [GitHub](https://github.com/gabrieldpeterson) [LinkedIn](https://linkedin.com/in/gabrieldpeterson) [Twitter](https://twitter.com/@gabedpeterson) [Cortex Implant](https://corteximplant.com/@gabe) |
|-------------------|----------------------|
| Arm IP:           | [Cortex-A](https://support.arm.com/?tab=compute-ip&Product%20Type=Application%20Processors) |
| Tags:             | ML, Linux, ChatGPT, Porcupine, Python |

### 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
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

#### 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.
