For an index to all my stories click this text.
In some previous stories on this weblog I showed how the Raspberry Pi Pico could produce audio. And not just plain audio but really decent audio.
And then when I was goofing around I had this weird idea.
How about the Raspberry Pi Pico activating my Google Home mini..........
If you want to try this and Troll your own Google you need the following setup:
- A raspberry Pi Pico with audio like described in this story:
https://lucstechblog.blogspot.com/2024/10/pico-audio-part-3.html
- A small active speaker (like a computer speaker)
- Preferably an SD card attached to the Raspberry Pi Pico like this story showed:
https://lucstechblog.blogspot.com/2025/01/pico-sdcard-part-1-hardware.html
And this story for the software:
https://lucstechblog.blogspot.com/2025/01/pico-sd-card-part-2-software.html
Next to that you will need the Audacity software to record your own voice saying ok google ...... and converting it into an 8K wav file. Audacity is free and available on Linux and Windows. I wrote a story on how to use audacity especially for this purpose which you can read here:
https://lucstechblog.blogspot.com/2024/10/audacity-pico-audio-part-1.html
The breadboard setup
I used my audio setup from the previous stories. This includes 3 buttons and an SD-card.
For the example presented here you only need the two buttons attached to GP18 and GP19. And you do not need the oled screen.
You could even do without the SD-card as both files together take less than 200k. However working with an SD card is so easy and convenient that I highly recommend it for many projects, but certainly for audio projects.
For all the details on this setup read this story:
https://lucstechblog.blogspot.com/2025/02/raspberry-pi-pico-audio-player.html
Record the "Ok-Google" sentence.
First thing you need to do is to record some sentences that you want your Google Home (or nest) to react on. I used Audacity to record two sentences and convert them to an 8K WAV file. The sentences I used are:
- OK Google, is it going to rain in Amsterdam today
- OK Google, what is the time.
Make sure you pause for a second or so after OK Google and before speaking the rest. Your Google home needs some time to wake up.
If you are not sure how to record the sentences and convert them to an 8K wav file please read this story:
https://lucstechblog.blogspot.com/2024/10/audacity-pico-audio-part-1.html
Transfer the recorded sentences to the SD card.
Next step is of course to transfer the recorded sentences to your SD card. You can do that physically by attaching the SD card to your computer with an SD-card reader.
Another option is to use Thonny to transfer the recorded sounds to the SD=card if that is still attached to your Pico.
I put the sounds in "/sd/Sounds2" and named them okgoogletime.wav and okgooglerain.wav.
You can of course put these in any directory you want and name them as you like. Just make sure to adjust the upocoming program to your own settings.
The program
The program is easy to follow. It just constantly tests whether one of the buttons is pressed and if so it speaks out the recorded sentences.
import os from machine import SPI, Pin import sdcard spi = SPI(1,sck=Pin(14), mosi=Pin(15), miso=Pin(12)) cs = Pin(13) sd = sdcard.SDCard(spi, cs) os.mount(sd, '/sd') but01=machine.Pin(18, machine.Pin.IN) but02=machine.Pin(19, machine.Pin.IN) from wavePlayer import wavePlayer import time player = wavePlayer() while True: if (but01.value()==0) : player.play('sd/Sounds2/okgooglerain.wav') if (but02.value()==0) : player.play('sd/Sounds2/okgoogletime.wav')
That is all. The program is based on my previous stories about playing audio and attaching an SD-card to the Pico. In these stories you will also find the links to the required libraries.
That's all.
Now just press one of the buttons and hear your voice speaking the sentences. And then just wait a moment and your Google Home will react.
The video that demonstrates it
The only thing now to do is to find a practical purpose for this. But for now it is fun to troll your google assistant a bit.
Till next time
have fun
Luc Volders