Tag Archives: DIY Home Automation

Automating your home with human-like senses


Maker creates an entire home automation system using Arduino and Raspberry Pi.


Over the years, we’ve seen a number of innovative projects using both Raspberry Pi and Arduino boards. And, this latest convergence surely doesn’t disappoint! With the Internet of Things infiltrating nearly every facet of our life, Maker Eric Tsai recently decided to design a slick home automation platform that could do just about anything from in and around the house.

FP43HPRI1SN6AS7.MEDIUM

Rather than simply use the ‘duino-Pi combination to automate things such as blinds or lights, the Maker elected to outfit his home with a full range of wireless sensor nodes on everything (and everywhere) that needed monitoring. Think of it as equipping your house with human-like senses. These nodes relay the data to a wireless gateway and the Arduino Uno (ATmega328), which in turn sends the data to the Raspberry Pi. The board then uploads the collected data to the web where owners can monitor their homes directly from their smartphones.

“Using this setup, that boatload of cheap sensors can now be on the Internet. They can email you when things get too hot, too cold, too smokie, too gassy, or too bright. And your dog can email you by barking. You can also view the status of sensors on your smartphone. These sensor nodes are wireless, so you’re not constrained by the location of Ethernet ports,” he writes.

gateways-1

The concept first originated as a way for Tsai to be immediately notified when his dog barked; however, that idea quickly turned into a project for the entire home, which included a variety of long range wireless sensors integrated into a sophisticated open-source automation server.

On the software side, the project is based on the OpenHAB program, which makes the system available through web browser and smartphone. What’s more, the communication between the display device and the Raspberry Pi is securely accomplished via encryption and authentication.

FQFA7IQHYSU49QN.MEDIUM

One area in particular worth mentioning is the Uber Sensor and the washer-dryer module. For the Uber Sensor, Tsai packed everything possible into the Arduino, including a sound sensor to detect when a cycle starts ends, a PIR presence sensor to determine when a load is picked up, a water detection circuit to signify if there is a leak or overflow, a light sensor to know when a laundry room light is left on, and a temperature sensor, well, just because.

p1080159_gateways

“I combined several sensors into this wireless Uber Sensor node. This sensor is powered via USB adapter, but it communicates wirelessly to the gateway, so you can place this where ever it has access to a power outlet. And you don’t have to build the whole thing, you can pick and choose which sensors you actually want.”

Using his smartphone to access the OpenHAB user interface, Tsai can enable email notifications for the sensors of his choosing. Once an alarm is activated, an email is sent the moment that a sensor detects something.

FQ9I7RTI0DOGL6C.MEDIUM

Sure, you can purchase your own home automation system, but this DIY setup will run you less than $300. You can find a pretty detailed step-by-step guide on the project’s official Instructables page here.

Building an Arduino-powered smart home model


PubNub Evangelist Ian Jennings walks through the process of building a smart home from scratch using Arduino.


Down the road we may build a full-sized smart home, but for now we figured a model home laser cut out of Eucaboard would do just fine for now.

We wanted to showcase how home automation, [Atmel AVR microcontroller based] Arduino, and PubNub go hand-in-hand-(in-hand). More importantly, we wanted to show how important reliable, realtime connectivity is for building a fully-featured home automation solution.

As a result, our Arduino connected home was born. In the story below, the home’s architect/PubNub Evangelist Ian Jennings walks through the process of building the home from scratch (with .gifs!). In the future, we’ll roll out a technical tutorial so you can build one yourself.


Back in September, our founder Stephen and I were talking about ways to make it easier to demonstrate where PubNub sits with the Internet of Things. Attendees at conferences often ask if we’re a “hub,” a bluetooth device, etc.

In reality, we’re a data stream network; a service similar to a CDN that provides a simple and reliable way for IoT devices to talk to each other.

I decided instead of telling people people what PubNub is, we should show them. If I handed you a mobile phone and told you to press a button and then a garage door opened, you would understand that the phone sent a message to the garage door (via Arduino remote configuration).

How did it send the message? That’s PubNub.

So I built the garage door, and a front door, and some lights, and a house, and a mobile app, and I recorded every minute of it. You can check out that video below:

The PubNub IoT Model House from PubNub on Vimeo.

Why a house?

