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


As IoT technology evolves, and machines become smarter and capable, the need for human intervention will reduce. Machines will be able to autonomously respond to alerts generated by other machines.

In this chapter, you are going to build an Energy Conservation System that will show how two machines can communicate. The figure below shows a high-level diagram of all components involved in this system. The first component is an Arduino device that monitors light brightness levels and sends an alert whenever the levels are low. The second component is an MQTT broker that helps avoid point-to-point communication. Multiple devices can communicate with each other without knowing each other’s identities. The final component is another Arduino device that controls lights, if light sensor publishes a message to MQTT broker that light brightness level is low then this device will automatically turn the lights on. In real life, you can see this system being utilized to turn street lights on or off only when they are required instead of doing that at scheduled times.

CodifyThings - Building Arduino Projects for the Internet of Things (IoT)

Learning Objectives

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

  • Read data from a light sensor
  • Publish message to MQTT broker
  • Control LED lights
  • Subscribe Arduino to an MQTT broker