IoT Tests/Demos
I put this material together from various sources. No guarantees are made.

Equipment / Test Setup

1. Raspberry Pi running MQTT Broker (connected to LAN via WIFI)
2. Arduino Uno With Wifi and a breakout board with LED
3. Linux Mint with:
    Node-RED
    MQTT Explorer
    Python3 MQTT subscribe and publish scripts
4. Windows PC with Arduino IDE

Note:
1. The applications on Linux and the PC can be combined and run on either machine.
2. An ESP32 (microcontroller) can be used instead of an Arduino.

Tests

Initially run the tests with one IoT device. Next, use multiple IoT devices (servo motors, LEDs, ...).

Suggested MQTT Topic and Messages

MQTT TopicMQTT MessageAction
test/wifi/iot-01onturn on LED
test/wifi/iot-01offturn off LED
test/wifi/iot-01blinkblink LED on and off
test/wifi/iot-01 blink on-duration [off-duration] turn LED on for on-duration seconds and off for off-duration seconds
if no off-duration is specified, it defaults to on-duration

Test #1 verify Python3 MQTT subscribe and publish

StepEquipmentAction
1Linux Mint run Python MQTT publish and subscribe scripts
2Linux Mint verify published messages
3Linux Mint verify subscriptions with MQTT Explorer

Note: Node-RED can also be used as MQTT publisher and subscriber.

Test #2 find Arduino's MAC address

StepEquipmentAction
1Arduino connect Arduino to a PC USB port
2PC start Arduino IDE and its serial monitor
3Arduino load appropriate sketch
4Linux Mint check serial monitor for Arduino MAC address

Test #3 verify Arduino connection via WIFI

StepEquipmentAction
1Arduino load appropriate sketch (Arduino connected to PC USB port)
(then disconnect from USB)
2Arduino connect Arduino to independent power supply (no USB connection)
3LAN Router check LAN router for device connections

Test #4 verify Arduino connected via WIFI can MQTT publish

StepEquipmentAction
1Arduino load appropriate Arduino sketch (publish to MQTT topic)
(then disconnect from USB)
2Linux Mint run Python3 MQTT subscriber
3Arduino connect Arduino to independent power supply (no USB connection)
4Arduino publish messages MQTT on a loop
5Linux Mint verify subscriber receives messages

Note: Node-RED can also be used as MQTT subscriber for this test.

Test #5 verify Arduino connected via WIFI can subscribe to MQTT topic

Note: the Arduino should be connected to the LED on the breakout board

StepEquipmentAction
1Arduino load appropriate Arduino sketch (subscribe to MQTT topic)
(then disconnect from USB)
2Arduino connect Arduino to independent power supply (no USB connection)
3Linux Mint run Python3 MQTT publisher
4Arduino when MQTT messages received, blink the LED in various patterns
specified by the message

Note: Node-RED can also be used as MQTT publisher for this test.