Lab Manual Final
Lab Manual Final
Lab Manual
Course Outcomes:
INDEX
Assig Pag Instructor’s
n. Date Tit Mar
e Sign.
le ks
No. No.
1 09/02/202 Know Your Micro-Controller Kit 3
4
2 09/02/202 Interfacing of LED with Arduino 7
4 UNO kit
3 15/03/202 Interfacing of LDR with Arduino 16
4 UNO kit
4 23/02/202 Interfacing of Ultrasonic Sensor with 21
4 Arduino UNO kit
5 03/05/202 16x2 LCD Interfacing with Arduino 25
4 Uno Kit
6 15/03/202 Thermistor analog temperature 30
4 sensor interfacing with Arduino
7 22/03/202 IR sensor interfacing with Arduino 33
4 Uno
8 22/03/202 Seven Segment Display Interfacing 37
4 with Arduino
9 12/04/202 Servo Motor Interfacing with 42
4 Arduino
10 12/04/202 DC Motor Interfacing with Arduino 47
4
The above Laboratory assignments are performed and completed by the following student.
3
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Experiment No-1.
Title: Know your Micro-controller kit.
Tasks:
A) Get introduced to the Arduino Uno kit hardware.
B) Get introduced to the features of Arduino IDE.
The Arduino UNO is an open-source microcontroller board based on the Microchip AT mega 328P
microcontroller and developed by Arduino. Arduino is a prototype platform(open-source) based on an easy-
o-use hardware and software. It consists of a circuit board, which can be programmed (referred to a
microcontroller) and a ready- made software called Arduino IDE (Integrated Development Environment),
which is used to write and upload the computer code to the physical board.
Key Features -
● Arduino boards are able to read analog or digital input signals from different sensors and turn it in to
an output such as activating a motor, turning LED on/off, connect to the cloud and many actions.
● You can control your board functions by sending a set of instructions to the microcontroller on the
board via Arduino IDE (referred to as uploading software).
● Unlike most previous programmable circuit boards, Arduino does not need an extra piece of
hardware (called a programmer) in order to load a new code onto the board. You can simply
use the USB cable since it provides the in-system programming facility.
● Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn to program.
● Finally, Arduino provides a standard form factor that breaks the functions of the micro-
controller into an easily accessible package.
● Microcontroller: ATmega328
4
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
● Digital / pins: 14 C6 are PWM) 01 Analog Vo pins 16. • De current per 1/0 pin - 40mA for 3.3v
pin-50mA
● Flash memory - 32 KD of which 0.5 XB wed by boot loader → SRAM -2kh (ATmega328)
● Sketch editing tools- Arduino programs are called as sketch. Tool has various libraries to perform
different mathematical, interfacing functions. Also provides the facility of a Serial Monitor to
observe interim results. One can choose board of the choice as per requirements. Port selection is
also available.
● Arduino programs can be divided in three main parts: Structure, Values (variables and constants),
and Functions. In this tutorial, we will learn about the Arduino software program, step by step,
and how we can write the program without any syntax or compilation error.
Software structure consists of two main functions −
● Setup () function - The setup () function is called when a sketch starts. Use it to initialize the
variables, pin modes, start using libraries, etc. The setup function will only run once, after each
power up or reset of the Arduino board.
5
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
● Loop () function - 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 Arduino board.
6
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
7
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Experiment No- 2
Tasks: Interface external LEDs with the UNO kit in a variety of combination and write a program.
Theory: As per the problem statement, we need to connect given LEDS into the specified variety of
combinations using Arduino Uno, jumpers, LED's, breadboards and resistance.
In the case of 5-LED problem statement, we need to arrange the LEDs in Specified manner along
with appropriate resistance in order to prevent LED from bursting. Similarly, vehicle turn indicator
and traffic signal are safety measures, which would work on similar principle.
Working: When we complete the total connection and coding part, the working can be understood
easily.
● First of all, in all the 3 cases, LED's blink or glow so using “Digital write" they can glow.
● In the alternating lightening case 1, 3, 5 glow while LED, 2, 4 are off and vice-versa...
8
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Whereas in loop run, we just increase the delay time. In case of parking light system, similar
mechanism is used. used along with delay, where the system depicts left led glowing to show that
vehicle is turning left and right glower when the vehicle is turning right and bath of them glow when
the vehicle u parked, while above two cases are similar, traffic light has 6 Led's in total (for two way)
and two glow at a time, where delay time is quite different as compared to above two cares.
● LEDs should be available in different colors as per requirement. Specification forward biased.
1.2 to 36 V rated about 10 to 30 mA.
Task 1
9
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
CODE
void setup()
{
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}
When we make any pin HIGH the LED connected to that pin lights up. At low LED Switches
off. Delay time tells us about the time duration for what it will be on or off. The on and off
keeps on repeating until power is taken out.
Task 2
10
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Code
void setup() {
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
}
void loop() {
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
delay(1000);
11
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
digitalWrite(3, LOW);
delay(200);
digitalWrite(4, LOW);
delay(200);
digitalWrite(5, LOW);
delay(200);
digitalWrite(6, LOW);
delay(200);
digitalWrite(7, LOW);
delay(1000);
digitalWrite(7, HIGH);
delay(200);
digitalWrite(6, HIGH);
delay(200);
digitalWrite(5, HIGH);
delay(200);
digitalWrite(4, HIGH);
delay(200);
digitalWrite(3, HIGH);
delay(1000);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
digitalWrite(5, LOW);
digitalWrite(4, LOW);
digitalWrite(3, LOW);
delay(1000);
}
Task 3
12
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Code
void setup() {
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
}
void loop() {
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
delay(100);
digitalWrite(3, LOW);
delay(200);
digitalWrite(4, LOW);
delay(200);
digitalWrite(5, LOW);
delay(200);
digitalWrite(6, LOW);
delay(200);
digitalWrite(7, LOW);
delay(1000);
digitalWrite(7, HIGH);
13
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
delay(200);
digitalWrite(6, HIGH);
delay(200);
digitalWrite(5, HIGH);
delay(200);
digitalWrite(4, HIGH);
delay(200);
digitalWrite(3, HIGH);
delay(100);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
digitalWrite(5, LOW);
digitalWrite(4, LOW);
digitalWrite(3, LOW);
delay(100);
}
Task 4
Code
14
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Industrial application:
● This project can be used in traffic signals and vehicle indicator.
15
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
16
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Experiment No.-3
Tasks: Interface LDR with the UNO kit and write a program.
A) : Interface LDR with the UNO kit such that when you cover the LDR surface, an LED will glow
indicating night hours. When uncovered , the LED should switch OFF.
B) To implement automated street light ON OFF system depending upon at ambient light intensity.
Use at least 3-LESs as street Light.
B) To count number of objects passing through. The system should use light source (LED) and
detector (LDR). Initially count should be. Zero and with every object passing it should be
incremented by '1' Display the count on serial monitor of the serial monitor.
Theory:
Sensor Specifications -
For the first problem statement, an automated sheet be implemented. Here, when the light is falling
on the LDR the LEDS will turn off and when the LDR is not receiving no / low light intensity the
LEDS will glow, which depicts that during the day the street lights would be off and during night
times they will turn on.
For the second problem statement, a counted is to be implemented where in the system would record
the number of objects posted through. Here, an LDR and & light source led would be placed
opposite to each other. When an object passes between both of them it would block the light source
to the LDR due to which the LDR will turn off hence incrementing the count. So, every time an
object passes the count will be incremented and from this, we can get the total number of objects
passed. The final count would be printed on the serial monitor.
Interfacing Circuit diagram: (Draw Connections between Arduino Uno and the Sensor as well
as other components)
The first Tasks was connecting the LDR and Arduino Uno on the bread board which was to be done
very carefully to avoid errors. Then, the coding part expected was quite easy and lastly it was
working at.
Task 1
19
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
In this trial, we effectively linked a Light Dependent Resistor (LDR) to the Arduino Uno setup.
The central goals of this trial encompassed comprehending the procedure to connect an LDR
to the Arduino and applying it for recognizing alterations in light levels. We designated diverse
LEDs for distinct degrees of light intensities. To illustrate, for lower light intensity, we
activated the red light, as depicted in the illustration. When encountering standard light
intensity, we engaged the yellow light, as illustrated in the image. And for elevated light
intensities, we triggered the green light, as depicted in the visual representation
Application:
Apart from being used in street lights, LDR is used in the:
● Infrared astronomy.
Conclusion:
20
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
In this experiment, we successfully interfaced an LDR (Light Dependent Resistor) with the
Arduino Uno kit. The primary objectives of this experiment were to understand how to
connect an LDR to the Arduino and use it to detect changes in light levels. we also made
various changes depending on the light
Title of the assignment – Interfacing of ultrasonic sensor with Arduino Uno kit.
21
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Experiment No.-4
Tasks: Interface ultrasonic sensor with the UNO kit and write a program.
A) To find distance (in cm) between the sensor and fixed surface like obstacle or wall etc.
Display the distance on Serial monitor. Verity the distance by actual measurement.
B) Give alert using Buzzer and LED. If distance goes above or below a predetermined level
C) Ultrasonic distance between two ranges finding and turn ON appropriate LED
Theory:
Working Principle - Ultrasonic sensors work by sending out a sound wave at a frequency above the
range of human hearing. The transducer of the sensor acts as a microphone to receive and send the
ultrasonic sound.
Sensor Specifications:
22
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
● Buzzer
Firstly, the sensor and Arduino Uno are connected. Now, as per the problem statement, we have to
measure the distance between the sensor and a fixed surface. Once the power supply is given, the
sensor will send and receive the sound waves and calculate the time taken for the waves to return.
Distance will be calculated by using the formula distance = (speed of sound X time) /2, and this
distance measured will be displayed on the Serial monitor.
23
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
● Jumpers - set of make to male connectors & a set of male to female connectors.
● Buzzer
Task 1
In this experiment, an Arduino was employed in conjunction with an ultrasonic sensor to gauge the
gap between the sensor and an obstacle, with the results displayed on the serial monitor. For varying
ranges of distances, as depicted in figures 1, 3, and 5, distinct LEDs were allocated specific roles. A
red LED would flash if the distance was situated between 30 and 50 centimeters, a yellow LED
24
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
would illuminate for distances within the range of 10 to 30 centimeters, and a green LED would be
activated when the distance fell between 5 and 10 centimeters.
Industrial application: Apart from the distance measurement, ultrasonic sensors are used in robot
sensing, presence detection, tank level detection and many applications on the production line, etc.
Conclusion:
In conclusion, the experiment effectively utilized ultrasonic sensors and LEDs to measure and
display distances within specific ranges. This approach provides a practical solution for real-
world applications, such as obstacle detection and monitoring.
Title of the assignment – 16x2 LCD Interfacing with Arduino Uno Kit
25
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Experiment No.5
Tasks:
A) Write a program to display Hello World! On LCD at desired location
B) Write a program to scroll custom message on Right or Left direction on LCD.
C) Write a program to display custom characters on LCD
D) Display distance measured by ultrasonic sensor.
Theory:
Liquid Crystal Display (LCD) is the display device that can be interfaced with Arduino. For this, The
LiquidCrystal library (LiquidCrystal.h) allows to control LCD displays. LCDs have a parallel
interface, meaning that the microcontroller has to manipulate several interface pins at once to control
the display. The interface consists of the following pins:
26
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
1) A register selects (RS) pin that controls where in the LCD's memory for writing data to. One
can select either the data register, which holds what goes on the screen, or an instruction
register, which is where the LCD's controller looks for instructions on what to do next.
2) A Read/Write (R/W) pin that selects reading mode or writing mode
3) An Enable pin that enables writing to the registers
4) 8 data pins (D0 -D7). The states of these pins (high or low) are the bits that you're writing to
a register when you write, or the values you're reading when you read.
A) Also, the Liquid Crystal library shows how to use the scrollDisplayLeft() and
scrollDisplayRight() methods to reverse the direction the text is flowing.
B) For custom character display,
Create a custom character for use on the LCD. Up to eight characters of 5x8 pixels are
supported (numbered 0 to 7). The appearance of each custom character is specified by an
array of eight bytes, one for each row. The five least significant bits of each byte determine
the pixels in that row. To display a custom character on the screen, write() its number.
There's also a display contrast pin (Vo), power supply pins (+5V and Gnd) and LED Backlight
(Bklt+ and BKlt-) pins that you can use to power the LCD, control the display contrast, and turn on
and off the LED backlight, respectively.
● USB Cable,
● Breadboard,
27
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
● 10K Potentiometer,
● Connecting Wires,
Task 1
In this experiment, using an Arduino UNO & an LCD display we displayed various messages on the
display. Learning how to display and how to move text across the display and custom characters
Flowchart/ Algorithm: Write detailed steps of algorithm for each Tasks(A,B,C and D )
Step - 1
Open Arduino IDE. Here use "Liquid Crystal" library. This is an inbuilt library, so no need to install
that library separately.
#include <LiquidCrystal.h>
Step -2
28
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Next initialize the library with the number of the interface pins. With the function "LiquidCrystal
lcd()". The function has six attributes. These are the interface pins in the order of "RS, E, D4, D5,
D6, D7". Here we use pins 12, 11, 5, 4, 3, 2. corresponding to above.
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
Step - 3
Now can call this display by "lcd". Next program the setup part. We need to set the number of
columns and number of rows. Here use the LCD with 16 column and 2 rows. Set the number of
columns and rows by the function "lcd.begin(16, 2)". If you have a display with 16 columns and 4
rows this become "lcd.begin(16, 4)". And set the A0 pin as input.
lcd.begin(16,2);
pinMode(A0,INPUT);
Step - 4
The setup part is over. Next loop partFirst to clear the displayuse the function "lcd. Clear()". This
function will clean the entire display.lcd. Clear();
Step - 5
We need a starting point to start printing. So set the cursor to that particular point by the function
"lcd.setCursor()". This function has only two attributes. It is that starting points.(The number of
column and number of row). Start from first column first row. The first column is represented as 0,
second is 1, and so on and the first raw is represented as 0, second is 1. So, we need to start from the
position (0, 0). You can easily understand if you know about matrix. The piece of code become,
lcd.setCursor(0,0);
Step - 6
The instruction to print. to print "Hello World" by the instruction "lcd.print()". Alternatively, you
can print anything. Please don, t forgot the double quote marks.
lcd.print("Hello World");
Step -7
In the above printing statement, we use total of 14 characters. So, the current position of cursor is at
(14, 0). Now to print on the next line, i.e., the position (0, 1). Set the cursor to that point by the
function "lcd.setCursor()".
lcd.setCursor(0,1);
Step - 8
Now the cursor is at the position of second row and first column(0, 1). Then print another text
"Value" by the function lcd.print().
lcd.print("Value : ");
Step - 9
Here we use 8 characters in second line. So, the current position of cursor is (8, 1). Next, we need to
read the analog value from the pin A0 and print it to the display. It uses "analogRead()" function to
read the analog value and use the "lcd.print()" function to print the value to the display. And there is
no need of double quotes.
29
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
lcd.print(analogRead(A0));
Step - 10
Delay(): we have to add some delay. Otherwise, the text will blinkcontinues. That because of the first
instruction "LCD. Clear()". Every time when see this command the Arduino will clear the display,
This results the blinking of display. But use of delay will decrease this blinking.
delay(500);
Step - 11
Connection
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 10K POT:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Conclusion:
LCDs are mostly used in portable electronic games, in flat panel televisions, in electronic
billboards, in video- projection system and many more such devices
30
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Robotics LaboratoryAssignmentNo.06
Title of the assignment– Thermistor analog temperature sensor interfacingwith with Arduino
31
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Experiment No. 6
Tasks:
A) Take temperature readings from the sensor and display the results on the Serial Monitor.
Theory: A Thermistor is a type of resistor whose resistance is dependent on temperature. There are
two opposite types of thermistors:
PTC (Positive Temperature Coefficient): In this type of Thermistor the temperature increases with
the decrease of the resistance. The resistance of the negative temperature coefficient Thermistor is
very large due to which it detects the small variation in temperature (resistance increases as
temperature rises)
NTC (Negative Temperature Coefficient): The resistance of the Thermistor increases with the
increases in temperature. (Resistance decreases as temperature rises)
Note that the sensor operates on a voltage range of 4 to 30 V and that the output voltage is
independent of the supply voltage.
Operating components and materials required with specifications:
● USB Cable,
● Breadboard,
● Connecting Wires,
5∗10 k
Rth +10 k = Vout
Rth is the resistance of thermistor.
32
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
10 k
Vout = 5 * 10 k + Rth
Vout is the voltage measured by the ADC
5∗ADC val
Vout = 1023
The temperature can be found out from thermistor resistance using the Steinhart-Hart equation.
Temperature in Kelvin = 1 / (A + B[ln(R)] + C[ln(R)]^3)
where A = 0.001129148, B = 0.000234125 and C = 8.76741*10^-8 ,and R is the thermistor
resistance.
Task 1
In this experiment, we put together an analog temperature sensor and a buzzer that will buzz
whenever the temperature is above a certain temperature.
33
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Conclusion:
By making use of the Analog input Pinmode of Arduino and interfacing it with a NTC
Thermistor we can easily determine the temperature changes in various environments
accurately. On making changes in the peripheral region of the thermistor it changes the
temperature. It is thus inferred that a Thermistor is a variable Resistance that changes it
resistance and voltage accordingly to give accurate temperature values
Robotics LaboratoryAssignmentNo.07
34
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Experiment No. 7
Theory: An IR sensor, also known as an Infrared sensor, is an electronic device that detects and
measures infrared radiation. Infrared radiation is a type of electromagnetic radiation with a
wavelength longer than visible light. IR sensors work by emitting an infrared beam and then
measuring the amount of reflected light. They are widely used in various applications such as
remote-control devices, security systems, obstacle detection, and industrial automation. The IR
sensor consists of two main parts: an infrared emitter and an infrared detector. The emitter emits an
infrared beam, which bounces back to the detector if it encounters an object. The detector measures
the reflected light and converts it into an electrical signal, which is then processed by the sensor’s
circuit. Based on the electrical signal, the IR sensor can determine the distance, speed, or presence of
an object. IR sensors are also available in both analog and digital forms, with different specifications
for sensitivity, accuracy, and response time.
IR Sensor Module
IR sensor module hardware mainly includes IR LED/IR Tx, Photodiode/IR Rx, LM393 comparator
IC, signal LED, power LED, Trim pot, and pins like VCC, GND & Output
35
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
● USB Cable,
● Breadboard,
● Connecting Wires,
● IRModule
Interfacing Circuit diagram: (Draw Connections between Arduino Uno and the IR Sensor as
well as other components)
36
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
void loop(){ int sensorStatus = digitalRead(IRSensor); // Set the GPIO as Input if (sensorStatus
== 1) // Check if the pin high or not
{
// if the pin is high turn off the onboard Led digitalWrite(LED, LOW); // LED LOW
Serial.println("Motion Detected!");
}
else {
//else turn on the onboard LED digitalWrite(LED, HIGH); // LED High
Serial.println("Motion
Ended!");
Result:(Put screenshot of serial monitor for each problem statement given i.e., for each of the Aim
A) and B).
37
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Applications of IR Sensor:
Proximity Sensing: IR sensors are commonly used for proximity sensing applications, such as
detecting the presence of an object or person in close proximity to the sensor for e.g., in Automatic
Hand Sanitizer.
Motion Detection: IR sensors can be used as motion detectors to sense movement in an area. They
are often used in security systems, automatic lighting controls, and burglar alarms. PIR motion
sensor is used in these types of Application.
Remote Control Systems: IR sensors are extensively used in remote control devices, such as TVs,
air conditioners, and home entertainment systems. They receive infrared signals from remote
controllers and convert them into electrical signals for device control.
Ambient Light Sensing: IR sensors can measure ambient light levels and adjust the brightness of
displays or lighting systems accordingly. They are commonly found in smartphones, tablets, and
automatic lighting systems.
Object Counting: IR sensors can be used to count the number of objects passing through a specific
area, such as people entering or exiting a building or items on a conveyor belt.
Conclusion:
The IR sensor sensor module essentially consists of 2 parts:
Transmitter IR LED and Receiver IR photo diode to receive the Infrared ray emitted. When voltage
is applied to the IR LED it emits IR rays which propagate through air.In presence of an Obstacle
object this ray will get hit on the object and gets reflected back to the photodiode receiver. If the
object is close, the reflected light will be stronger, if the object is far away, the reflected light will be
weaker. Corresponding Readings to the above scenarios will be displayed on serial monitor
38
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Robotics LaboratoryAssignmentNo.08
39
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Experiment No. 8
Theory:
When Arduino application only needs to display numbers, consider using a seven-segment display.
The seven-segment display has seven LEDs arranged in the shape of number eight. They are easy to
use and cost effective.
Seven segment displays are of two types: common anode and common cathode. The Internal
structure of both types is nearly the same. The difference is the polarity of the LEDs and
common terminal. In a common cathode seven-segment display (most popularly used), all seven
LEDs plus a dot LED have the cathodes connected to pins 3 and pin 8. To use this display, we need
to connect GROUND to pin 3 and pin 8 and, and connect +5V to the other pins to make the
individual segments light up. The following diagram shows the internal structure of common-
cathode seven-segment display:
40
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
The common anode display is the exact opposite. In a common-anode display, the positive terminal
of all the eight LEDs is connected together and then connected to pin 3 and pin 8. To turn on an
individual segment, you ground one of the pins. The following diagram shows the internal structure
of the common-anode seven-segment display.
● Connecting Wires,
41
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Interfacing Circuit diagram: (Draw Connections between Arduino Uno and the disply as well
as other components)
42
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
43
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
44
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Applications:
1) Digital Displays of Testing Machines
2) Digital Clock
Conclusion:
• The seven-segment display has 8 Led’s arranged int format of Number 8.
• When we Provide Proper code using For Loop it gives output as the numbers from 1 to 10 occurs
on Display.
Robotics LaboratoryAssignmentNo.09
45
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Experiment No. 9
Theory:
A servo motor is an electric device used for precise control of angular rotation. It is used in
applications that demand precise control over motion, like in case of control of a robotic arm, The
rotation angle of the servo motor is controlled by applying a PWM signal to it.By varying the width
of the PWM signal, we can change the rotation angle and direction of the motor.
Servo motors have three wires: power, ground, and signal. The power wire is typically red, and
should be connected to the 5V pin on the Arduino board. The ground wire is typically black or
brown and should be connected to a ground pin on the board. The signal pin is typically yellow or
orange and should be connected to PWM pin on the board. In these examples, it is pin number 9.
46
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
For the Knob example, wire the potentiometer so that its two outer pins are connected to power
(+5V) and ground, and its middle pin is connected to A0 on the board. Then, connect the servo motor
to +5V, GND and pin 9.
Functions Used
1. Servo my servo
2. myservo.attach(pin)
3. myservo.write(angle)
● This function writes a value to the servo, thus controlling the position of the shaft.
● Angle can take values between 0 to 180.
● This function is used to map a number from one range to another range.
● This means that “value” having a value between “fromLow” to “fromHigh” gets converted
to equivalent values in the range of “toLow” to “toHigh”. “fromLow” gets mapped to
“toLow” and so on.
47
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
● Connecting Wires,
● 10 K Potentiometer
● Servo
●
Interfacing Circuit diagram: (Draw Connections between Arduino Uno and the Sensors as well
as other components )
Algorithm: Write (Type) detailed steps of algorithm for each Tasks giveni.e., for each of the Aim
A), &B).
A)Program to control the Servo Motor Rotation by one Degree
STEP 1-Start
STEP 2- include servo.h library
STEP 3- define angle
STEP 4- create a new object myservo from the library
STEP 5- in void setup, declare myservo.attach(9)
STEP 6- in void loop, use for loops to rotate the motor
STEP 7-Stop
Result:
Applications:
Servo motors are used in DVD and Blue ray disc players. Automobiles also use servo motors. In
modern cars it is used to control its speed. Printers also uses the servo.
Conclusion:
In conclusion we can say that servo motors are motors that rotate in a defined manner and
specifies degrees. These can be used in a variety of applications, with a wide range of motion
and intervals.
49
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Robotics LaboratoryAssignmentNo.10
50
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Experiment No. 10
Components: Arduino UNO Development Board, USB Cable, Breadboard, LED, Resistor (1 k
ohm), Connecting Wires, Potentiometer 10K, DC Motor etc.
Theory:
DC motor converts electrical energy in the form of Direct Current into mechanical energy in the
form of rotational motion of the motor shaft. The DC motor speed can be controlled by applying
varying DC voltage; whereas the direction of rotation of the motor can be changed by reversing the
direction of current through it. For applying varying voltage, we can make use of PWM technique.
For reversing the current, we can make use of H-Bridge circuit or motor driver ICs that employ the
H-Bridge technique. PWM wave generated on the Arduino UNO is used to provide a variable
voltage to the motor through L293D. In Arduino, analog. Write function is used to generate PWM
wave.
51
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
● This function is used to configure the mode of interrupt event and declare the ISR for that
interrupt. The interrupt event and ISR is for the interrupt pin declared by the function digital
Pin To Interrupt(pin).
● ISR in this function is the name of the ISR that will be used for this interrupt.
● mode defines when the interrupt will be triggered. There are four modes available to choose
from:
- LOW: trigger the interrupt whenever the pin is low.
- CHANGE: trigger the interrupt whenever the pin changes value.
- RISING: trigger when the pin goes from low to high.
- FALLING: trigger when the pin goes from high to low.
52
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
● Example, attach Interrupt(digital Pin ToInterrupt(2), motor, FALLING) configures digital pin
2 as an interrupt pin with ISR named motor and which generates interrupt for every falling
edge event on pin 2.
● This function is used for generating PWM on PWM digital pins (3, 5,6,9,10,11 for Arduino
UNO).
● Value can be any number between 0 to 255. 0 being 0% duty cycle and 255 being 100% duty
cycle.
● Connecting Wires,
● 10 K Potentiometer
53
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2023-2024: Semester I
ES1053: Robotics
Result:
Conclusion:
For controlling a dc motor using Arduino we have to use a motor driver circuit (L293D).
In this experiment we have learnt how to use a DC motor without a dedicated motor driver.
We now know the complete use of Arduino PWM (pulse with modulation pins) and their use
not just for servo motors but also for DC motors.
54