Introduction to
IoT, Arduino &
IDE
IoT – Internet of Things?
Just from the name Internet of Things which of the following technologies do you
consider IoT and why?
Traffic Lights Smart Thermostat GPS Device
Fitness Trackers Bluetooth Speaker Modern Security Cameras
What is IoT?
● IoT (Internet of Things) refers to interconnected devices that communicate and share data
over the internet.
● These devices range from sensors and wearables to household appliances and industrial
machines.
● The core idea is to collect, exchange, and act on data autonomously.
IoT Examples
● Smart thermostats adjusting room temperature based on occupancy.
● Wearable fitness trackers monitoring health metrics.
● Smart cities using sensors for traffic control and environmental monitoring.
● Industrial machines monitoring performance and predicting maintenance needs.
● Home automation systems managing lighting, security, and appliances.
Benefits of IoT?
● Enhances efficiency by automating routine tasks.
● Improves decision-making through data insights.
● Enables remote monitoring and control.
● Supports predictive maintenance and cost savings.
● Boosts convenience in personal and professional environments.
What is Arduino?
● Arduino is an open-source electronics platform
based on easy-to-use hardware and software.
● It consists of microcontroller boards (like the
Uno) and a development environment (IDE).
● Primarily used for building digital devices and
interactive objects.
Key Aspects of Arduino
● Uses a simplified C/C++ programming environment.
● Compatible with various sensors, modules, and shields.
● Encourages hands-on experimentation and prototyping.
● Accessible to both beginners and professionals.
● Supported by a vast online community.
What Sets Arduino Apart from Other Microcontrollers
● Unlike other microcontrollers, Arduino doesn't require specialized hardware programmers.
● Arduino programs are simpler than low-level code used in other microcontrollers.
● Offers a wide variety of boards tailored to different use cases.
● Highly modular with shields and modules for expansion.
● Open-source hardware and software encourage customization.
Exercise - Arduino Board Exploration
● Divide students in groups
● Give each group an Arduino Uno board to examine
● Give the students a few minutes to try to figure out what each pin/pin group and other
components do
● Have each group take turns and share with the rest of the class one component they
discovered
Arduino Uno Overview
● One of the most popular Arduino boards.
● Based on the 8‑bit ATmega328P microcontroller.
● Contains 14 digital I/O pins, 6 analog inputs,
USB interface, power jack, and reset button.
● Ideal for beginners due to its simplicity and
compatibility with many tutorials and examples.
● Operating voltage: 5V
● Input voltage (recommended): 7–12V
● Flash memory: 32 KB.
● Clock speed: 16 MHz.
Physical layout
● Arduino Uno uses a standard rectangular layout with female headers on each side.
● Clear labeling for all pins (e.g., A0–A5, 0–13).
Top
USB port and power jack
Onboard LED on pin 13 for quick testing
Left side Right side
Power and analog pins. Digital I/O pins and PWM pins
Input and Output (I/O) pins of Arduino
● Digital I/O pins (0–13) can read or write HIGH/LOW
signals.
● PWM-enabled digital pins (3, 5, 6, 9, 10, 11) allow
analog-like output.
● Analog input pins (A0–A5) read voltage levels (0–5V)
and convert to digital values.
● Pins can be set as input or output using pinMode() in
code.
Arduino Boards other than Uno
● Arduino Nano: Smaller version of Uno, ideal for breadboard use.
● Arduino Mega: Offers more I/O pins and memory, suited for complex
projects.
● Arduino Leonardo: Can emulate a keyboard or mouse.
● Arduino Due: Based on ARM Cortex-M3, provides higher processing
power.
● LilyPad Arduino: Designed for wearable electronics.
● Each board targets different needs: size, power, I/O, or special features.
Expansion Options: Shields and Modules
Shields Modules
Stackable boards that plug directly into Arduino Small self-contained components that connect with
pins to add capabilities like WiFi, motor control, wires (e.g., sensors, relays, displays).
GPS, etc.
Common Shields
● Ethernet Shield: Enables Arduino to connect to the
internet via LAN.
● WiFi Shield: Adds wireless network connectivity.
● Motor Shield: Controls DC motors, stepper motors,
and servos.
● Relay Shield: Provides high voltage switching
capabilities.
● LCD Shield: Displays data and messages on
character-based LCDs.
● Shields are stackable and follow standard Arduino pin
layouts for compatibility.
Common Modules
● Ultrasonic Sensor Module: Measures distance using
sound waves.
● Bluetooth Module (HC-05): Enables wireless
communication between Arduino and smartphones.
● RFID Module: Used for identity verification and access
control.
● GPS Module: Provides location and time data using
satellite signals.
● Temperature/Humidity Sensors (e.g.,
DHT11/DHT22): Monitor environmental conditions.
Sensors and Actuators
● Sensors collect data from the environment (e.g., temperature, light,
sound).
● Actuators perform physical actions in response to control signals (e.g.,
motors, relays, buzzers).
● Both are essential in IoT and embedded systems for interacting with the
real world.
● Arduino supports analog and digital sensors and a wide range of
actuators.
Common Sensors
● Temperature and Humidity: DHT11, DHT22.
● Light Sensor (LDR): Measures ambient light levels.
● Ultrasonic Sensor: Measures distance using sound
reflection.
● IR Sensor: Detects motion or proximity.
● Gas Sensor: Detects gases like CO2, LPG, or smoke.
Common Actuators
● Servo Motor: Rotates to specific angles;
used in robotics and control systems.
● DC Motor: Basic rotational motion for wheels,
fans, etc.
● Relay Module: Controls high-voltage circuits
safely.
● LEDs: Used as indicators and visual output.
● Buzzers: Provide sound-based alerts.
Other Components
● Breadboard: Allows temporary, solder-free wiring of circuits.
● Jumper Wires: Used to connect components on a breadboard or between a breadboard and Arduino.
● LEDs (Light Emitting Diodes): Basic output component that lights up when current flows through it.
● Resistors: Control the flow of current to protect components like LEDs from burning out.
● Power Supply (Batteries or USB): Arduino boards can be powered by a USB cable or an external
battery pack (e.g., 9V battery).
● Push Buttons: Allow user input to trigger code responses (e.g., start/stop a motor, turn on an LED).
Programming and Development in Arduino
● Programming is done using the Arduino IDE (based on
simplified C++).
● Code files are called Sketches.
● Programs include two main functions: setup() and loop().
● Built-in functions simplify I/O control (e.g., digitalWrite,
analogRead).
● Arduino IDE compiles and uploads code via USB to the
board.
● Serial monitor helps with debugging and feedback.
Sketches
● Arduino programs are called Sketches.
● File extension: .ino.
● Each sketch must have:
● setup() – runs once at startup.
● loop() – runs repeatedly.
● Sketches can include global variables,
custom functions, and library imports.
● Structure is designed to make embedded
programming approachable.
Libraries
● Libraries are reusable blocks of code that
simplify using sensors, modules, or
protocols.
● Stored in .h and .cpp files.
● Help abstract low-level hardware
operations.
● Can be installed via Library Manager in
the IDE or manually.
Common Libraries
● Servo.h – Used to control servo motors easily.
● LiquidCrystal.h – For interfacing with 16x2 LCDs.
● DHT.h – Reads temperature and humidity from DHT11/DHT22 sensors.
● WiFi.h / Ethernet.h – Manages network connections.
● Adafruit Sensor Libraries – Provides drivers for advanced sensors like
accelerometers or GPS.
Serial Monitor
● Built-in tool in the Arduino IDE to communicate
with the board over USB.
● Used to:
● Print data from sensors.
● Send commands for debugging.
● Visualize serial output for logic testing.
● Functions used: Serial.begin(), Serial.print(),
Serial.println().
Arduino Web Editor (Online IDE)
● Accessible at create.arduino.cc/editor.
● Allows writing, compiling, and uploading
sketches from a browser.
● Requires Arduino Create plugin to detect
boards.
● Automatically syncs sketches to your
online account.
● Integrates with Arduino Cloud for IoT
projects.
Arduino IoT Cloud
● A specialized platform by Arduino for developing and managing IoT projects.
● Allows you to connect multiple Arduino devices and monitor them remotely.
● Features:
● Dashboard creation for visualizing sensor data.
● Variable synchronization across devices and
cloud.
● Secure communication with SSL.
● Over-the-air (OTA) firmware updates.
● Compatible with specific Arduino boards (e.g., MKR
series, Nano 33 IoT).
Forums and Resources
● Arduino Forum: Official community support platform.
● Instructables: Step-by-step guides for projects.
● GitHub: Open-source libraries and example sketches.
● YouTube Channels: Tutorials, reviews, and walkthroughs.
● Arduino Project Hub: Official repository of projects with diagrams and code.
● These resources help beginners learn and help experts solve complex issues.
Arduino Home Automation Example
● A basic home automation system might include:
● Sensors: Temperature, light, motion.
● Actuators: Relays to control lights, fans, or appliances.
● Communication: WiFi or Bluetooth modules to enable remote control.
● Control Logic: Written in Arduino sketch using if statements to trigger actions.
● Example: If motion detected + room is dark → turn on lights.
● Can be connected to cloud dashboard for monitoring and manual override.
Create Your Own Arduino Project Plan
● In groups, have the students brainstorm an Arduino project that solves a real-world problem
experienced in their lives
● Then have them fill out the following Arduino - Project Plan document
● Link
https://docs.google.com/document/d/1o4Ls3i6m0EzWw2ndu5UO-f0iWjxRGbr4uk_Rci3ZiMc/e
dit?usp=sharing
● After they are finished have the teams present their plans;
● Peers rate their ideas and give comments for improvement
● Then give quick feedback and keep plans for later build sessions
Installing the Arduino IDE
● Visit www.arduino.cc → Software → Download for Windows.
● Choose the Windows Installer or ZIP version.
● Run installer, follow on-screen instructions.
● After installation:
● Connect Arduino board via USB.
● Install drivers if prompted.
● Launch IDE and select board and port.
Understanding the Arduino Programming
Language
● Arduino uses a simplified version of C++.
● Emphasizes ease of use with built-in functions like:
● pinMode(), digitalWrite(), digitalRead(), analogRead(), analogWrite().
● Includes features such as:
● Variables, control structures (if, while, for), functions, and libraries.
● Memory-constrained: Code must be efficient.
Structure of Arduino Sketch
● Global declarations (constants, variables, includes).
● Basic structure:
● `setup()` – runs once
● `loop()` – runs repeatedly
● Global variables and function definitions can be added above or below these functions.
● Optional functions like serialEvent() or custom functions can be added.
Setup
● setup() is called once when the Arduino starts or resets.
● Typically used for:
● Initializing pin modes (input/output).
● Starting serial communication (Serial.begin()).
● Configuring sensors or modules.
Loop
● The loop() function runs continuously after setup() completes.
● It defines the core behavior of the program.
● Ideal for:
● Reading sensor values repeatedly.
● Controlling outputs based on logic.
● Handling communication or timing functions.
Key concepts of Arduino programming
● Pin Modes: INPUT, OUTPUT, INPUT_PULLUP.
● Digital I/O: digitalRead(), digitalWrite().
● Analog I/O: analogRead(), analogWrite() (PWM).
● Delays and Timing: delay(), millis().
● Functions and loops: Used for organizing code.
● Serial Communication: Serial.begin(), Serial.print() for debugging.
Pin Modes
● Defined using pinMode(pin, mode) in setup().
● Modes:
● INPUT: Reads voltage on the pin (e.g., sensors).
● OUTPUT: Sends voltage (e.g., LEDs, motors).
● INPUT_PULLUP: Uses internal pull-up resistor for button inputs.
● Correct pin mode ensures proper operation and avoids hardware damage.
Digital Vs Analog Signals
● Digital:
● Two states: HIGH (5V) and LOW (0V).
● Used for binary sensors and output control (e.g., turning LEDs on/off).
● Analog:
● Continuous range (0–1023 on Arduino Uno for 0–5V input).
● Used for sensors like temperature, light, or potentiometers.
● Analog output via PWM (analogWrite() on PWM-enabled pins).
Delays and Timers
Millis Example
● delay(ms) pauses execution for a specified number of
milliseconds.
● millis() returns the number of milliseconds since the board
started.
● Common use:
● delay() for simple timing.
● millis() for non-blocking timing (used in advanced
projects).
Delay Example
Serial Communication
● Enables data exchange between Arduino and other devices (e.g., PC).
● Functions:
● Serial.begin(9600): Starts communication at 9600 baud.
● Serial.print(), Serial.println(): Send data to Serial Monitor.
● Serial.read(): Reads incoming data.
● Useful for debugging, logging, or controlling Arduino through a terminal.
Writing your first Arduino Sketch (Blink
Program Overview)
● Goal: Toggle an LED on and off in regular intervals.
● Demonstrates:
● Digital output control.
● The use of setup() and loop() functions.
● Use of delay for timing.
Step by Step Instruction for Blink Program
1. Open Arduino IDE.
2. Connect the board via USB.
3. Select the correct board and port.
4. Write or open the Blink sketch.
1. Write the Blink Code provided on next page
2. Or go to File > Examples > 01.Basics > Blink.
5. Click Upload.
6. Observe LED blinking.
7. Use Serial Monitor (if needed) for debugging.
8. Modify timing values to change blink rate.
Blink Code
Key Elements of Blink program
• setup(): Initializes pin 13 as OUTPUT.
• loop(): Alternates LED state with digitalWrite() and delay().
• Logical flow:
• Turn on LED.
• Wait.
• Turn off LED.
• Wait.
• Repeat.
Troubleshooting the Blink Program
• LED not blinking?
• Check pin number (use built-in pin 13 or external LED).
• Confirm code uploads successfully.
• LED always on/off?
• Ensure correct use of digitalWrite(HIGH/LOW).
• Check for short circuits or reversed LED polarity.
• Long delays or no blinking?
• Check delay() values.
Extending the Blink program
• Multiple LEDs: Control several LEDs on different pins.
• Different Time Intervals: Assign unique delays to each LED.
• External Components: Add buttons, sensors, or transistors for more control.
• Can transition from fixed timing to event-driven logic (e.g., motion-activated blink).
Try your Own Variations of the Program
Example code that blinks 2 LED’s at different intervals
Homework
Come up with another Arduino project idea that can benefit from assigning
different pins with different delay times.
Thank You