Nothing Special   »   [go: up one dir, main page]

MAR Lab Manual 1 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

Vishwakarma Institute of Technology

Department of Engineering, Sciences and Humanities


FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Bansilal Ramnath Agarwal Charitable Trust’s

Vishwakarma Institute of Technology, Pune-37


(An autonomous Institute of Savitribai Phule Pune University)

Department Of Engineering Science and Humanities

Lab Manual

Course Code Course Name Teaching Scheme (Hrs. / Week) Credits


ES1039 Mechatronics and Theory: 3 Hours / Week 5
Robotics Tutorial: 1 Hour / Week
Lab: 2 Hours / Week

Course Outcomes:
1. The students will be able to identify different sensors, understand their significance related to Robotics
and select a sensor as per the requirement.
2. The students will be able to understand the internal configuration and architecture of microcontroller.
3. The students will be able to interface different sensors and peripherals to a microcontroller and program
the same.
4. The students will be able interface different display devices, actuators and control them using a program.
5. The students will be able to understand working principle of different communication protocols used in
Robotics.
6. The students will be able to understand significance of different systems used in Robotics and Automation
Create front end web pages using HTML5 and CSS3 tags and attributes

Class : F.Y. Branch : ALL Branches Common

Year : 2021-22 Prepared By : Mrs. Swati A. Joshi

Required H/W and S/W : Arduino UNO Kit, Various


Sensors and Arduino CC Compiler HTML,CSS,NODEJS,REACT
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

Contents
Sr. Title of Experiment Page CO
No no mapping
1. Know Your Arduino Uno Kit 3 2

2. Interfacing of Multiple LED with Arduino 5 2,3

3. Interfacing of LDR 7 1,2,3


4. Interfacing of Ultrasonic Sensor 8 1,2,3
5. Interfacing of 16x2 LCD 12 1,2,4
6. Interfacing of Bluetooth Module 16 1,2,3,5
7. Interfacing of Temperature sensor 18 1,2,3
8. Interfacing of Seven Segment display. 20 1,2,3,5

9. Interfacing of Push button/Micro Switch. 22 1,2,3


10. Interfacing of 4X4 keypad. 24 1,2,3
11. Interfacing of Servo 26 1,2,3,4
12. Interfacing of DC Motor 29 1,2,3,4
13 Course Project (Group Activity) - 1,2,3,4,5,6

Note :
1. First five Assignments are Mandatory . Out of rest 7 any three can be chosen.
2. Minimum 8 experiments are required.
3. Part A and B of every assignment is compulsory for all students.

2
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and 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.

History & important features of the Arduino UNO kit hardware:

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-to-use hardware and software. It consists of a circuit board, which can be
programed (referred to as 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 into 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.

Specifications of Arduino UNO:

• Microcontroller: ATmega328

• Operating Voltage – 5V Input voltage - 7-12 V Recommended), 6-20v (limits).

• 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)

3
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

• EEPROM - 1xb. (AT mega 32), Clock speed - 16 MHz

Parts of Arduino Uno

Important features of Arduino IDF and the menu:

• 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 consist 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.
• 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.

4
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

Experiment No- 2

Title: Interfacing of LED with Arduino Uno kit.

Pre-requisite: Information about safe voltage levels and protection of LEDS.

Tasks: Interface external LEDs with the UNG kit in a variety of combination and write a
program.

A) To glow 5 LEDS in

1) Alternate fashion &


2) Running light sequence in continuous loop.

B) To implement vehicle, turn / parking indicator in visual made. Blink two LEDS - I) Alternatively
ii) simultaneously.

C) To simulate working of traffic signal for two three way road. Formulate your own theme and
delay cycle Decide the hardware required and assemble the same on a breadboard for your theme

Theory: As per the problem statement, we need to connect given LEDS into the specified variety
of combinations using Arduino Uno, jumpers, Lea'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...

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.

5
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

Electronic components and materials required:

• Arduino Uno - operating voltage 5.v. AT mega 328P. No of digital 1/o pins-14, Input voltage
limits 6-20 V.

• LEDs should be available in different colors as per requirement. Specification forward biased.
1.2 to 36 V rated about 10 to 30 mA.

• Bread board - 5A rated. 2 distribution strips.

• Jumpers should be male to male.

• Resistors - As per requirement, but 182 recommended.

