Your house, 11 Netduinos and the Cloud...
Today's Hardware Friday project by Mike Linnen is one that's pretty awesome in a cool Internet of Things kind of way. We've featured bits and pieces of like functionality in the past, but I don't think something ever as complete as this.
The best part of all is that it's not really a project as much as it is a "teach you to fish all the while creating an awesome thing" kind of... well... thing.
I put together a talk that includes a lab on building a security/home automation system using 11 netduinos communicating over MQTT with a broker located in Windows Azure. The attendees of this talk will walk through the lab and build out various components of a security system.
Here is a video demonstrating the various components of the system.
This project was created to show off some fun things you can do to get started in the Internet of Things craze. This project was never intended to be an actual working Home Security system so don’t try and use it for that unless you really think about addressing some of the internet security issues that need to be tackled with a project like this. Please use this code as an example only!
Each device that is connected to the system's central hub will perform a specific function in the security platform. In a real security system you wouldn’t have mission critical devices dependent on external connectivity to the cloud. The connectivity to such an external system could be easily disrupted. Again this is just a fun example to get you thinking about connecting many devices to a cloud service.
The hardware used for this project is the Netduino Plus 2 from Secret Labs LLC. All code samples you see on this sight will target the Netduino Plus 2 device. However, the protocol to communicate with the cloud service is not platform specific so any device can be used to communicate with the Home Security service. So feel free to use a different .Net Micro Framework device. You could even use one of the very popular Arduino devices.
Of course the cloud service part of this project is running on the Windows Azure Platform. There are so many options available to you with the Azure platform. I decided to use a small subset of the features available just to prove that it doesn't take a lot to get something going on the Azure platform.
Where to start
As a participant in this project you will be building the devices that complete the Home Security system. Some basic code will already be written for you but for the most part it will be your job to complete the code and make the device functional. The cloud service that connects the devices is already completed and deployed to Windows Azure for you to use, so you wont need to do any of that coding. However the code for the cloud service is available in source control for you to look at.
- Documentation - This is where you will spend most of your time because it contains all the documentation to complete the lab exercises.
- Getting Ready For the Meeting - All the information you need to come prepared for the event.
- Azure Source Code Repository - All the source for the Azure components of the security system.
- Netduino Source Code Repository - All the source for the Netduino components of the security system
- Dashboard - This is the Home Security Dashboard where you can see the status of a device and interact with it
- Slide Deck - The slides for the presentation
What do I need
Before you attend this event you need to get a few things in order. We don't have a lot of time during the event to spend it setting up your development environment so make sure you check out Getting Ready For the Meeting.
What will I be doing
You will be building one of the following devices in the home security system:
- External Door Entry- This device handles all the I/O for any External Door
- Door Bell- This device handles the I/O for letting the user know a door bell was pushed
- Alarm- This device handles the I/O for letting the user know the alarm was tripped
- Alarm Control Panel- This device handles the I/O for the control panels placed in each room of the house
- Master Control Panel- This isn't really a device (but it could be) and it is already built for you. I am calling it out here because without it the entire system would be a bunch of devices that are independent of one another with no real central control managing the whole security system logic.
Determine which one of the devices that you want to attempt to build. Some of the devices are harder to complete than others. If you want to start out easy then you can do the doorbell device. If you want a tougher challenge then go ahead and try the Alarm Control Panel.
There will be some code that is already written for you so that you don't have to worry about the communication protocols needed to publish and subscribe to the MQTT message bus. Since the protocol is abstracted away from you all you need to know is that the MQTT messages are basically made up of two parts: a Topic and a Message. There is a lot more to the MQTT standard that you can read up on your own but you won't need it for this project. Basically, topics are a series of words separated by a / topic separator. The message is simply any string. The devices on the bus are expected to understand the topics and message formats, but like all pub/sub designs the devices don't know
What is running in the cloud
There are two main components that already exist in Azure that the devices will interact with: MQTT Message Broker and Master Control Panel. The message broker runs under an Azure Worker Role. The Master Control Panel runs in Windows Azure Web Role. The broker simply routes MQTT messages and has no real home security specific business logic on it. The Master Control Panel manages the state of the security system as well as the business rules around how the security system functions as a whole. SignalR is used to update the client browsers when the state of the security system changes. Take a look at the Master Control Panel for more details on how it functions.
As you can see, pretty awesome. If you're in his area, make sure you see him, and build this project with him... Scroll to the bottom of http://www.cloudhomesecurity.com/ to see where and when.