Driveway Vehicle Sensor

An Arduino and ultrasonic sensor in my driveway can detect when a vehicle arrives by measuring distance to the nearest obstacle. The Arduino notifies a Raspberry Pi, which plays an alert over my speakers, and sends an image snapshot to my phone and watch.

Amazon Echo Pauses My TV

I can say “alexa, turn on TV pause” or “turn on TV play” to control my TV.  A Raspberry Pi receives the request from the Amazon Echo, then the Pi queries my receiver to find out if I am watching my TiVo or my smart TV’s built in apps like Hulu, YouTube or Netflix.  Then the Pi pauses either the TiVo or the smart TV.  I am fortunate that my LG TV, TiVo and Marantz receiver can all be network controlled, so I don’t have to rely on a stateless infrared blaster.

Using Alexa is very handy in case I abruptly have to walk out of the room, I can pause my TV while walking, so I am not slowed down but also do not have to miss my TV show.  If the phone rings, I can quickly pause the TV without waiting to answer my phone.  Another use case is when somebody turns on the blender or gets ice from the fridge.

Next I plan to implement an “alexa turn on rewind” to skip back 30 seconds both with the TiVo or smart TV.

Software Libraries

  • Custom code that talks to my TiVo (telnet) and Marantz stereo (http)

All the code and libraries are kept running forever on my Raspberry Pi using PM2.

PM2 is designed for node scripts, not Java, so to keep Amazon Echo Bridge running forever I use this PM2 process configuration.  (Thanks Zalym)

    "name": "Amazon Echo Jar",
    "args": [
    "script": "java",
    "node_args": [],
    "log_date_format": "YYYY-MM-DD HH:mm Z",
    "exec_interpreter": "none",
    "exec_mode": "fork"

Control Stereo Volume with Siri and Alexa

Denon and Marantz receivers have a web interface that allows the volume to be changed using standard HTTP requests.  Siri and Alexa can change the brightness of a lightbulb between 0% – 100%.  My Raspberry Pi simulates a light bulb but instead of changing the brightness of a light, the Raspberry Pi sends an HTTP message to my receiver to adjust the volume according to the simulated brightness percentage.

  • “hey siri, set the stereo volume to 25%”
  • “alexa, set the stereo to 50%”

Now I can control my TV volume with these devices

  • TV remote
  • Stereo remote
  • TiVo remote
  • Siri on my iPhone or Apple Watch
  • Siri on my wife’s iPhone, Watch or iPad
  • Stereo’s web interface
  • Amazon Echo Dot’s Alexa
  • iPhone light bulb brightness shortcut
  • Apple Watch digital crown

I almost always set the volume using Alexa, because she is in the same room as the stereo.  If I turn up the stereo so loud that Alexa can’t hear me well enough to turn it down, then I can speak directly into the mic of my Apple Watch, which will always hear me over any background noise since my mouth is so close to the mic.


A Node.js HTTP PUT request to the stereo’s control URL changes the volume

var relativeVolume = (newVolume - 80).toFixed(1);
request.get('http://stereo/goform/formiPhoneAppVolume.xml' + '?1+' + relativeVolume, function(error, response, body) {
    if (!error && response.statusCode == 200) {
        callback(null, response.statusCode);
    } else {


Homebridge allows Siri control

A Raspberry Pi running Homebridge uses this plugin to create a fake lightbulb which changes the stereo volume when you use your iPhone to change the brightness.

Amazon Echo Bridge allows Alexa control

Amazon Echo Bridge simulates a Philips Hue bridge for controlling web services with an Amazon Echo.  It supports on, off and brightness.  An Express web server on my Raspberry Pi handles Alexa’s requests, then forwards them to my stereo.

Echo Dot Mounted Above Doorway

My Amazon Echo Dot can hear me from all four rooms on my main floor because it is mounted in the doorway.  I can control all my lights and the TV without having to buy a second Dot, and it is out of the way with the wires concealed.

I bought a plastic wall mount on Amazon which looked nice but unfortunately it did not have a big enough cutout for the power and audio cables so I had to bore out a larger hole with my dremel.  I would not recommend mounting a Dot on the wall because it would prevent the Dot from cancelling out background noise due to sound echoing off the wall which would greatly decrease its useable range.

20′ audio and power cables.

The audio output plugs into my ceiling speakers so I can hear Alexa from every room on the main floor.  The Echo’s built in speaker would be muffled by the mount.

$60 Smart Coffee Maker controlled with Siri or Alexa

Dumb appliances can be combined with smart plugs to create inexpensive smart appliances.  This dumb coffee maker can be controlled with both Siri and Alexa.  Complex schedules can easily be configured with smart phone apps, such as only weekdays, instead of clumsy buttons on digital coffee makers.  On the weekends, when I wake up at inexact times, I just tell Alexa or Siri to turn on the coffee maker and my coffee is ready by the time I go to the kitchen.

Smart plugs only work with dumb appliances, that is the appliance must have a physical switch that is always in the on position regardless of whether the appliance is unplugged and plugged back in.  A digital coffee maker would not work because the power button would not be pressed if it was unplugged and plugged back in.

Parts Used

This video shows how Siri or Alexa can turn on the coffee maker instantly, hands-free and eyes-free.

Scheduling the coffee maker to turn on four days a week with Apple’s Home app.


Traditional Light Switches Controlled by Both Alexa and Siri

Alexa and Siri can both control my light switches, regardless of the position of the light switches.

Parts Used

  • Z-Wave Dual Relay – $30ish dollars
  • Z-Wave Hub (I’m using Wink but Samsung Smart Things is a good choice)
  • Raspberry Pi running homebridge-wink (exposes lights to HomeKit/Siri)
  • Amazon Echo Dot (already supports Wink hub)

A relay like this is inside the light switch.

One dual-relay supports two light switches.  A relay like this is ideal for stairways/hallways with multiple switches that control one circuit AS LONG AS THE RELAY IS INSTALLED IN THE LIGHT SWITCH CONNECTED TO THE LOAD and your light switches have a neutral wire.  A relay like this is not good for lights that you can’t see from the switch, such as an outdoor light, because you can’t be sure the light is off by flicking the switch down.  If the light is already off, and you flip the switch down, the light would turn on, which is probably not what you want, but it’s fine for stairs with multiple switches because those switches are already like that.

It can be tough to fit the relay behind the light switches.  This relay is black but it is identical to the white relay pictured above.