SE322 /

Lab: Arduino Cloud IoT Lab

Prof. Anis Koubaa
Professor

Prof. Anis Koubaa

SE322: Internet of Things Applications
Spring 2025
College of Engineering, Alfaisal University

Arduino Cloud IoT Lab

📅 Duration: 2 hours
🎯 Objective:
Learn to connect Arduino Nano to Arduino Cloud for IoT device control and monitoring, including LED control and temperature sensing.

Short Tutorial on Arduino Cloud

Introduction to Arduino Cloud

Arduino Cloud is a powerful platform that enables users to connect and manage IoT devices effortlessly. It allows remote monitoring and control of hardware components like Arduino Nano through a user-friendly web interface or mobile app.

1. Things

A Thing in Arduino Cloud represents your IoT project. It contains variables that store and exchange data between your Arduino device and the cloud. You can create a Thing by:

  • Navigating to Things in Arduino Cloud.
  • Clicking Create Thing and naming it.
  • Adding variables such as Boolean (for LEDs) or Float (for sensor readings).
2. Devices

A Device is the physical hardware (e.g., Arduino Nano) that connects to the cloud. To add a device:

  • Go to Devices and click Add Device.
  • Select your board (Arduino Nano).
  • Follow the on-screen instructions to link it.
3. Sketches

A Sketch is the code that runs on the Arduino. Arduino Cloud automatically generates a sketch when a Thing is created. You can modify it using the Arduino Web Editor or Arduino IDE. Key libraries like ArduinoIoTCloud handle communication between the device and the cloud.

4. Dashboards

Dashboards provide a graphical interface to interact with connected devices. You can:

  • Create widgets (toggle switches, gauges) for Thing variables.
  • Control LEDs or monitor sensor values in real time.
  • Access the dashboard via a web browser or the Arduino Cloud mobile app.
Conclusion

Arduino Cloud simplifies IoT development by integrating hardware, cloud storage, and remote control features, making it ideal for smart applications.

Introduction to Arduino Cloud

Arduino Cloud is a powerful platform that enables users to connect and manage IoT devices effortlessly. It allows remote monitoring and control of hardware components like Arduino Nano through a user-friendly web interface or mobile app. This lab will guide you through creating an IoT-enabled device that can be controlled and monitored remotely.

Materials Required

  • Arduino Nano (or compatible board)
  • DHT11 or DHT22 Temperature Sensor
  • External LED and resistor (220Ω)
  • Jumper wires
  • Breadboard
  • USB cable for programming
  • Internet connection

Lab Implementation Steps

Step 1: Setting up Arduino Cloud

  1. Create an account on Arduino Cloud
  2. Install Arduino Create Agent on your computer
  3. Add Arduino Nano as a new device
  4. Install required libraries:
    • ArduinoIoTCloud
    • DHT sensor library

Step 2: Hardware Setup

Arduino Cloud Wiring Diagram

Circuit diagram showing connections for DHT sensor and LED

Connect the components as follows:

  • DHT Sensor Connections:
    • VCC → 5V
    • GND → GND
    • Data → Digital Pin 2 (with 10kΩ pull-up resistor)
  • External LED Connections:
    • Anode (long leg) → Digital Pin 3 via 220Ω resistor
    • Cathode (short leg) → GND

Step 3: Creating the Dashboard

The dashboard is where you'll interact with your IoT device:

  1. Navigate to Dashboards in Arduino Cloud
  2. Create a new dashboard for your project
  3. Add and configure widgets:
    • Toggle switch for built-in LED
    • Toggle switch for external LED
    • Gauge widget for temperature display
  4. Customize widget appearance and settings
  5. Save and share the dashboard

Step 4: Testing and Validation

Once your setup is complete, test the functionality:

  • Verify cloud connectivity status
  • Test LED control through dashboard:
    • Toggle built-in LED
    • Toggle external LED
  • Monitor temperature readings:
    • Verify sensor data updates
    • Check update frequency
  • Test mobile app access

Troubleshooting Guide

If you encounter issues during the lab, here are some common problems and solutions:

Connection Issues

  • Verify internet connectivity
  • Check Arduino Create Agent status
  • Confirm device secret is correctly configured

Sensor Problems

  • Verify wiring connections
  • Check pull-up resistor installation
  • Confirm DHT library is properly installed

LED Control Issues

  • Verify LED polarity
  • Check resistor values
  • Confirm pin assignments in code

Review Questions

Question 1

Explain the purpose of the MFRC522 library in the RFID access control system and list the key functions it provides.

Question 2

Why is it necessary to convert the RFID card's UID from raw bytes to a string format? What problems would arise if we tried to compare raw byte arrays directly?

Question 3

Modify the provided code to add a counter that keeps track of how many times each authorized card has been used. Display this information on the Serial Monitor each time a card is scanned.

Question 4

What are the common issues that might arise when working with RFID readers, and how would you troubleshoot them?

Question 5

Design a system that uses both the RFID reader and an LCD display. Explain how you would modify the code to show personalized messages for different authorized users.