0% found this document useful (0 votes)
15 views36 pages

Module 2 Partial

The document provides an overview of the Internet of Things (IoT) components, including sensors, actuators, microcontrollers, and networking. It specifically highlights the functionality and applications of Arduino boards, programming basics, and examples of digital input and output operations. Additionally, it discusses the Grove ecosystem for standardized connections and the setup of Arduino IDE for programming various microcontroller boards.

Uploaded by

Vineet Don
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views36 pages

Module 2 Partial

The document provides an overview of the Internet of Things (IoT) components, including sensors, actuators, microcontrollers, and networking. It specifically highlights the functionality and applications of Arduino boards, programming basics, and examples of digital input and output operations. Additionally, it discusses the Grove ecosystem for standardized connections and the setup of Arduino IDE for programming various microcontroller boards.

Uploaded by

Vineet Don
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Internet of Things

IoT Components
[Sensors, Actuators, Microcontrollers, Networks]
Sensors
• Fundamental building blocks of IoT
• What a sensor does: It senses
• Devices/modules that detect events or changes in the environment
• Measures a physical quantity  Digital representation
Actuators
Actuator takes an electrical input signal and turns it into physical action
• Modify the environment
• Natural complements to sensors

Examples:
• LEDs
• Relays
• Motors
• Solenoid valves
• Buzzers
• Display
Sensors and Actuators
MicroControllers Units (MCU)
• A microcontroller is an integrated circuit that contains one or more
CPUs (processor cores) along with memory and programmable
input/output peripherals

Arduino UNO Seeedstudio XIAO M5 Paper E-ink


Edge/Fog Computing Nodes
• Higher processing power: CPU + GPU
• Higher RAM and non-volatile storage
• Consume more power than MCUs
• Custom full-fledged operating system

Raspberry Pi Nvidia Jetson Google Coral


Networking and Services

Source: [Link]
What is Arduino?
• Arduino is an open-source hardware/software/company
• Designs and manufactures single-board microcontrollers for building digital devices
• Arduino Boards (Hardware)
• Arduino IDE (Software) and Arduino Web Editor
• Arduino Cloud
• Arduino boards are able
• Read inputs - light on a sensor, a finger on a button
• Send output - activating a motor, turning on an LED, publishing something online
• Accomplished by executing a set of instructions to the microcontroller on the
board
• A program written in Arduino programming language is called a Sketch
Arduino Boards
Ardunio UNO Maker UNO NodeMCU ESP32

ESP32-CAM LilyPad Arduino XIAO TTGO-LoRa


Microcontroller Board Anatomy
General Purpose Input/Output (GPIO)
pins: Used to connect microcontrollers
to sensors, diodes, displays etc.
1) Digital pins: Use these pins to read
digital input, write digital output,
and write analog output (only on
the pins with the PWM ~ symbol)
2) Pin 13 LED: LED is very useful for
programming and debugging
3) Power LED: Indicates that your
board is receiving power
4) Microcontroller: The heart of your
board
5) Analog Pins: Use to read analog
input. Can be used as digital pins in
some boards. [ADC written]
Arduino UNO Board Anatomy
6) GND and 5V/3.3V pins: To provide
+5V/3.3V power and ground to your
circuits
7) Power connector: Provide power to the
board when it’s not plugged into a USB
port for power
8) TX and RX LEDs: These LEDs indicate
communication between your board and
your computer
• Flicker rapidly during sketch upload as well as
during serial communication
9) USB port: Used for powering your board,
uploading your sketches to your board,
and for communicating with your
program (via Serial. println() etc.).
10) Reset button: Resets the microcontroller
11) Boot button: Shift to bootloader mode
Arduino Programming

• What you need


• Arduino Board

• Programmer
• Arduino Web Editor ([Link] Hardware Mode

• Arduino IDE

• USB Cable

• Sensors and Actuators


Arduino Simulators
• Wokwi
• Tinkercad
• Virtual Breadboard & Avatar Hardware
• SimulIDE
• PICSimLab
• UnoArduSim
• IO Simulator
• ……..
Arduino IDE
Arduino IDE 2.3.2
[Link]
en/software
Exploring Arduino IDE
Menu Bar Board Manager Serial Monitor
Serial Plotter

Verify/Upload Sketchbook

Start Debug Board Manager

Library Manager
Debugger

Search

Editor
Status Bar
PandaByte xC3m
By PandaByte Innovations Pvt. Ltd.

• ESP32-C3 SoC
• Supports 2.4 GHz WiFi (802.11b/g/n) and Bluetooth 5
• 32-bit single-core processor, up to 160 MHz
• 384 KB ROM
• 400 KB SRAM
• 4 MB FLASH
• 15 GPIO Pins Programmable LED

Programmable Switch

Programmable RGB
Cores for the Boards
• Third party microcontroller boards are not directly supported
• Cores allow new microcontrollers to be programmed with Arduino IDE
• Possibly use existing libraries and examples
• How to install third party core:
• Find a specific file [link], written in JSON format
• Go to Arduino IDE Preferences  Additional Board Manager URLs
• Past the JSON link
• Go to Board > Boards Manager
• Search for the board  Install
xC3m Pinout Diagram

3V3 GPIO0 ADC1_0 SCL XTAL_32K_P

SCK RST GPIO1 ADC1_1 SDA XTAL_32K_N

ADC1_4 GPIO4 GPIO2 ADC1_2 BOOT

MISO LED ADC2_0 GPIO5 GPIO3 ADC1_3 CS

MOSI RGB GPIO6 GPIO19 USB_D+

BUTTON GPIO7 GPIO18 USB_D-

GPIO8 GPIO21 TX0

BOOT GPIO9 GPIO20 RX0

GND GPIO10

5V GND
Setting Up IDE: Board Manager
• File  Preferences  Additional Board Manager URLs
[Link]

• Tools  Board  Board Manager OR Click Board Manager ICON


⮚Select esp32 by Espressif

• Select Board
⮚PandaByte xC3 ESP32C3
A (Very) Simple Sketch
void setup() {
// Runs only Once
}

void loop() {
// Runs until board has power
}

Each sketch must be stored in a folder having the same name as the sketch file
Digital vs Analog
Digital vs Analog
Digital HIGH and LOW

• HIGH, 1, true
• A voltage ~3.3V is present at the pin (3.3V boards)
• A voltage ~5V is present at the pin (5V boards)

• LOW, 0, false
• A voltage ~0V is present at the pin (5V or 3.3V boards)
Digital I/O
• pinMode(pin, mode): Configures the specified pin to behave either as an INPUT or
an OUTPUT
Example: pinMode(13, OUTPUT)
pinMode(14, INPUT) //Optional
• digitalRead(pin): Reads the value from a specified digital pin, either HIGH (1) or
LOW (0)
Example: val = digitalRead(14);
• digitalWrite(pin, value): Write a HIGH or a LOW value to a digital pin. 5V for HIGH,
0V (ground) for LOW
Example: digitalWrite(13, HIGH)

WARNING: If the pin isn’t connected to anything, digitalRead()


can return either HIGH or LOW
Blink Example : Digital Output
• Arduino Sketch to blink an LED in ON-OFF
pattern
• Setting a GPIO pin to OUTPUT
Ground
• Set pin to LOW and HIGH alternatively Output

LED Module

xC3m LED
2 IN
[Link] G GND
Blink Example : Digital Output
• Arduino Sketch to blink RGB LED in ON-
OFF pattern
• Setting three GPIO pin to OUTPUT

• Set each pin to LOW and HIGH alternatively


RGB Module

xC3m RGB
1 R
2 G
3 B
[Link] G GND
Serial Monitor

• Used for communication between the Arduino board and a computer


or other devices or sensor/actuators.
• All Arduino boards have at least one serial port
• Functions
[Link](115200): Sets the data rate in bits per second (baud)
for serial data transmission
[Link]("Hello"): Prints data to the serial port as human-
readable ASCII text

[Link]
Blink Example : Digital Input Push
Button
R2
• Arduino Sketch to print a message to the Serial
Monitor when a push-button is pressed R1

• Setting a GPIO pin to INPUT and connect the push-button


• [Link] a message whenever button is pressed

• NOTE: If the analog input pin is not connected to Input


VCC
anything Ground
• Value will fluctuate
• Based on a number of factors
• Values of the other input pins nearby xC3m Switch
• Static 2 IN
3.3V VCC
Push Button Module
[Link] G GND
Blink Example : Digital Input & Output

• Arduino Sketch to turn an LED ON


whenever push-button is pressed
• Setting a GPIO pin to OUTPUT and another
pin to INPUT

• Set OUTPUT pin to HIGH whenever INPUT


pin is HIGH
xC3m RGB
1 R xC3m Switch
2 G 4 IN
3 B 3.3V VCC
[Link] G GND G GND
Internal Pull-up Resister

Push
Button

xC3m RGB
1 R
xC3m Switch 2 G
2 IN 3 B
G VCC G GND [Link]
Grove Ecosystem

Classical Connections Grove Interfaces


Grove Ecosystem Standard M-M
Cable

• Standardized 4 wire system

Standard Female
Header

pin Function Note Wire Color


Primary Digital/Analog
pin1 X Yellow
Input/Output
Secondary Digital/Analog
pin2 Y White
Input/Output
pin3 VCC Power for Grove Module, 5V/3.3V Red
pin4 GND Ground Black
Grove Ecosystem
• For Microcontroller Boards
• Shield/Expansion Board/HAT
Blink Example : Digital Input & Output

• Using Grove Cables

xC3m RGB
1 G
2 R
3 B
G GND

xC3m Switch
4 IN
3V/5V VCC
G GND

[Link]
Hold the Button?
• Why keep holding the button to light up the LED?
• Single Push Button: ON <-> OFF Hold the Button
• Look for the value of the switch to change from low to high
• Switch Bouncing

How to Debounce?

[Link]
[Link]
[Link]

You might also like