$65 Home Automation Announcer

requires_server
project_voice
raspberrypi

(Adam Outler) #1

Hi guys.

This is a project I’ve wanted to do since the Raspberry Pi 3 with built-in WiFi came out. I just turned a couple of RPI3’s into home automation announcers. I thought I would post my experience here as it was time consuming in research but very easy to execute once the research was complete.

Here’s a picture of the final product. The raspberry pi is hidden behind the OnHub router, but it could be hidden behind the speakers themselves.

I took my notes in Microsoft OneNote but it doesn’t translate to the forums well, so you’ll see below there are code boxes where text should be. I dont want to go through and manually change everything here, so

You will need:

  1. Raspberry Pi 3 - $35 https://www.amazon.com/gp/product/B01CD5VC92/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1
  2. Speakers - $25 - https://www.amazon.com/gp/product/B00BZ7MALY/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1
  3. SDCard - Between $3 to $100, your choice. Boot times between 10 seconds to 30 seconds depending on speed of SDCard. Recommendation: https://www.amazon.com/Silicon-Power-MicroSDHC-Class10-SP016GBSTHBU1V20SP/dp/B00TDBLTWK/ref=sr_1_16?s=pc&ie=UTF8&qid=1474818660&sr=1-16&keywords=micro+sd+card

Installation:

  1. Download Raspian Jessie Lite https://www.raspberrypi.org/downloads/raspbian/

  2. Install Raspian Jessie Lite https://www.raspberrypi.org/documentation/installation/installing-images/README.md

  3. Plug in speakers, network cable and Ethernet

  4. At this point you can choose to either ssh into the raspberry pi or hook up a keyboard and HDMI monitor
    If you choose to ssh:

    a. Use your router’s “DHCP Leases” to find the IP address of your newly installed Raspbery Pi
    1) Consult your router documentation to find out more information
    a) In my case it was 192.168.1.66

    b. Execute "ssh pi@192.168.1.66"
    1) Use password "raspberry"
    If you choose to use a keyboard and monitor

    a. Log in with username pi
    b. Password is raspberry

Configuration:

1. Change your password 
	a. Execute "passwd" and follow instructions.

2. Establish Wireless Network
	a. Execute "sudo nano /etc/network/interfaces"
		i. Remove all references to "wlan0"
		ii. Replace with 
			auto wlan0
			allow-hotplug wlan0
			iface wlan0 inet dhcp
			    wpa-ssid "My Wifi Network"
			    wpa-psk "My Wifi Network Passsword"
		ii. press Ctrl-x, then "y" to exit and save.

	b. Execute "sudo service networking restart"
		i. If that doesnt work, try "sudo systemctl daemon-reload" followed by "sudo service networking restart"
	c. Verify your connection 
		i. Execute "Ifconfig wlan0"
			1) Check wlan0 has an "inet addr"
			2) If wlan0 does not have an inet addr after 30 seconds you probably put in the wrong hotspot or password. 

3. Establish Static IP via DHCP
	i. Log Into Router
	ii. Set up static DHCP according to the methods for the device
	iii. Reboot the router and the device to ensure the new changes take effect

4. ssh into the raspberry pi via wifi, from a linux computer or install an ssh client such as http://www.putty.org/
		i. ssh pi@192.168.1.252
		ii. Use your new password. 

5. Configure pi
	a. Execute "sudo raspi-config"
		i. Expand Filesystem
		ii. Advanced>Audio>Force 3.5mm ('headphone') jack
		iii. Finish > no,  dont reboot now

6. Install VLC
	a. Execute "sudo apt update; sudo apt upgrade -y; sudo apt install -y vlc-nox"

7. Establish your command line and password
	a. Execute "vlc -I http --http-password=YOURPASSWORD --http-host=0.0.0.0 --http-port=8080"
	b. Visit your new website to verify it works, using the password you selected.
		i. in my case: http://192.168.1.252:8080


8. Set up SmartThings
	a. My Device Handlers>new
		i. From Code
		ii. Add VLCThing Device Type. See here for more https://community.smartthings.com/t/vlc-thing-a-poor-mans-sonos/5433/8
	b. IDE>Devices
	c. New Device
		i. Give it a name
		ii. Set the IP address as the address for now
		iii. Select VLCThing
		iv. Click create

		v. Preferences (edit)
			1) Enter the IP address.  Mine was 192.168.1.252
			2) Enter the port.  Mine was  8080
			3) Enter your password.  Mine was.... Just kidding, you're not getting my password.

	d. Test the device
		i. Device handlers
		ii. Select your device
		iii. Simulator
		iv. Set location
		v. Select the device
		vi. Install
		vii. Type something in Speech Synthesis
		viii. Click speak

9. Set volume
	a. ssh pi@192.168.1.252
	b. Execute "alsamixer"
		i. Press escape when volume is set
	c. Exeute "sudo alsactl store"

