This project demonstrates the use of a NodeMCU board to interact with the MiA (Middleware in Action) IoT platform. The NodeMCU collects sensor data and sends it to the MiA broker using the MQTT protocol. The platform allows users to control and monitor IoT devices in real-time.
- Connects NodeMCU to MiA, the IoT platform
- Uses MQTT protocol for communication
- Sends sensor data (e.g., light intensity) to the broker
This section explains how to run an IoT agent. For instructions about running the MiA server, refer to this guide.
-
Clone the Repository:
git clone <repository-link>
-
Open the Project:
- If using Arduino IDE: Open
src/main.cpp
. - If using PlatformIO: Open the project folder in your preferred code editor.
- If using Arduino IDE: Open
-
Install Dependencies: Install the required libraries using the Arduino Library Manager or PlatformIO.
- PubSubClient for MQTT communication
- WiFi for connecting to your network
-
Configure Wi-Fi and MiA Broker: Add the
src/arduino_secrets.h
file to set your Wi-Fi credentials and the MiA broker details:#define SECRET_SSID "your_SSID" #define SECRET_PASS "your_password" #define BROKER_IP "MiA_server_address"
-
Upload to NodeMCU: Connect your NodeMCU to your computer and upload the code using the appropriate method (Arduino IDE or PlatformIO).