Hardware Setup Guide

From zero to your first local IoT dashboard. Learn how to program an ESP32 or NodeMCU to work with Dynamic IoT.

lightbulb A. Introduction & Core Concept

Welcome! If you are new to microcontrollers, you're in the right place. Dynamic IoT works completely offline by leveraging the Wi-Fi chip built into your board.

How it works: The board creates its own local Wi-Fi network (Access Point Mode, usually at 192.168.4.1) and listens for simple HTTP requests (like visiting a website: http://192.168.4.1/open). When you tap a button in the Dynamic IoT app, it simply sends this request behind the scenes. No cloud servers, no internet connection required!

check_circle Prerequisites

1. An ESP32 or NodeMCU (ESP8266) board + Data cable.
2. Arduino IDE installed on your PC.
3. ESP32 / ESP8266 Board Package installed in Arduino IDE.

build B. Step 1: Setting Up Arduino IDE

Before writing code, Arduino needs to know how to talk to your board.

  1. Open Arduino IDE. Go to File > Preferences.
  2. In the "Additional Boards Manager URLs" field, paste this URL:
    https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json
  3. Go to Tools > Board > Boards Manager...
  4. Search for esp32 or esp8266 and install the latest version.
  5. Connect your board via USB. Go to Tools > Board and select your exact board model.
  6. Go to Tools > Port and select the COM port your board is connected to.

code C. Step 2: Code Templates

Copy and paste the appropriate code for your microcontroller into the Arduino IDE, then click the Upload button.

ESP32 Template

ESP32 Web Server
#include <WiFi.h>
#include <WebServer.h>

const char* ssid = "ESP32_Dynamic_IoT";
const char* password = "12345678";

WebServer server(80);
const int ledPin = 2; // Onboard LED

void setup() {
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
  
  // Start Access Point
  WiFi.softAP(ssid, password);
  Serial.println("Access Point Started.");
  Serial.print("IP Address: ");
  Serial.println(WiFi.softAPIP());

  // Define Endpoints
  server.on("/open", []() {
    digitalWrite(ledPin, HIGH);
    server.send(200, "text/plain", "Opened");
  });

  server.on("/close", []() {
    digitalWrite(ledPin, LOW);
    server.send(200, "text/plain", "Closed");
  });

  server.on("/temperature", []() {
    server.send(200, "text/plain", "24.5"); // Simulated Data
  });

  server.on("/status", []() {
    String state = digitalRead(ledPin) ? "ON" : "OFF";
    server.send(200, "text/plain", state);
  });

  server.begin();
}

void loop() {
  server.handleClient();
}

NodeMCU (ESP8266) Template

ESP8266 Web Server
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

const char* ssid = "ESP32_Dynamic_IoT";
const char* password = "12345678";

ESP8266WebServer server(80);
const int ledPin = 2; // Onboard LED (Note: active LOW on some NodeMCU)

void setup() {
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
  
  // Start Access Point
  WiFi.softAP(ssid, password);
  Serial.println("Access Point Started.");
  Serial.print("IP Address: ");
  Serial.println(WiFi.softAPIP());

  // Define Endpoints
  server.on("/open", []() {
    digitalWrite(ledPin, LOW); // Turning LED on
    server.send(200, "text/plain", "Opened");
  });

  server.on("/close", []() {
    digitalWrite(ledPin, HIGH); // Turning LED off
    server.send(200, "text/plain", "Closed");
  });

  server.on("/temperature", []() {
    server.send(200, "text/plain", "24.5"); // Simulated Data
  });

  server.begin();
}

void loop() {
  server.handleClient();
}

menu_book D. Step 3: Understanding the Code

bug_report E. Step 4: Testing Before Using the App

You can test if the board is working perfectly using just your web browser!

  1. Open your laptop or phone's Wi-Fi settings.
  2. Connect to the new network called ESP32_Dynamic_IoT (Password: 12345678).
  3. Open a web browser (Chrome, Safari, etc.) and type: http://192.168.4.1/open.
  4. If the page loads displaying "Opened" and your board's LED turns on, you have successfully set up your hardware!

dashboard_customize F. Step 5: Connecting to Dynamic IoT

Now that your hardware works, it's time to build a beautiful UI for it.

  1. Go to the Dynamic IoT Dashboard.
  2. Create a new project. Enter the SSID ESP32_Dynamic_IoT, Password 12345678, and Base URL http://192.168.4.1.
  3. Add a Button component. Set its endpoint to /open.
  4. Save the layout! The Dynamic IoT mobile app will automatically fetch this layout and give you instant local control.