DIY Internet-Enabled Home Control System

Why shell out hundreds or thousands of dollars on various home control systems (HCS) when you have the skills and resources to build your own? You can design and implement sophisticated Internet-enabled systems with free tools and some careful planning.

John Breitenbach did just that. He used a microcontroller, free software, and a cloud-based data platform to construct a remote monitoring system for his home’s water heater. The innovative design can email or text status messages and emergency alerts to a smartphone. You can build a similar system to monitor any number of appliances, rooms, or buildings.

An abridged version of Breitenbach’s article, “Internet-Enabled Home Control” (Circuit Cellar 264, July 2012), appears below. (A link to the entire article and an access password are noted at the end of this post.) Breitenbach writes:

Moving from the Northeast to North Carolina, my wife and I were surprised to find that most homes don’t have basements. In the north, the frost line is 36˝–48 ˝ below the surface. To prevent frost heave, foundations must be dug at least that deep. So, digging down an extra few feet to create a basement makes sense. Because the frost line is only 15 ˝ in the Raleigh area, builders rarely excavate the additional 8’ to create basements.

The lack of basements means builders must find unique locations for a home’s mechanical systems including the furnace, AC unit, and water heater. I was shocked to find that my home’s water heater is located in the attic, right above one of the bedrooms (see Photo 1).

Photo 1: My home’s water heater is located in our attic. (Photo courtesy of Michael Thomas)

During my high school summers I worked for my uncle’s plumbing business (“Breitenbach Plumbing—We’re the Best, Don’t Call the Rest”) and saw firsthand the damage water can do to a home. Water heaters can cause some dramatic end-of-life plumbing failures, dumping 40 or more gallons of water at once followed by the steady flow of the supply line.

Having cleaned up the mess of a failed water heater in my own basement up north, I haven’t had a good night’s sleep since I discovered the water heater in my North Carolina attic. For peace of mind, especially when traveling, I instrumented my attic so I could be notified immediately if water started to leak. My goal was to use a microcontroller so I could receive push notifications via e-mails or text messages. In addition to emergency messages, status messages sent on a regular basis reassure me the system is running. I also wanted to use a web browser to check the current status at any time.

MCU & SENSOR

The attic monitor is based on Renesas Electronics’s YRDKRX62N demonstration kit, which features the RX62N 32-bit microcontroller (see Photo 2). Renesas has given away thousands of these boards to promote the RX, and the boards are also widely available through distributors. The YRDK board has a rich feature set including a graphics display, push buttons, and an SD-card slot, plus Ethernet, USB, and serial ports. An Analog Devices ADT7420 digital I2C temperature sensor also enables you to keep an eye on the attic temperature. I plan to use this for a future addition to the project that compares this temperature to the outside air temperature to control an attic fan.

Photo 2: The completed board, which is based on a Renesas Electronics YRDKRX62N demonstration kit. (Photo courtesy of Michael Thomas)

SENSING WATER

Commercial water-detection sensors are typically made from two exposed conductive surfaces in close proximity to each other on a nonconductive surface. Think of a single-sided PCB with no solder mask and tinned traces (see Photo 3).

Photo 3: A leak sensor (Photo courtesy of Michael Thomas)

These sensors rely on the water conductivity to close the circuit between the two conductors. I chose a sensor based on this type of design for its low cost. But, once I received the sensors, I realized I could have saved myself a few bucks by making my own sensor from a couple of wires or a piece of proto-board.

When standing water on the sensor shorts the two contacts, the resistance across the sensor drops to between 400 kΩ and 600 kΩ. The sensor is used as the bottom resistor in a voltage divider with a 1-MΩ resistor up top. The output of the divider is routed to the 12-bit analog inputs on the RX62N microcontroller. Figure 1 shows the sensor interface circuit. When the voltage read by the analog-to-digital converter (ADC) drops below 2 V, it’s time to start bailing. Two sensors are connected: one in the catch pan under the water heater, and a second one just outside the catch pan to detect failures in the small expansion tank.

Figure 1: The sensor interface to the YRDK RX62N board

COMMUNICATIONS CHOICES

