Download PDF Parts List View on YouTube Download Code

Build a fully offline, voice-to-voice language translator using a Raspberry Pi 5, a USB microphone, and a USB speaker. Meet the Google Gemma Translator project!

Introduction

Recently, Google released an open-source project called the Gemma Translator, and it’s one of the more impressive Raspberry Pi builds I’ve come across in a while. Speak into a microphone in one language, and a few seconds later the translated speech comes out of a speaker in another language, entirely on its own. No cloud service, no API calls, no internet connection required (once it’s set up).

That last point is really what makes this project worth building. Sure, you could open Google Translate on your phone, use its voice interface, and get something similar. But the Gemma Translator is a standalone appliance. Once it’s installed, you can unplug the Ethernet cable or Wi-fi, and it keeps working anywhere you can plug it in.

There are a couple of things to be upfront about before you commit to building one:

  • First, because everything runs locally on a Raspberry Pi’s CPU, there’s noticeable latency between when you finish speaking and when the translation plays back. It’s not instant, and you should go in expecting that.
  • Second, this project needs a Raspberry Pi 5 with 8 GB of RAM. Given current Pi prices, I’m hoping you already have one sitting on the shelf, as I did, rather than needing to buy one specifically for this project.

Beyond the Pi, the only other hardware you will need is a USB microphone and a USB or Bluetooth speaker. You’ll also require a microSD card with the latest version of the Raspberry Pi OS; I would suggest a 32 GB or greater card.

The official project also includes a 3D-printed enclosure, but we will just be assembling it on the workbench. You can probably come up with an enclosure by either 3D-printing one or modifying an existing Raspberry Pi case.

The Google Gemma Translator

Before we get started, it’s worth understanding how the Gemma Translator actually works.

The translator can be broken down into three AI components:

  • Speech-to-Text – Converts incoming voice to text.
  • Translation – Takes that text and outputs text (JSON string) in a different language. A Large Language Model (LLM) is used to perform this task.
  • Text-to-Speech – Converts that text to speech.

Here are the components used to perform thsese three tasks:

Speech-to-text: Moonshine

When you speak into the microphone, your voice is captured and sent to Moonshine, a family of speech recognition models from Useful Sensors. Moonshine was built specifically for edge devices, such as microcontrollers and microcomputers, and it uses a separate trained model for each language it supports.

Note that Moonshine runs entirely on the Pi’s CPU; it doesn’t take advantage of a GPU or any AI accelerator boards you might have attached.

Translation: Gemma 3n E2B

The transcribed text is then sent to Gemma, Google’s family of open-weight language models that shares its research lineage with the popular Gemini chatbot.

Specifically, the project uses the E2B variant, meaning it has an Effective 2 Billion parameters. This is all packaged as a 2.6 GB model file.

It’s worth pointing out that Gemma here is a general-purpose large language model, not a dedicated translation engine – it’s simply given a very specific prompt and asked to behave like a translator. The actual system prompt used by the project is:

Gemma runs locally via a lightweight LLM server on the Pi, which loads the model and handles translation requests. It only requires Internet access the first time it is run; after that, it operates completely stand-alone.

Text-to-speech: Moonshine Voice

Once the translated text comes back as a JSON string, it’s fed into Moonshine Voice, a companion neural text-to-speech engine. It performs grapheme-to-phoneme conversion using language-specific rules and outputs raw audio samples ready to play on the USB speaker (or headphones).

How it all fits together

We can break down the operation of the Google Gemma Translator into five distinct steps:

  1. Audio capture – You hold the Z key down on the keyboard, and the React-based web interface records your voice through the USB microphone for as long as the key is held. Releasing the key ends the recording, and the browser packages the audio and sends it to the backend over HTTP.
  2. Transcription – The audio is fed into the local Moonshine speech-to-text engine, which analyzes the waveform and outputs a plain text string.
  3. Translation – The Python backend wraps that text in the translation prompt and sends it to the local LLM server hosting Gemma, which returns the translated text as a JSON string.
  4. Synthesis – The translated text is passed to Moonshine Voice, which generates a new audio file of the spoken translation.
  5. Playback – The translated text and the synthesized audio are sent back to the React frontend, which updates the on-screen display and plays the audio through the USB speaker.

