INTERNET OF THINGS
By
Dr. Minakshmi Shaw
Assistant Professor
School of CS & AI
Arduino Board Description
ARDUINO
Arduino is an open-source electronics platform based on easy-to-use hardware
and software.
Several Boards
Software
Arduino Mega 2560 Arduino Uno Arduino Mini Arduino Nano
Arduino Uno: Technical Specifications
Microcontroller ATmega328
Clock Speed 16 MHz
Operating Voltage 5V
Input Voltage (limits) 6-20V
Input Voltage (recommended) 7-12V
Digital I/O Pins 14 (of which 6 provide PWM output)
(Input/Output) (Pulse Width Modulated)
Arduino Uno: Technical Specifications
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB of which 0.5 KB used by bootloader
SRAM 2 KB, EEPROM 1 KB
(Static Random Access Memory) (Electrically Erasable Programmable Read Only
Memory) (volatile-data is lost when power is off)(uses flip flop to store bit)(faster
expensive)
Serial Communication ports: UART, I2C, SPI
(Universal Asynchronous Receiver Transmitter)(Inter Integrated Circuit)(Serial
Peripheral Interface)
Arduino Uno Board Description
Analog
RESET O/P Digital I/O Pins Serial I/O Pins
Universal Serial Bus
USB or PWM
Port
Power
SPI Pins LED
ICSP
Loader
AT Mega 328
Microcontroller
AC to DC I2C Pins
Adapter A5- SCA
Analog Input A4-SDA
Pin Descriptions
Pin Category Pin Name Details
Power Vin, Vin: Input voltage to Arduino when using an external power
Pins 3.3V, source.
5V, 5V: Power source, 3.3V: Power source
GND GND: ground pins.
Reset Reset Resets the microcontroller.
Analog Pins A0 – A5 Used to provide analog input in the range of 0-5V
Input/ Digital Pins Can be used as input or output pins.
Output Pins (0 – 13)
PWM 3, 5, 6, 9, 10, Provides 8-bit PWM output.
11
Pin Description
Pin Pin Name Details
Category
AREF AREF To provide reference voltage for input voltage.
(Analog
Reference)
Serial 0(Rx) Used to receive and transmit TTL (Transistor Transistor
1(Tx) Logic) serial data.
I2C A4(SDA) Used for I2C communication.
(Serial Data)
A5 (SCL)
(Serial Clock)
Pin Description
Pin Pin Name Details
Category
SPI 10 (SS) (Slave Select), Used for SPI communication.
11(MOSI)
(Master Out Slave In)
12 (MISO)
(Master In Slave Out)
13 (SCK) (Serial Clock)
External 2, 3 To trigger an interrupt.
Interrupts
Arduino Programming
A program for Arduino is called a sketch.
Arduino programs are written in C
The structure of Arduino programs
There are two required functions (called by the system) in an Arduino sketch. Those are:
void setup(): a function run once at startup that performs initialization
void loop(): a function called repeatedly until the board powers off
Other functions must be created outside the brackets of these two functions.
Arduino Basic functions
Digital I/O Functions
pinMode()
digitalRead()
digitalWrite()
Analog I/O Functions
analogRead()
analogWrite()
Timer Functions
delay()
delayMicroseconds()
Serial I/O Function
Serial.begin( )
Serial.print( )
Serial.read()
Digital I/O functions
pinMode( ): Configures the specified pin to behave either as an input or an output.
Syntax: pinMode(pin, mode)
Any digital I/O pin (0 to 13) INPUT or OUTPUT
Ex: pinMode(13, OUTPUT)
Ex: pinMode(10, INPUT)
Digital I/O functions
digitalWrite( ): Write a HIGH or a LOW value to a digital pin
Syntax: digitalWrite(pin, mode)
Any digital I/O pin (0 to 13) HIGH or LOW
Ex: digitalWrite(13, HIGH)
Ex: digitalWrite(13, LOW)
Digital I/O functions
digitalRead( ): read value from a digital input pin
Syntax: int x=digitalRead(pin)
Any digital I/O pin (0 to 13)
Ex: int x= digitalRead(10)
0 or 1
Analog I/O functions
analogRead( ): Reads the value from the specified analog pin.
Syntax: int x=analogRead(pin)
Any Pin from
0 to 1023
A0 to A5
Returns: int(0 to 1023)
Ex: int x=analogRead(A0)
analogWrite( ): Writes an analog value to a pin .
Syntax: analogWrite(pin, value)
Any analog output pin 0 to 255
3 or 5 or 6 or 9 or 10 or 11 Based on the voltage requirement
Eg: analogWrite(6, 200)
Returns: Nothing
Timer functions
Delay( ): Pauses the program for the amount of time (in milliseconds) specified as
parameter.
Syntax: delay(ms)
Parameters:
ms: The number of milliseconds to pause
Returns: Nothing
delayMicroseconds( ):
Pauses the program for the amount of time (in microseconds) specified as parameter.
Syntax: delayMicroseconds(µs)
Parameters:
µs: The number of microseconds to pause
Returns: Nothing
Serial I/O functions
Serial.begin( ): Sets the data rate in bits per second (baud) for serial data
transmission.
Syntax: Serial.begin(speed)
Parameters:
speed: in bits per second (baud)
Returns: Nothing
Serial.print( ): Prints data to the serial port as human-readable ASCII text.
Syntax: Serial.print(val)
Parameters:
val: the value to print - any data type
Returns: Nothing
Serial.println( ): Prints data to the serial port followed by a carriage return.
Syntax: Serial.println(val)
Parameters:
val: the value to print - any data type
Returns: Nothing
Working with Arduino Uno
Connect Arduino Uno to PC with USB cable
Select Tools Board Arduino/Genuino Uno
Select Tools Port Com8
Working with Arduino Mega 2560
Connect Arduino Uno to PC with USB cable
Select Tools Board Arduino/Genuino Mega or Mega 2560
Select Tools Port Com14
IOT on LAB using TinkerCAD
(Virtual Simulation tool)
TINKER CAD
•In the world of 3D modeling, Tinkercad has established itself as a worthy introduction to
computer-aided design (CAD). It’s a free and intuitive web-based CAD program that anyonecan
use. In fact, if you want to get started with Tinkercad, we even have a beginner’s tutorial to get you
going.
• Recently, Tinkercad has introduced something new: An expansion to include circuits in its design
capability called Tinkercad Circuits. This brings a whole new side to Tinkercad, revolving
around simulating circuits with Arduino.
• Arduino is an open-source electronic prototyping platform that also sells microcontrollers.
Tinkercad Circuits allows anyone to virtually create and program Arduino projects without the
need for physical hardware.
• In this article, we’ll be showing you how to program a basic Arduino in Tinkercad, but first,
let’s take a closer look at the new capabilities Tinkercad Circuits offers.
Use Any Type of Web Browser for Create a New
Account or Login Account in TINKER CAD
Search TINKER CAD or https://www.tinkerc
ad.com/ in Web Browser
Click and Enter Into TINKER
CAD
CREATE A NEW ACCOUNT IN TINKER
CAD
Select Student Accounts
Sign in Gmail Id
AFTER CREATING A NEW ACCOUNT
CREATE ANEW CIRCUIT IN
TINKERCAD
Bread board Connection
SENSORS
Sensor
A sensor is a device that measures a physical quantity and converts it into a
electrical signal
Physical quantity Sensor Electrical Signal
Temperature sensors
Displacement, position, motion and velocity sensors
Fluid sensors, liquid flow, liquid level
Light sensors etc.,
Temperature Sensors Water Sensors
Proximity sensors Gyroscope Sensors
Light Sensors Gas Sensors
PIR sensor Color sensor Heart rate Vibration
(Passive sensor sensor
Infrared)
Joystick Sound sensor Angular displacement
sensor sensor
Actuator
An actuator is a component of a machine that drives the mechanism or
system.
Mechanical Actuators
Gears Belt drives Chain Drives Bearings
Electrical Actuation systems Relays
Switches
• Push button switches
• Switches
Solid-state switches,
Diodes, transistors, thyristors Solenoids
Drive systems
DC., AC., or stepper motors
Microprocessor/Microcontrollers
ARITHMETIC LOGIC
UNIT(ALU)
REGISTE
CONROL UNIT
RS
MICROPROCESSOR
CPU RAM ROM
SERIAL
I/O
TIMERS COM
PORTS
PORTS
MICROCONTROLLER