0% found this document useful (0 votes)
46 views

IOT Lab manual-new

The document outlines a series of experiments conducted at JSPM University Pune for F.Y. MCA and MSc. students focusing on the Internet of Things and Applications. Each experiment aims to familiarize students with various tools and concepts, including the Wokwi simulator, Arduino IDE, and interfacing components like LEDs, push buttons, potentiometers, LDRs, and PIR sensors with ESP32. The document includes objectives, procedures, and assignment questions for each experiment to facilitate learning and practical application.

Uploaded by

Omkar Gilbile
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)
46 views

IOT Lab manual-new

The document outlines a series of experiments conducted at JSPM University Pune for F.Y. MCA and MSc. students focusing on the Internet of Things and Applications. Each experiment aims to familiarize students with various tools and concepts, including the Wokwi simulator, Arduino IDE, and interfacing components like LEDs, push buttons, potentiometers, LDRs, and PIR sensors with ESP32. The document includes objectives, procedures, and assignment questions for each experiment to facilitate learning and practical application.

Uploaded by

Omkar Gilbile
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
You are on page 1/ 45

JSPM University Pune

Faculty of Science and Technology


School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and
Applications”
Experiment No: 1 Date: / /
Aim: Introduction to Virtual Platform https://wokwi.com/.

OBJECTIVE: The main objective of this experiment is,


A. Create an account on Wokwi.
B. Identify the different devices and measuring instrument.
C. Simulate a simple circuit in Wokwi.

DESCRIPTION: Wokwi is an online Electronics simulator. You can use it to simulate


Arduino, ESP32, and many other popular boards, parts and sensors .

1
Creating New Projects

To get started, navigate to the Wokwi Simulator website. From there, you’ll see the following
dashboard. You can use the app for free and without creating a user account.

2
Wokwi Main Sheet

3
• The ESP32 is a popular choice among other modules for the following two
reasons:
• Low Cost of ESP32: This board is available at low prices, starting at $6, which
makes it accessible for students, teachers, hobbyists, and professional users as
well. This makes it the best board for experimentation.
• Low Power Consumption: The ESP32 runs on very low power as compared to
the other options. It has mode states such as deep sleep to save the power and
this makes it ideal for the IoT and other such projects.

Features of ESP32:

• ESP32 is considered one of the best boards for IoT projects because of the
versatility and latest features that are in demand for such projects. The following
features will help you understand the functionalities of ESP32.

WiFi Capabilities of ESP32:


• The ESP32 can be connected to WiFi, which makes it more versatile than other
boards such as Arduino. Users can connect it in two ways:
– Connect the network to the internet in station mode.
– Create the WiFi network and connect the board with the other devices
in access point mode.
• The WiFi capabilities are also used to carry out communication between multiple
devices.

Bluetooth Connections in ESP32:


• Multiple applications run on Bluetooth, which is an important feature of ESP32.
There are two types of Bluetooth connectivity:
– The classic Bluetooth is the legacy technology that is used to
connect headsets, keyboards, mice, and other such devices.

4
– Bluetooth Low Energy (BLE) is the latest technology that can be
used to connect devices like smart watches, fitness trackers, heart
rate monitors, etc.
• The ESP32 supports both types of Bluetooth; therefore, multiple types of devices
are suitable for use with it.

ESP32 PIN Diagram:

RESULTS:

ANALYSIS AND INFERENCES:

5
Assignment Question

1. What is the Wokwi simulator, and how does it work for simulating microcontroller
projects?
2. What are the key differences between simulating a project on Wokwi versus testing on
actual hardware (e.g., ESP32 or Arduino)?

6
JSPM University Pune
Faculty of Science and Technology
School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and Applications”
Experiment No: 2 Date: / /
Aim: Arduino IDE Software Installation and Programming Concepts for Node MCU

OBJECTIVE: The main objective of this experiment is,


A. Install Arduino.
B. Study Programming concept.

DESCRIPTION:

The Arduino IDE is the primary tool we will use in the class for programming the ESP32 based
microcontroller, though there are a lot of other options, such as Visual Studio Code. We will
also use the Arduino programming language, which is essentially a wrapper of C/C++. You can
also use MicroPython, a subset of Python that designed for to run on a microcontroller.
However, we will not cover the syntax of MicroPython, and it is up to you to figure this out.
Depending on your operating system, the installation may vary. Contact TA if you encounter
any issues and we can figure it out together. Below we will use Windows system as an
example, with side notes for Mac users.

