UNIT 5_IOT and Ard
UNIT 5_IOT and Ard
Follow the instructions in the installation guide. The installation may take
several minutes.
You can now use the Arduino IDE 2.0 on your Windows computer!
Voltage Regulator
The function of the voltage regulator is to control the voltage given to the Arduino
board and stabilize the DC voltages used by the processor and other elements.
Crystal Oscillator
The crystal oscillator helps Arduino in dealing with time issues. How does
Arduino calculate time? The answer is, by using the crystal oscillator. The
number printed on top of the Arduino crystal is 16.000H9H. It tells us that the
frequency is 16,000,000 Hertz or 16 MHz.
Analog pins
It has six analog input pins A0 through A5. These pins can read the signal from
an analog sensor like the humidity sensor or temperature sensor and convert it
into a digital value that can be read by the microprocessor.
Main microcontroller
Each Arduino board has its own microcontroller. You can assume it as the brain
of your board. The main IC (integrated circuit) on the Arduino is slightly different
from board to board. The microcontrollers are usually of the ATMEL Company.
ICSP pin
Mostly, ICSP is an AVR, a tiny programming header for the Arduino consisting of
MOSI, MISO, SCK, RESET, VCC, and GND. It is often referred to as an SPI (Serial
Peripheral Interface), which could be considered as an "expansion" of the output.
Actually, you are slaving the output device to the master of the SPI bus.
Digital I/O
The Arduino UNO board has 14 digital I/O pins (of which 6 provide PWM (Pulse
Width Modulation) output. These pins can be configured to work as input digital
pins to read logic values (0 or 1) or as digital output pins to drive different
modules like LEDs, relays, etc. The pins labeled “~” can be used to generate
PWM.
AREF
AREF stands for Analog Reference. It is sometimes, used to set an external
reference voltage (between 0 and 5 Volts) as the upper limit for the analog input
pins.
The coding screen is divided into two blocks. The setup is considered as the
preparation block, while the loop is considered as the execution block.
The set of statements in the setup and loop blocks are enclosed with the curly
brackets. We can write multiple statements depending on the coding
requirements for a particular project.
void setup ( )
{
Coding statement 1;
Coding statement 2;
.
.
.
Coding statement n;
}
void loop ( )
{
Coding statement 1;
Coding statement 2;
.
.
.
Setup: It contains an initial part of the code to be executed. The pin modes,
libraries, variables, etc., are initialized in the setup section. It is executed only
once during the uploading of the program and after reset or power up of the
Arduino board.
Loop: The loop contains statements that are executed repeatedly. The section of
code inside the curly brackets is repeated depending on the value of variables.
PinMode: The specific pin number is set as the INPUT or OUTPUT in the pinMode
() function.
Where,
pin: It is the pin number. We can select the pin number according to the
requirements.
Mode: We can set the mode as INPUT or OUTPUT according to the corresponding
pin number.
Where,
HIGH: It sets the value of the voltage. For the 5V board, it will set the value of 5V,
while for 3.3V, it will set the value of 3.3V.
If we do not set the pinMode as OUTPUT, the LED may light dim.
Example:
digitalWrite(13, LOW); // Makes the output voltage on pin 13 , 0V
digitalWrite(13, HIGH); // Makes the output voltage on pin 13 , 5V
digitalRead(): The digitalRead () function will read the HIGH/LOW value from the
digital pin, and the digitalWrite () function is used to set the HIGH/LOW value of
the digital pin.
Some Programs
Turns on and off a light emitting diode(LED) connected to digital pin 13,
when pressing a pushbutton attached to pin 2.
CONNECTIONS
connect one end of button with one end of resistor. Connect other end of resisitor
to GND.
Connect other end of button 5v.
Connect one end of button (just oppostite to those end which is connected to
GND) to pin 2.
CODE
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
CONNECTIONS
connect one end of button with one end of resistor. Connect other end of resisitor
to GND.
Connect other end of button 5v.
Connect one end of button (just opposite to those end which is connected to GND)
to pin 2.
connect long leg of LED to one end of another resistor.
Connect other end of that resistor to +5v of arduino.
Connect short leg of LED to GND.
Connect long tail of LED to digital input 2 of arduino
CODE
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
Definition of IOT
Internet of things (IOT) is a network of physical objects. The internet is not only a
network of computers, but it has evolved into a network of device of all type and
sizes , vehicles, smart phones, home appliances, toys, cameras, medical
instruments and industrial systems, animals, people, buildings, all connected ,all
communicating & sharing information based on stipulated protocols in order to
achieve smart reorganizations, positioning, tracing, safe & control & even
personal real time online monitoring , online upgrade, process control &
administration. Internet of things is an internet of three things:
(1). People to people,
(2) People to machine /things,
(3) Things /machine to things /machine, Interacting through internet
Characteristics of IOT
Dynamic changes: The state of devices change dynamically, e.g., sleeping and
waking up, connected and/or disconnected as well as the context of devices
including location and speed. Moreover, the number of devices can change
dynamically.
Enormous scale: The number of devices that need to be managed and that
communicate with each other will be at least an order of magnitude larger than
the devices connected to the current Internet. Even more critical will be the
management of the data generated and their interpretation for application
purposes. This relates to semantics of data, as well as efficient data handling.
Safety: As we gain benefits from the IoT, we must not forget about safety. As both
the creators and recipients of the IoT, we must design for safety. This includes
the safety of our personal data and the safety of our physical well-being. Securing
the endpoints, the networks, and the data moving across all of it means creating
a security paradigm that will scale.
The term “input device” in the definition of a Sensor means that it is part of a
bigger system which provides input to a main control system (like a Processor or
a Microcontroller).
The following is a list of different types of sensors that are commonly used in
various applications. All these sensors are used for measuring one of the physical
properties like Temperature, Resistance, Capacitance, Conduction, Heat Transfer
etc.
Why 0.48828125 ?
Code:
float temp;
int tempPin = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
temp = analogRead(tempPin);
// read analog volt from sensor and save to variable temp
temp = temp * 0.48828125;
// convert the analog volt to its temperature equivalent
Serial.print("TEMPERATURE = ");
Serial.print(temp); // display temperature value
Serial.print("*C");
The pins on the humidity sensor are S, for signal, the one in the middle is
voltage, and the minus sign is ground. The signal pin goes to header A0 on the
Arduino. The middle pin goes to 5V, and the minus sign goes to GND.
First of all we have to add DHT library. For this we have to follow following
steps:
In Arduino go to sketch >> include libraries >> manage libraries
In library manager search DHT 11 then click on install.
Code:
#include <dht.h>
void setup(){
Serial.begin(9600);
delay(500);//Delay to let system boot
Serial.println("DHT11 Humidity & temperature Sensor\n\n");
delay(1000);//Wait before accessing Sensor
}//end "setup()"
void loop(){
//Start of Program
Actuators in IOT
Types of Actuators:
1. Hydraulic Actuators –
A hydraulic actuator uses hydraulic power to perform a mechanical
operation. They are actuated by a cylinder or fluid motor. The mechanical
motion is converted to rotary, linear, or oscillatory motion, according to the
need of the IoT device. Ex- construction equipment uses hydraulic actuators
because hydraulic actuators can generate a large amount of force.
Advantages :
• Hydraulic actuators can produce a large magnitude of force and high
speed.
• Used in welding, clamping, etc.
• Used for lowering or raising the vehicles in car transport carriers.
Disadvantages :
• Hydraulic fluid leaks can cause efficiency loss and issues of cleaning.
• It is expensive.
• It requires noise reduction equipment, heat exchangers, and high
maintenance systems.
2. Pneumatic Actuators –
A pneumatic actuator uses energy formed by vacuum or compressed air at high
pressure to convert into either linear or rotary motion. Example- Used in robotics,
use sensors that work like human fingers by using compressed air.
3. Electrical Actuators –
An electric actuator uses electrical energy, is usually actuated by a motor that
converts electrical energy into mechanical torque. An example of an electric
actuator is a solenoid based electric bell.
Advantages :
• It has many applications in various industries as it can automate
industrial valves.
• It produces less noise and is safe to use since there are no fluid
leakages.
• It can be re-programmed and it provides the highest control precision
positioning.
Disadvantages :
• It is expensive.
• It depends a lot on environmental conditions.
With the expanding world of IoT, sensors and actuators will find more
usage in commercial and domestic applications along with the pre-existing
use in industry.