Raspberry Pi and MQTT Essentials

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Key Features Learn some of the most popular tools used in IoT – Raspberry Pi, MQTT, ESP8266 and more Build exciting projects such as an IoT weather station and a smart switch board Discover the advantages of taking your MQTT broker global Book Description 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. What you will learn Configure and use a Raspberry Pi for IoT projects Implement the MQTT communication protocol for projects Understand how to set up the NodeMCU and ESP32 boards as MQTT clients Control a NodeMCU board through a Node-RED dashboard hosted on Raspberry Pi Get LAMP server, Home Assistant, and MariaDB on the Raspberry Pi Set up an online MQTT broker on a cloud service or enterprise service provider platform Build full-scale, end-to-end prototype projects Who this book is for This book is for students who are interested in IoT and want to build projects using the available developer hardware. Educators who want to introduce a course on IoT into their curriculum, technology enthusiasts, and IoT developers who are just getting started will also benefit from this book. No prior knowledge about the two main topics that the book covers is required - Raspberry Pi and MQTT. A basic understanding of what IoT is will also be useful but not mandatory.

Author(s): Dhairya Parikh
Edition: 1
Publisher: Packt
Year: 2022

Language: English
Pages: 272
Tags: MQTT embedded c17 c23 c++ systems iot electronics

Cover
Title Page
Copyright and Credits
Dedicated
Contributors
Table of Contents
Preface
Part 1:Covering the Basics
Chapter 1: Introduction to Raspberry Pi and MQTT
What is MQTT and how does it work?
What is MQTT?
Basic concepts of MQTT
A gentle introduction to Raspberry Pi
Setting Up Your Raspberry Pi
Technical requirements
Setting up an SD card for your Raspberry Pi
Flashing the OS image onto the SD card
Setting up Raspberry Pi for the first time
Setting up VNC for Raspberry Pi
Setting up and testing the MQTT broker
Testing the MQTT broker locally
Summary
Chapter 2: MQTT in Detail
Introducing MQTT clients
MQTT messages
MQTT topics
MQTT clients
How does an MQTT client connect to a broker?
Understanding the MQTT protocol packet structure
Connect packet
CONNACK packet
PUBLISH and SUBSCRIBE packets
Practical demonstration of MQTT in action
Summary
Chapter 3: Introduction to ESP Development Boards
ESP8266-based NodeMCU development board
Technical specifications
NodeMCU GPIO pinout and pin configurations
Arduino IDE setup for the NodeMCU development board
ESP32-based development board
Technical specifications
ESP32 GPIO pinout and pin configurations
Arduino IDE setup for the ESP32 development board
Mini-project 1: NodeMCU as an MQTT client
Part 1 – NodeMCU development board setup
Part 2 – Raspberry Pi setup
Summary
Chapter 4: Node-RED on Raspberry Pi
Introduction to Node-RED
Node-RED first-time installation, setup, and demonstration
Node-RED installation
Running Node-RED on your Pi for the first time
Node-RED crash course
Node-RED MQTT components and dashboard setup
Node-RED MQTT nodes
Node-RED dashboard
Mini project 2 – Controlling a NodeMCU LED from the Node-RED dashboard
Hardware requirements
Software requirements
NodeMCU setup
Raspberry Pi setup
Summary
Part 2: Practical Implementation – Building Two Full-Scale Projects
Chapter 5: Major Project 1: IoT Weather Station
Hardware requirements
The NodeMCU development board
The DHT11 temperature and humidity sensor
The BMP280 temperature and pressure sensor
The CCS811 air quality sensor
Sensor interfacing
Code explanation
Raspberry Pi setup
Starting Node-RED
Project flow and dashboard setup
Additional functionality – email alerts
Summary
Chapter 6: Major Project 2: Smart Home Control Relay System
Hardware requirements and setup
ESP32 development board
5V non-latching relay
5V Hi-Link power supply
Miscellaneous components
Hardware setup (PCB design and circuit)
Code explanation
Raspberry Pi setup
Project enhancements
Summary
Part 3: How to Take Things Further – What Next?
Chapter 7: Taking Your MQTT Broker Global
Establishing the advantages of a global MQTT broker
How to take your broker global
Option 1 – online MQTT broker
Option 2 – virtual server
Summary
Chapter 8: Project Prototype to Product – How?
Innovative project ideas
Idea 1 – Home automation system
Idea 2 – air quality monitoring system
IoT services provided by enterprise cloud platforms
IoT cloud platforms
Project – getting started with AWS IoT Core
How to scale your projects using the current hardware
Home Assistant
LAMP Server
Summary
Index
Other Books You May Enjoy