One of my project goals was to push notifications to my cell phone because Murphy’s Law says water heaters are likely to fail while you’re away for the weekend. Because I wanted to keep the project costs low, I used my home’s broadband connection as the gateway for the attic monitor. The Renesas RX62N microcontroller includes a 100-Mbps Ethernet controller, so I simply plugged in the cable to connect the board to my home network. The open-source µIP stack supplied by Renesas with the YRDK provides the protocol engine needed to talk to the Internet.

There were a couple of complications with using my home network as the attic monitor’s gateway to the world. It is behind a firewall built into my router and, for security reasons, I don’t want to open up ports to the outside world.

My Internet service provider (ISP) occasionally changes the Internet protocol (IP) address associated with my cable modem. So I would never know what address to point my web browser. I needed a solution that would address both of these problems. Enter Exosite, a company that provides solutions for cloud-based, machine-to-machine (M2M) communications.

TALKING TO THE CLOUD

Exosite provides a number of software components and services that enable M2M communications via the cloud. This is a different philosophy from supervisory control and data acquisition (SCADA) systems I’ve used in the past. The control systems I’ve worked on over the years typically involve a local host polling the hundreds or thousands of connected sensors and actuators that make up a commercial SCADA system. These systems are generally designed to be monitored locally at a single location. In the case of the attic monitor, my goal was to access a limited number of data points from anywhere, and have the system notify me rather than having to continuously poll. Ideally, I’d only hear from the device when there was a problem.

Exosite is the perfect solution: the company publishes a set of simple application programming interfaces (APIs) using standard web protocols that enable smart devices to push data to their servers in the cloud in real time. Once the data is in the cloud, events, alerts, and scripts can be created to do different things with the data—in my case, to send me an e-mail and SMS text alert if there is anything wrong with my water heater. Connected devices can share data with each other or pull data from public data sources, such as public weather stations. Exosite has an industrial-strength platform for large-scale commercial applications. It provides free access to it for the open-source community. I can create a free account that enables me to connect one or two devices to the Exosite platform.

Embedded devices using Exosite are responsible for pushing data to the server and pulling data from it. Devices use simple HTTP requests to accomplish this. This works great in my home setup because the attic monitor can work through my firewall, even when my Internet provider occasionally changes the IP address of my cable modem. Figure 2 shows the network diagram.

Figure 2: The cloud-based network

VIRTUAL USER INTERFACE

Web-based dashboards hosted on Exosite’s servers can be built and configured to show real-time and historical data from connected devices. Controls, such as switches, can be added to the dashboards to push data back down to the device, enabling remote control of embedded devices. Because the user interface is “in the cloud,” there is no need to store all the user interface (UI) widgets and data in the embedded device, which greatly reduces the storage requirements. Photo 4 shows the dashboard for the attic monitor.

Photo 4: Exosite dashboard for the attic monitor

Events and alerts can be added to the dashboard. These are logical evaluations Exosite’s server performs on the incoming data. Events can be triggered based on simple comparisons (e.g., a data value is too high or too low) or complex combinations of a comparison plus a duration (e.g., a data value remains too high for a period of time). Setting up a leak event for one of the sensors is shown in Photo 5.

Photo 5: Creating an event in Exosite

In this case, the event is triggered when the reported ADC voltage is less than 2 V. An event can also be triggered if Exosite doesn’t receive an update from the device for a set period of time. This last feature can be used as a watchdog to ensure the device is still working.

When an event is triggered, an alert can optionally be sent via e-mail. This is the final link that enables an embedded device in my attic to contact me anywhere, anytime, to alert me to a problem. Though I have a smartphone that enables me to access my e-mail account, I can also route the alarm message to my wife’s simpler phone through her cellular provider’s e-mail-to-text-message gateway. Most cellular providers offer this service, which works by sending an e-mail to a special address containing the cell phone number. On the Verizon network, the e-mail address is <yourcellularnumber>@vtext.com. Other providers have similar gateways.

The attic monitor periodically sends heartbeat messages to Exosite to let me know it’s still working. It also sends the status of the water sensors and the current temperature in the attic. I can log in to Exosite at any time to see my attic’s real-time status. I have also configured events and alarms that will notify me if a leak is detected or if the temperature gets too hot…