INSTALLATION STEPS:

1. Install Arduino IDE. We will use the Arduino IDE 2.2.1 version: here is the link for Windows
or MacOS.
2. Install ESP32 support. Go to File - Preference, as in Figure 1. In the box Additional boards
manger URLs, paste https://raw.githubusercontent.com/espressif/arduino-esp32/gh-
pages/package_esp32_index.json
3. Click OK.
4. Click Tools - Board: - Boards Manger in file click preferences

7
5. Paste the link for installing ESP 32 Board.

6. Select Board manager

8
7. Select Version for ESP32

8. After Installing ESP32 Board is added in Arduino UNO IDE

9
PROGRAMMING CONCEPT:

• pinMode() : The specific pin number is set as the INPUT or OUTPUT in the pinMode ()
function.
▪ Syntax is: pinMode (pin, mode);
▪ Eg : pinMode(13,OUTPUT);

• digitalWrite() : If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or


disable (LOW) the internal pullup on the input pin.

▪ Syntax is : digitalWrite(pin, value);


▪ Eg : digitalWrite(13, HIGH);

• digitalRead( ) : digitalRead() is basically an in-built function used by Arduino to read


values from sensors, buttons, etc. digitalRead() returns one values whether 0 or 1 which

10
represents 0v and 5v. digitalRead() is used by digital pin (0-13) of Arduino.
▪ Syntax : digitalRead(pin);
▪ Eg : digitalRead(13);

• analogRead(): analogRead() reads Analog voltage from 0v to 5v. analogRead()


returns integer values from 0 to 1023.analogRead() uses an analog pin from A0-A5
.
▪ Syntax : analogRead(A1);
▪ Eg : analogRead(A1);

RESULTS:

ANALYSIS AND INFERENCES:

Assignment Questions

1. What are the main features of the ESP32, and how does it differ from other
microcontrollers like the Arduino Uno or NodeMCU?
2. How do you set up and upload a simple program, like blinking an LED, to the ESP32 using
the Arduino IDE?
3. How can you connect the ESP32 to a Wi-Fi network.
4. What is the role of the GPIO pins on the ESP32, and how can you use them to control
sensors or actuators in a project?

11
JSPM University Pune
Faculty of Science and Technology
School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and Applications”
Experiment No: 3 Date: / /
Aim: Controlling GPIO pins and LED blinking using NodeMCU/ESP32 (Digital Write).

OBJECTIVE: The main objective of this experiment is,


A. To blink an LED with a delay of 2 seconds.
B. To Blink 2 LED'S alternatively with a delay of 1 second.

APPRATUS: LED, Jumper wires, Breadboard, ESP32, Arduino IDE.

DESCRIPTION:
LED blinking is the most beginner & easy step to start experiments with ESP32.
Firstly identify anode (+ve) & cathode (-ve) leg of LED. Following diagram gives a
clear idea of LED. Now connect a resistor to positive leg and other end of resistor to
5V.Cathode will be connected to EPS32 GPIO, in this case pin 13. Final circuit will
look as below:

INTERFACING DIAGRAM:

12
PROCEDURE:

• Give the connections to the ESP32 board as shown in the connection diagram.
• Open Arduino IDE in the computer
• Create new file_--→ New
• Type your program and Save it in appropriate location in your computer.
• Compile your program by clicking Verify option in the menu.
• Once the program compiled successfully, connect the Arduino board to the
computer using USB cable. After connecting, go to Tools ----→Board ---→
Select Arduino/Genuine Uno option
• After selecting board, go to Tools ----→Port ---→ Select Arduino Uno COM port 3

PROGRAM:

RESULTS:

13
ANALYSIS AND INFERENCES:

Assignment Questions

1. What are the components required for blinking LED using ESP32?
2. What is the use of resistor in connection diagram.
3. What is the command used to declare the inputs/outputs?
4. List out the types of LED’s.

14
JSPM University Pune
Faculty of Science and Technology
School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and Applications”
Experiment No: 4 Date: / /
Aim: Controlling LED using push button with NodeMCU/ ESP32 (Digital Read).

