Introduction: Raspberry Pi Google Assistant With Sleek Wood Box

In this instructable I’ll show how to build a DIY Google AI Assistant using a Raspberry Pi, USB Speaker and USB microphone. I’ll also show how to make the sleek hardwood box it’s housed in.

I’m assuming a basic knowledge of the linux operation system, raspberry pi and unix command line. If your new to raspberry pi there are plenty of good getting started tutorials here https://www.raspberrypi.org/help/ and on instructables (:

If your not interested in woodworking. You can easily substitute the wooden box for something simpler, like a cardboard box or a plastic project box.

Hardware used:

Materials needed for the box:

  • 10mm aluminum tube
  • Tasmanian oak was used for the wood. Each board measured 24x9x1.2cm
  • Wood finishing oil, I used Danish oil.
  • 2mm wood screws
  • 30mm wood screws

Tools used:

  • soldering iron
  • tenon saw
  • hand router
  • bench chisel and mallet
  • sand paper
  • drill press
  • electronics perfboard was used as a template for the speaker holes
  • hacksaw
  • flat file

Step 1: Watch the Build Video

Watch this build video to get an idea on what is involved. If you like my video please, like it, leave a comment and subscribe to my channel (: https://www.youtube.com/user/andii1701

Step 2: Setup the Raspberry Pi

Connect the pi to a keyboard, monitor and mouse. Boot it up. Now configure network and ssh access. There is a good guide here: https://developers.google.com/assistant/sdk/develop/python/hardware/setup

Note Raspberry PI's do not have real time clocks so you will need to either setup NTP or manually set the time with the command:

$ date -s '2014-12-25 12:34:56'

not doing so can cause SSL errors later.

Once network is setup update you pi’s operating system by following this guide: https://www.raspberrypi.org/documentation/raspbian/updating.md

(Optional) Compile python3.6 on the raspberry pi

The default python3 install on the raspberry pi is python3.4, I wanted a more modern python, so I downloaded and compiled python3.6 from source http://bohdan-danishevsky.blogspot.com.au/2017/01/building-python-360-on-raspberry-pi-3.html

Step 3: Configure Google Cloud

The google assistant SDK needs to talk to it's API in google cloud. This process involves creating a google cloud project, enabling the assistant API, generating a client secret and downloading that secret json blob to the pi. There are detailed instructions here: https://developers.google.com/assistant/sdk/develop/python/config-dev-project-and-account

Step 4: Configuring the Assistant Python Software on the Pi.

If you just want a bear bones google assistant running on follow this guide: https://developers.google.com/assistant/sdk/develop/python/run-sample.

However if you want to add a LED or extend it in other ways git clone this library and follow the instructions to get it running:

$ git clone https://github.com/googlesamples/assistant-sdk-py...
$ cp -r assistant-sdk-python/google-assistant-sdk/googlesamples/assistant/library new-project

You should now have a working Google assistant running on the Pi.

Step 5: Getting the Assistant to Turn on the LED

Solder the 330ohm resistor to the negative terminal of the LED and wire it up according to the above diagram. I used PIN3 for ground and PIN18 for positive.

Python has an excellent library for controlling GPIO pins called Rpi.GPIO. Install this library into your virtual env:

$ pip install RPi.GPIO

Before messing around with the assistant's code, I'd suggest following this guide to make sure the LED works first:

https://thepihut.com/blogs/raspberry-pi-tutorials/...

Adding GPIO code to the google assistant was quite straight forward. Download the attached patch and apply it with:

$ patch -p0 < hotword.py.patch

If the patch applied correctly the LED should turn on after "OK Google" and turn off after the assistant finishes.

Step 6: Building the Box

Now the google assistant and LED are working you can now make the box.

I sawed the timber to length 24cm and planed down the ends to match each other. Using a marking gauge I marked a rectangle on the inner face of each board that was 1/4” in from each side. I then chiseled and hand routed out this area to a depth of about 6mm. I place the pi between the boards regularly to check the gap distance. If you don't have a hand router, you could use an electric router or make a simple one.

Note I should have left raised platforms in the corners of the trench for the aluminum spacers to sit on. The wood screws had very little wood on the front board to bite into. It was enough, just!

This is not shown on the video. On the back board I cut out a deeper area around the PI’s USB ports. This extra trench depth came to about 9mm. This allowed the boards to end up closer together, providing a more sleek look.

Step 7: Drill Speaker Holes

Using a speaker as a size guide, I masked out an area of holes on an electronics perfboard with tape. I then used this perfboard as a drill template by taping it to the board. Make there is enough room at the back to place the pi and two speakers. I’d do a mock electronics layout first.

Using a 1mm drill bit carefully drill out the speaker grill. (This will take some time :)

Step 8: Layout Electronics

Layout all electronics. Drill pilot holes for the Pi and screw it in place using the 2mm wood screws. Place the speakers over the grills and figure out how long the USB cord needs to be. A long usb cord will not fit in the box. Cut the cord to length and re-solder it to the usb controller. Everything can now be connected and placed. Hot glue the speakers in place. I placed the USB controller board under it’s usb cables near the Pi’s USB hub. I also used a bit of electrical to cover it so no shorts occur.

Drill a 3mm hole for the LED. Place it in the hole and wire it up. Note I had to cut 2mm off each black pin connector on the breadboard wires so they will fit in the box. Cover the exposed wires and resistor with electrical tape to prevent shorts.

Step 9: Make Aluminium Spacers and Finishing the Box

Using 10mm aluminium tube, I cut the spacers to length 23mm with the hack saw (same height as the Pi). Then cleaned up the cuts with the flat file. Place the spacers in the corners and put the back board in place, make sure you are happy with how wide the gap is.

Using the spacers as a guide mark a drill hole at the centre of each spacer. In the back piece drill pilot holes for the case screws. Do a mock assembly and secure it together with tape. Using the depth guide on the drill press, drill shallow pilot holes on the front board by drilling though the back board pilot holes. BE VERY CAREFUL not to drill through the front board!

Counter sink the back drill holes with a counter sink bit.

You can now screw together the box. Be careful to choose the correct length wood screws. I got lucky, the 30mm wood screws were just long enough. It might be worth taking the box to the hardware store so you can find the correct screws.

Finishing the box

I sanded the box smooth and used a camera dust remover to blow out the dust from the speaker grill and electronics. I finished the box with danish oil, carefully dabbing it on around the speaker grill so the holes to do not get clogged.

Congratulations your done! BTW google assistant have tonnes of easter eggs you can discover (:

Step 10: Extending the Google Assistant

Extending the assistant is an instructable in itself. So I'm not going to cover it in detail here. But I'll point you in right direction. The simplest way to extend the assistant is to write apps in the ittt.com (If this then that) service. ittt.com is a online service you can create simple web apps that automatically perform various tasks. The google assistant can be wired up to this service.

Another way to extend the assistant is by extending the python client. I did not look into this in detail but this link is worth looking at: https://developers.google.com/assistant/sdk/develop/python/next-steps

Step 11: Conclusion

Thanks for reading the instructable, hope you enjoyed it. If you have not done so watch the build video above (: Please subscribe to my channel if you like it.

Me:

twitter: @andii1701

instagram: @andrew_r_jones

youtube: @andii1701

Comments

author
varun ronaldo (author)2017-08-16

Can I use any other box for this project

author
andii (author)varun ronaldo2017-08-16

Sure can, you can even have no box (:

author
varun ronaldo (author)2017-08-16

Super project

author
andii (author)varun ronaldo2017-08-16

Thanks!

author
absinth4. (author)2017-08-15

Great project! If i skip the step with the led part, will it still be working ???

author
andii (author)absinth4.2017-08-15

Sure will. Just will be a little harder to tell when it's activated.

author
tinaciousz (author)2017-08-14

Can I ask it to set reminders for me? I want one of these in my kitchen!

author
andii (author)tinaciousz2017-08-14

Hi yes, it can set reminders and alarms (:

author
rene6 (author)2017-08-10

Hello Andii, great project! In step 8 you're describing the USB controller board. Can you tell me what hardware that is and how you connected it to the Pi.

Thanks,

René

author
andii (author)rene62017-08-11

Thanks! The USB controller was part of the off the shelf USB speaker I used. When breaking the speaker case I broke some of its internal wires. So I had to re-solder them back to it's original PCB.

author
rene6 (author)andii2017-08-11

Ok thanks, so when I use the speaker in your hardwarelist I just connect it to one of the pi's usb ports and the microphone to the other I assume. What is the maximum distance so that the microphone still reacts to your voice?

author
andii (author)rene62017-08-12

Yesm USB speaker an mic plug still plug in via USB. Not sure of maximum distance of the mic, but works fine when saying "OK google"anywhere in our open plan living room.

author
rene6 (author)andii2017-08-12

Thanks. Hope to build one in the comming months. I will place the result here.

author
mlowinske (author)2017-08-10

What was the overall cost of this and about how long did it take, but not including the wooden casing?

author
andii (author)mlowinske2017-08-10

Total cost including pi, official sdcard, usb mouse, usb speaker and official powersupply was $120AUD. You can probally get it cheaper as everying is more expensive in Australia.

author
Strato_caster (author)2017-08-09

Great project! I have an old Raspberry Pi 2 laying around. Is there any reason I couldn't use it for this project?

author
andii (author)Strato_caster2017-08-09

Thanks! Don't see why not, it might run a bit slower.

author
HerrRouge (author)2017-08-07

I just love the video of the process! ^_^

author
andii (author)HerrRouge2017-08-07

Happy you liked the video. Be sure to subscribe to my channel (:

author
HerrRouge (author)andii2017-08-08

Already did :)

author
fourbyfour4 (author)2017-08-07

I don't understand how to add GPIO code to the google assistant. patch -p0 hotword.py.patch does not do anything. Can anyone help me understand what I'm doing wrong. I downloaded hotword.py.patch to the download folder. Maybe I need to move it?

author
andii (author)fourbyfour42017-08-07

Sorry the correct command is:

$ patch -p0 < hotword.py.patch

author
bruno.ck.9 (author)2017-08-07

Hey ! Great Project ! Congratulations!!! Do you know if this Google assistant service could run on a Raspberry Pi with other services running at the same time? I have a raspberry pi at home running a DNS and OpenVPN server already. If it could run alongside the other services, I'll upgrade my Pi to a Raspberry pi 3.

author
andii (author)bruno.ck.92017-08-07

Raspberrypi 3 is quad core. So should be fine as long as other services are not high load.

author
sorebigtoe (author)2017-08-07

Brilliant, I have a few 1st generation Raspberry Pi's. Do you know if it works with them

author
andii (author)sorebigtoe2017-08-07

Not sure. Don't see why not. Will probably run slower.

author
dbess (author)2017-08-07

And nobody saw the Debian swirl.. but I did ! ?

author
EmersonV10 (author)2017-08-07

Hi, And can be configured in Spanish?

author
PiguCoupon (author)2017-08-06

Great Instructible! Let's see if I can use the google assistant on my Smart Mirror project...

author
andii (author)PiguCoupon2017-08-06

thanks and Cool idea!

author
Ace Gambit (author)2017-08-04

I've never been good with electronics, but I have an old raspberry pi lying around, and this looks like a really cool project to try.

author
andii (author)Ace Gambit2017-08-06

Not sure if it works with the older pi models but worth a try..

author
TechKiwiGadgets (author)2017-08-06

NIce work

author
andii (author)TechKiwiGadgets2017-08-06

Thanks

author
seniorfrito (author)2017-08-06

Can this do all the things that the official Google Assistant can do? For instance, making lists, setting reminders, and interacting with other devices via bluetooth?

author
andii (author)seniorfrito2017-08-06

It can set reminders and make lists. I don't think it cacn interact with other devices via bluetooth.

author
BenjaminK79 (author)seniorfrito2017-08-06

it should about as much

author
Imetomi (author)2017-08-06

Amazing project! Beautiful design, thank you for sharing!

author
andii (author)Imetomi2017-08-06

Thanks!

About This Instructable

16,374views

298favorites

License:

Bio: Instructable about how I make things that appear in my videos. Check out my youtube channel about making and hand tool woodworking. https://www.youtube ...
More by andii:Raspberry Pi Google Assistant With Sleek Wood Box Building and Testing a Budget 3D Printer KitHow to CNC Without a CNC
Add instructable to: