Reader small image

You're reading from  Raspberry Pi and MQTT Essentials

Product typeBook
Published inSep 2022
PublisherPackt
ISBN-139781803244488
Edition1st Edition
Right arrow
Author (1)
Dhairya Parikh
Dhairya Parikh
author image
Dhairya Parikh

Dhairya Parikh is an Electronics Engineer who currently works as a Data Engineer at Accenture. He has a year’s experience in building and maintaining data pipelines for a huge amount of data. In his free time, he builds IoT and Machine Learning projects and even writes about them. He has written several project articles for Circuit Cellar, which is a monthly tech magazine. He makes projects which positively impacts the society, making people’s life easier.
Read more about Dhairya Parikh

Right arrow

Taking Your MQTT Broker Global

The previous two chapters covered two fully functional prototype projects so that you can get hands-on experience on how to build IoT projects. So, what next?

Now that you have seen the potential of IoT and the hardware we used – the Raspberry Pi – you are ready to learn how to utilize these technologies best. In this chapter, we will talk about the MQTT broker that we have currently hosted on the Raspberry Pi. This gives us access to it within a local network only. But what if we can access it over the internet?

Figure 7.1 – MQTT meets the internet!

In this chapter, we will cover the following topics:

  • Establishing the advantages of a global MQTT broker
  • How to take your broker global

Everything discussed in this chapter is not always required, so if you just want to create small projects for your home, I suggest sticking with the Raspberry Pi instead of using the options presented in...

Establishing the advantages of a global MQTT broker

There are several advantages of using an MQTT broker that is hosted on a server or machine with internet access. We will look at some of these in this section:

  • Accessibility: You can access the devices connected to your broker from anywhere and with any device, so long as you have an active internet connection.
  • Scalability: When you use a Pi, you have limited coverage. However, that is not the case with an online MQTT broker. You can easily connect multiple smart devices, which are present in different locations.
  • Efficient channel use: This method supports multiple devices, allowing you to proficiently utilize channels.
  • Large-scale compatibility: If you want to use this at a larger scale (for example, you have more than 10,000 devices in your ecosystem), you can easily choose a new plan, which gives you access to more storage and more topics (larger channel bandwidth).
  • Cost efficient: We can keep using the...

How to take your broker global

In this section, we will discuss the two major options that we have to grant internet access to our existing projects.

There are two ways to obtain access to a global MQTT broker:

  • Online MQTT brokers: Several online MQTT brokers provide you with a ready-to-use MQTT broker (credentials are provided). These are available on a subscription basis (monthly, quarterly, or annually).

Some popular sites for this are HiveMQ, Paho, CloudMQTT, and Adafruit IO. These can be seen in the following diagram:

Figure 7.2 – Some popular online MQTT brokers

We will be using the HiveMQ platform to test this later. We will use the free plan provided by the platform, wherein you will be given the following features:

Figure 7.3 – Free plan provisions

  • Virtual Server: If you want more customization and additional features, you can get a virtual server from AWS, Azure, Google Cloud Platform...

Summary

We covered a lot of interesting topics in this chapter. So, let’s go through them once more to refresh our memory. We started by discussing the limitations of our present Raspberry Pi MQTT broker and then looked at the advantages of an MQTT broker, which can be hosted and accessed through the internet. Then, we discussed two options that can help us take our MQTT broker global and learned how to set up each and test them using a simple Node-RED flow on our Raspberry Pi.

We are almost at the finish line! We have covered a lot of content throughout this book. In the next chapter, we will cover the topics that will assist you in answering a very important question: What next?

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Raspberry Pi and MQTT Essentials
Published in: Sep 2022Publisher: PacktISBN-13: 9781803244488
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.
undefined
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 AU $19.99/month. Cancel anytime

Author (1)

author image
Dhairya Parikh

Dhairya Parikh is an Electronics Engineer who currently works as a Data Engineer at Accenture. He has a year’s experience in building and maintaining data pipelines for a huge amount of data. In his free time, he builds IoT and Machine Learning projects and even writes about them. He has written several project articles for Circuit Cellar, which is a monthly tech magazine. He makes projects which positively impacts the society, making people’s life easier.
Read more about Dhairya Parikh