10 tips for DIY IoT home automation – Opensource.com
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.
Write a Reply or Comment:
You must be logged in to post a comment.