Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Internet of Things from Scratch

You're reading from   Internet of Things from Scratch Build IoT solutions for Industry 4.0 with ESP32, Raspberry Pi, and AWS

Arrow left icon
Product type Paperback
Published in Feb 2024
Publisher Packt
ISBN-13 9781837638543
Length 438 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Renaldi Gondosubroto Renaldi Gondosubroto
Author Profile Icon Renaldi Gondosubroto
Renaldi Gondosubroto
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Part 1: Getting Started with the Internet of Things
2. Chapter 1: An Introduction to IoT Architecture, Hardware, and Real-Life Applications FREE CHAPTER 3. Chapter 2: Understanding and Designing IoT Networks 4. Chapter 3: Integrating Application Protocols 5. Chapter 4: Examining Communication and Connectivity Technologies 6. Part 2: Developing and Optimizing IoT Systems for Smart Environments
7. Chapter 5: Realizing Wireless Sensor Networks within Smart Spaces 8. Chapter 6: Creating Applications on the Edge 9. Chapter 7: Working with Cloud Computing to Power IoT Solutions 10. Chapter 8: Designing for Interoperability 11. Part 3: Operating, Maintaining, and Securing IoT Networks
12. Chapter 9: Operating and Monitoring IoT Networks 13. Chapter 10: Working with Data and Analytics 14. Chapter 11: Examining Security and Privacy in IoT 15. Chapter 12: Exploring and Innovating with Open Source IoT 16. Part 4: Delving into Complex Systems and the Future of IoT
17. Chapter 13: Developing IoT Solutions for Digital Transformation within Industry 4.0 18. Chapter 14: Architecting Complex, Holistic IoT Environments 19. Chapter 15: Looking Ahead into the Future of IoT 20. Index 21. Other Books You May Enjoy

Practical – creating an MQTT pub and sub communication between an ESP32 and a Raspberry Pi

One of the best ways to see MQTT in action is to create a pub/sub model based on communication between two devices. In this case, we will be using the ESP32 and the Raspberry Pi, where the ESP32 will serve as the publisher and subscriber while the Pi serves as the MQTT broker. Here is a breakdown of the roles of all three in this practical:

  • Publisher: The ESP32 publishes messages to the MQTT broker. It sends messages to the /topic/test1 topic when there is user input from the serial monitor, and it also periodically sends Hello World messages to the /topic/test3 topic every 15 seconds.
  • Subscriber: The ESP32 is also a subscriber, as it listens for messages on the /topic/test1 and /topic/test2 topics. When it receives a message on one of these topics, it processes the message in the callback function, which in this case prints the received message to the Serial Monitor.
  • Broker...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image