Industrial manufacturing
Industrial Internet of Things | Industrial materials | Equipment Maintenance and Repair | Industrial programming |
home  MfgRobots >> Industrial manufacturing >  >> Manufacturing Technology >> Manufacturing process

Getting Started with IoT and MQTT: A Code‑Free ESP8266 Tutorial

MQTT is the lightweight messaging backbone of most IoT solutions. This guide shows how to launch a complete, code‑free workflow: an ESP8266 sensor publishes data to a Raspberry Pi running Node‑RED, where the readings appear in a live dashboard.

Why MQTT Matters for IoT

MQTT’s publish/subscribe model keeps network traffic minimal and is designed for unreliable or low‑bandwidth connections—exactly what most IoT deployments require. By leveraging open standards such as Arduino, MQTT, and Node‑RED, you can prototype quickly without writing a single line of code.

What You’ll Need

Step 1: Download the IoT Werkstatt Package

Grab the IoT Werkstatt ZIP. It bundles a portable Arduino 1.8.5, all required libraries, and Ardublock, which supplies pre‑built “superblocks” for common IoT tasks.

Step 2: Prepare the ESP8266

Open Ardublock and load the provided XML project. Configure your Wi‑Fi SSID/password and point the MQTT settings at your Raspberry Pi’s broker address. Select the Bosch BME280 sensor and create a distinct topic for each measurement (e.g., home/room1/temperature).

Click Upload to Octopus—the Arduino IDE compiles the generated sketch and flashes it to the ESP8266. Once running, the device publishes sensor data to the MQTT broker.

Step 3: Set Up the MQTT Broker on Raspberry Pi

On the Pi, install Mosquitto:

sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients

Start the broker (it runs automatically on boot). No additional configuration is required for a basic local setup.

Step 4: Import the Node‑RED Flow

Open Node‑RED (https://localhost:1880) and paste the supplied flow JSON. Double‑click each MQTT input node to set the broker address and credentials.

The debug panel on the right will show incoming messages once the ESP8266 begins publishing.

Step 5: Add a Dashboard

In Node‑RED, install the node‑red-dashboard palette node. The flow already contains the configuration for the dashboard UI.

After installing, the dashboard is accessible at https://localhost:1880/ui and will display live graphs of temperature, pressure, and humidity.

Optional: Secure the Dashboard

To protect the UI, enable httpNodeAuth in settings.js as described in the Node‑RED security docs.

Raspberry Pi Quick‑Start Checklist

  1. Download Raspbian from the official Raspberry Pi website and flash it to a 32 GB SD card.
  2. Enable Wi‑Fi and SSH for a headless setup:
    • Create an empty file named ssh in the /boot partition.
    • Place a wpa_supplicant.conf file with your network details:
    country=US
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    network={
      ssid="YourNetworkSSID"
      psk="YourNetworkPassphrase"
      key_mgmt=WPA-PSK
    }
    
  3. Boot the Pi, then upgrade the OS:
    sudo apt-get update
    sudo apt-get upgrade
  4. Install Mosquitto (see Step 3).
  5. If Node‑RED is not pre‑installed, run:
  6. bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
  7. Enable Node‑RED to start on boot:
  8. sudo systemctl enable nodered.service
  9. Install the Node‑RED dashboard node:
  10. sudo apt-get install npm
    sudo npm install -g npm
    hash -r
    cd ~/.node-red
    npm i node-red-dashboard
    node-red-start

Once running, access Node‑RED at https://localhost:1880 and the dashboard at https://localhost:1880/ui.

Managing Node‑RED

What’s Next?

Expand your project with machine learning: install TensorFlow on the Pi (pip3 install tensorflow) and add the node-red-contrib-machine-learning palette to bring AI capabilities to your dashboard.

References

— DONE —

Manufacturing process

  1. The Science of Textiles: A Deep Dive into Acid, Reactive, Leather, and Direct Dyes
  2. IoT: The Real Golden Ticket for Business Growth—or Just a Goose with a Golden Egg?
  3. Leveraging IoT for Early Wildfire Detection and Prevention
  4. Connecting the Remote World: How Satellite IoT Expands Global Coverage
  5. Designing Security into the Industrial IoT: Expert Guidelines for Protecting IIoT Systems
  6. Integrate Your Weather Station with CWOP: A Practical Guide
  7. AIoT: Harnessing the Synergy of Artificial Intelligence and the Internet of Things
  8. IoT Revolutionizing Field Service: Predictive Maintenance & Higher ROI
  9. IoT World: Inside Vertica’s Big‑Data Solution for IoT Analytics
  10. Software AG Projects the Next Wave of IoT Growth