Skip to content
Pinter Computing

Knowledge Base for IT Professionals, Teachers, and Astronauts

Pinter Computing

Knowledge Base for IT Professionals, Teachers, and Astronauts

  • Home
  • Programming
  • DevOps
  • Project Management
  • Software and Hardware
  • Miscellaneous
  • Egyebek
  • About
  • Experience
  • Education
  • Contact
  • Home
  • Programming
  • DevOps
  • Project Management
  • Software and Hardware
  • Miscellaneous
  • Egyebek
  • About
  • Experience
  • Education
  • Contact
Close

Search

Home/AI/Happy, the AI hardware robot – understanding – speech to text
AI

Happy, the AI hardware robot – understanding – speech to text

By Laszlo Pinter
November 12, 2026 4 Min Read
0

These are the steps to set up the speech to text converter process for the Building Happy, the AI hardware robot project to enable Happy to understand speech.

Happy’s speech-to-text works in two parts. The ESP32 records your voice and sends it over Wi-Fi to your PC, and Whisper turns it into text on the PC. Whisper is too big to run on the ESP32 itself.

For the latest instructions see speech-to-text\README.md in the repository.

Setup on the PC

Install Python 3.12:

  • Open a PowerShell terminal
winget install Python.Python.3.12
  • Verify the Python installation
py -3.12 --version

Create a virtual Python environment

  • We will create a virtual environment and install PyTorch with GPU support. Virtual Python environments enable us to use different Python versions per project to avoid version conflicts
cd speech-to-text\brain
py -3.12 -m venv .venv
  • Running Python from the terminal
    • The Happy scripts call Python with the full path to use the correct environment. If you want to run Python scripts in the speech-to-text\brain directory, every time you open a new Terminal window activate the environment with
      .venv\Scripts\Activate.ps1

Install PyTorch with GPU support

  • Open a new terminal in the brain folder. Install PyTorch with GPU support first; this command is for an Nvidia card:
.venv\Scripts\python.exe -m pip install torch --index-url https://download.pytorch.org/whl/cu126
  • Test the Pytorch installation
.venv\Scripts\python.exe -c "import torch; print(torch.__version__, torch.cuda.is_available())"
  • Expected: something like 2.x.x+cu126 True.

Install Whisper (and Kokoro)

.venv\Scripts\python.exe -m pip install -r requirements.txt
  • Test the Wisper and Kokoro installation
.venv\Scripts\python.exe -c "import whisper, kokoro, soundfile; print('all good')"
  • Expected: all good

Start the LM Studio server to run the AI model in the background

  • In the terminal execute
& "$env:USERPROFILE\.lmstudio\bin\lms.exe" server start
  • Test the server access
curl.exe http://localhost:1234/v1/models
  • Expected a list of AI models

Test if Gemma answers

  • In the terminal execute
'{"model":"google/gemma-4-26b-a4b-qat","messages":[{"role":"user","content":"Say hi in one sentence"}],"reasoning_effort":"none"}' | curl.exe http://localhost:1234/v1/chat/completions -H "Content-Type: application/json" --data-binary "@-"
  • Expected: a JSON answer with "content": "Hi there! ...". The first call can take up to a minute while the model loads.

Start the Happy server by hand

  • In the terminal execute
cd speech-to-text\brain
.venv\Scripts\python.exe stt_server.py
  • The first start downloads the models (Whisper ~460 MB, Kokoro ~330 MB, plus a small language pack), which takes a few minutes. Later starts take about 20 seconds. It’s ready when it prints:
    Listening on http://0.0.0.0:8000 (POST /talk /stt /chat /say, GET /health)
  • Leave this window open to keep the server running

Let the ESP32 reach the server through Windows Firewall

  • Run this in an admin PowerShell:
New-NetFirewallRule -DisplayName "Happy STT" -Direction Inbound -Protocol TCP -LocalPort 8000 -Action Allow

Optionally, test with any 16-bit WAV file before the robot is involved

  • In a terminal execute
curl.exe -X POST -H "Content-Type: audio/wav" --data-binary "@test.wav" http://localhost:8000/stt

Setup on the ESP32

  1. Open the speech-to-text\firmware\stt_client\stt_client.ino file with the Arduino IDE
  2. At the top of the sketch, fill in WIFI_SSID, WIFI_PASS and STT_URL. For the URL, use your PC’s IPv4 address from ipconfig.
  3. Upload it the same way you did mic_test.
  4. Open the Serial Monitor, set the speed to 115,200 baud
  5. Hold BOOT button on the ESP32 board, say something, and release the button to send the audio to the server.

