Book Image

Raspberry Pi and MQTT Essentials

By : Dhairya Parikh
Book Image

Raspberry Pi and MQTT Essentials

By: Dhairya Parikh

Overview of this book

The future of IoT has the potential to be limitless. Wouldn’t it be great if you could add it to your own technological stacks? But where to start? With the basics, of course. In this book, you will start by learning about the most popular hardware and communication protocol, Raspberry Pi and MQTT. You will see how to use them together by setting up your own MQTT server on Raspberry Pi and understand how it works. This book explores MQTT in detail, including the clients and devices that you can connect to your server. You will discover two very popular IoT development boards among project developers: the ESP8266 and ESP32 development boards. Then, you will learn how to build interactive dashboards on your Pi and monitor your client devices. The book also shows you how to build a dashboard using another popular software – Node-RED. You will be able to put your skills to the test by creating two full-scale projects. That’s not all: you will also learn how to host your own MQTT server on a virtual cloud service. Finally, you will be guided on how to move forward from here, what technologies to learn, and some project recommendations to polish or test your knowledge. By the end of this book, you will be able to build meaningful projects using Raspberry Pi and MQTT and create dashboards for your projects on Node-RED.
Table of Contents (14 chapters)
1
Part 1:Covering the Basics
6
Part 2: Practical Implementation – Building Two Full-Scale Projects
9
Part 3: How to Take Things Further – What Next?

Introduction to Raspberry Pi and MQTT

In recent years, the Internet of Things (IoT) has been a trending field for research and development. The future of IoT has the potential to be limitless. By 2025, it is estimated that there will be more than 21 billion IoT devices. So, wouldn’t it be great if you could add these to your known technological stacks? In this book, we will start with the absolute basics.

I will walk you through two fascinating subjects throughout this book: Raspberry Pi, which is a prevalent development board for beginners, and MQTT, a very commonly used and robust communication protocol to delve into the world of IoT.

This chapter will introduce you to the basics of MQTT and Raspberry Pi. Moreover, it will help you set up your Raspberry Pi. Although simple, it is crucial to perform each step as this will help us set up our own local MQTT broker on the Raspberry Pi. This will also help you understand how to get started with your new Raspberry Pi by installing an operating system onto it.

First, we will flash the popular Debian-based Raspberry Pi OS on our Raspberry Pi. After that, we will install all the necessary libraries and packages to make our device a local MQTT broker.

We will cover the following main topics in this chapter:

  • What is MQTT and how does it work?
  • A gentle introduction to Raspberry Pi
  • Setting up your Raspberry Pi

So, let’s start by knowing what MQTT is.