In this in instructable ,I will show you how to use MQTT protocol with ESP8266 and node-red platform.
HTTP being used on request-response is not the best option for transferring data fast and efficiently .On the other hand we have MQTT which is lightweight , fast and best for sending data over different IOT devices.
We have only two things in MQTT
- MQTT broker
Client can be publisher or subscriber.Publisher ,as its name suggests ,publishes data and Subscriber receives data.
It is broker which makes the link and pass the published data from publisher to subscriber.
To resolve any conflict in data transmission there is topic in MQTT.
Each client(Subscriber) that wants to receive messages subscribes to a certain topic and the broker delivers all messages(from publisher) with the matching topic to the client.
Step 1: Install Node-red
Install node-red on your computer .I am showing it for windows
1. Goto Node.js ofiicial website and download the installer
2. Run the installer
3. Goto command prompt and verify the version by giving command " node -v"
4.If you get the response then everything is good .Now download node-red by giving command
"npm install -g node-red"
5.Ignore the error and warning messages and check if it is downloaded or not by command "node-red"
if you get response(welcome to node-red ) then you are good to go .
if not then give command "npm install npm" and then again try "npm install -g node-red"
6. Get node-red dashboard by giving command "npm install node-red-dashboard"
you are done .