The complete article includes details such about the Internet engine, reading the cloud, tips for updating the design, and more.  You can read the entire article by typing netenabledcontrol to open the password-protected PDF.

CC264: Plan, Construct, and Secure

Circuit Cellar July 2012 features innovative ideas for embedded design projects, handy design tips with real-world examples, and essential information on embedded design planning and security. A particularly interesting topic covered in this issue is the microcontroller-based home control systems (HCS). Interest in building and HCSes never wanes. In fact, articles about such projects have appeared in this magazine since 1988.

Circuit Cellar 264 (July 2012) is now available.

Turn to page 18 for the first HCS-related article. John Breitenbach details how he built an Internet-enabled, cloud-based attic monitoring system. Turn to page 36 for another HCS article. Tommy Tyler explains how to build a handy MCU-based digital thermometer. You can construct a similar system for your home, or you can apply what you learn to a variety of other temperature-sensing applications. Are you currently working on a home automation design or industrial control system? Check out Richard Wotiz’s “EtherCAT Orchestra” (p. 52). He describes an innovative industrial control network built around seven embedded controllers.

John Breitenbach's DIY leak-monitoring system

The wiring diagram for Tommy Tyler's MCU-based digital thermometer

The rest of the articles in the issue cover essential electrical engineering concepts and design techniques. Engineers of every skill level will find the information immediately applicable to the projects on their workbenches.

Tom Struzik’s article on USB is a good introduction to the technology, and it details how to effectively customize an I/O and data transfer solution (p. 28). On page 44, Patrick Schaumont introduces the topic of electronic signatures and then details how to use them to sign firmware updates. George Novacek provides a project development road map for professionals and novices alike (p. 58). Flip to page 62 for George Martin’s insight on switch debouncing and interfacing to a simple device. On page 68, Jeff Bachiochi tackles the concepts of wireless data delivery and time stamping.

Jeff Bachiochi's hand-wired modules

I encourage you to read the interview with Boston University professor Ayse Kivilcim Coskun on page 26. Her research on 3-D stacked systems has gained notoriety in academia, and it could change the way electrical engineers and chip manufacturers think about energy efficiency for years to come. If you’re an engineer fascinated by “green computing,” you’ll find Coskun’s work particularly intriguing.

Special note: The Circuit Cellar staff dedicates this issue to Richard Alan Wotiz who passed away on May 30, 2012. We appreciate having had the opportunity to publish articles about his inventive projects and innovative engineering ideas and solutions. We extend our condolences to his family and friends.

Circuit Cellar Issue 264 (July 2012) is now available on newsstands. Go to Circuit Cellar Digital and then select “Free Preview” to take a look at the first several pages.

Tech Highlights from Design West: RL78, AndroPod, Stellaris, mbed, & more

The Embedded Systems Conference has always been a top venue for studying, discussing, and handling the embedded industry’s newest leading-edge technologies. This year in San Jose, CA, I walked the floor looking for the tech Circuit Cellar and Elektor members would love to get their hands on and implement in novel projects. Here I review some of the hundreds of interesting products and systems at Design West 2012.

RENESAS

Renesas launched the RL78 Design Challenge at Design West. The following novel RL78 applications were particularly intriguing.

  • An RL78 L12 MCU powered by a lemon:

    A lemon powers the RL78 (Photo: Circuit Cellar)

  • An RL78 kit used for motor control:

    The RL78 used for motor control (Photo: Circuit Cellar)

  • An RL78 demo for home control applications:

    The RL78 used for home control (Photo: Circuit Cellar)

TEXAS INSTRUMENTS

Circuit Cellar members have used TI products in countless applications. Below are two interesting TI Cortex-based designs

A Cortex-M3 digital guitar (you can see the Android connection):

TI's digital guitar (Photo: Circuit Cellar)

Stellaris fans will be happy to see the Stellaris ARM Cortex -M4F in a small wireless application:

The Stellaris goes wireless (Photo: Circuit Cellar)

NXP mbed

Due to the success of the recent NXP mbed Design Challenge, I stopped at the mbed station to see what exciting technologies our NXP friends were exhibiting. They didn’t disappoint. Check out the mbed-based slingshot developed for playing Angry Birds!

mbed-Based sligshot for going after "Angry Birds" (Photo: Circuit Cellar)