When I think IoT, my mind goes to home automation. It’s a great use case of a number of different connected devices where reliability and security are paramount. In this case, the house is a single IoT device that represents any number of devices.

I started by looking for a suitable “house.” Originally the idea was the have the house fold down so it could be packed and shipped around to conferences. This lead me to believe laser cutting was the best option, because the “snap fit” ability is not only sturdy, but portable.

I eventually stumbled upon this CAD file of a house from “The Simpsons.” It was extremely well designed and only $15. I took a 2 hour lesson here at ATX Hackerspace and learned how to use the laser cutter. A couple days later my roommate came home with some extra Eucaboard.

I wasted half of the board because Corel Draw determines scaling settings when each file is opened. Apparently I cut all 4 laser files at different scales, so none of the pieces fit together! Once I figured this out I had a clean cut.

From there I needed to glue the smaller parts like the windows and chimney. No need to set these up on the road.

It turns out gorilla glue is extremely messy because it expands over time. This created a bunch of huge solid glue globs that completely ruined the aesthetics of the house. I used a dremel to cut away at the excess glue. It took me a while but I definitely leveled up my dremel skills.

Then I started prototyping. I used an Arduino Uno Rev 3 and an ethernet shield to get up and running fast. I started with a breadboard, LEDs, and used electrical tape to test mounting the servos.

Hooking Up PubNub

Everything checked out so I started to hook it up to PubNub. We have drivers for Arduino which made it really easy.

I used a Seed Studio Ethernet Shield v2 to provide an internet connection to the IoT house. I didn’t have an Ethernet port around, so I was using my Macbook’s Internet Sharing setting to share the WiFi network connection to the Arduino. There were some slight modifications I needed to make for the SS v2 drivers to work with our v1 library (a full post about this fix coming later).

I opted to use a key value syntax to process messages. As you can see in the video, it was as simple as “garage:0” or “lightLeft:1” to close the garage and turn the left light on.

When I verified that this worked correctly, I soldered everything into a separate board that could be mounted inside the house.

Looking back now, this board should have been a “prototype shield” for Arduino but at the time I thought it would be so simple that it wouldn’t require an entire shield. This was a mistake, and there are now 7 extra wires that would have been unnecessary with a shield.

I built a simple UI in a CodePen to publish PubNub messages on the same channel the house was listening to. I then mounted the LEDs in the house, drilled mounts for the servos and connected them to doors, and mounted the circuit board and the Arduino + Ethernet shield to the house.

It worked!…

About half of the time.

There was something really strange about the behavior. I would have a great connection to PubNub and everything would work… then suddenly it was completely broken. I noticed that something was amuck, and I suspected it was the internet connection.

I dug down into the network, spending many hours looking at WireShark for hints and configuring the WiFi network.

I tried things like assigning an IP address to the Arduino, making sure the MAC address was correct, and even ordering a second Ethernet shield from a different manufacturer and switching from driver-supported USB to native Thunderbolt sharing. Eventually I was able to isolate the problem.

Whenever I opened the garage door, the ethernet shield would reset. I laughed, in what other situation could opening your garage door possibly destroy your internet connection?

Arduino Board Limiters

Arduino board has limiters in place that prevent you from drawing too much power through the board (and frying it). Every time the garage door opened, the servos were drawing all the current, not leaving enough for the Arduino and Ethernet shield to properly function.

I tested my theory with a few external power supplies. When I verified it fixed the problem, I wired in the battery pack you can see in the video.

That was it! I had the working prototype.

Assembling the IoT House

I showed it to my team at PubNub over video chat. They loved it, but seemed a little concerned about how to assemble it. After all, there were about 20 wooden pieces that fit like a puzzle, and then another 20 wires.

There was also a new plan. Now we had a deadline; an upcoming IoT conference in San Francisco. In addition, I wouldn’t be going with the house. It was going right to our CEO Todd who was attending the show.

I started to second guess my original plan of shipping the house to be assembled on spot.

My co-worker at ATX Hackerspace picked up an awesome Pelican case to carry his function generator and other crazy electronic gizmos safely to his clients this same day. He gave me quick demo and ensured that this was the way to go. I plopped the assembled house on top of the case and verified it would fit inside. Later that day I drove over to Fry’s and got one myself.

