Think 2021: New tools have the developer ecosystem and IBM building together Learn more

Control your smart home the open source way

Summary

In this code pattern, you learn how to use open source technologies to set up and control your smart home. This solution shows how easy it is to set up generally available IoT devices, sensors, and communication protocols such that you can apply them in more complex environments.

Description

To make a home smart, there are many solutions available in the market that you can use, such as lamps, power sockets, and so on. They work fine in most cases, but there are some disadvantages with these smart devices. Some of these devices are not compatible, so you need different systems, different apps, or different dashboards to operate them. And, in some cases, these devices are quite expensive.

Wouldn’t it be nice if you could build something yourself, combining the output of the devices and see this output and control the devices from one dashboard? This code pattern makes that possible, using only open-source technologies and using relatively inexpensive devices and sensors.

Although this smart home solution might not be an enterprise-ready solution, it does show how easy it is to use any device. Also, more professional devices can be used in similar ways.

All the sensors and actuators can be monitored via a dashboard on your mobile device, so you can immediately take action when it is needed via this same dashboard. You can also send updates to Slack if you want.

In this code pattern, I will explain how to connect sensors and actuators to an Arduino and NodeMCU device, how to read the values from these sensors and actuators, and how to use a Raspberry Pi as a gateway and an MQTT server. This code pattern will also go deeper into how to use technologies like Bluetooth, wifi, MQTT (and optionally LoRaWan) for communication between all the devices.

Flow

Architecture of the smart home over MQTT

  1. Set up your smart home with 13 sensors and actuators connected to an Arduino-like device.
  2. Set up a smart garden (optional) with a NodeMCU device and sensor.
  3. Both devices connect to a gateway on a Raspberry Pi, which sends and receives the sensor data.
  4. The smart home has a Bluetooth module that you can connect a mobile device to.
  5. The devices and the dashboard communicate with each other via an MQTT server.
  6. The dashboard, which can be run on a local machine or in the IBM Cloud, and which can be reached by mobile devices via wifi, gives an overview of the status of the smart home and smart garden.
  7. Some of the notifications are being sent to Slack via the gateway.

Instructions

Ready to get started? Check out the README for the step-by-step details.