OBJECTIVE: The main objective of this experiment is,


A. To read the Push button State Using Serial Monitor
B. To turn ON an LED when a button is pressed, OFF when button
isreleased.

APPARATUS: Arduino IDE, ESP32, LED , PUSH Button, Jumper wires ,


Breadboard .

DESCRIPTION:
In this experiment we simply hook up 5 volts to one side of a button and to the other
side of the button we connect pin 2. When you press the button it completes an
electrical connection, pin 2 will “see” the 5 volts and if we digitalRead() at pin 2, it will
report HIGH. During the times the button is not being pressed, pin 2 reports LOW.

We also have pin 2 connected to ground at all times through a resistor. This is because
when we read values at pin 2, we want to get either a HIGH or a LOW reported. If pin 2
is not connected to ground, then when the button is not being pressed it becomes what
is called a floating pin – it’s not connected to anything. Floating pins on the ESP32 are
fine for the most part – unless you are trying to record an input from them – then they
are bad, and can give you spurious information.

INTERFACING DIAGRAM:

15
PROCEDURE:
• Connect one of the E S P32 GND pins to one of the long power rails on
the bread board –this will be the ground rail.
• Connect the short leg of the LED to this same ground rail on the breadboard
thenconnect the long leg to a row on the breadboard.
• Connect the 220-ohm resistor from pin 11 to the same row that you have the
longleg of the LED attached.
• Place the pushbutton on the breadboard. Most buttons will straddle the
centertrench on the breadboard.
• Connect a jumper wire from the 5-volt pin to one side of the pushbutton.
• Connect a jumper wire from pin 7 to the other side of the pushbutton.
• Connect one side of the 10k resistor from the ground rail on the breadboard to
theother side to the pushbutton – on the same side that pin 7 connects.

PROGRAM:

16
RESULTS:

ANALYSIS AND INFERENCES:

Assignment Questions

1. How does push button work in ESP32?


2. What are the types of push button?
3. Does push button need resistor?
4. What are the applications of push button?
5. How many pins are there for push button?

17
JSPM University Pune
Faculty of Science and Technology
School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and Applications”
Experiment No: 5 Date: / /
Aim: Interfacing potentiometer with NodeMCU/ ESP32 (Analog Read).

OBJECTIVE: The main objective of this experiment is,


A. To read potentiometer data and print on the Serial Monitor
B. To interface potentiometer with LED

APPARATUS: Arduino IDE , ESP32, LED, Potentiometer, Jumper wires, Breadboard.

DESCRIPTION:
The potentiometer is a device that is used to measure the voltage or electric potential. It
provides a variable resistance when the shaft of the device is turned.
The potentiometer is a three-terminal device. It has a rotating contact that acts as an
adjustable voltage divider. The potentiometer structure consists of a sliding contact
(called wiper), a resistive element, electrical terminals, and housing.
The sliding contact moves along the resistive element, while the housing consists of the
wiper and the element.

WORKING:
The fixed input voltage is applied across the two ends terminal of a potentiometer,
which further produces the adjustable output voltage at the wiper or slider. As the slider
moves from one end to another, the divider can vary the output voltage from maximum
to Ground.

INTERFACING DIAGRAM:

18
PROCEDURE:
• Connect potentiometer to ESP32 Board.
• Connect one terminal of potentiometer to GND
• Connect other terminal to 5V supply.
• Connect middle terminal to ANALOG pin

PROGRAM:

RESULTS:

19
ANALYSIS AND INFERENCES:

Assignment Questions

1. What is the purpose of potentiometer in


2. What are the parts of potentiometer in ESP32?
3. What are the two main types of potentiometers?
4. How to control potentiometer with ESP32?

20
JSPM University Pune
Faculty of Science and Technology
School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and Applications”
Experiment No: 6 Date: / /
Aim: Smart lighting system using LDR and NodeMCU/ ESP32.

OBJECTIVE: The main objective of this experiment is,


A. To read LDR data and print on the Serial Monitor
B. To interface LDR with LED.

APPARATUS: Arduino IDE, ESP32, LED, LDR, Jumper wires, Breadboard.

