This post provides an overview and learning objectives of Chapter 5 from my book Building Arduino Projects for the Internet of Things.


An important pattern of IoT is the ability to sense data and make it available to users in real-time, such as with home monitoring solutions, perimeter security applications, and inventory alerts.

In this chapter, you are going to build an example of this pattern, an intrusion detection system. The figure below shows components of an intrusion detection system. The first component is an Arduino device that has a motion sensor attached to it. The second component is an MQTT broker. You will use the publish-subscribe model of MQTT for sending intrusion detection notifications in real-time (for details, see Chapter 3). The final component of your IoT application is an Android app that subscribes to the MQTT broker and shows an alert notification to users whenever Arduino detects an intrusion and publishes a message to the MQTT broker.


Learning Objectives

At the end of this chapter you will be able to:

  • Read motion sensor data from Arduino
  • Publish sensor data to an MQTT broker
  • Build an Android app that subscribes to an MQTT broker
  • Display a notification in the app whenever a new message is published to the MQTT broker

Final Product

CodifyThings-Building-Arduino-Projects-for-Internet-of-Things_5-27 CodifyThings-Building-Arduino-Projects-for-Internet-of-Things_5-28