10. Set up VLC to start automatically on reboot
	a. ssh pi@192.168.1.252
	b. Exeucte "crontab -e"
		i. Press enter to select nano as the default editor for crontab
		ii. Go to the bottom of the list
		iii. Enter the @reboot command
			1) @reboot vlc -I http --http-password=YOURPASSWORD--http-host=0.0.0.0 --http-port=8080
	c. Execute "sudo reboot"

That’s all there is to it. If everything worked properly, you now have a $65 home announcement device.

I will now direct you to the BigTalker thread to set it up with events. [OBSOLETE 1.1.6 5/25/16] Big Talker - Talk when events occur

And here’s some visual motivation for you :slight_smile:

Here’s a video of a DeviceType I worked on, with the VLCThing operating in the background


CHIP/Pi Zero W & VLC Thing/Big Talker = SONOS KILLER!
BigTalker 2.0 -- Development
(fightingmajor) #2

What are you using to set up when to talk. Sorry if I missed it, reading this on my phone and it doesn’t all fit on the screen.


(Wayne) #3

:+1: Really nice, love the clean look and finish of the setup in your stairway. What chassis did you put your pi in? Looks very cool.


(Pizzinini) #4

The response time is awesome! I have a couple of speakers connected to DLNA/Wifi devices but they have about 5-10 sec delay… looks like I will have to spend some $'s!


(Christopher Masiello) #5

WOW! Quite the project and the documentation is just as impressive. I was just trying to do something like this with an old PC - I might need to try it with this Pi’s.


(Adam Outler) #6

Hey, you quoted the entire first post in it’s entirety. Any chance you can remove that for cleanliness? It makes it look like it has more steps.

The I use BigTalker. You can find it here [(OBSOLETE See 1.1.10 or later) 1.1.8 10/11/16] Big Talker - Talk when events occur


(Adam Outler) #7

No chassis. It’s just laying on the shelf, slightly above eye level. However, That shelf is hollow so it can slide into it.


(fightingmajor) #8

If only this forum formatted correctly on a phone. Didn’t mean to quote anything.

Anyway, I thought you were using something custom, but this seems to be the same set up as described in using a raspberry pi posted on here previously. I was doing it with Volumio.


(Adam Outler) #9

And after saying it was hollow, my OCD took over and I took care of it. It’s now stuffed inside the shelf. The other one is laying on top of the refrigerator. We don’t put things up there so it’s fine.


[(OBSOLETE See 1.1.10 or later) 1.1.8 10/11/16] Big Talker - Talk when events occur
(Adam Outler) #10

I don’t see where a Raspberry Pi 3 tutorial was created on the site. I checked before I started making notes and I just checked now. Sure, it’s one of those things you can figure out over a long weekend, but using this guide removes the guess work and makes it take just 30 minutes.

Also, this setup, as opposed to most RPI tutorials, uses a server-edition which means no GUI overhead. The unit is performing the absolute minimum possible which means it is consuming a very small amount of power and works as efficiently as possible.


(Glenn Brockett) #11

Nice tutorial. This will give me something to do with the rPi 2 I have sitting around.


(Adam Outler) #12

For the Raspi2, ignore section 2, or find a dongle with instructions to replace it.


(Wayne) #13

No chassis? What is the cool looking black inverted vase like thing on the shelf then?


(Michael Hess) #14

It’s the OnHub router. Nice matching speaker choice!


(Wayne) #15

Ah yes, they sell for ridiculous money here in the UK. £270!! double the US price.


(Glenn Brockett) #16

If you are playing with the rPi, modifying the wifi or networking should be pretty much the same between the versions. I already was working on using it as a SmartTiles display, the added stuff for the sound system should be a breeze.


(Brianh) #17

Why did you post such a great idea and such great documentation? Why oh why?!?!?!? Now something else I need to build. My addiction is getting out of control.


(Adam Outler) #18

There’s no wifi on any Raspi prior to Raspi3.

This tutorial also focuses on headless which conserves energy though reduced overhead. In your case you’re running headed mode with a full X Server, Desktop/window manager and several other convenience packages which support the web browser and hit performance. Which means you would likely want to start at step 3 and skip setup entirely.

however if you wanted to go with a minimal, kiosk-like package instead of the full raspian/NOOBS, it would be possible to install firefox/chromium with just an X-Server and start that in nearly the same way as the vlc server in step 10. Something like “@reboot Xorg & sleep 5; export DISPLAY=:0; firefox” would do the trick. This would reduce startup times to about 10 seconds with a good SDCard.


#19

From the video, it sounds like your setup has a more natural voice compared to what I had tried setting up on the fire tablet. I used LANnouncer on that first try at voice announcements.


(Dan P Parker) #20

I have a couple of Pi Zeros and WiFi+BT hat that have been in search of a project. I think they just found it. Thanks for the outstanding thread.