DESCRIPTION:
LDR (Light Dependent Resistor) as the name states is a special type of resistor that
works on the photoconductivity principle means that resistance changes according to
the intensity of light. Its resistance decreases with an increase in the intensity of light.
It is often used as a light sensor, light meter, Automatic street light, and in areas where
we need to have light sensitivity. LDR is also known as a Light Sensor. LDR are usually
available in 5mm, 8mm, 12mm, and 25mm dimensions.

How LDRs are Made?


The Light-dependent resistors made with photosensitive semiconductor materials like
Cadmium Sulphides (CdS), lead sulfide, lead selenide, indium antimonide, or
cadmium selenide and they are placed in a Zig- Zag shape as you can see in the pic
below.

Two metal contacts are placed on both ends of the Zig-Zag shape these metal
contacts help in creating a connection with the LDRs. Now, a transparent coating is
applied on the top so that the zig- zag- shaped photosensitive material gets protected
and as the coating is transparent the LDR will be able to capture light from the outer
environment for its working.

Figure: Working principle and


symbol of LDR

21
INTERFACING DIAGRAM:

PROCEDURE:
• Connect other resistor leg to ground.
• Wire up the LED anode (positive, longer leg) to ESP32 pin 9.
• Drag a photoresistor from the components panel to your breadboard, so
itslegs plug into two different rows.
• Click to create a wire connecting one photoresistor leg to power.

PROGRAM:

22
RESULTS:

23
ANALYSIS AND INFERENCES:

Assignment Questions

1. What is LDR?
2. Which type of sensor is LDR?
3. Why LDR is used?
4. How LDR are Made?

24
JSPM University Pune
Faculty of Science and Technology
School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and Applications”
Experiment No: 7 Date: / /
Aim: Motion Detection using PIR Sensor and NodeMCU/ ESP32.

OBJECTIVE: The main objective of this experiment is,


A. To read the digital sensor value and display the sensor value in
serial monitor.

APPRATUS: Arduino IDE, ESP32 , Breadboard, Resistors, PIR sensor, connecting


wires, supply source, Display.

DESCRIPTION:
PIR stands for Passive Infrared Sensor. It is called passive sensor because it does
not emit the IR rays. It only receives the IR rays. PIR sensor allows to detect or
sense the motion. It is small, Inexpensive and low power device. It is non-wearable
device for that reason they are commonly found in appliances and gadgets used in
homes or businesses. It is having 3 pin structure where, o Pin 1 is Vcc (+5v) o Pin 2
is Output o Pin 3 is ground All pins must be connected with Arduino pins. PIR
sensor can detect animal/human movement in a requirement range. For Indoor
passive infrared Detection distances range from 25 cm to 20 m. For Outdoor
passive infrared, the detection distance ranges from 10 meters to 150 meters. It
detects infrared radiation from the environment. Once there is infrared radiation
from the human body particle with temperature, focusing on the optical system
causes the device to generate a sudden electrical signal.

25
Figure: Structure and Working Principle of PIR Sensor

INTERFACING DIAGRAM:

26
PROCEDURE:
• Give the connections to the ESP32 board as shown in the connection diagram.
• Open Arduino IDE in the computer
• Create new file File_--→ New
• Type your program and Save it in appropriate location in your computer.
• Compile your program by clicking Verify option in the menu.
• Once the program compiled successfully, connect the Arduino
board to the computer using USB cable.
• After connecting, go to Tools ----→Board ---→ Select Arduino/Genuino
Unooption.
• After selecting board, go to Tools ----→Port ---→ Select Arduino
UnoCOM port 3 (name may appear differently for other computers).

PROGRAM:

30
RESULTS:

31
ANALYSIS AND INFERENCES:

Assignment Questions

1. What is the working principle of PIR sensor ?


2. How do you interface a PIR sensor with ESP32?
3. What is the main function of PIR sensor?
4. What is the range of PIR sensor in Arduino?
5. State applications of PIR sensors.

29
JSPM University Pune
Faculty of Science and Technology
School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and Applications”
Experiment No: 8 Date: / /
Aim: Temperature measurement using thermistor-LM35/DHT11 and NodeMCU/
ESP32.

OBJECTIVE: The main objective of this experiment is


A. To interface Temperature measurement using thermistor and
ESP32

APPRATUS: ESP32, Arduino IDE, Breadboard, Resistors, any temperature sensor,