I glued the house together and decided I was going to ship it in as few pieces as possible. I glued the house walls together, cut out the styrofoam, and fit the house snugly inside the Pelican case.

Then I threw it off a table, kicked it, and tossed it down stairs.

I figured that I would subject the house to the worse torture possible while I could still fix it. Who knows what kind of abuse it will need to endure in shipping?

The house survived with minor injury.

I decided it was time to show this thing off. Test it in a live environment.

Showcasing the IoT House

I took it to HackTX, a hackathon hosted at the University of Texas here in Austin and run by my new pal Taylor. My other good pals Swift and Jon happened to be in town too.

I found a seat next to the students and set up the house. I repeatability assured the other contestants that I wasn’t going to be competing for any of the prizes.

There was a problem. I was connected to the UT campus internet, but their security settings prevented the network from being rebroadcast. I couldn’t share the WiFi from my Macbook to the Arduino. I learned after the fact that there is some way around this, but didn’t look to far into it.

Instead, I decided it was time to make this thing wireless. I did 30 minutes of research and decided I was going to replace the Arduino Uno and the WiFi chip with the newer Arduino Yún board. In addition to the WiFi chip, Yún has a second processor that runs Linux.

What better time to get this thing set up then at a hackathon? My roommate Nick showed up to the hackathon, so we both jumped in my hatchback, rolled down the windows, and cruised to a Radio Shack in South Austin. I called to confirm they had the chip, it wasn’t available at every Radioshack.

We didn’t support Yún at the time so I used our REST API documentation to write my own client. I really wanted JSON support and getting it to work with Arduino was difficult.  It took me the entire hackathon, but by the end…

It was complete.

I bought an external battery pack and a WiFi hotspot. I chiseled little spots out of the Pelican case to fit them in, and configured the Arduino to automatically connect to the hotspot.

The I went to Harbor Freight and bought a toolkit, extra tools, a soldering iron, etc. I rounded up extra servos, LEDs, wires, and wrote a debugging guide in case something went wrong with the house. I also recorded a video about how to take the house out of the case and set it up.

Then I dropped it off at FedEx. Overnight shipping to California.

The worst wasn’t over. Now it was time to wait for the call from our CEO Todd so I could walk him through setting it up.

I didn’t get a call, but instead a couple emails.  One at 6:43am said:

“Awake?”

I wasn’t.

“If so, call me. Starting set up now.”

Another arrive at 8:20am. I was awake for this one. It read:

“All works!”

I fell back asleep.

Wrapping Up

Working on this project was incredibly difficult yet also very fulfilling. I don’t have any formal electrical engineering experience, I’m a web developer by trade. I haven’t learned this much this fast since graduating college.

I was working extremely long days to meet the deadline. I would spend the entire morning just shopping for the right components, screws, glue, or paper. Then I would work, sometimes until 3 or 4am, getting everything together.

Thankfully Arduino makes things simple and I had a great network of people who helped me each step along the way. Alex, in particular was extremely helpful with electronics and another member of the space, Riley, spent on late Friday supplying me with every tool and component I needed during assembly like a surgeon’s assistant.

The IoT house is on display at the ground level office at 725 Folsom in San Francisco. It will also be displayed at upcoming IoT conferences which will be announced on our blog. If you would like me to give a talk about building IoT house at your conference, you can reach me at ian@pubnub.com.

Now to convince PubNub to get me a drone…

Control your window shade with your smartphone

This development from RCGuy out of ALP Electronic Innovation takes us one step closer to complete DIY home automation. No longer is there a need to mess around with those fussy window blinds, just swipe your way to perfect lighting!

Using an Arduino Uno (ATmega328), this device hosts a simple wiring schematic that enables a smartphone app to control a motor driven window shade. A Bluetooth connection is used to establish a connection between the Arduino Uno and the smartphone of choice. From there, a DC motor controls the shade track — allowing in light to wake you up or blocking out the rays to let you catch a few extra minutes of shut-eye!

For easy identification, a series of LED lights notifies the user of the shade’s current status. Now this project may not be as refined as the Homey or as large as these automated blinds, but this project is a true Maker endeavor. The ease of this build almost leaves no excuse as to why your windows aren’t automatically controlled. For those interested in installing a set of connected blinds into their living room, a step-by-step tutorial of the build can be seen below or  on the Maker’s original lnstructables guide.