Dan Thyer, Friend of the Blog, has written up another great post on our favorite topic, IoT...
I built my own Internet of Things, IoT, home automation system that is controlling 30 different things with 4 different types of microcontrollers with nearly 150 commands. This article talks about IoT design patterns and the lessons learned from the design patterns that I have used.
We live in an exciting time where more and more everyday items "things" are becoming smart! "Things" have sensors and can communicate to other "things" and can provide control to more "things". The Internet of Things, IoT, is upon us in a huge way and people are rapidly inventing new gadgets that enhance our lives. The price of microcontrollers with the ability to talk over a network keeps dropping and developers can now tinker and build things inexpensively. Developers and hardware enthusiasts no longer need to wait on others to invent or build all the "cool" stuff!
The value of IoT is in both data and control. With home automation it is nice to have a log of events to know when a family member did something like got home or when they turned on the fireplace. The control aspects of IoT are really great for home automation. It's great to be able to play with the cat via my IoT cat toy while we are on a trip anywhere in the world with an internet connection!
My Evolution of IoT Projects
My ventures into the IoT space all started with wanting to play with my kids while I was in the office and they were home swimming in the pool. I built an IoT squirt gun out of a netduino microcontroller, a couple of servos, a solenoid valve and a water hose. The details of this project can be read on the following article:
I came up with an idea to remotely control monsters in the yard for Halloween, but did not want to run wires all the way from my existing netduino to the front of the house. The solution was to purchase a $20 Ethernet bridge and a second netduino.
Make Each Thing Smart
It became extremely cumbersome to run wires through the house to a central microcontroller. I also became concerned and did not want to build too much into the house that I could not take with me if we moved. With the IoT movement starting I realized that I could make each "thing" in the house smart and on the network so that I would not need to run extra wires. There is a lot of benefit to having each "thing" smart, including being flexible with moving things around.
Logical Living Open Source Home Automation System
Design Lessons learned from my IoT projects
I have learned quite a bit from building my own IoT home automation:
- 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 - Being able to update the program (firmware) Over The Air, OTA, leads to more rapid development of new features.
- Lesson 3 - Use DHCP and 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 with a broker to loosely couple all of the things
Funny Lessons learned from my IoT projects
- Lesson 1 - With great power comes great responsibility! One of my projects talked about in the article was to send IR signals to the TV, DVR, and music. I added the control to my mobile web interface and started randomly changing the TV channels or music when I was away from home. It was my way to tell my family that I was thinking of them, but only they did not see it that way! When I got home someone had disabled the control by removing key wires! I was however proud that my family member figured out which wires to remove to disable it though!
- Lesson 2 - Be careful when controlling fire with IoT! We have a cat that likes to play in funny places. I was excited when I added control for the fireplace but the cat was also interested in the project and wanted to learn more! I added speech recognition to the mix and voice from the TV would say the phrase occasionally to turn on the fireplace. We can also turn on the fireplace when we are away if we want to make the house feel cozy when we get home. 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 - If you squirt the kids too often they will start ignoring it! It is hard to resist nailing your friends and family with cold water when the control is as easy as pushing a few buttons on your phone.
- Lesson 4 - When its in the home then it has to be nearly 100% reliable. Family members are not forgiving of quality defects! The home automation will not be used if it is not reliable and family members will let you know it! My netduino's used to lock up after a couple of days because of Ethernet communication issues. I knew I had a serious support problem with the reliability when my wife called me when I was away from home because the garden was not 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 netduino's reboot quickly even with code that I wrote to call to a time service on start up to set the date and time. The reboot is so fast that people do not usually notice the downtime. The home automation needs to be nearly 100% reliable or its not worth the support efforts or the frustration of other family members.
Download the code
I hope that you enjoyed this article and hopefully you got some ideas for your own projects!