connectingwires, supply source, Display.

DESCRIPTION:
A thermistor is a type of temperature sensor that changes its resistance with
temperature variations. Specifically, we will be using an NTC (Negative
Temperature Coefficient) thermistor, which has a higher resistance at lower
temperatures and lower resistance at higher temperatures. By measuring the
resistance of the thermistor, we can determine the temperature. The thermistor is
connected to the Arduino UNO using two wires. One end of the thermistor is
connected to the 5V pin of the Arduino, and the other end is connected to an
analog input pin (e.g., A0). Additionally, a resistor (typically 10k ohms) is connected
in parallel with the thermistor, with one end connected to the analog input pin and
the other end connected to ground.

INTERFACING DIAGRAM:

30
PROCEDURE:
• Give the connections to the Arduino board as shown in the connection diagram.
• Open Arduino IDE in the computer
• Create new file File_--→ New
• Type your program and Save it in appropriate location in your computer.
• Compile your program by clicking Verify option in the menu.
• Once the program compiled successfully, connect the Arduino
board to the computer using USB cable.
• After connecting, go to Tools ----→Board ---→ Select Arduino Uno option
• After selecting board, go to Tools ----→Port ---→ Select Arduino Uno COM
port 3 (name may appear differently for other computers).
**Note that this port option will be displayed only when board is connected to computer
• Now upload the program to the Arduino board by clicking Upload option.
• Observe the output.

PROGRAM:

31
RESULTS:

ANALYSIS AND INFERENCES:

Assignment Questions

1. What is a thermistor?
2. How is the thermistor connected to the ESP32?
3. How can we convert the analog reading from the thermistor into temperature
values?
4. How can we improve the accuracy of temperature measurements
usingthe thermistor and ESP32?
5. What are some applications of temperature measurement using a thermistor and
ESP32?

32
JSPM University Pune
Faculty of Science and Technology
School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and Applications”
Experiment No: 9 Date: / /
Aim: Distance measurement using SR-04 and NodeMCU/ ESP32.

OBJECTIVE: The main objective of this experiment is,


A. To Interface an Ultrasonic sensor to activate a buzzer and RED
LED if the distance between the sensor and object is less than 35
inches and activate Green LED and OFF the buzzer when
distance is more than 35 inches.

APPRATUS: Arduino IDE, E S P 3 2 , Breadboard, Resistors, Ultrasonic sensor SR-04,


connecting wires, supply source, Display.

DESCRIPTION:
To Interface an Ultrasonic sensor to activate a buzzer and RED LED if the distance
between the sensor and object is less than 35 inches and activate Green LED and
OFF the buzzer when distance is more than 35 inches.

Figure 4: Ultrasonic Sensor

33
INTERFACING DIAGRAM:

PROCEDURE:
• Give the connections to the Arduino board as shown in the connection diagram.
• Open Arduino IDE in the computer
• Create new file File_--→ New
• Type your program and Save it in appropriate location in your computer.
• Compile your program by clicking Verify option in the menu.
• Once the program compiled successfully, connect the Arduino board to the
computer using USB cable.
• After connecting, go to Tools ----→Board ---→ Select Arduino/Genuino Uno

34
PROGRAM:

35
RESULTS:

ANALYSIS & INFERENCES:

Assignment Questions

1. What is the purpose of the SR-04 ultrasonic sensor in this experiment?


2. What is the formula used to calculate the distance using the SR-04
ultrasonicsensor ?
3. What is the purpose of the trigPin and echoPin connections in the SR-04 ultrasonic
sensor?
4. How does the SR-04 ultrasonic sensor measure distance?
5. How is the SR-04 ultrasonic sensor connected to the ESP32?
6. What is the maximum range of the SR-04 ultrasonic sensor?
7. How can the accuracy of distance measurement be improved with the SR-04
ultrasonic sensor?

36
JSPM University Pune
Faculty of Science and Technology
School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and Applications”
Experiment No: 10 Date: / /
Aim: Harmful gas monitoring using NodeMCU and ThingSpeak

OBJECTIVE: The main objective of this experiment is,


A. To interface Gas Detecting Sensor with ESP32.

APPRATUS: ESP32, Arduino IDE, Breadboard, Resistors, Gas Detecting sensor MQ-
135/MQ-2, connecting wires, supply source, Display.

