Mini-project 1: NodeMCU as an MQTT client
This is the first project we will be doing related to MQTT and our Raspberry Pi broker.
First, we will start by setting up the NodeMCU board. No external connections need to be made as we are only controlling the on-chip LED. This will be divided into two parts:
- Node MCU setup and code explanation
- Raspberry Pi setup and project demonstration
We will first set up our NodeMCU development board for this project.
Part 1 – NodeMCU development board setup
In this section, we will program our NodeMCU board to act as an MQTT client and control its onboard LED using an external device (your home computer, in this case).
For this, we will write a sketch that gives us access to the features we need. We will be using the pubsub library for this purpose. The code we will be using will do the following:
- First, it will connect to an MQTT server.
- Once the connection has been established, it will publish "...