Send the text to the AI model

Send the text from the reply to Gemma through LM Studio’s local server (Developer tab → Start Server). I left a comment at that spot in the sketch. Doing this on the PC side is easier than on the ESP32.

Enable the ML Studio Ai service

  • Start LM Studio on the computer
  • In the lower left corner click the gear icon
  • On the Developer tab make sure the Developer mode is On, and Enable Local LLM Service

  • Close the page with the X in the upper right corner

Set up the auto start of the AI servers

We will create a Scheduled Task that runs every time you log in, so no credentials are saved on the computer.

It starts 3 servers:

  • stt_server.py – Python server to run Whisper, the speech to text converter. It receives audio clips from the ESP32, converts them to text, and passes them to LM Studio within the computer
  • LM Studio server to function as Happy’s brain and generate the answers
  • Kokoro – text to speech server to generate Happy’s voice

To set up the Scheduled Task

  • Open a PowerShell terminal in the speech-to-text\brain folder
  • Execute the command
    powershell -ExecutionPolicy Bypass -File install_autostart.ps1
  • To manually start the Scheduled Task from the command line without logging off and on, execute
    Start-ScheduledTask -TaskName "Happy Brain"
  • To remove the Scheduled Task later when not needed anymore
    powershell -ExecutionPolicy Bypass -File install_autostart.ps1 -Uninstall
  • To see what the speech to text server is doing, open brain\logs\stt_server.log

Testing Speech to Text

Send an audio file from the computer

  • We will generate an audio file from text. Open a PowerShell terminal and execute
    Add-Type -AssemblyName System.Speech; $s = New-Object System.Speech.Synthesis.SpeechSynthesizer; $s.SetOutputToWaveFile("$PWD\test.wav"); $s.Speak('Hello Happy, how are you today?'); $s.Dispose()
  • The test.wav file is created in the current directory
  • Send the test.wav file to the speech to text Python server
    curl.exe -X POST -H "Content-Type: audio/wav" --data-binary "@test.wav" http://localhost:8000/stt
  • The response will contain Happy’s answer
    {“text”: “Hello Happy, how are you today?”, “language”: “en”, “seconds_audio”: 2.98, “seconds_stt”: 0.47, “peak”: 0.947, “reply”: “I am doing great and feeling very energetic! Are you having a good day so far?”, “seconds_llm”: 3.07}

With the robot

  1. Open stt_client.ino and fill in your Wi-Fi details.
  2. Set STT_URL to http://<your PC's IPv4 from ipconfig>:8000/stt.
  3. Upload the sketch and open the Serial Monitor at 115200.
  4. Hold BOOT, speak, then release. You should see Whisper: {"text": "...", "reply": "..."}.

Tags:

AI
Author

Laszlo Pinter

Follow Me
Other Articles
Previous

Happy, the AI hardware robot – the touch – metal plate

Next

Happy, the AI hardware robot – talking – text to speech

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Last Changes

  • How to convert STL file to solid in FreeCAD November 16, 2026
  • FreeCAD installation issue November 15, 2026
  • Happy, the AI hardware robot - understanding - speech to text November 15, 2026
  • Building Happy, the AI hardware robot November 14, 2026
  • Happy, the AI hardware robot – Configuration November 14, 2026

Tags

.NET .NETcore 3Dprinting AI AutodeskInventor AWS C# Chef cloud DevOps Docker EntityFramework Games Git Go iOS iPad iPhone iPod Java Kubernetes Linux MacOSX MSSQL MVC MySql Node.js Packer Python RDS RightScale Ruby security Splunk TeamCity Terraform TestKitchen Tomcat Ubuntu Vagrant VirtualBox VisualStudio Windows WordPress Xcode

Recent Comments

  • Laszlo Pinter on Turn off the built in touchpad when a mouse is attached
  • Kenneth Bush on Turn off the built in touchpad when a mouse is attached
  • Zengei László on MyHeritage családfa exportálása és küldése emailben
  • Raúl Castillo on DynDns update error
  • MICHAEL on Windows Media Player 12 cannot find the album information

–

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Copyright 2026 — Pinter Computing. All rights reserved.