I hope you guys liked my last article. The intent was to show how easy was it to get started. I am not going to talk about real sensors or actuators until we have built our base understanding strong.
“The secret of getting ahead is getting started. The secret of getting started is breaking your complex, overwhelming tasks into smaller manageable tasks, and then starting on the first one.” — Mark Twain
I always like to break big problem statements into a chunk of smaller ones, which help me focus and then knock them down one at a time. It's just a matter of time, we could stitch these different solutions together and achieve our ultimate goal.
So, in this article, I shall demonstrate how we could build an IoT application without Internet. Basically, set up the control center locally in this case would be a MQTT broker. In the course of my further articles, I will cover how can we secure the local MQTT broker which would demonstrate the IoT security aspect which is a major design consideration when we build an IoT application be it on the edge or the cloud.
We shall install the MQTT broker on our Raspberry Pi IoT gateway which we got ready here. Our client would be a laptop that will have a MQTT client. I recommend MQTT.Fx, since it's a free and offers cross-platform support. Overall, what we are trying to achieve is depicted in the below image.
Let us begin…!
Login to the Raspberry Pi IoT gateway and install the broker and the clients if not installed using the below commands. This will install the Mosquitto MQTT broker on the gateway. After the installation mosquitto starts as background service automatically. This is also true after the reboot of the gateway.
sudo apt-get install -y mosquitto mosquitto-clients
Install MQTT.Fx on your laptop and start the application. This would be our MQTT client which would connect to our IoT gateway, and then we could send and receive messages locally without being connected to the Internet.