• Arduino IDE software - Latest supporting version supporting UNO.

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 given i.e., for each of the Aim
A) and B).
Note:
• Connecting Arduino board and other connections was taking caring of anode & cathode in
LEDs was necessary...
Industrial application:
• This project can be used in traffic signals and vehicle indicator.
• In day to day life, in festival lightings, road safety boards, etc.

6
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Experiment No.-3

Title: Interfacing of LDR with ARDUINO UNO kit.

Pre-requisites: Assignment number 2 must be performed and Principle of working of LDR.

Tasks: Interface LDR with the UNO kit and write a program.

A) To implement automated street light ON OFF system depending upon at ambient light intensity.
Use at least 3-Leds 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 OND simulator.

Theory:

Working Principle - The working principle of an LDR is photoconductivity, which & nothing but
an optical phenomenon.

When the material absorbs the light then the conductivity of the material enhances. When the light
falls on the LDR, then the elections in the material's valence bond are eager to the conduction I
band. But, the photons in the incident light must have energy superior to the band gap of the
material to make the electrons jump from one band to another band (valence to conduction).

Hence, when light has ample energy, more electrons are excited to the conduction band which
grades in many change canters. When the effect of this process and the flow of the current starts
flowing more the resistance of the device decreases.

Sensor Specifications -

• Resistance: 400 ohm to 400 kilo ohm.

• Normal resistance variance: 1 kilo ohm to 10 kilo ohm.

• Sensitivity: about 3 msec.

• Voltage rating: - 3-12 V.

7
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

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.

Electronic components and materials required:

1) Arduino board (UNO): operating voltage 5V (AT mega 328P)

2) LDR Rating - 250 V

3) Bread board - 5A rated. 2 distribution strips.

4) Arduino IDE software.

5) LEDS – lids as per requirement (4) and in different colors.

6) Jumpers - should be male to male.

7) Resistors as per requirement, but 1 kilo ohm recommended.

Interfacing Circuit diagram: (Draw Connections between Arduino Uno and the Sensors as
well as other components )
8
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

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.

Conclusion:

Apart from being used in street lights, LDR is used in the:

• Infrared astronomy.

• It is used in light failure alarm circuits and used in light meter.

• LDR is also used in smoke detectors.

9
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Experiment No.-4

Title - Interfacing of ultrasonic sensor with Arduino Uno kit.

Pre-requisite: Principle of working of ultrasonic sensor and Calculation of distance

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 wall etc. Display the distance
on Serial monitor. Verity the distance by actual measurement.

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:

• Operating voltage +5v

• Theoretical measuring distance - 2cm to 450 cm

• Practical measuring distance - 2 cm to 80 cm

• Accuracy-3mm, measuring angle covered < 15°

• Operating current < 15 mA.

• Operating frequency – 40 Hz.

• 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 wing the formula distance = (speed of sound X time) /2, and this
distance measured will be displayed on the Serial monitor.

10
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

Operating components and materials required:

• Arduino board (und) - operating voltage 5V (At mega 328P)

• Breadboard 1-5A rated, 2-distribution strips.

• Jumpers - set of make to male connectors & a set of male to female connectors.

• Arduino IDE Software - updated to the latest version.

• Ultrasonic Sensor - operating voltage-5x

• Buzzer

Interfacing Circuit diagram: (Draw Connections between Arduino Uno and the Sensors as
well as other components )

Industrial application: Apart from the distance measurement, ultrasonic sensors are used in robot
sensing, presence detection, tank level detection and many application on the production line, etc.

11
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Experiment No. 5

Title: 16x2 LCD Interfacing with Arduino Uno Kit

Prerequisites: Working Principle and Character formation logic of LCD

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

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:
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 LiquidCrystal 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.

12
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

LCD functions :1. LiquidCrystal. Begin(16x2)- Initializes LCD specifying size in number of
columns and rows.
Electronic components and materials required:
• Arduino UNO Development Board,
• USB Cable,
• Breadboard,
• LED, Resistor (1 k ohm),
• 10K Potentiometer,
• Connecting Wires,
• 16x2LCDModule.

Interfacing Circuit diagram: (Draw Connections between Arduino Uno and the Sensors as
well as other components )

Also Draw spl character matrix 5x8 and explain formation of special character.

Flowchart/ Algorithm :Write detailed steps of algorithm for each Tasks(A,B,C)


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
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.