Below is a video of the project on the mbedmicro YouTube page:

FTDI

I was pleased to see the Elektor AndroPod hard at work at the FTDI booth. The design enables users to easily control a robotic arm with Android smartphones and tablets.

FTDI demonstrates robot control with Android (Photo: Circuit Cellar)

As you can imagine, the possible applications are endless.

The AndroPod at work! (Photo: Circuit Cellar)

Living & Working Off the Grid

Interested in engineering your own solar panel system installation? If so, you’ve likely begun researching photovoltaic technology, construction materials, and test equipment on the Internet. Have you been satisfied with the information you’ve found? Probably not. There’s simply a scarcity of reliable electronics engineering advice out there about serious solar panel installation projects. Enter Circuit Cellar. Over the past several years, we’ve published articles by professional engineers about their own installations.

Three panels are wired in series and run into the MPPT controllers. Their capacity is 170 W each, 510 W total, to charge the batteries and put off running the generator. (Source: George Martin CC218)

So, before you get sidetracked with another 3-minute video or bullet-point tutorial, do yourself a favor and read columnist George Martin’s two-part article series “Living and Working Off the Grid.” Here’s an excerpt from Part 1:

“First, I’m an engineer—and an electrical one at that (except my degree is so old that it reads “DC ONLY!”). In addition, my neighbors in New Mexico already have systems up and running. Jeff and Pat live up the road in a handmade log home. Jeff is a former engineer for General Motors (Pontiac GTO, Avanti, and Saturn to his credit). That makes for some interesting discussions about how electronics will revolutionize the car industry, but I digress. He’s a mechanical engineer who doesn’t fully embrace all of this electrical stuff. He has a minimal system with four panels of about 150 W each. Another neighbor’s system has about 3 kW of panels. Armed with the idea that it could be done, I started to match up equipment with our requirements.

The equipment I selected falls into four main categories: solar panels, inverters, charge controllers, and batteries. In fact, you could consider each independently and not get too far off an ideal system. There are, however, some areas of concern when mating equipment from different manufactures, so I stayed with one manufacturer for the control devices.

SOLAR PANELS

Solar panels convert solar energy into electrical energy. Again, there is a lot of literature available about how this is accomplished. But what about some hard code conversion details? Standard test conditions require a temperature of 25°C and an irradiance of 1,000 W/m² with an air mass of 1.5 (AM1.5) spectrum. They correspond to the irradiance and spectrum of sunlight incident on a clear day on a sun-facing 37° tilted surface with the sun at an angle of 41.81° above the horizon. This condition approximately represents solar noon near the spring and autumn equinoxes in the continental U.S. with the surface of the cell aimed directly at the sun. Thus, under such conditions, a solar cell with a 12% efficiency and a 100 cm2 (0.01 m2) surface area can be expected to produce approximately 1.2 W of power.[1] This gives you an idea of what’s involved in rating and selecting solar panels. Look at the University of Western New Mexico’s weather site for solar radiation and you’ll get a feeling for the actual solar radiation for the area.

There is another consideration when selecting a panel, namely cost per watt. If you start looking, you will find panels of different wattages and different prices. In March 2004, I started a spreadsheet listing panels from 125 to 195. Note pricing from March 2004, purchased equipment in 2005, installed in 2006–2007, and operational in October 2007. Then, I added the costs different suppliers were charging for each panel and calculated a price/watt number.

My results range from $4.35 to $4.76 per watt. I estimated that I would need 3,000 W of panels, and came up with $13,320 for the cost of the BP Solar SX 170B.

More polysilicon is currently being used in solar panel manufacturing than all other usages combined, so this is big business. It also seems that the larger-power-rating panels command a higher price per watt. It is sort of like the CPU business where chips are speed graded and priced accordingly.

My cost estimates are a bit old, so you’ll need to run the numbers with today’s prices. Let me add that I found solar panels to be in tight supply, so when you begin your design, look to secure the panels at a good price early in the game.

The 3,000 W in my design was derived from the sun’s availability in the winter. Figure 2 represents the solar radiation for an actual cloudless winter day.

Figure 2: The actual solar radiation recorded by Western New Mexico University in Silver City about 30 miles to the west of the house site. (Source: George Martin CC 216)

The peak radiation is 600 W/m2. Let’s estimate that the shape of the curve is a sine function so that the area under the curve is its average value (2/pi, or 0.6366 times the peak value) multiplied by its width. So, that is 600 W/m2 × 0.6366 × 8 h (9 A.M. to 5 P.M.), or 3,055.7 Wh/m2. Therefore: Close to 10 kWh per day is good enough for the workshop, but not enough for the house when it’s built. And 3 kW of panels is what one neighbor is using.

We also need to account for cloudy days. The energy to run the workshop would need to come from the battery or backup generator. Another concern is hot summer days when the panel efficiency drops because of the heat. But the days are longer in the summer. Actually, it’s still a 24-hour day, but there is more available sunlight each day. I don’t have test results for summer generation (because I’m writing this in February 2008 after getting the system put together in October 2007), so stay tuned. The last point to watch out for in panel selection is cold weather open-circuit voltage going into the charge controller.

In the cold, with no current drawn, the open-circuit voltage of the solar panel will rise. If several panels are connected in series (for efficiency), this voltage may damage the input to the charge controller. This is a well-known situation and your equipment dealer will be able to guide you in this area.

INVERTERS

I must confess that I find inverters boring. They are not as exciting as solar panels, charge controllers, or even batteries. I thought I would not find much difference in available inverters and that probably was due to my lack of enthusiasm. I selected inverters from OutBack Power Systems. I wanted the inverter/charge controller combination to be from one manufacturer. As I looked at the literature, OutBack seemed to have covered all of the issues for my installation. I ended up with two OutBack VFX3648 inverters (see Photo 2).

Photo 2: The placement of the Outback System next to the feed into the normal house distribution panel. (Source: George Martin CC216)

They are 3.6 kW (continuous) with connections for a 48-V battery and vented. You will find vented and sealed inverters. I selected vented because they typically have a larger power rating and I’m not in a harsh environment.

Also, the inverters are located in an area that is protected from the elements. Another option is a fan on the inverter. The fan also gives you more capacity, but what will you do when the fan fails, and you know it will? Our system is a normal 220-V home application. So, there are two inverters, one for each phase. OutBack has a neat option that includes a transformer to supply the second phase so the second inverter can remain in a low-power operating mode. When the power requirements become large enough, the main inverter will signal the second (slave) inverter to start up and handle the increased load. This is a good setup for our application. We can install a normal commercial heating/cooling system and power up only the second inverter when the load is calling for it.

Click here to read the entire article series.

 

Radiant Floor Heating Zone Controller Project

Even if you aren’t interested in designing a radiant floor zoned heating system, you can study this innovative project and apply what you learn to any number of building control and automation applications. Dalibor Zaric’s Radiant Floor Heating Zone Controller is built around an NXP Semiconductors LPC2134 ARM processor that’s connected to an Echelon Pyxos chip. The project won Second Place in Echelon’s 2007 “Control Without Limits” design competition.

The heat zone controller system (Source: Echelon & Dalibor Zaric)

Zaric provides the following details in his project documentation:

“• Power supply to unit is 24VAC and controller has switching power supply to provide 24VDC for Pyxos network as well 5V for logic, there is 3.3V linear regulator as well.

• There are four relay with 24VAC output to power up thermoelectric zone valve on radiant floor heating manifold. These outputs are protected with 1.85A self resetting fuse to prevent overloading. This block has as well 24VAC/DC dry contact to provide a call for heat to boiler or optional zones pump.

• Pyxos power supply filter and Pyxos chip provides Pyxos network connection for future sensors and thermostats. Pyxos thermostat will be more cost effective than regular LONWorks sensors/thermostats.

• RS-485 driver will provide future Modbus connection for local touch screens or smart home systems with Modbus connections. There is end of line resistors enabled with the dip switches beside connector.

• 3150 Neuron board with 64K flash provides LONWorks connection to the controller.”

 

The heat zone controller diagram (Source: Echelon & Dalibor Zaric)

For more information about Pyxos technology, visit www.echelon.com.

This winning project, as well as others, was promoted by Circuit Cellar based on a 2007 agreement with Echelon.