[go: up one dir, main page]

0% found this document useful (0 votes)
136 views26 pages

Integration of Sensors and Actuators With Arduino

The document provides an introduction to integrating sensors and actuators with Arduino, focusing on the DHT sensor for measuring temperature and humidity, and the servo motor for controlled motion. It includes details on wiring, library installation, and sample code for reading sensor data and controlling the servo motor. Additionally, it outlines the basic principles of sensors and actuators, along with their types and functionalities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views26 pages

Integration of Sensors and Actuators With Arduino

The document provides an introduction to integrating sensors and actuators with Arduino, focusing on the DHT sensor for measuring temperature and humidity, and the servo motor for controlled motion. It includes details on wiring, library installation, and sample code for reading sensor data and controlling the servo motor. Additionally, it outlines the basic principles of sensors and actuators, along with their types and functionalities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Integration of Sensors and Actuators with

Arduino:
Part I

Introduction to Internet of Things 1


Sensor
s

 Electronic elements
 Converts physical quantity/ measurements into electrical
signals
 Can be analog or digital

Introduction to Internet of Things 2


Types of
Sensors

Some commonly used sensors:


 Temperature
 Humidity
 Compass
 Light
 Sound
 Accelerometer

Introduction to Internet of Things 3


Sensor Interface with
Arduino

 Digital Humidity and Temperature


Sensor (DHT)
 PIN 1, 2, 3, 4 (from left to right)
 PIN 1- 3.3V-5V Power supply
 PIN 2- Data
 PIN 3- Null
 PIN 4- Ground

Introduction to Internet of Things 4


DHT Sensor
Library

 Arduino supports a special library for the DHT11 and DHT22


sensors
 Provides function to read the temperature and humidity
values from the data pin
dht.readHumidity()
dht.readTemperature()

Introduction to Internet of Things 5


Connection

 Connect pin 1 of the DHT


to the 3.3 V supply pin in
the board
 Data pin (pin 2) can be
connected to any digital
pin, here 12
 Connect pin 4 to the
ground (GND) pin of the
board

Introduction to Internet of Things 6


Sketch:
DHT_SENSOR

Install the DHT Sensor Library

 Go to Sketch -> Include Library ->


Manage Library

Introduction to Internet of Things 7


Sketch: DHT_SENSOR
(contd..)
 Search for DHT SENSOR
 Select the “DHT sensor
library” and install it

Introduction to Internet of Things 8


Sketch: DHT_SENSOR
(contd..)
#include <DHT.h>; void loop()
DHT dht(8, DHT22); {
//Initialize DHT sensor //Read data from the sensor and store it to variables
float humidity; humidity and temperature
//Stores humidity value
float temperature; humidity = dht.readHumidity();
value //Stores temperature
temperature= dht.readTemperature();
void setup() //Print temperature and humidity values to serial
{ monitor
Serial.begin(9600); Serial.print("Humidity: ");
Serial.print(humidity);
dht.begin(); Serial.print("%, Temperature: ");
} Serial.print(temperature);
Serial.println(" Celsius");
delay(2000); //Delay of 2 seconds
}

Introduction to Internet of Things 9


Sketch: DHT_SENSOR
(contd..)

Introduction to Internet of Things 10


Sketch: DHT_SENSOR
(contd..)

 Connect the board to the PC

 Set the port and board type

 Verify and upload the code

Introduction to Internet of Things 11


Outp
ut
The readings are printed at a delay of
2 seconds as specified by the delay()
function

Introduction to Internet of Things 12


Integration of Sensors and Actuators with
Arduino-
Part II

Introduction to Internet of Things 1


Topics Covered

 Introduction to ACTUATOR
 Servo Motor
 Servo motor interfaced with Arduino
 Hardware interface
 Sketch

Introduction to Internet of Things 2


Actuator
s

 Mechanical/Electro-mechanical device
 Converts energy into motion
 Mainly used to provide controlled motion to other
components

Introduction to Internet of Things 3


Basic Working
Principle
Uses different combination of various mechanical structures
like screws, ball bearings, gears to produce motion.

Introduction to Internet of Things 4


Types of Motor
Actuators
 Servo motor
 Stepper motor
 Hydraulic motor
 Solenoid
 Relay
 AC motor

Introduction to Internet of Things 5


Servo
Motor
 High precision motor
 Provides rotary motion 0
to 180 degree
 3 wires in the Servo
motor
 Black or the darkest one is
Ground
 Red is for power supply
 Yellow for signal pin

Introduction to Internet of Things 6


Servo Library on
Arduino

 Arduino provides different library- SERVO to


operate the servo motor
 Create an instance of servo to use it in the
sketch
Servo myservo;

Introduction to Internet of Things 7


Sketch:
SERVO_ACTUATOR
#include void loop(){
//Servo moves to 0 degrees
ServoDemo.write(0);
<Servo.h> delay(1000);
//Including the servo library for the
program
// Servo moves to 90
int servoPin = 12; degrees
ServoDemo.write(90);
delay(1000);
Servo ServoDemo; // Servo moves to 180
// Creating a servo object degrees
ServoDemo.write(180);
void setup() { delay(1000);
// The servo pin must be attached to
the servo before it can be used

ServoDemo.attac}
h(servoPin);
Introduction to Internet of Things
} 8
Sketch: SERVO_ACTUATOR
(contd..)
 Create an instance of Servo
 The instance must be attached
to the pin before being used
in the code
 Write() function takes the
degree value and rotates the
motor accordingly

Introduction to Internet of Things 9


Connection

 Connect the Ground of the


servo to the ground of the
Arduino board.
 Connect the power supply wire
to the 5V pin of the board.
 Connect the signal wire to any
digital output pin (we have used
pin 8).

Introduction to Internet of Things 10


Board
Setup
 Connect the board to the PC

 Set the port and board type

 Verify and upload the code

Introduction to Internet of Things 11


Outp
ut
The motor turns 0, 90 and 180
degrees with a delay of 1 second
each.

Introduction to Internet of Things 12


Do more with the Servo
library
Some other functions available
with the Servo library:
 Knob()
 Sweep()
 write()
 writeMicroseconds()
 read()
 attached()
 detach()
Introduction to Internet of Things 13
Thank You

Introduction to Internet of Things 14

You might also like