13
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
lcd.begin(16,2);
pinMode(A0,INPUT);
Step - 4
The setup part is over. Next loop part First to clear the display use 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.
lcd.print(analogRead(A0));
Step - 10
Delay(): we have to add some delay. Otherwise, the text will blink continues. 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
14
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
* 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)

Observation: Put screenshot of serial monitor for each Tasks(wherever applicable).

Conclusion:(Write at least 3 Industrial Applications Here )


LCDs are mostly used in portable electronic games, in flat panel televisions, in electronic
billboards, in video- projection system and many more such devices

15
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Experiment No. 6

Title: Bluetooth module HC05 Interfacing with Arduino


Pre requisite : Basics of Communication , Serial Communication , Wireless communication ,
Down load Bluetooth communication App on Mobile

Tasks:
A) Write a program to transfer message from mobile and display it on the serial monitor using
Bluetooth.
B) Write a program to Transfer message from mobile and display it on the LCD using Bluetooth

Theory:
A Bluetooth technology is a high-speed low powered wireless technology link that is designed to
connect phones or other portable equipment together. It is a specification (IEEE 802.15.1) for the
use of low power radio communications to link phones, computers and other network devices over
short distance without wires. Wireless signals transmitted with Bluetooth cover short distances,
typically up to 30 feet (10 meters).
It is achieved by embedded low-cost transceivers into the devices. It supports on the frequency
band of 2.45GHz and can support up to 721KBps along with three voice channels. This frequency
band has been set aside by international agreement for the use of industrial, scientific and medical
devices (ISM).
Working with the help of HC 05 android app:
• Download the Application
• Pair your device with HC 05/06 Bluetooth module
• Turn ON HC 05/06 Bluetooth module
• Scan for available device
• Pair to HC 05/06 by entering default password 1234 OR 0000
• Open the Application.
• Press paired devices
• Select your Bluetooth module from the List (HC 05)

The Bluetooth module at other end receives the data and send to Arduino through the TX
pin of Bluetooth module (RX pin of Arduino). The Code fed to Arduino checks the received
data and compares. If received data is 1 the LED turns on turns OFF when received data is
0.

16
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

Operating components and materials required with specifications:

• Arduino Development Board,


• USB Cable,
• Breadboard,
• LED, Resistor (1 k-ohm),
• Connecting Wires,
• LCD Module(16*2) ,
• Potentiometer 10K,
• HC-05 Bluetooth Module.

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 given i.e., for each of the Aim
A) and B).

Result:(Put screenshot of serial monitor for each Tasks given i.e., for each of the Aim A) and B).

Conclusion: Bluetooth is widely used in remote controls, headphones, to transfer files from one
device to another, devices such as keyboard, printer and mouse, etc.

17
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Experiment No. 7

Title: Thermistor (Temperature Sensor ) Interfacing with Arduino Uno


Prerequisites : Various Temperature Sensors, and its usage in applications, Sensitivity
Control Of Sensor.
Problem statement
A) Write a program to interface Thermistor so as to display temperature reading in degrees
on serial monitor.
B) Write a program to interface Thermistor so as to display temperature reading in degrees
on LCD Display.

Theory: Thermistors are variable resistors that change their resistance with temperature. They are
classified by the way their resistance responds to temperature changes. In Negative Temperature
Coefficient (NTC) thermistors, resistance decreases with an increase in temperature. In Positive
Temperature Coefficient (PTC) thermistors, resistance increases with an increase in temperature.
NTC thermistors are the most common, NTC thermistors are made from a semiconducting material
(such as a metal oxide or ceramic) that’s been heated and compressed to form a temperature
sensitive conducting material.
The conducting material contains charge carriers that allow current to flow through it. High
temperatures cause the semiconducting material to release more charge carriers. In NTC
thermistors made from ferric oxide, electrons are the charge carriers. In nickel oxide NTC
thermistors, the charge carriers are electron holes.
Thermistor Symbol

The Arduino will measure the voltage at a point between the thermistor and a known resistor. This is
known as a voltage divider. The equation for a voltage divider is:

Vout=Vin xR2/R1+R2
In terms of the voltage divider in a thermistor circuit, the variables in the equation above are:
18
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Vout Voltage between Thermistor and known Resistor
Vin Vcc i.e., +5V
R1 Known Resistor
R2 resistance of Thermistor

Explain Map () function of Arduino cc,


Operating components and materials required with specifications:

• Arduino Development Board,


• USB Cable,
• Breadboard,
• LED, Resistor (1 k-ohm),
• Connecting Wires,
• LCD Module(16*2) ,
• Potentiometer 10K,
• Thermistor Module

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 given i.e., for each of the Aim
A) and B).

Result:(Put screenshot of serial monitor for each problem statement given i.e., for each of the Aim
A) and B).

Conclusion: Write Industrial Applications of Thermistor. Digital Thermometers , Automotive


Sectors

19
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Experiment No. 8

Title: Seven Segment Display Interfacing with Arduino


Pre-requisite: LED Display Construction and working , Seven seg display code concept,
Counter Operation
Tasks
A) Write a program to turn ON and turn OFF the LED using push button.
B) Write a program to implement simple decade counter (Counting 0 to 9) using push button using
a 7 Segment Display.
C) Form Special Character of Your choice and Display.

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:

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

20
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
individual segment, you ground one of the pins. The following diagram shows the internal structure
of the common-anode seven-segment display.

Operating components and materials required with specifications:

• Arduino UNO Development Board,


• USB Cable, Breadboard,
• Connecting Wires,
• Push Button (Micro Switch)
• Segment Display (Common Cathode Type)

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 given i.e., for each of the Aim
A) and B).

Conclusion: Digital Displays of Testing Machines, Digital Clock

21
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Experiment No. 9

Title: Push Button or Micro Switch Interfacing with Arduino


Pre-requisite: Different types of electronic switches and their selection and usage in
applications, DC motor working requirements.
Tasks
A) Write a program to turn ON and turn OFF the LED using push button.
B) DC motor on-off control using a push button (Micro switch) using Arduino Uno.

Components: Arduino UNO Development Board, USB Cable, Breadboard, LED, Resistor (1 k
ohm, 10Kohm), Connecting Wires, Push Button (Micro Switch), DC Motor etc.

Theory:

The pushbutton is a component that connects two points in a circuit when you press it. We
connect three wires to the Arduino board. The first goes from one leg of the pushbutton through
a pull-up or pull-down resistor (here 10 KOhms) to the 5-volt supply. The second goes from
the corresponding leg of the pushbutton to ground. The third connects to a digital I/o pin (here
pin 7) which reads the button's state. When the pushbutton is open (unpressed) there is no
connection between the two legs of the pushbutton, so the pin is connected to 5 volts (through
the pull-up resistor) and we read a HIGH. When the button is closed (pressed), it makes a
connection between its two legs, connecting the pin to ground, so that we read a LOW. (The
pin is still connected to 5 volts, but the resistor in-between those means that the pin is "closer"
to ground.)

Operating components and materials required with specifications:


• Arduino UNO Development Board,
• USB Cable, Breadboard,
• Connecting Wires,
• Push Button (Micro Switch)
• DC Motor etc.

22
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

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 given i.e., for each of the Aim
A), &B)

Result: Put screenshot of serial monitor for each Tasks given i.e., for each of the Aim A),& B)

Conclusion: Explain debouncing and need of pull-down resistor in micro switch.

23
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Experiment No. 10

Title: 3x4 and 4x4 Keypad Interfacing with Arduino


Pre-requisite: Assignment number 9
Tasks
A) Write a program to interface 3 x 4 keypad using Arduino UNO to display pressed characters
on Serial Monitor.
B) Write a program to interface 4 x 4 keyboard and LCD using Arduino so as to display pressed
characters on LCD.

Components: Arduino UNO Development Board, USB Cable, Breadboard, Connecting Wires,
3x4 and 4x4 keypad module, 16x2 LCD, Potentiometer 10K etc.

Theory:
The library Keypad’s is used for interfacing keypad with Arduino. A keypad is often needed to
provide input to an Arduino system, and membrane-type keypads are an economical solution for
many applications. They are quite thin and can easily be mounted wherever they are needed. A 12-
button keypad has three columns and four row. Pressing a button will short one of the row outputs
to one of the column outputs. From this information, the Arduino can determine which button
was pressed. For example, when key 1 is pressed, column 1 and row 1 are shorted. The Arduino
will detect that and input a 1 to the program.
How the rows and column are arranged inside the keypad is shown in the figure below.