DESCRIPTION:
This Experiment, reads the sensor analog output voltage and when the smoke reaches
certain level, it will make sound a buzzer and a red LED will turn on. When the output
voltage is below that level, a green LED will be on.
MQ-2 Smoke Sensor
The MQ-2 smoke sensor is sensitive to smoke and to the following flammable gases:
− LPG
− Butane
− Propane
− Methane
− Alcohol
− Hydrogen

The resistance of the sensor is different depending on the type of the gas. The smoke sensor
has a built-in potentiometer that allows you to adjust the sensor sensitivity according to how
accurate you want to detect gas. The voltage that the sensor outputs changes accordingly to
the smoke/gas level that exists in the atmosphere. The sensor outputs a voltage that is
proportional to the concentration of smoke/gas. In other words, the relationship between
voltage and gas concentration is the

37
following:
− The greater the gas concentration, the greater the output voltage
− The lower the gas concentration, the lower the output voltage

The output can be an analog signal (A0) that can be read with an analog input of the
Arduino or a digital output (D0) that can be read with a digital input of the Arduino.
PIN WIRING:
The MQ-2 sensor has 4 pins.
Pin -------- Wiring to Arduino
Uno
A0--------- Analog pins
D0 ---------Digital pins
GND--------- V
So, before jumping into the coding part, let's check whether we've assembled all the
necessary hardware components.

INTERFACING DIAGRAM:

38
PROCEDURE:
• Give the connections to the Arduino board as shown in the connection diagram.
• Open Arduino IDE in the computer
• Create new file File_--→ New
• Type your program and Save it in appropriate location in your computer.
• Compile your program by clicking Verify option in the menu.
• Once the program compiled successfully, connect the Arduino
boardto the computer using USB cable.
• After connecting, go to Tools ----→Board ---→ Select Arduino/Genuino Uno
option
• After selecting board, go to Tools ----→Port ---→ Select Arduino UnoCOM port 3
(name may appear differently for other computers).

PROGRAM:

39
RESULTS:

ANALYSIS AND INFERENCES:

Assignment Questions

1. What is the principle of MQ2 Gas sensor?


2. What is the function of a gas sensor?
3. How do you interface a gas sensor?
4. What is the range of a gas sensor?
5. Is MQ2 Gas Sensor an analog sensor? If yes, then why?

40
JSPM University Pune
Faculty of Science and Technology
School of Basic & Applied Sciences
F.Y. MCA , MSc. “Internet of Things and Applications”
Experiment No: 11 Date: / /
Aim: Servo motor (SG-90) control using ESP32.

OBJECTIVE: The main objective of this experiment is


A. To interface Servo motor (SG-90) control using Arduino UNO.

APPARATUS: ESP32 Board, Servo Motor (SG-90),Jumper Wire, Breadboard

DESCRIPTION:
In this lab, participants will learn how to control a servo motor (specifically, the SG-90
servo motor) using an Arduino UNO microcontroller. The lab aims to provide a hands-
on experience in understanding the principles of servo motor control and how to
interface it with the Arduino board.
The lab session will begin with an introduction to servo motors and their applications.
Participants will learn about the working principle of servo motors, which use feedback
control to precisely position the motor shaft. They will understand the structure of a
servo motor, including the motor, gears, and control circuitry.

INTERFACING DIAGRAM:

41
PROCEDURE:
• Give the connections to the Arduino board as shown in the connection diagram.
• Open Arduino IDE in the computer
• Create new file File_--→ New
• Type your program and Save it in appropriate location in your computer.
• Compile your program by clicking Verify option in the menu.
• Once the program compiled successfully, connect the Arduino board to the
computer using USB cable.
• After connecting, go to Tools ----→Board ---→ Select Arduino/Genuino Uno option
• After selecting board, go to Tools ----→Port ---→ Select Arduino
Uno COM port 3 (name may appear differently for other
computers).

PROGRAM:

48
RESULTS:

49
ANALYSIS AND INFERENCES:

Assignment Question

1. What is a servo motor?


2. How does a servo motor work?
3. How is the SG-90 servo motor connected to the ESP32?
4. How can we control the position of the servo motor using the ESP32?
5. What is the range of motion for the SG-90 servo motor?

50
51

You might also like