Legacy Content: This content was published a long time ago. The information may no longer be accurate.
Earlier this month, I got my new Echo from Amazon. What exactly is an Amazon Echo? Basically, it’s a little Wi-Fi connected speaker that you place in your home. It has eight directional microphones in a ring around the top, and it’s constantly listening–just like the NSA! When it hears you say a wake word (“Alexa”), it starts listening for commands. With only your voice, you can tell it to do all kinds of things, and get all kinds of information.
For example, ask about the weather, and you get a detailed weather report for your current location. Ask about news and you get a flash briefing from NPR. You can even tell it to play a song, and it’ll pull the song from Amazon Prime music and play it with surprisingly decent sound quality. Amazon is constantly adding new capabilities, and integrates with services like If This Then That to interface with all kinds of different websites.
One of the most exciting things about the Echo, though, is that it integrates with Smartthings, Hue, and several other home automation platforms. You can give it commands like “turn off the lights”, and it obeys. This is my original home automation dream finally realized; turning off the lights by yelling at the ceiling!
I’ve been using the Echo for about a week now, and I’m surprised by how useful it remains. I’ll be doing a whole series of posts and videos about the Echo and how you can use it for your own home automation system, so stay tuned.
This week, I’ve been posting a bunch about my new Android home automation tablet. So far, I showed the basic setup, and I showed how I use the tablet combined with the Phillips Hue Android app to control the lights in my living room.
But as I mentioned in my first post about the DIY Android home automation tablet, one of the advantages of repurposing an old tablet for a home automation controller is the plethora of useful hardware that even a super outdated tablet brings to the table. You’re got graphics, audio, Bluetooth, a camera, etc.
Audio, in particular, is a great feature to have. Lots of companies are getting into the market for Bluetooth or internet connected music streaming devices. Take a look at Sonos, for example; their popular speakers can be installed in your home, and can then access music from Pandora, Spotify, etc.
But Sonos systems are expensive. So how do you get streaming audio in your living room without paying a fortune? Well if you have a home automation tablet, it’s easy. I already have a stereo receiver with nice speakers in my living room, to play audio for my TV. And my HA tablet has a simple headphone output. All I had to do was buy an RCA -> headphone adapter, plug one end into the tablet, plug the other into the receiver, and my tablet could easily play music at really high fidelity through my home system.
And the best part? Because the tablet runs Android, I can use any music streaming service with an Android app. Which is to say, all of them. Spotify is now free for use on tablets, so I installed it. I now have access to basically the entire world’s music library (minus Taylor Swift), and can play it all through my home stereo system. It’s like a Sonos, but free.
Yesterday I posted about my new (ish) Android home automation tablet. Basically, I took a five year old Samsung tablet, set its screen to “always on” mode, plugged it into the wall to bolster its completely dead battery, and installed it on a stand in my living room. It makes for an awesome, graphical home automation control screen which was basically free.
So what have I installed on the home automation tablet? Well for starters, Phillips Hue. A while back, I replaced many of the lights in my apartment with Phillips Hue bulbs. The bulbs can be controlled remotely through the Hue Android app, or you can control them via your home automation system through an API. They’re awesome, especially for apartment dwellers, who might have one switchable electrical socket but 3-5 different lamps in a single room.
The only annoyance with Hue, though, was the need to always pull out a phone to change light scenes. Phillips did eventually introduce a Hue wall switch, but I didn’t have one, so I was always hunting for my cellphone in order to switch the lights off at night or on in the morning.
My home automation tablet solves this problem brilliantly. I installed the Hue app on it, and added some light presets (“All off”, a warm incandescent like setting, etc.) to the home screen, and tada! Instant, very, very powerful lightswitch. Since the tablet is connected via Wifi to the same network as my Hue hub, the light changes are also extremely fast. Check it out in this video.
Remember when Android tablets were a shiny new technology? I do, and I still have a tablet from that era; an ancient Samsung tab from at least five years ago. Android has stopped supporting it, the (integrated) battery no longer holds a charge, etc.
So E-Cycle time, right? Not so fast. Even an ancient tablet like this one can make a fantastic DIY home automation controller. It’s got a touchscreen, WIFI, Bluetooth, access to tons of home automation apps, audio, a camera, even some sensors (magneto, light sensor, etc.). That’s a lot of hardware to get in a sleek, integrated package for basically free.
I set up my old Samsung tablet in a stand, plugged it into the wall so it has power, and set the screen to always-on mode (it draws almost no power–did I mention that tablets are insanely efficient, too?). It’s in the corner of my living room, and is super easy to walk up to and interact with when I want to do something with my home automation system.
Over the next few weeks I’ll be sharing examples of some of the functions I’ve added. Stay tuned!
In my last post, I talked about using the Raspberry Pi as a DIY remote webcam, in the style of Dropcam. After I published the post, I got an interesting email from someone who is embarking on a large project around using the Raspberry Pi as a webcam platform.
It sounds like he wants to create his own Raspberry Pi distro which would automatically launch and stream webcam video. He also wants to do servo remote control for pan/tilt enabled cams, and other neat stuff like that.
If you’re interested in the same kinds of things, why not check out his Source Forge and see if you can help him out? A lightly edited version of the email is below:
I was wondering whether perhaps you (and/or privateeyepi) are interested in helping me with a script (available at http://sourceforge.net/projects/arpsetupscripts/files/?source=navbar ) which currently attempts to set up the raspberry pi as a fileserver and as a videofeed server, automatically (without user input) -the videofeed server is accessible via internet, whereas the file server is intended only for the LAN-. I don’t know whether it works all ready, mainly because I don’t have a raspberry pi, and also lack the programing knowledge to get it 100% done.
Unlike privateeyepi’s writings, the videofeed server uses mjpg streamer, not motion, so might all ready provide better footage.It might even allow remote control of the video camera (hopefully even from a different computer, perhaps even from the internet, rather than directly from the raspberry pi). The servo motors used would need to be of a specific brand (so not brand-nonspecific) but that would be a minor issue.
I was thinking if you guys prefer, I could also split up the scripts again (to seperate the webcam and file server functionaility), and we could perhaps introduce other features, to increase the home automation tasks it can handle. It could ie be expanded with an automatic setup script for electricity use tracking (see http://diy-ha.com/track-realtime-electrical-use/ ), and perhaps the automatic setup of a webserver. (ie by installing XAMPP –https://www.apachefriends.org/index.html – or lighttpd -see https://en.wikipedia.org/wiki/Lighttpd – That way, all houses equipped with the system automatically also get a blog or website to post things on.
Sincerely, Thomas [ed: Yes, we are both named Thomas]
Lately, I’ve been thinking about ways to beef up my home security using Raspberry Pi. The Raspberry Pi is a pretty capable, dirt cheap little board, and it can connect to all kinds of sensors and systems. I’ve been working on adding a Raspberry Pi camera module, but for those who don’t want to shell out another $30, there’s an even simpler solution.
The Raspberry Pi has full USB support, and runs a fully featured Linux operating system. The Raspberry Pi OS includes support for Video for Linux (V4L), which can interface with webcams. Everyone has a webcam sitting around in their closet. You know, from the 90s? Why not combine a Raspberry Pi and a webcam together to make a super cheap home security camera (ala Dropcam), but for a fraction of the price?
To try this out, I went to my own closet. Sure enough, I found a webcam; in this case, an old Ipevo document camera. Ipevo cameras are nice, because they come with a stand which allows you to reposition them however you like, and they have pretty decent optics, making for a pretty clear picture.
Connecting the Ipevo to the Raspberry Pi was simple as can be. You just plug it into the USB port.
But how do you go about actually taking pictures? I like Python, so I wanted to find a Pythonic solution. It turns out that the easiest one is to use Pygame. Pygame is usually used to design simple games, but it’s great for this surveillance application too, since it has webcam support and comes pre-loaded on most Raspberry Pi boards.
I Googled around a bit, and in just a couple minutes, I was able to hack together some Python code which connects to the webcam, takes a picture each second for 10 secconds, and saves them to the disk.
cam = pygame.camera.Camera(pygame.camera.list_cameras(), (1280,720))
print "Camera Started"
i = 0
while i < 10:
img = cam.get_image()
print "Image captured"
print "Image package imported"
pygame.image.save(img, "webcam_photos/photo%s.jpg" % i)
print "Image saved"
i += 1
Here’s an example picture. In this case, I caught my dog in the act of…walking away from the camera.
The neat thing about this is that I can connect the camera to my Raspberry Pi home automation server, and since the server is wireless, I could place the camera anywhere in my house. Instant diy surveillance cam.
My next step is to set up the camera for remote access. I’ll probably add in some simple Python code to upload the images to a web server, so I can access them from elsewhere. I’d also like to add in motion detection, and ultimately facial recognition, so my home automation system can know when someone familiar shows up at the door. More on these projects soon.
Ever wondered how far you drive in a given month? Want to track everywhere your car goes, NSA style? About six months ago, I was invited to beta test a new product from a company called Metromile. Californians may be familiar with Metromile’s ads, which seem to be everywhere, including on the very pricey billboards flanking the Bay Bridge.
The company’s main goal is to sell you per-mile car insurance. The idea is that if you walk or bike a lot, paying per-mile for your car insurance will save you money, and encourage you to drive less. Metromile’s rates are pretty reasonable for this service, but I’m not terribly interested in using it. What interested me about Metromile is their device.
In order to bill you per mile for car insurance, Metromile needs to know how much you drive. To accomplish this, they issue you a little dongle which plugs into your car’s onboard diagnostic port. Don’t worry, your car has one; it’s usually somewhere under the steering wheel, unless you drive something super, super old. The device, which they call a Metronome, reads acceleration, fuel usage, and other data from your car. It also has a GPS chip, which it uses to track your position. All this data gets sent to Metromile over a built in cellular connection.
The neat thing is that since Metromile would like to sell you car insurance, they don’t charge anything for the usage of the device (at least for now). That means that their system provides a fantastic, free, wireless way to get all kinds of data about your driving.
Installing the Metronome is stupidly simple. You take it out of the box, find the diagnostic port on your car, and plug it in. As you begin to drive, your Metromile account receives data on each trip you take. You can log into their app/web interface to see each trip plotted on a map, see fuel efficiency data, view your speed at each part of your drive, etc. You can also get summary stats on your driving for the past week or month. And of course, you can see how much you would save by switching to their insurance plan.
From a home automation perspective, Metromile provides some neat capabilities. If you’re into hypermiling or life automation, you can use it to optimize your driving, finding which routes are fastest, most direct, or result in the best fuel efficiency. What’s more interesting is the possibility of getting data back out of Metromile. They don’t have an API at the moment, but they do have a way to export all your raw data, so you can at least see what’s there.
Once they do introduce an API—or once I figure out how to write one for them like with Bidgely—I plan to integrate my driving data into my home automation system more directly. For example, I could use Metromile to help my system determine if I’m home. If the GPS reports that my car is approaching, my system could turn the lights on for me, turn on the AC, etc.
A Metromile integration could also be a great addition to a home security system. If Metromile reports that my car is driving away at 2am, my system could alert me. It could also detect if the car drives away while I’m on vacation, and send me a text with its location.
Finally, a Metromile integration could be a great way to get an additional data point into the system for use in my info displays. For example, I could configure my ambient indicator (more soon) to change color as my driving increases towards the 1,000 miles per month limit on my lease. It would be a great reminder to walk a bit more.
Check out Metromile here, and remember to pester them about an API!
California gets a lot of sun; where I live, we get about 9 months per year of continuously sunny days. In fact, it’s genuinely surprising when the weather isn’t sunny. And we’re not talking wimpy East Coast sun, either. The sun here is bright and strong, and there’s rarely any pesky clouds to interrupt it.
It’s a shame, then, that so much of the sunlight which falls on my house gets wasted. Solar, as you’d expect, is a big deal here, and lots of people make good money installing big 5kw+ units on their roofs.
My issue, though, is that I rent. My landlord probably wouldn’t be too thrilled if I started climbing around screwing things into the roof. And I’d have to stay in the same place for an awfully long time to recoup the investment involved with installing a solar system on someone else’s property.
Lately, though, I’ve been thinking about ways I could turn some of that constant California sunshine into free (or at least cheap) (or probably expensive, actually, but fun to generate) energy. Why not build a solar system that’s the right scale for an apartment?
Realistically, an apartment scale solar system probably wouldn’t save money, at least in the short term. Even in California, my average electric rate is only $0.18 per kilowatt hour, which is pretty hard to beat.
But there’s other reasons to have a solar system. In addition to sunlight, California also gets earthquakes, and they can cause extended power outages. It would be nice to have a way to generate power even without the grid. And there’s the general self-reliance aspect, which is nice too. Oh, and of course there’s the environment. That thing.
In thinking about designing an apartment scale solar system, a couple requirements come to mind. First, I would want it to operate without the grid. Net metering—where you buy power from the utility when your panels aren’t generating enough to supply your needs—is the trendy model these days. There’s even some plug in solar options (which claim UL certs but still look sketchy to me) that claim to do net metering for apartment dwellers. But these systems are required by law to shut down if there’s a power outage, so you don’t electrocute lineworkers from PGE, so they wouldn’t address the off-grid aspect.
Secondly, the system would have to be portable. It would need to be something you could move from property to property, so no fixed wiring, panels installed on the roof, etc.
Lastly, and probably most important, it would have to be seamless to use. I’m not about to go swapping out my lightbulbs for 12 volt models. And I know myself well enough to know that I’m too lazy even to have to unplug from one outlet and plug into another when the system wasn’t generating enough power. So my system would need to be automatic; it would use my existing appliances, and would run on solar when solar was available, but would switch to another power source (assuming one was available; see the off grid comments above) when the sun went down and the battery ran out.
So here’s what I came up with.
Panels and Charge Controllers
Renogy offers some really nice looking monocrystaline panels for cheap. They’re small enough to set up on your porch or deck, but efficient enough to generate some decent power output. $180 buys you a 100 watt kit, which includes the panels, cabling, and a PWM charge controller.
These are pretty easy. All I would need is a deep cycle 12 volt battery from Autozone. The RV models are designed to hold a bunch of juice, and can output lots of power over a long time without losing capacity.
A 60 amp hour battery runs about $120. Applying some basic high school physics, if my panels output 100 watts at 12 volts, that’s 8.33 amps. So a 60 amp hour battery would hold about 7.2 hours worth of California sunshine (and yes, I’m simplifying by ignoring charging losses and panel losses…sue me).
Here’s where things get interesting. Everything so far is pretty straightforward hardware. And the inverter could be too; you can get little car inverters which turn your 12v input into about 100 watts of AC output, for as little as $20. You could hook up one of these to your battery, plug in a lamp or something, and be done with it.
This is where the laziness comes into play, though. I would want my system to be automatic; more like the panels people put on their roofs than the hacked together systems Midwesterners put in their hunting cabins. So I don’t want an inverter where I have to physically unplug my appliances and plug them in elsewhere when the solar power runs out. I would want something which runs on solar when it’s there, but can move over to grid power when it’s not.
Luckily, there’s a model for this kind of operation. It’s a Uninterruptable Power Supply (UPS). People use them to power computers and TVs during intermittent outstages. A UPS has a battery, an inverter, and a connection to the wall. Under normal operation, the wall power powers the appliance plugged into the UPS, and also charges the battery. If the wall power is cut, the system switches (within a couple milliseconds) to the battery, giving your enough time to power down your computer safely, or finish your show.
My system would be like a UPS, but in reverse. It would run off the battery (charged by the Renogy panel) under normal conditions, but could instantly fail over to wall power if the battery ran out.
I’m not sure first one to have this idea. Like most things, countless people on the internet have been there first. Just type “solar UPS” into Youtube, and you’ll see what I mean. But I don’t want a solution which involves hacking a traditional desktop UPS. I want an apartment scale solar system, not a house fire. So what are the options?
Enter the APS750 inverter from Tripplite. It’s a beefy, commercial grade inverter which produces up to 2000 watts, and has lots of neat features, like filtered power output for running sensitive electronics. But most importantly, it has a UPS mode. You can plug it into wall power as well as a battery, and it will fail over to battery if the wall power is cut.
So how would I cut the wall power at will, keeping the system in a failure state by default so it can run off the battery/solar?
Enter the home automation portion of the project. I figure the best bet would be have an Arduino or similar board monitoring the voltage of my 12v battery using a simple voltage divider circuit. The Triplite inverter’s wall power plug would then go into a Powerswitch tail before connecting to the grid, and the Powerswitch tail would also go to the Arduino. The 12v input on the Tripplite would go to the battery.
When the Arduino detected that the battery voltage had reached a certain level, it would trigger the Powerswitch, cutting the grid power to the Triplite. The Triplite would think a power outage had occurred, and would instantly switch over to running off the battery (again, charged by the Renogy panel). Tada—instant solar system! When the battery got too low, the Arduino would turn the Powerswitch Tail back on, restoring grid power to the Triplite, and keeping my appliance running.
The whole thing would be very portable, as it would just be a bunch of self contained units plugged into each other; Renogy to Battery, Battery to Triplite, Triplite to Appliance and Wall. Nothing to short out or require professional installation. And there are a ton of things I could plug into it. My media center condenses a television, receiver, DVD player, Roku, and a couple floor lamps into a single plug, so it would be a great candidate.
All told, it would be $660 for this apartment scale solar system. Supposing it generated 100 watts of power for 8 hours per day, that would be 800 watt hours per day at 12 volts, or 66 amp hours, which translates to 717 watt hours per day at 120 volts (ignoring charging and conversion losses for now…again, sue me). That means .71 kwh per day, or $0.1278 worth of electricity saved. You would need to operate the system for 14 years, under absolutely perfect sun conditions (which don’t exist in reality, even in California) to recoup the cost.
So it wouldn’t exactly be saving a bunch of money. But there’s some good news; a system like this might be able to qualify for federal sustainable energy tax credits, which would take about 30% off the price.
And of course, the best reasons for building a system like this probably aren’t financial. A couple years back, before I was on the West coast, I experienced Hurricane Sandy and its lovely aftermath; a 4 day power outage which left my neighborhood pitch black at night. I was grateful to have an old car jumpstarter and an inverter, which I hacked into a system for powering some lights. Having the ability to go off grid is nice for situations like that. And it’s also nice just to know you have the option.
With all good things home automation related, there are a bunch of ways my apartment scale solar system could be expanded. You could always add more panels, or a larger battery, to increase the capacity. And you could find other ways to charge it, too. If your landlord is really nice, you might be able to justify a wind generator, which outputs a ton more power than a solar panel. And if not, there’s always a bicycle generator, which would let you make free power and improve your quads.
And of course, there’s a ton you could do if you were willing to go just a bit more hardcore. Swapping out your 120v lights for 12v light bulbs and then running them off your system would skip all the hassle of the inverter, and could give you some serious run time and power savings. And why stop there? Amazon all kinds of 12v appliances. Solar powered vacuum cleaner, anyone?
So that’s my idea for an apartment scale solar system. Now the big question is, should I actually build it?
In a previous post, I shared some details on the new Arduino Tre, which is currently in Beta testing. I was lucky enough to be invited to be part of the Beta by the terrific Michael Shiloh at Arduino. As part of the Beta, I got a Developer edition of the board to play with.
The Tre is extremely promising as a platform for home automation projects. It has both high-level, graphical Linux capabilities and low-level Leonardo-like Arduino capabilities all on the same board. You can run some Arduino code to pull data from a sensor or the like, and then some Python code to send the data to your home automation system’s database, email yourself if certain conditions are met, etc.
You still can’t buy the Tre just yet, but to give you an early sense of what the board is like, I’ve created a 3D model of my Developer Arduino Tre using 123d Catch from Autodesk, which you can play with below. It’s not perfect (there aren’t really gaping holes in the side of the USB connectors, for example), but you can use my model to pan around the board, zoom in and out, and otherwise check out the Tre to your heart’s content.
To get the full experience, click on the “3D View” button in the model below. Wait for it to load (slowly), and then use your mouse and scroll wheel to explore.
Points of interest include the on-board Leonardo, which Arduino have gone as far as to actually silk screen onto the board itself. You can also see that there’s two sets of two USB ports on opposite sides of the board, as well as HDMI and audio jacks. If you look really closely, you can even see the little TI logo on the Sitara processor.
If you’re too lazy to play with the model yourself, here is a little video showing a full pan around the model, and some fancy zooming.
I’ll share more details on the Arduino Tre here, especially as it gets closer to launch, so stay tuned!
Legacy Content: This content was published a long time ago. The information may no longer be accurate.
In the Hardware section of the site, I talk about using an old Powerspec PC as my home automation server. An outdated PC works fine as a server in some cases, but really, running a little spaceheater-ish P4 around the clock? That’s so 2006. It would be kind of silly to blog all about power efficient lightbulbs and realtime energy monitoring while having a 10 year old PC buring 400 watts all the time. And who wants to run all their home automation stuff on Windows, anyway?
Over the last year, I’ve moved almost all my home automation code and programs over to a new platform: the Raspberry Pi. The PI makes a ton of sense as an HA server. It’s tiny, cheap, extremely power efficient, and can run a full Linux operating system with a graphical interface. You can tie it into low-level sensors (sort of), but at the same time, it can run Python scripts faster than the old Powerspec.
Here’s a little video introducing my Raspberry Pi home automation server:
Another great thing about the Raspberry Pi is that you can easily get it onto wifi. Just add an external adapter like the cheapo ones from Rosewill and you’re set. You can put your server anywhere in the house–in a cabinet, under your desk, in the garage, etc. Here’s my wifi setup:
So once you have your Raspberry Pi home automation server set up (and perhaps embedded in a project), how do you actually communicate it or upload new code? You can be fancy and get it to run an FTP server, but I find it’s often easier just to use Putty to send stuff over SSH:
So what does my server actually do? Well for starters, it uses CHRON to run my Bidgely scraping script once per minute, pulling in my realtime electrical usage. It also scrapes data from the endpoints of a ton of other APIs. You can even have it control things like Phillips Hue over your home network, using Python. I’ll share more on how I’m using my Pi in future posts.