Tag Archive for: API

On the 13th of March, we hosted a casual knowledge sharing session around the Google Assistant API’s and a do-it-yourself Google Assistant device. Together with our colleagues we built no less than 3 fully operational Google Assistants

THE PURPOSE OF THIS SESSION

One of the main objectives was to introduce the Raspberry Pi and additional hardware like the Voice-HAT, which stands for “Hardware Attached on Top”. Also understanding the concepts of Machine Learning and Artificial Intelligence applied within ‘smart assistants’ like Google Home, Siri or Alexa was something we wanted to achieve. 

Introduction and objectives

THE INGREDIENTS, PREPARATION AND ASSEMBLY OF COMPONENTS

To be able to build a Google Assistant, we needed both hardware and software components. We did some preparations on forehand, so the participants wouldn’t have to waste too much time on downloading Linux distributions and configuring the Raspberry Pi in terms of Wi-Fi connectivity and remote access via SSH and VNC.

After a short introduction to the project, the two teams started by assembling the different components. Most components can be connected easily by using the provided connector cables and attaching the Voice-HAT to the Raspberry’s GPIO pins. However, two wires of the 8 Ohm speaker needed to be screwed onto the connector on the Voice HAT.

The casing will be made out of card board, so we had to use our folding skills to build the box to house all electronical components.

Assembly of components

But off course our own human hardware needs input and energy as well, so we had a Pizza break before continuing with the software part of the project.

Fuel for the human hardware

CONFIGURING THE SOFTWARE

So, the hardware part is now done and we continue by inserting the Micro-SD card with the Raspbian Linux operating system distribution. This Micro-SD card was prepared and pre-configured to automatically connect with our QforIT Wi-Fi network. Also the VNC-service and SSH-service were enabled, so external access to both the graphical interface as the command line is possible. To be able to connect easily, we configured static IP-addresses on the Raspberry Pi’s. 

When the operating system has been booted up, we perform some checks to determine if all hardware has been assembled correctly. To do so, we run a prepared Python script check_audio.py. This script will try to play a test sound over the Voice-HAT and connected speaker. Also the user is asked to record a test message which will then be replayed by the device, so both the microphones and the speaker are tested.

GOOGLE CLOUD PLATFORM: GOOGLE ASSISTANT SDK

The real magic happens within the Google Cloud Platform. Voice Recognition will be done by sending audio fragments to Google’s servers via the Google Assistant API’s. First we log in to the Google Cloud Platform dashboard, to create a new project.

The project we create will be named ‘Voice Kit’, the next step is to enable the Google Assistant API.

The Google Assistant client on our Raspberry Pi needs to connect to this API, but to do so, it will need to authenticate with the proper credentials. The Google Cloud Platform dashboard allows us to create a credentials-file for downloading to the client.

After downloading the Json credentials file to the home directory on the Raspberry Pi, we need to reboot the system. The startup procedure of the Raspberry Pi has been configured so it will automatically start all necessary Voice Kit services and the credentials file will be loaded. After the system has been rebooted, we have a working Google Assistant!

Interacting with the Assistant is easy, just press the arcade button on top and start talking, or just say ‘Hey Google’ and ask questions like: 
– ‘What is the weather forecast?’ 
– ‘Can you sing me a song?’ 
– ‘What is the latest news’ 

Hey Google, Let’s talk!
The end-result in its full glory
We also like to thank Dennis van Gerwen from InnoTractor
for the demonstration of their amazing IoT CUBE. 

With the ease of Arduino and beauty of Narrow Band. The CUBE is a multi-sensor development device with NB-IOT and CAT-M1 connectivity. By being fully Arduino compatible, making Internet of Things use cases has never been so easy! Innotractor uses The CUBE to create fast and reliable end to end Proof of Concepts.

#TopTeam