Skip to content

nathanielmit/talking-pumpkin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Talking Pumpkin β€” Interactive AI Halloween Project Welcome to the Talking Pumpkin project! This Raspberry Pi-based setup lets you create a spooky interactive pumpkin that listens to visitors, talks back using AI-generated responses, and lights up with magical LED effects.

πŸŽƒ Project Overview Uses a USB microphone to listen for voice input.

Sends audio to OpenAI Whisper API for speech-to-text transcription.

Sends transcription text to OpenAI GPT to generate a fun, spooky pumpkin reply.

Converts the reply text to speech using ElevenLabs TTS API.

Plays the spoken response through a connected speaker.

Controls two LEDs connected to the Pi's GPIO pins:

A glow LED that pulses softly to create a magical ambient effect.

A speech LED that flickers brightly synced with the speech audio playback.

πŸ›  Hardware Requirements Component Notes Raspberry Pi 3B+ or 4 Main controller and AI processing USB Microphone Compact mic compatible with Pi Speaker USB or 3.5mm audio output LED (Glow) Connected to GPIO pin for pulsing effect LED (Speech) Connected to GPIO pin for flickering effect Resistors (220Ξ©) For current limiting on LEDs Jumper wires & breadboard For prototyping Power supply For Raspberry Pi and peripherals

πŸ“ Repository Structure talking-pumpkin/ β”œβ”€β”€ audio/ β”‚ β”œβ”€β”€ prompts/ # Optional: pre-recorded prompts or chime sounds β”‚ └── responses/ # Generated audio responses β”œβ”€β”€ scripts/ β”‚ β”œβ”€β”€ main.py # Main script: listens, generates reply, speaks, flickers LED β”‚ β”œβ”€β”€ led_controller.py # PWM-based LED pulsing and flickering β”‚ └── utils.py # Audio recording, AI interaction, TTS, playback β”œβ”€β”€ requirements.txt # Python dependencies β”œβ”€β”€ setup.sh # Setup script for Raspberry Pi β”œβ”€β”€ .env.example # Sample environment variables for API keys β”œβ”€β”€ README.md # This file └── wiring_diagram.png # Optional wiring diagram for LEDs and mic βš™οΈ Software Setup Clone this repository on your Raspberry Pi.

Create a Python virtual environment (recommended):

python3 -m venv venv source venv/bin/activate Install dependencies:

pip install --upgrade pip pip install -r requirements.txt Run the setup script to install system dependencies (optional but recommended):

sudo ./setup.sh Set up your environment variables:

Copy .env.example to .env and add your API keys for OpenAI and ElevenLabs.

Connect your hardware:

Wire LEDs to the specified GPIO pins (default 17 for glow LED, 27 for speech LED).

Connect microphone and speaker to Raspberry Pi.

πŸš€ Running the Project From the scripts directory, run:

python main.py The system will prompt you to speak.

It will generate a spooky reply and play it.

LEDs will pulse and flicker according to the speech.

πŸ“ Notes Ensure your microphone and speaker are properly configured and tested on the Pi.

Modify GPIO pins in main.py and led_controller.py as needed.

You can customize the AI personality by editing the system message in utils.py.

You can swap ElevenLabs TTS for other services by modifying utils.py.

πŸ’‘ Future Improvements Add voice activity detection (VAD) for smarter recording.

Use local speech-to-text or text-to-speech models for offline use.

Add a physical button or PIR sensor to activate the pumpkin.

Use multiple LEDs or addressable LED strips for richer lighting effects.

πŸ“„ License This project is open source and available under the MIT License.

πŸ™‹β€β™‚οΈ Questions? Feel free to open issues or contact me!

Happy Halloween and enjoy your talking pumpkin! πŸŽƒπŸ‘»

About

Raspberry pi & Arduino, AI talking pumpkin.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •