10 tips for DIY IoT home automation

5 readers like this
5 readers like this
Several houses


We live in an exciting time. Everyday more things become Internet-connected things. They have sensors and can communicate with other things, and help us perform tasks like never before. Especially at home.

Home automation is made possible by amaetuer developers and tinkers because the price of microcontrollers with the ability to talk over a network continue to drop. It all started for me when I was stuck in the office wishing I was at home playing with my kids. Since I couldn't be there physically, I built a squirt gun out of a microcontroller, a couple of servos, a solenoid valve, and a water hose for around $80 US. See how I did it.

I was on to something. Next I built what I call The Logical Living home automation system out of inexpensive microcontrollers, custom circuits, and other household components. And, I published the code at Code Project. My house now has hundreds of IoT features helping me help it run effeciently, and with more input from me, the home owner.

Along the way, I've learned a few things that can help other beginner IoT makers.

6 design lessons for getting started

Lesson 1: Make each thing smart.

It is hard to move things around when all of your things are connected with wires to a central controller. If each "thing" is self-contained, then it's easy to move it around and easy to take it with you when you move.

Lesson 2: Update the program (firmware) Over The Air (OTA).

It is important to select a microcontroller or microprocessor that has the capability to flash code updates to your remote device. I built a 20 foot outdoor Christmas tree made of lights that I can program while sitting in the office or anywhere with an Internet connection. This is especially nice when it is cold and raining outside. It is very inconvenient to plug my laptop into some of my other IoT projects to do code updates. There is a simple feature that I have been wanting to add for a long time to an IoT cat toy project built on a different platform but the pain of connecting my laptop to the hard to access microcontroller has kept me from making the update.

Lesson 3: Use DHCP or an identity service.

And have one program for all of the devices for each type of microcontroller in your fleet.

Lesson 4: Use a publish / subscribe model.

Do so with a broker to loosely couple all of your things. A broker is software middleware between the "thing" and whatever is communicating with it. Many of my previous IoT implementations were done with "things" that were tightly coupled to a broker to dispatch messages to other "things". I have learned that a well-designed broker can connect publishers with subscribers in a loose coupled approach without opening up a port in the firewall. It is a smart idea to leverage MQTT protocol and an open source broker like Mosquitto.

Lesson 5: Leverage existing cloud services.

Machine learning algorithms can be complex and you can develop new features much quicker by leveraging work from large teams of people with specialties in the area. I'm working on an IoT project to predict the health of my pets that I would not have the time to get the expertise to do without the help from existing cloud services.

Lesson 6: Make the code available to the community.

When I open sourced the code and made it available to the community, I put extra time and thought into making sure the code was clean, of high quality, and used best practices. I knew that many eyes would be looking at and reviewing the code which caused me to want to refactor it often. Open sourcing your project is a great way to get feedback from the community and improve.

4 tips for IoT in the home 

I've learned just as many lessons about people as I did about technology.

Lesson 1: With great power comes great responsibility.

I can control the TV, DVR, and music player with IR signals. So, to be funny, I'd randomly change the TV channel or music station when I was away from home, while my family was at home. It was my way of telling them I was thinking of them, but they didn't exactly see it that way! When I got home someone had disabled the control by removing wires from my circuit. Needless to say, I was proud they figured out which wires to remove to disable it. Smart!

Lesson 2: Be aware of pets.

We have a cat that likes to play in funny places, and she was particularly interested in my project to control the fireplace with speech-voice recognition. A burned kitty would mean the end of my IoT projects, so I quickly wired up a mesh screen to keep the cat out.

Lesson 3: Beware of fire.

I built an IoT-controlled pumpkin for Halloween that shot a 4-foot flame out of its face when mentioned on Twitter or alternatively controlled with a watch or phone. This was a huge hit but IT became difficult to keep all the kids at a safe distance all night long. This year, I'm building a 12-foot monster that shoots the flame way above the kids heads and is controlled by speech commands. See some of my other Halloween IoT projects.

Lesson 4: When it's in the home it needs to be nearly 100% reliable.

Family members are not forgiving of quality defects, and your home automation projects will not be used if they are not reliable.

Some of my microcontrollers would lock up after a couple of days because of Ethernet communication issues, and I knew I had a problem when my wife called me while I was traveling because the garden wasn't watering. I spent days working out the issue and finally resolved it by having the code detect the issue and then reboot the device to recover. The reboot is so fast that people don't usually notice the downtime.

Dan is passionate about building cool stuff, writing articles, having fun with technology and talking about it in user groups. Dan is co-founder and CTO of Logical Advantage, http://www.logicaladvantage.com.

1 Comment

Beware of fire.... Dan you put a great big smile on my face!!! After all what is Hallowe'en without a 12 foot tall fire-shooting pumpkin?

I considered trying to build such a thing but I think there is a city ordinance against it...

Thanks for the great article!

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.