You are on page 1of 35

ESP32 FOR IOT

APPLICATIONS
DAY 1
SESSION 1:
● Introduction to ESP32
● Installing the software and Adding of libraries
● Specifications of ESP32
● PIN OUT of ESP32
● Functions used
● Working of few sensors
Why ESP32?
EXAMPLE:
INSTALLING THE SOFTWARE
SCAN THIS QR
CODE TO
DOWNLOAD
THE SOFTWARE
Step 1
Step 2
Step 3
Step 4
Step 5
Specifications-ESP32 DEVKIT V1
PINOUT OF ESP32
DIGITAL INPUT OUTPUT PIN
D2,D4,D12,D13,D14,D15,D16,D17,D18,D19,D21
D22,D23,D25,D26,D27

DIGITAL INPUT ONLY PIN


D34,D32,D36,D39
RX2-D16
TX2-D17
VP-D36
VN-D39
16 ADC PINS(15 available)

12 bit ADC
D2,D4,D12,D13,D14,D15,D25,D26,D27,D32,D33

INPUT ONLY ADC D34,D35,D36,D39

10 CAPACITIVE PINS(9 available)

D2,D4,D12,D13,D14,D15,D27,D33,D34
We can use any digital pin for I2c
communication(not include 34,35,36,39 pins)

Default pin D21 as a SDA and D22 as a SCL

2 DAC- D25,D26
BASIC FUNCTIONS USED IN
ARDUINO
setup()
The setup() function is called when a sketch starts. Use it to initialize

variables, pin modes, start using libraries, etc. The setup() function will only

run once, after each power-up or reset of the board.

loop()
After creating a setup() function, which initializes and sets the initial values, the
loop() function does precisely what its name suggests, and loops consecutively,
allowing your program to change and respond. Use it to actively control the
board.
pinMode()
[Digital I/O]

Configures the specified pin to behave either as an input or an output. See the Digital

Pins page for details on the functionality of the pins

Syntax

pinMode(pin, mode)

Parameters

pin: the ESP32 pin number to set the mode of.

mode: INPUT, OUTPUT, or INPUT_PULLUP.


digitalRead()
[Digital I/O]

Reads the value from a specified digital pin, either HIGH or LOW.

Syntax

digitalRead(pin)

Parameters

pin: the ESP32 pin number you want to read

Returns

HIGH or LOW
digitalWrite()
[Digital I/O]

Description

Write a HIGH or a LOW value to a digital pin.

If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the

corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.

Syntax

digitalWrite(pin, value)

Parameters

pin: ESP32 pin number.


analogRead()
[Analog I/0]

Reads the value from the specified analog pin. Arduino boards contain a multichannel, 10-bit analog to

digital converter. This means that it will map input voltages between 0 and the operating voltage(5V or

3.3V) into integer values between 0 and 1023.

Syntax

analogRead(pin)
analogWrite()
[Analog I/O]

Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a

motor at various speeds. After a call to analogWrite(), the pin will generate a steady rectangular wave of the

specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite()) on the same pin.

Syntax

analogWrite(pin, value)

Parameters

pin: the Arduino pin to write to. Allowed data types: int.

value: the duty cycle: between 0 (always off) and 255 (always on). Allowed data types: int.
delay()
[Time]

Pauses the program for the amount of time (in


milliseconds) specified as parameter. (There are 1000
milliseconds in a second.)

Syntax

delay(ms)
BLINKING AN LED USING ESP32
int LED_BUILTIN = 2;
void setup() {
pinMode (LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
SENSORS
PIR SENSOR
COMPONENTS REQUIRED:
1. ESP 32
2. Jumper wires
3. PIR Sensor

CONNECTIONS:
1.Power>>3v3
2.Ground>>GND
3.Signal>>GPIO27
SERVO MOTOR
COMPONENTS REQUIRED:
1. ESP 32
2. Jumper wires
3. Servo Motor(SG90)

CONNECTIONS:
1.Power>>VIN(Red)
2.Ground>>GND(Brown)
3.Signal>>GPIO 13(orange)
DHT11

COMPONENTS
REQUIRED:
1. ESP 32
2. Jumper wires
3. DHT11 Sensor

CONNECTIONS:
1.VCC>>3V3
2.Ground>>GND
3.Signal>>GPIO 4
ULTROSONIC SENSOR
COMPONENTS REQUIRED:
1. ESP 32
2. Jumper wires
3. Ultrasonic sensor (HC-SR04)

CONNECTIONS:
1.Power>>VIN
2.Ground>>GND
3.Trig>>GPIO 5
4.ECHO>>GPIO 18
POTENTIOMETER
COMPONENTS REQUIRED:
1. ESP 32
2. Jumper wires
3. Potentiometer

CONNECTIONS:
1.VCC>>3V3
2.Ground>>GND
3.Signal>>GPIO 12
PRESENTED BY
DIVYESH
SWAROOPA A
PRATEEKSHA

You might also like