Prepare

Google Speech-to-Text

Speech-to-Text is an API that is powered by Google's artificial intelligence (AI) technology. You send your audio data to Speech-to-Text, then receive a text transcription of your audio data in response. For more information about how to construct a Speech-to-Text request, see the requests page.

https://cloud.google.com/speech-to-text/docs/before-you-begin?hl=en

Enable Speech-to-Text on a project.

Connect Raspberry Pi

Check out our step-by-step guide:
How to set up your Raspberry Pi 4 for the first time

Connect W5100S-EVB-Pico

W5100S-EVB-Pico is a microcontroller evaluation board based on the Raspberry Pi RP2040 and fully hardwired TCP/IP controller W5100S – and basically works the same as Raspberry Pi Pico board but with additional Ethernet via W5100S.

Setup Google API service

In this tutorial, you'll learn how to use the Speech-to-Text V1 API from a Python application by following these steps:

Select a Google Cloud project and enable the Speech-to-Text API.

Set up authentication by creating a service account and downloading a key.

Create a sample application that transcribes an audio file to text.

Estimated time to complete: To get started, click Start.

Creating a project on the Google Cloud platform

<step-1> Menu -> IAM & Admin -> Manage resources

<step-2> Go to the page [Manage Resources] and [+CREATE PROJECT] select.

<step-3> Enter a name for the project and press CREATE. This creates a project.

<step-4> Menu -> APIs & servuce -> Library

<step-5> [Cloud Speech-to-Text API] Find and click. [MANAGE] click

Create User Credentials

<step-1> [+CREATE CREDENTIALS] select and Service account click

<step-2> Enter a name for the account and press CREATE

<step-3> Verify that the service account has been created as follows:

Create API key

<step-1> Manage service accounts click. Enter the service account you just created.

<step-2> KEYS -> ADD KEY -> Create new key

<step-3> Press Create while selected as the JSON format.

<step-4> Move the created JSON file to the RPi directory.

<step-5> Now it's time to export the JSON file.

example) pi@raspberry:~ $ export GOOGLE_APPLICATION_CREDENTIALS="KEY_STRING"

Getting Started

Raspberry Pi Setup
pi@raspberry:~ $ pip install --upgrade google-cloud-speechorpi@raspberry:~ $ python3 -m install --upgrade google-cloud-speech

pi@raspberry:~ $ sudo apt install -y mosquitto mosquitto-clients

To make Mosquitto auto start when the Raspberry Pi boots, you need to run the following command (this means that the Mosquitto broker will automatically start when the Raspberry Pi starts :)

pi@raspberry:~ $ sudo systemctl enable mosquitto.service

Now, test the installation by running the following command:

pi@raspberry:~ $ mosquitto -v

mosquitto_pub -d -h mqtt_host -t mqtt_topic -m mqtt_msg
WIZnet W5100S-EVB-Pico setup

Install CircuitPython on Raspberry Pi Pico by referring to the link above.

https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/circuitpython

CircuitPython 7.3.3 link - DOWNLOAD

Copy the WIZnet library Into the lib folder inside the Raspberry Pi Pico. https://learn.adafruit.com/ethernet-for-circuitpython/circuitpython-setup

Before continuing, make sure your board's lib folder has at least the following files and folders copied over: https://github.com/Wiznet/RP2040-HAT-CircuitPython

adafruit_bus_deviceadafruit_wiznet5kadafrui_minimqtt

Copy the CircuitPython NeoPixel into the lib folder inside the Raspberry Pi Pico.

https://learn.adafruit.com/circuitpython-essentials/circuitpython-neopixel

adafruit_pixelbuf.mpyneopixel.mpy

The following serial terminal program is required for MQTT Publish test, download and install from below links.

Tera Term

Before this, you should find the Raspberry Pi Pico COM port number from "Device Manager" on your PC.

Let's start Speech-to-Text control device

Rainbow Color

Color LED on