The project lives on GitHub at github.com/google-gemma/gemma-translator, and it’s worth a visit.

Aside from the code, there are demo videos there, including one showing how the project was built using Google’s Antigravity tool, along with the feature list and prerequisites.

The GitHub page does list a Raspberry Pi 5 with 8 GB of RAM as a hardware requirement, but it doesn’t specify an exact microphone, speaker, or display, and it includes a 3D-printed case design that assumes specific hardware. As noted above, I skipped the case and built this on the open bench instead.

It’s likely you already have a microphone and speaker that could be used in this project. It needs to be USB or Bluetooth, as the Pi 5 doesn’t have the audio output jack that previous models had.

For my experiments, I used a USB “stick”-style microphone along with a small USB speaker. I powered everything with the official Raspberry Pi USB-C power supply.

Building the Translator

With the hardware understanding out of the way, here’s how to actually build one. I’ve laid this out as a cheat sheet you can copy and paste from directly, in the exact order I ran it on my own Pi. You can download the full cheat sheet from this article rather than typing everything out by hand.

What you’ll need before you start

  • A Raspberry Pi 5 with 8 GB of RAM
  • A USB microphone
  • A USB or Bluetooth speaker
  • An HDMI display and USB keyboard
  • A microSD card, at least 32 GB, with the 64-bit Raspberry Pi OS (Bookworm) already installed
  • An internet connection for the initial setup (you can disconnect it once installation is complete)

Stage 1 – Update the OS and install required packages

Start with a standard update and upgrade, then install the packages the project depends on:

There are quite a few packages to install, so give it a few minutes to complete.

Stage 2 – Switch from Wayland to X11

The most recent Raspberry Pi OS defaults to the Wayland desktop environment, but this project needs X11. Switch over and reboot:

Stage 3 – Verify your audio devices

Before installing the translator itself, confirm the Pi can see and use your microphone and speaker. List the available devices:

You should see your USB microphone and speaker listed – keep in mind that an HDMI monitor often shows up as an audio output too, so you’ll probably have a few audio output devices.

Next, do a quick record-and-playback test. Start the recording, say something, and press Ctrl+C to stop:

Then play it back:

If you hear yourself, both devices are working correctly. Clean up the test file when you’re done:

Stage 4 – Clone and deploy the project

Now for the main event. Clone the repository and prepare the install scripts:

A quick bug fix before you deploy. As of this writing (August 2026), setup.sh passes a ––require-hashes flag to pip, but requirements.txt doesn’t actually contain any hashes. Left as-is, this causes pip to abort with an error like “ERROR: Hashes are required in –require-hashes mode…”. Google may fix this by the time you read this, but if you hit that error, strip the flag with:

Now run the one-command deployment. This is the long step – expect somewhere between 20 and 40 minutes, mostly spent downloading the roughly 2.6 GB Gemma model and building the frontend:

Let it run to completion, then reboot:

When the Pi comes back up, it boots straight into Chromium in kiosk mode, showing the translator interface. Don’t be alarmed if it briefly reports that the site can’t be found right after boot – the browser starts slightly before the backend server does, and the page loads correctly a few seconds later.

Stage 5 – Scale the UI for an HDMI monitor

The interface was originally designed for a small 480×320 display, so on a full-size HDMI or 4K monitor it appears as a tiny box in the corner. You can zoom in on the fly with Ctrl and + in Chromium, but for a permanent fix, add a display scale factor to the kiosk launch command and reboot:

After this reboot, the interface should fill the screen properly.

Giving it a try. The interface shows two languages, one on each side – for example, Arabic on one side and English on the other – and you switch which one is active with the space bar, then use the left and right arrow keys to change either language. Out of the box, you get six languages: English, Spanish, Japanese, Chinese, Korean, and Arabic.

