Whole House Media Player

I love music but I tend to zip in and out of rooms while working around the house. I'm just never in one room long enough to put on music and enjoy it while I do a task. To combat this I made sure to include an 8x8 audio matrix in my automation system; which has been sitting idle until today.

I decided to do a little research and find a headless media player that allow me to remotely control audio being played from a Raspberry Pi via a web browser. I found two good options; PiMusicbox and RuneAudio. I had an older Raspberry Pi B+ unit in the drawer so I opted to go with RuneAudio since they had an SD card image for this model.

I downloaded the image and wrote it to the SD card with USB Image Tool (via the instructions on RuneAudio's website). I put the card in the Raspberry Pi, logged into my router to find the IP address. It identified itself in the distribution list as Rune Audio which was a big help. Then I opened Firefox and hit the IP address. Bam! There it was. Rune Audio's interface.

rune interface.png

The next step was to make a Rune Audio user account on my NAS and set it for read only access to my music library. Then I added the music libraries to the Rune interface. Once I did this I browsed to the the player and started playing music. I have never had something like this work so easily before.

The final steps were to connect the Pi to one of the inputs on my 8x8 audio matrix. Then I sat at the living room touchpanel and opened the browser. I navigated to the IP address and everything worked beautifully.

The last step was to modify the Crestron touchpanel files to automatically load the IP address for the media player. Then I made a few UI tweaks and that's it. 3 hours of time and I have a media player that I can hear in various rooms in the house and control from all the touchpanels. I can't believe how easy of a project this was.


TV & Remote Control

I have used simple remotes and I have used programmable remotes like the Logitech Harmony. They all fall short of my expectations. The Harmony is especially frustrating because it promises to simplify the home AV experience. It offered macros and an "assistant" to troubleshoot problems but it was never intuitive enough for a guest to use. The touchpanel menus changed based on the "mode" of the remote and that confused people. The assistant would ask if everything turned on correctly but was cumbersome to use.

A few years ago I decided to fix this and implement my own programming to this issue. What I have now is a remote that I can hand to a guest and have them couch surfing like it was their own home.

First, let's take a look at the remote I have. It's a Crestron MLX-3. It Communicates via RF to the Crestron processor. The processor then sends commands via IR, RS232, and TCP/IP to my stereo equipment.

The top of the remote has a programmable LCD display. It's not touch screen but there is a scroll wheel on the right side of the remote. You can see that "Cable Box" is highlighted. If I press the scroll wheel the remote sends the command for "Cable Box" to the Crestron system.

The rest of the buttons on the remote are hard buttons and easy to find with muscle memory. There's also a hard power button on the top of the remote that you can't see. Our Verizon DVR had two extra buttons that this remote doesn't offer so I used two other buttons and put a p-touch label on there for now. I'll find a more elegant way to fix that some other time.

I am a firm believer that there is no better remote for the living room than a remote with hard buttons. The main reason I feel this way is because I want to watch TV and not look at my remote to find a button and make sure I'm pressing it. A touch screen requires constant attention to make sure you're pressing the right "button". When you're flipping through channels or the channel guide hard buttons give your fingers a place to rest and the tactile feel let you know exactly where your fingers are so they're ready to press the next button.

This is the remote logic diagram.

The idea is that the source selection section of the remote always stays the same. That is, the LCD display will always show the same items in the same order. The user simply needs to scroll to the item they want to use, select it, and then the remote will control that device. It's actually controlling a few devices, but it's transparent to the user.

When you're done watching, simply press the power button and the TV and the Stereo are turned off. There's no need to turn anything else off since in my tests all the other AV equipment draws the same amount of power in both the on and off state. Items like the Firestick or Apple TV will timeout and go to sleep on their own.

So let's dive into this.

When a user selects one of the sources, lets say they choose the Cable Box, the Crestron system will map all the hard buttons (with exception to volume, mute, and power) to the IR driver for the Cable Box. That means channel up, down, number pad, etc.

That same button press that selects the Cable Box also triggers a source selection program. The Crestron system does the following:

Delay 0s:   Turn TV ON
Delay 0s:   Turn Stereo ON
Delay 0s:   Turn Cable Box ON
Delay .25s: Set TV to Input 2 //If the TV is already on set the input immediatly but wait .25s so as not to step on the on command
Delay .25s: Set Stereo to Input 3 //give the stereo a chance to react to turning on
Delay 12s:  Set TV to Input 2 //wait for tv to turn on and receive commands

When a user wants to watch the Cable Box there are two scenarios. One the TV is already ON, two the TV is OFF. If the TV is on sending another On command won't do any harm so I can send an On command immediately and it'll work toward both scenarios. Next I need to turn the Stereo on. The same thought applies. If the stereo is on already the On command will do no harm. If it is off, then I need to turn it on anyway. After that the Cable Box needs to be turned on. In my case, my cable box has an "ON" command. I'll use that. It also makes no difference if the box is on or off first. On my old cable box I used the "Exit" command to trigger the box to wake up. I have also heard of people using the "0" number key but that will cause a "0" to popup on screen.

Now if the TV was actually off we need to wait for the initial "ON" command to complete. So we wait 12 seconds (that's how long it takes my TV) and then send the "Set Input" command again.

There's no intervention needed, I don't need an assistant program, this just works. Here's the fun part...I also don't need a ton of feedback from the devices because as a user of the system, I am the feedback. I can see if the TV didn't turn on or hear the lack of audio if the stereo didn't turn on. All I need to do is press the same command again. By now if the TV had a longer delay and the input didn't set appropriately the first time or the stereo glitched, the second press of the selection key should trigger the appropriate ON or INPUT commands this time. If it doesn't work by the second press then there's a bigger problem and no assistant is going to be able to solve the problem.

The Volume UP, DOWN, and MUTE commands are next. As I mentioned earlier, these hard buttons don't get routed with the rest of the remote buttons. These will always get peeled off and send to either the TV or the Stereo. By default I have them set to control the stereo. But I did add a feature for when I might want to keep the stereo off. I programmed the mute button with a special function. If I press and hold the mute button for 2 seconds, the Volume UP, Volume DOWN, and MUTE will now control the volume on the TV instead of the stereo. If I press and hold the mute button again then it switches back to the stereo.

Finally the power button is peeled off as well. This will simply turn the TV and Stereo OFF as I mentioned earlier in the post.

I can program this remote for as many devices as I want and the user will always be able to navigate the layout because it'll always be the same. The only thing that changes is which buttons work. It would be nice if I could illuminate the buttons that work in a particular layout but that's not an option. So for now the only remotes I need in my living room are this one and the one for the Firestick, but I hope to incorporate the Firestick into this remote as well. The goal is to only need one remote in the living room.

Current Thoughts

I purchased a new TV and there is no discrete ON or OFF command. I will probably end up adding a current sensor to the TV so I can detect when it is on and run the logic based on that. I also found a control module for the Firestick. I'll be trying that out soon and modify the blog post as necessary.

Automation Core

Here's a quick look at my automation system. I have been working to get this on paper so it'll be easier to discuss with people. My vision for the system has expanded over the years but there are still remnants of my senior thesis in this design. The main processing of the system is handled by the Crestron processor, Raspberry Pi, and Universal Devices ISY. Each part handles different aspects of the system. The Crestron mainly handles multimedia and human interfacing. ISY handles lighting and sensor input via Insteon. The Raspberry Pi handles computing and processing that can't easily be handled by the other processors (amazon dash, web scraping, internet stuff, data logging/graphing, etc.) A lot of the Raspberry Pi stuff is planned but not implemented. So far the Dash buttons are all that I have setup on the RPi.

Crestron TSW Touchpanels

I'm a big fan of the TSW series touch panel from Crestron. I have 4 of them in my condo at the moment. 2 of them are on my and my wife's night stands. This model doesn't offer tactile buttons so when I wake up in the morning and want to turn the lights on, I need to physically look at the touch panel to do that.

Since the touch panel has 5 capacitive buttons on the right hand side of the panel I just needed to give them tactile feedback. So a few weeks ago I purchased capacitive suction cup buttons for smart phones and found that they work great on the touch panels except they fall off after 30 minutes or so.

Tonight I designed a prototype plate to fit on the touch panel and stuck the buttons inside the plate. An hour and a half of my time to measure, design, and print a great addition to my touch panels. Take a look at the results. It will need a little fine tuning and a reprint in black. But for a prototype this works great.

Bluetooth Beacons

I'm looking for not-so-expensive ways to track occupants inside a home. I have been for years. I have looked at RFID with mid-range readers, motion detection, IR beam-break detectors, etc. They all fall short for me though. I want to know exactly who is in what room and when so that I can actually tailor the home environment to them. I thought bluetooth could be useful for this because BT devices are cheap. I could put readers around the house and measure RF power to estimate a position.

Recently I noticed that the concept of beacons was becoming popular in retail. I started exploring this as an option for my home. What I found is that the typical use case is for the beacons to be placed in specific locations and then the user launches a phone app to determine where in space the phone is based on those beacons. Retailers can then target messages, ads, or customer service to them. I wanted the system to work in reverse.

I finally found a project where someone has created a proof of concept where the user is the Bluetooth Beacon and there are static receivers (Raspberry PIs) located in the home. The receivers can then transmit information when the beacon (ie. Occupant) comes into the room.  http://stackoverflow.com/questions/21733228/can-raspberrypi-with-ble-dongle-detect-ibeacons

I hope to get to this sometime soon.

Network Scripts

This is how I make my life easier. I am constantly moving between home base and client sites and this means I need to make network configuration changes almost daily. It gets even crazier than that some days too. Some sites have multiple VLANs with no routing and I need to change network address space for each VLAN I’m working on. These are the scripts that make my life easier.

My new work PC doesn’t have a switch to turn WiFi on or off. Since I keep the lid closed and in a docking station at work I can’t use the FN+Hotkey to turn WiFi on or off. So I created these batch files to turn the adapter on and off instead. Each one lives in its own batch file and I simply “Run as Administrator” to execute.

File "Disable Wireless Connection":

netsh interface set interface "Wireless Network Connection" Disable
netsh interface set interface "Wireless Network Connection" Disable

File “Enable Wireless Connection”:


netsh interface set interface "Wireless Network Connection" Enable

I used to have a script that let me configure and save network configurations but when I switched PCs a few years ago I never updated it. Instead I created a bunch of batch files like this one:

File “Wired Adapter Client Video Lan”:

netsh interface ip set address "Local Area Connection" static

When you run it as administrator you can see it is designed to set a static IP address of the network I need to work on. These networks don’t have external network access so I didnt’ specify the DNS servers.

This is how you set the adapter back to DHCP
netsh interface ip set address "Local Area Connection" dhcp

These scripts mean I don’t need to take the time to muddle through the GUI and waste time looking up which IP address to use and typing it in. When laying out the networks I keep track of which IP is used for my configuration PC and leave that IP address free for my use.


Amazon Dash Buttons

Amazon Dash Buttons

Amazon has this amazing product called Dash. It’s a product line of WiFi buttons that connect to your wireless network and when you press the button Amazon orders the associated product for you...but where's the fun in using something the way you're supposed to.

I'm going to hack my first Dash button to remind me when I run out of shampoo so I can put a new bottle in the shower before I'm already in the shower so I don't drip water everywhere.

Motorizing Blinds

I'm a strong believer that home automation should make life more enjoyable and that it's not just about having some "cool" new gadget. I actually enjoy the more obscure and transparent automation devices. Take a look at this picture and you'll notice a lack of anything technical. It's just a picture of the blinds in our home office.

Typically, a person will go into a room and open the blinds every morning. Then at night they'll go around closing all the blinds. If you're in my house then the blinds typical stay closed since doing the same task every day just seems boring and wasteful of my time. Though having closed blinds leads to less natural light, more use of artificial light, and less enjoyment of my natural environment; it's like living in a cave.

I ended up purchasing Somfy RTS motors for my blinds and installing them myself. These work with 2" blind systems and have the option to plug into an outlet or be powered by a battery wand. You'll need a RTS remote to program and use them. You can also purchase a RS-232/485 interface so you can control them with an automation system. I believe they sell a few other options for interfacing them as well.

You can purchase blinds with these motors already installed but I found that the blind companies wanted at least 250 dollars more per window covering and installation had to be done professionally. These motors cost me 135 dollars per covering. The savings of doing it myself allowed me to buy the RS-232 interface.

Installation was pretty easy. I followed two videos from youtube (Video1 Video2).

When I was done with installation I programmed the automation system to close the blinds at dusk. It's really nice not to have to go around the house and close the blinds. The next step will be figuring out when to open the blinds and if I'll have the system ask if we want the blinds open prior to them opening. That's a decision for another day.