{"id":241794,"date":"2018-01-02T10:57:59","date_gmt":"2018-01-02T08:57:59","guid":{"rendered":"https:\/\/mybroadband.co.za\/news\/?p=241794"},"modified":"2018-01-02T10:59:00","modified_gmt":"2018-01-02T08:59:00","slug":"build-your-own-google-home-using-a-raspberry-pi","status":"publish","type":"post","link":"https:\/\/mybroadband.co.za\/news\/software\/241794-build-your-own-google-home-using-a-raspberry-pi.html","title":{"rendered":"Build your own Google Home using a Raspberry Pi"},"content":{"rendered":"<p>If you need a project for the Raspberry Pi you have lying around, you could always turn it into a DIY Google Home.<\/p>\n<p>With a minimal amount of hardware and setup, you can create a functioning home assistant linked to your Google account and controlled by voice commands.<\/p>\n<p>Follow the steps below to install the Google Assistant SDK on your Raspberry Pi and set it up to listen for voice commands.<\/p>\n<hr \/>\n<h3 class=\"my-4\">Hardware<\/h3>\n<p>To set up a Raspberry Pi with Google Assistant, you will need the following:<\/p>\n<ul>\n<li>Raspberry Pi 2 or 3<\/li>\n<li>Power Supply<\/li>\n<li>microSD card with <a href=\"https:\/\/www.raspberrypi.org\/downloads\/noobs\/\" target=\"_blank\" rel=\"noopener\"><strong>NOOBS<\/strong><\/a> installed<\/li>\n<li>USB microphone<\/li>\n<li>Speaker<\/li>\n<li>Ethernet\/Wi-Fi connection<\/li>\n<\/ul>\n<p>Connect peripherals to your Pi for initial setup and use the NOOBS image on your SD card to install a clean version of Raspbian.<\/p>\n<p>After setting up Internet access and a new Raspbian installation on the Pi, you can move on to set up the audio devices.<\/p>\n<p><a  data-lightbox=\"post-image\" href=\"https:\/\/mybroadband.co.za\/news\/wp-content\/uploads\/2016\/02\/Raspberry-Pi-3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-156889\" src=\"https:\/\/mybroadband.co.za\/news\/wp-content\/uploads\/2016\/02\/Raspberry-Pi-3.jpg\" alt=\"Raspberry Pi 3\" width=\"630\" height=\"420\" srcset=\"https:\/\/mybroadband.co.za\/news\/wp-content\/uploads\/2016\/02\/Raspberry-Pi-3.jpg 630w, https:\/\/mybroadband.co.za\/news\/wp-content\/uploads\/2016\/02\/Raspberry-Pi-3-250x166.jpg 250w\" sizes=\"(max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<hr \/>\n<h3 class=\"my-4\">Audio<\/h3>\n<p>Connect your USB microphone and speaker, and test to see whether the devices are working properly.<\/p>\n<p>Start up the Terminal application on your Pi. All setup procedures will be done through this command line interface.<\/p>\n<p>Check to see if your speaker is working by inputting the following into the terminal:<\/p>\n<blockquote><p>speaker-test -t wav<\/p><\/blockquote>\n<p>To check if your microphone is working properly, input the following to record a short clip:<\/p>\n<blockquote><p>arecord &#8211;format=S16_LE &#8211;duration=5 &#8211;rate=16000 &#8211;file-type=raw out.raw<\/p><\/blockquote>\n<p>And then input the following to play back the recording:<\/p>\n<blockquote><p>aplay &#8211;format=S16_LE &#8211;rate=16000 out.raw<\/p><\/blockquote>\n<p>If you have an HDMI display connected to your Pi, you can also choose to play audio out to the monitor it is connected to.<\/p>\n<hr \/>\n<h3 class=\"my-4\">Developer Project<\/h3>\n<p>To install the Google Assistant SDK, you will need to set up a Google Developer Project.<\/p>\n<p>Follow the steps below to set up a Developer Project.<\/p>\n<ul>\n<li>Open a web browser on any device and log in to your Google Account.<\/li>\n<li>Head to the <a href=\"https:\/\/console.cloud.google.com\/start\" target=\"_blank\" rel=\"noopener\"><strong>Google Cloud Platform<\/strong><\/a> and select the option to create a new project.<\/li>\n<li>Name and create your project, then select the <a href=\"https:\/\/console.developers.google.com\/apis\/api\/embeddedassistant.googleapis.com\/overview\" target=\"_blank\" rel=\"noopener\"><strong>Google Assistant API<\/strong><\/a> and enable it for your project.<\/li>\n<li>Click on the OAuth consent screen tab and give your product a name, then press Save.<\/li>\n<li><strong><a href=\"https:\/\/console.developers.google.com\/apis\/credentials\/oauthclient\" target=\"_blank\" rel=\"noopener\">Create an OAuth ID<\/a><\/strong>.<\/li>\n<li>Select the Other option and give your client ID a name.<\/li>\n<li>Select Create and close the dialog that appears.<\/li>\n<li>Click on the Download JSON button to the right of the OAuth ID.<\/li>\n<\/ul>\n<p>This JSON file authorises a device to use the Google Assistant SDK. Move this file to your Raspberry Pi&#8217;s local storage under &#8220;\/home\/pi&#8221;.<\/p>\n<p>To enable all the Google Assistant, you will need to share the activity data of your Google account you want to use with the Assistant SDK.<\/p>\n<p>Open your account&#8217;s <strong><a href=\"https:\/\/myaccount.google.com\/activitycontrols\" target=\"_blank\" rel=\"noopener\">Activity Controls<\/a><\/strong> and ensure the following options are enabled.<\/p>\n<ul>\n<li>Web &amp; App Activity<\/li>\n<li>Include Chrome browsing history and activity from websites and apps that use Google services<\/li>\n<li>Device Information<\/li>\n<li>Voice &amp; Audio Activity<\/li>\n<\/ul>\n<p>After your account has been set up, you can move back to your Pi terminal and prepare to install the Assistant SDK.<\/p>\n<hr \/>\n<h3 class=\"my-4\">SDK Setup<\/h3>\n<p>Open a terminal on the Pi and run the below commands in order:<\/p>\n<blockquote><p>git clone https:\/\/github.com\/google\/aiyprojects-raspbian.git ~\/voice-recognizer-raspi<\/p>\n<p>cd ~\/voice-recognizer-raspi<\/p>\n<p>scripts\/install-deps.sh<\/p>\n<p>sudo scripts\/install-services.sh<\/p>\n<p>cp src\/assistant_library_with_local_commands_demo.py src\/main.py<\/p>\n<p>sudo systemctl enable voice-recognizer.service<\/p><\/blockquote>\n<p>Google Assistant SDK should now be installed on your system and will run automatically when the Pi boots up.<\/p>\n<p>To enable wake word detection and voice recognition, run the following commands in order:<\/p>\n<blockquote><p>cd ~\/voice-recognizer-raspi<\/p>\n<p>source env\/bin\/activate<\/p>\n<p>python3 src\/main.py<\/p><\/blockquote>\n<p>Now that Google Assistant is set up on your device, you should be able to address by simply saying &#8220;OK Google&#8221; and issuing it commands.<\/p>\n<p>Developers can build on the above project by programming their own custom voice skills and smart home functions using Google Assistant&#8217;s voice recognition as input.<\/p>\n<p>If the device is still connected to a monitor, keyboard, and mouse, you can set it up to be accessible via SSH and run in a headless configuration using the Pi&#8217;s network options.<\/p>\n<hr \/>\n<h3 class=\"my-4\">Now read:\u00a0<a href=\"https:\/\/mybroadband.co.za\/news\/software\/240734-the-most-popular-browsers-on-desktop-and-mobile.html\" rel=\"bookmark\">The most popular browsers on desktop and mobile<\/a><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>If you need a project for the Raspberry Pi you have lying around, you could always turn it into a DIY Google Home.<\/p>\n","protected":false},"author":341028,"featured_media":195470,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[47886,167,35,8043],"class_list":["post-241794","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-assistant-sdk","tag-google","tag-headline","tag-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/posts\/241794"}],"collection":[{"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/users\/341028"}],"replies":[{"embeddable":true,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/comments?post=241794"}],"version-history":[{"count":2,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/posts\/241794\/revisions"}],"predecessor-version":[{"id":243324,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/posts\/241794\/revisions\/243324"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/media\/195470"}],"wp:attachment":[{"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/media?parent=241794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/categories?post=241794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mybroadband.co.za\/news\/wp-json\/wp\/v2\/tags?post=241794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}