To translate, make sure the side showing your spoken language is highlighted, then hold down the Z key while you speak and release it when you’re done. The first time you use any given language pair, the Pi still needs an internet connection to download the supporting files; after that, it works entirely offline, exactly as promised.

Adding Other Languages

Six languages is a reasonable start, but it’s a fairly short list – and if you, like me, were hoping for a language that isn’t on it, you have options. I live in Montreal, so French was the language I most wanted to add, and it isn’t one of the six defaults.

It turns ot tha there is a reason those six languages were included.

Gemma itself, as a general-purpose language model, can translate between a very wide range of languages. The bottleneck isn’t Gemma – it’s Moonshine.

Moonshine’s speech recognition supports only a limited set of languages, and, on top of that, several of Moonshine Voice’s additional languages are output-only. In practice, this means you can extend the translator to speak a new language a lot more easily than you can extend it to understand one spoken to it.

Moonshine currently offers a modest handful of additional languages beyond the default six, and among those, only Vietnamese and Ukrainian currently work as both an input and an output language – the rest can only be used as translation targets, not sources.

Adding a new language means touching three things:

The Menu

The “AVAILABLE_LANGUAGES” array near the top of TranslatorApp.jsx in the frontend, which controls what shows up on the on-screen menu. The name field here is what the user actually sees.

The Voice

The “TTS_LANG_MAP” array in server.py on the backend, which tells Moonshine Voice which text-to-speech voice to use for that language.

The Ear

The “SUPPORTED_STT_LANG” array, also in server.py, which lists the languages Moonshine can recognize as spoken input. Remember, you can only add a language here if Moonshine actually supports it as an input language (currently just Vietnamese or Ukrainian beyond the defaults).

After editing these files, rebuild the frontend and restart the service for the changes to take effect. And just as with the initial six languages, the very first time you use a newly added language, the Pi needs an internet connection to download that language’s model. Expect increased latency on that first run, after which it behaves normally.

Adding French as an output language

Here’s exactly how I added French to my own translator, using the same cheat sheet approach as the main build. Since Moonshine doesn’t currently support French as an input language, this adds French purely as an output – you’ll be able to translate into French, but not speak French to the translator.

Move into the project directory:

Add French to the frontend language list, right after the existing Spanish entry:

Add French to the backend text-to-speech map, again right after Spanish:

Rebuild the frontend and restart the service:

Reboot the Pi, and French now appears in the language list.

The first time you use it, keep the Pi connected to the internet or Wi-Fi so it can download the necessary files – after that, you’re free to disconnect entirely.

In my own test, with the Ethernet cable unplugged and no Wi-Fi ever configured on the unit, I spoke “Hello, my name is Bill” in English and the Pi replied with a perfectly translated “Bonjour” back through the speaker – confirming the whole thing runs happily offline, even with a language added after the fact.

Conclusion

The Gemma Translator on a Raspberry Pi 5 is a genuinely fun project, and more importantly, a genuinely useful one – a real-time, voice-to-voice translator that needs no cloud connection once it’s set up.

If you have a Raspberry Pi 5 sitting around, I’d encourage you to give this one a try.

 

Parts List

Here are some components that you might need to complete the experiments in this article. Please note that some of these links may be affiliate links, and the DroneBot Workshop may receive a commission on your purchases. This does not increase your cost and is a way to support this ad-free website.

Raspberry Pi 5 8 GB       Raspberry Pi

USB Microphone          Amazon

USB Speaker                Amazon

32 GB microSD           Amazon

 

Resources

Cheat Sheet – All those cryptic commands, packaged into a text file for easy copy and paste.

Google Gemma Translator – GitHub page for this project.

 

 

Stand-alone Translator – Build Google Gemma
Summary
Stand-alone Translator - Build Google Gemma
Article Name
Stand-alone Translator - Build Google Gemma
Description
Build a stand-alone language translator using a Raspberry Pi. The Google Gemma Translator is an easy and fun project.
Author
Publisher Name
DroneBot Workshop
Publisher Logo

0 Comments
Oldest
Newest