A 4×4 Matrix Keypad consists of 16 Keys or Buttons arranged in four rows and four columns. The
internal circuit of the 4×4 Keypad with all the 16 buttons. When a key is pressed, the corresponding
column will become LOW as the current flows from HIGH Column Pin to LOW Row Pin. The
Arduino can easily identify the Column of the Key just by scanning for LOW on Columns. The
trick part comes in identifying the Row of the Key. For this, the Arduino should make the Rows of
the keypad HIGH, one-by-one and check for the Column Pins to become HIGH. This procedure is

24
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
continued till the earlier detected Column becomes HIGH. This way, the Arduino can determine
both the Column and the Row of the Key and hence the Key pressed is identified.
Operating components and materials required with specifications:
• Arduino UNO Development Board,
• USB Cable, Breadboard,
• Connecting Wires,
• Push Button (Micro Switch)
• DC Motor etc.

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 given i.e., for each of the Aim
A), &B)

Result: Put screenshot of serial monitor for the Tasks given i.e., Aim A) and B)

▪ Conclusion: Various Instruments where a smaller number of keys are required.


▪ Data entry for microcontroller
▪ Menu or data selection
▪ Password lock

25
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Experiment No. 11

Title: Servo Motor Interfacing with Arduino


Pre-requisite: Difference between servo and DC motor, PWM, Current requirements of a
Servo
Tasks:
A) Write a program to control the Servo Motor Rotation by one Degree using Arduino Uno
B) Write a program to control Servo Motor Rotation Control using potentiometer
C) Write a program to rotate servo through given degrees . Accept Command from cell phone
via blue tooth.

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.

The Servo.h is a great library for controlling servo motors.


Knob Circuit
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

• This creates an object named my servo of the class Servo.

2. myservo.attach(pin)

• This function attaches the servo variable to a pin.


• Pin is the pin number to which the servo is attached.

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.

4. map (value, fromLow, fromHigh, toLow, toHigh)

26
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
• 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.

Operating components and materials required with specifications:


• Arduino UNO Development Board,
• USB Cable, Breadboard,
• 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 given i.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

27
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
B) Program to control servo motor with potentiometer.
STEP 1- Start
STEP 2- include servo.h library
STEP 3- create a new object myservo from the class Servo
STEP 4- define a variable val and port pin and initialize it to the analogue pin of the Arduino A0
STEP 5- in void setup, declare myservo.attach(9)
STEP 6- in void loop, initialize the variable val to the value from the analogue input of the
potentiometer
STEP 7- map the value of angle and rotate the motor
STEP 8- Stop

Result: Put screenshot of serial monitor for each Tasks given i.e., for each of the Aim A), &B).

Conclusion: Explain working principle of the stepper motor.


Servo motors are used in DVD and Blu ray disc players. Automobiles also use servo motors. In
modern cars it is used to control its speed. Printers also user servo.

28
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
Experiment No. 12

Title: DC Motor Interfacing with Arduino


Pre-requisite: PWM , Current requirements of DC Motor , Calculation of required voltage
and Current of a DC motor.
Tasks
A) Write a program to control DC motor clockwise & anti clockwise rotation control using a push
button.
B) Write a program to control Speed of DC Motor Rotation using a potentiometer
C) Write A Program To rotate Motor at 3 different Speeds using command from Switch /
Blue tooth

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.

29
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics

1. digitalPinToInterrupt(pin)

• This function is used to declare the digital pin as an interrupt pin.


• Example, digitalPinToInterrupt(2) is used to declare digital pin 2 as an interrupt pin.
• On UNO board, only pins 2 and 3 can be configured as interrupt pins. Hence, argument to
this function can only be pin 2 or pin 3.

2. attachInterrupt(digitalPinToInterrupt(pin), ISR, mode)

• 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
digitalPinToInterrupt(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.
• Example, attachInterrupt(digitalPinToInterrupt(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.

3. analog Write(pin, value)

• 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.

Operating components and materials required with specifications:


• Arduino UNO Development Board,
• USB Cable, Breadboard,
• Connecting Wires,
• 10 K Potentiometer
• DC Motor 12V 200 rpm

30
Vishwakarma Institute of Technology
Department of Engineering, Sciences and Humanities
FY: 2021-2022:Semester II
ES1024: Mechatronics and Robotics
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 given i.e., for each of the Aim
A), & B).

Result: Put screenshot of serial monitor for each Tasks given i.e., for each of the Aim A), & B).

Conclusion: Explain working principle of the stepper motor.

31

You might also like