SlideShare a Scribd company logo
Subject : ___________________________________________________________
Department : ____________________________________________________
Class : ________________________ Semester : ___________________
AY – 2016-17
Pune Vidyarthi Griha’s
LAB MANUAL
Faculty : ___________________________________________________________
( PROGRAMMING LABORATORY - III )
College of Engineering, Nasik.
A Laboratory Manual for
Programming Laboratory - III
(310254) Semester – VI
(Computer Engineering)
Bachelor Degree in Engineering
UNIVERSITY OF PUNE
Pune Vidyarthi Griha’s
COLLEGE OF ENGINEERING, NASIK
DEPARTMENT OF COMPUTER ENGINEERING
1
Develop an application using Beeglebone Black/ ARM Cortex
A5 development board to simulate the operations of LIFT
2
Develop an application using Beeglebone Black/ ARM Cortex
A5 development board to simulate the working of signal lights.
3
Implement an calculator (64 bit Binary Multiplication)
application using concurrent lisp
4
Apply the Following Software Engineering to all
assignments(No 1,2,3 of Group A and B). Mathematical
Modeling must result into UML Requirements. Apply
Assignment No 4a to 4d for all Group A and Group B
assignments of Embedded Operating system and Concurrent
and Distributed Programming. Use tools Open source tools like
ArgoUML, UMLLet, StarUML or equivalent tools for UML
models) Or Use Agile or Scrum-Agile ethodologies and
Tools.Use of Possitive and Negative Testing.
5
Design mathematical model of the application/system using set
theory, algebraic system, relations and functions, Deterministic
and Non-Deterministic entities
6
Analyze requirements from the Problem statement,
mathematical model, Domain requirements and identify
Functional, Non functional, Actors, Usecases for the
application/system. Create usecase diagram, activity
diagram/swimlane diagram for each usecase.
7
Design the architecture for the system/application using
package diagram , deployment diagram. Design classes using
class diagram
8
Design the behavior of the system/application using state
machine diagram and sequence diagram.
9
Create Project plan, SRS, Design document and Test Plan for
one group-C assignment from embedded operating system or
Concurrent and Distributed Programming
10
Write an application to parse input text file concurrently and
compare the result of concurrent parsing with serial parsing (
Use concurrent YACC parser)
11
Write an application to and demonstrate the change in BeagleBoard/
ARM Cortex A5 /Microprocessor /CPU frequency or square wave of
programmable frequency.
12
Vedic Mathematics method to find square of 2-digit number is used in
a distributed programming. Use shared memory and distributed (multi-
CPU) programming to complete the task.
13
Implement a Parallel ODD-Even Sort algorithm using GPU or ARM
equivalent.
GROUP - A
GROUP - B
Sr.
No
Name of Experiment/
Assignment
Page
No.
Date Of
Perfomance
Date of
Completion
Signature
INDEX
14
Implement nxn matrix parallel multiplication using CUDA/OpenCL
GPU, use shared memory.
15
Develop a network based application by setting IP address on
BeagleBoard/ ARM Cortex A5
16
Implement a Multi-threading application for echo server using socket
programming in JAVA
17 Implement Reader-Writer problem using OPENMP
18 Develop Robotics(stepper motor) Application using Beagle Board.
GROUP - C
Subject Teacher H.O.D.
Third Year Engineering Programming Laboratory - III
1 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Assignment: 1
Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign
Title of Assignment: Simulation of LIFT operations
Problem Definition: Develop an application using Beaglebone Black/ ARM Cortex
A5 development board to simulate the operations of LIFT.
1.1 Perquisite: Beaglebone Black, minicom
1.2 Learning Objective: To simulate the operations of LIFT on BBB.
1.3 Relevant Theory / Literature Survey:
1.3 Introduction
The element14 BeagleBone Black is identical in technical design and functionality
as the specified BeagleBoard.org product (BeagleBone Black) and runs on the version of
the software provided by BeagleBoard.org to element14. General support for this board is
available from the BeagleBoard.org community.
1.4 Setup:
1. Connect beaglebone black to PC with +5v supply and USB cable.
2. Open terminal in ubuntu.
3. Type sudo su ---
enter Type
password--enter
4. Then type minicom –s---enter
5. Goto serial port setup-
• Press A
• Change /dev/ttyxx to /dev/ttyACM0—enter
• Press G
• Press Enter
6. Save setup as dfl – enter
7. Goto EXIT – enter
8. Now system will boot and then type username and password
and you booted into beaglebone black.
9. Type su –enter.
Third Year Engineering Programming Laboratory - III
2 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
1.5 CONNECTOR DETAILS:
Connector PIN PIN Description PIN connects to board Function
Number
Number
P9 1,2 GND GND(25pin) GND
P9 3,4 VCC(3.6V) VCC(26pin) VCC
P8 7 GPIO2[2] FRC-6pin In
P8 8 GPIO2[3] FRC-5pin In
P8 9 GPIO2[5] FRC-4pin In
P8 10 GPIO2[4] FRC-3pin In
P8 11 GPIO1[13] FRC-13pin Out
P8 12 GPIO1[12] FRC-14pin Out
P8 13 GPIO0[23] FRC-11pin Out
P8 14 GPIO0[26] FRC-12pin Out
P8 15 GPIO1[15] FRC-9pin Out
P8 16 GPIO1[14] FRC-10pin Out
P8 17 GPIO0[27] FRC-7pin Out
P8 18 GPIO2[1] FRC-8pin Out
P8 19 GPIO0[22] FRC-23pin Out
P8 21 GPIO1[30] FRC-24pin Out
P9 11 GPIO0[30] FRC-21pin Out
P9 12 GPIO1[28] FRC-22pin Out
P9 13 GPIO0[31] FRC-19pin Out
P9 14 GPIO1[18] FRC-20pin Out
P9 15 GPIO1[16] FRC-17pin Out
P9 16 GPIO1[19] FRC-18pin Out
Third Year Engineering Programming Laboratory - III
3 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
TABLE 1
1.6 How to get GPIO pin number:
•Once you have decided the pin number which you would like to use as a GPIO, you need to
find out its corresponding reference number.
•For example, if you would like to use pin 12 on P8 expansion header, Then find out its default
function. Note down the entire signal name. In this case, pin 12 is GPIO1_12.So any GPIO
you come across would be referenced as GPIOX_Y. Identify X,Y.
• Use the formula below to find the corresponding reference number:
Reference number =( (X*32 )+ Y )
Hence, pin 12 would be referenced as gpio 44 in the kernel.
1.7 To use GPIO pin as GPIO in programs follow the steps :
• To make GPIO pin xx as output type command in terminal(xx—pin
number)
echo xx > /sys/class/gpio/export -- press enter
echo out > /sys/class/gpio/gpioxx/direction --press enter
for example:
echo 44 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio44/direction
• To make GPIO pin xx as input type command in terminal(xx—pin
number)
echo xx > /sys/class/gpio/export -- press enter
echo in > /sys/class/gpio/gpioxx/direction --press enter
for example:
echo 44 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio44/direction
• After making GIPO pin as output, To change the initial value of
output pin type command in
terminal(x—1/0,xx—pin number)
echo x > /sys/class/gpio/gpioxx/value –press enter
for example:
echo 0 > /sys/class/gpio/gpio44/value
OR
echo 1 > /sys/class/gpio/gpio44/value
1.8 PROCEDURE:
1. Make a connection as shown in above Table1.
2. Make pin as input or output as told in function block of Table1.
Export pins :
echo 45 > /sys/class/gpio/export
P9 23 GPIO1[17] FRC-16pin Out
P9 24 GPIO0[15] FRC-15pin Out
Third Year Engineering Programming Laboratory - III
4 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
3. Make New folder with name Lift elevator and go to that folder using
command
mkdir lift_elevator—press enter
cd lift_elevator—press enter
4. Create and open a file with command
vim lift_elevator.cpp
5. Write a program and save it.
6. Now compile and run the program using command
g++ lift_elevator.cpp -o lift_elevator –press enter
./lift_elevator –press enter
1.9 Oral Questions:
1) What are the steps to enter BBB?
2) What is difference between OS and EOS?
Third Year Engineering Programming Laboratory - III
5 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Assignment: Group A2
Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign
Title of Assignment: Simulation of signal lights operations
Problem Definition: Develop an application using Beeglebone Black/ ARM Cortex A5
development board to simulate the working of signal lights.
2.1 Perquisite: Beaglebone Black, minicom
2.2 Learning Objective: To simulate the operations of signal lights operations on BBB.
2.3 Relevant Theory / Literature Survey:
2.3.1 Introduction:
The element14 BeagleBone Black is identical in technical design and functionality as
the specified BeagleBoard.org product (BeagleBone Black) and runs on the version of the
software provided by BeagleBoard.org to element14. General support for this board is available
from the BeagleBoard.org community.
2.3.2 Setup:
2. Connect beaglebone black to PC with +5v supply and USB cable.
3. Open terminal in ubuntu.
3. Type sudo su ---enterType password.
4. Then type minicom –s---enter
5. Goto serial port setup-
• Press A
• Change /dev/ttyUSBxx to /dev/ttyACM0—enter
• Press G
• Press Enter
6. Save setup as dfl – enter
7. Goto EXIT – enter
8. Now system will boot and then type username and password
and you booted into beaglebone black.
9. Type su –enter.
Third Year Engineering Programming Laboratory - III
6 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
2.4 CONNECTOR DETAILS:
TABLE 1
Connector PIN PIN Description PIN connects to accessory Function
Number
Number
board
P9 1,2 GND GND(25pin) GND
P9 5 VCC(5V) VCC(26pin) VCC
P9 11 GPIO0[30] FRC21pin Out
P9 12 GPIO1[28] FRC-22pin Out
P9 13 GPIO0[31] FRC-19pin Out
P9 14 GPIO1[18] FRC-20pin Out
P9 15 GPIO1[16] FRC-17pin Out
P9 16 GPIO1[19] FRC-18pin Out
P9 24 GPIO0[15] FRC-15pin Out
P9 23 GPIO1[17] FRC-16pin Out
P8 11 GPIO1[13] FRC-13pin Out
P8 12 GPIO1[12] FRC-14pin Out
P8 13 GPIO0[23] FRC-11pin Out
P8 14 GPIO0[26] FRC-12pin Out
P8 15 GPIO1[15] FRC-9pin Out
P8 16 GPIO1[14] FRC-10pin Out
P8 17 GPIO0[27] FRC-7pin Out
P8 18 GPIO2[1] FRC-8pin Out
Third Year Engineering Programming Laboratory -
III
7 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
2.5 How to get GPIO pin number:
• Once you have decided the pin number which you would like to use as a GPIO,
you need to find out its corresponding reference number.
• For example, if you would like to use pin 12 on P8 expansion header, Then find
out its default function. Note down the entire signal name. In this case, pin 12 is
GPIO1_12.So any GPIO you come across would be referenced as GPIOX_Y.
Identify X,Y.
• Use the formula below to find the corresponding reference number:
Reference number =( (X*32 )+ Y )
Hence, pin 12 would be referenced as gpio 44 in the kernel.
2.6 To use GPIO pin as GPIO in programs follow the steps:
• To make GPIO pin xx as output type command in terminal(xx—pin number)
echo xx > /sys/class/gpio/export -- press enter
echo out > /sys/class/gpio/gpioxx/direction --press enter for example:
echo 44 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio44/direction
• To make GPIO pin xx as input type command in terminal(xx—pin number)
echo xx > /sys/class/gpio/export -- press enter
echo in > /sys/class/gpio/gpioxx/direction --press enter for example:
echo 44 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio44/direction
• After making GIPO pin as output, To change the initial value of output pin type
command in terminal(x—1/0,xx—pin number)
echo x > /sys/class/gpio/gpioxx/value –press enter
for example:
echo 0 > /sys/class/gpio/gpio44/value
OR
Third Year Engineering Programming Laboratory -
III
8 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
echo 1 > /sys/class/gpio/gpio44/value
2.7 PROCEDURE:
1. Make a connection as shown in above Table1.
2. Make pin as input or output as told in function block of Table1.
Export gpio pins:
echo 45 > /sys/class/gpio/export
Set direction for pins:
echo out > /sys/class/gpio/gpio45/direction
3. Make pin as input or output as told in function block of Table1.
4. Make New folder with name Lift elevator and go to that folder using
command
mkdir traffic_light—press enter
cd lift_traffic_light—press enter
5. create and open a file with command
vim traffic_light.c
6. write a program and save it.
Now compile and run the program using command
gcc traffic_light.c -o traffic_light –press enter
./traffic_light –press enter
OR
g++ stepper.cpp –o stepper –press enter
./stepper -- enter
2.8 Oral Questions:
1 How to activate any pin as Input or output? Using command and through program?
2 What is GPIO?
3 How many pins are there of GPIO ?
4 What is minicom?
Third Year Engineering Programming Laboratory - III
9 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Assignment: 4b
Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign
Title of Assignment: Use Case Diagram
Problem Definition: Analyze requirements from the Problem statement, mathematical
model, Domain requirements and identify Functional, Non functional, Actors, Usecases for
the application/system. Create usecase diagram, activity diagram/swimlane diagram for each
usecase.
4.1 Perquisite: Understanding of software development lifecycle
4.2 Learning Objective: To understand what happens in the system
4.3 Relevant Theory / Literature
Survey:
1. Activity diagrams are used to model the dynamic aspects of a system. An activity
diagram is essentially a flow chart showing flow of central from activity to activity.
2. Activity diagrams may stand alone to visualize, specify construct and document the
dynamics of a society of objects or they may be used to model the flow of control of an
operation.
3. Activity diagrams are not only imp for modally the dynamic aspects of the systems
but also but constructing executable systems through forward and reverse engineering.
4. An Activity diagram shows flow from activity to activity. An activity is a non-atomic
execution within a state machine.
5. An Activity diagram is basically a projection of elements found in an activity in which
all or most transitions are triggered by completion of activities in the source state.
4.4 Contents of an activity
Third Year Engineering Programming Laboratory - III
10 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
diagram:
Activity diagram commonly
contains
1. Activity, states and actions states.
2. Transitions
3. Objects
Notions used for activity diagrams
4.4.1. Action starter
1. Evaluation of expressions, settings values and attributes, or returns some values, a call
operation on an object, sending a signal to an object or even creates or destroy and object
these executions are called action states
2. Action states are represented using a oblong shape inside which expression is
written.
3. Action states can be decomposed.
4. The work of an action state is assumed to take a significant execution time. For ex
4.4.2. Activity states
1. Simple branching, sequential transitions are Activity states can be further decomposed,
their activity being represented by other activity diagrams.
2. They are not atomic. Hence they may be interrupted and are considered to take some
finite time to complete.
3. Action state is a special state of activity state.
4. An activity state is composite and its flow of control is made up of other activity states
and action states.
5. Activity states have additional parts like entry and exit actions and some machine
specifications.
4.4.3. Transitions
1. When the action or activity of state completes, flow of control passes immediately to next
action or activity state.
Third Year Engineering Programming Laboratory - III
11 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
2. This flow is specified by using transitions to show path from one action or activity state
to the next action or activity state.
3. The transition is a simple directed line.
4. The flow of control has to start and end of some place.
5. The start state is specified by a solid ball the end state is specified by a solid ball in a
circle
6. Trigger less transitions are those where control passes immediately once work of source
is done.
7. Once the work of a state is done, its exit action is executed. Immediately control is
transferred without delay to the next state.
8. Then the entry action is executed and the process continues. Once the work of that state
is done this process continues indefinitely.
3.4.4. Branching
1. Simple sequential transitions are common. But they are not only kind of path we need to
module.
2. As in a flow chart a branch maybe included to show any alternate flow if required.
3. These alt paths are taken on evaluation on Boolean expressions.
4. A branch may have one incoming transition and two or more outgoing ones. On each
outgoing one, a Boolean expression is placed, which is evaluated only on entering the branch.
5. The effect of iteration can be achieved by using one action state that sets value of an
iterator and a branch that evaluates if the iterate is finished.
3.4.5 Forking and Joining most common paths found in activity diagrams but while
modeling work flows of business processors that are concurrent, may be encountered.
1. Synchronization bars are used to specify the forking the joining of parallel flows of
control.
2. A synch bar is thick horizontal line.
3. Joins and forks should balance, meaning that the number of flows that lead a fork
Third Year Engineering Programming Laboratory - III
12 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
should match the number of flows that enter its corresponding joins.
4.4.6 Swim lanes
1. Swim lanes are of great use while modeling work flows or business processes to partition
activity states on an activity diagram into groups, each group representing business
organizations responsible for those activities.
2. Each swim lane has a unique name. it may represent some real world entity.
3. There is a loose connection between swim lanes and concurrent flows of control.
4. Activities of swim lanes are considered separate from activities of the neighboring
swim lanes.
5. These swim lanes are independent and concurrent.
Fig 3.1 to meet the client
Third Year Engineering Programming Laboratory - III
13 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
4.4.7 Object flow
1. Objects may be involved in flow of control associated with an activity diagram.
2. Instances of classes are created by certain activities which may be modified by other
activities
4.3.5 Applications of activity diagrams
Activity diagrams are used to typically two ways:
1. To model a work flow: Work flow often lie on fringe of software intensive systems and
are used to visualize, specify, construct and document business processor that involve the
system of that is being developed.
2. To model an operation: we use flow chart like activity diagrams to model details of a
computation. Here modeling of branch, fork and join states are particularly important.
4.6 Forward and reverse engineering
Forward engineering
(The creation of code from a model)
This is possible for activity diagrams especially if context of diagram is an operation.
Reverse engineering
(Creation of model from code)
This is possible for activity diagrams esp. if context of code is the body of an expression. In
particular previous diagram could have been generated from the implementation of the class
line.
4.7 Oral Questions
1 What is activity diagram?
2 What are the elements of activity diagram?
3 What is fork (split) and join (merge)?
4 What is use of swim lanes?
5 What is difference between activity diagram and use case diagram?
Third Year Engineering Programming Laboratory - III
14 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Assignment: 4c
Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign
Title of Assignment: Class Diagram
Problem Definition: Design the architecture for the system /application using package
diagram , deployment diagram. Design classes using class diagram.
4.1 Perquisite: Understanding of software development lifecycle
4.2 Learning Objective: To understand how classes are related to each other with
their basic as well as advanced notation
4.3 Relevant Theory / Literature Survey:
To identify and describe key concepts like classes, types in the system and their
relationships and advanced relationships, other classifier like interfaces.
A class diagram shows a set of classes, interfaces, and collaboration and their
relationships. Class diagram commonly contains the following things:
1 Classes
2 Interfaces
3 Collaboration
4 Dependency, generalization, and association relationship
Fig 4.1 Class of Washing Machine
Third Year Engineering Programming Laboratory - III
15 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
4.4 Relationships:
4.4.1 Association: An association is structural relationship, specifying that objects of one
thing are to objects of another. Given an association connecting two classes, you can navigate
from an object of the other class, and vice versa. There are four basic adornments that apply
to an association: a name, the role at each end of the association, the multiplicity at each end
of the association, and aggregation.
Notation: Graphically, an association is rendered as a solid line connecting the
same or different classes.
Example: Consider two classes Recruitment Manager and Student. Recruitment Manager
Recruits Student is 1 to 0….* kind of relationship which is shown in following figure
Association Name
Recruits
Recruiment Manager Student
1 0..*
Multi plici ty
Fig 4.2 Multiplicity
4.4.2 Aggregation: A plain association, between two classes represents a structural
relationship between peers, meaning that both classes are conceptually at the same level, no
one more important that the other. Sometimes, we want to model a ―whole/part‖ relationship,
in which one class represents a larger thing (the ―whole‖), which consists of smaller things
(the ―parts‖). This kind of relationship is called aggregation, which represents a ―has a!‖
relationship.
Notation: It is specified by adorning a plain association with an open diamond at the whole
end. Example: Consider the two classes Company and department. In these two classes
Company acts as a whole part. The association between them is shown as follows:
Third Year Engineering Programming Laboratory - III
16 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Company
Whole
1
Aggregation
Part
1..*
Department
Fig 4.3 Aggregation
4.4.3 Composition: Composition is a form of aggregation, with strong relationship and
coincident lifetime as part of the whole. Parts with non-fixed multiplicity may be created after
the composite itself, but once created they live and die with it. This means that, in a
composite aggregation, an object may be a part of only one composi te at a time.
Notation: It is specified by adorning a plain association with a filled diamond at the whole
end.
Example: In windowing system, a Frame belongs to exactly one Window. When you create a
Frame in a system, you must attach it to an enclosing Window. Similarly, when you destroy
the window, the Window object must in turn destroy its Frame parts. It is shown in following
figure.
4.4.4 Generalization: It is the relationship between a general thing (called super class or
parent) and a more specific kind of that thing (called sub class or child). Generalization is
called an ―is-a –kind-of‖ relationship.
Notation: Generalization among classes is rendered as a solid directed line with a large open
arrowhead
Example: Consider a parent class Shape and child classes Rectangle, Circle, The
generalization between them is as shown in figure.
Third Year Engineering Programming Laboratory - III
17 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Base class
Shape
Generalization
Ci rcle Rectangle
Leaf Classes
Fig 4.4 Generalization
4.5 Dependency: A dependency is a using relationship that states that a change in
specification of one thing may affect another thing that uses it, but not necessarily reverse.
Notation: Graphically, a dependency is rendered as a dashed line, directed to the thing being
depended on.
Example: Consider Film Clip class which completely depends on Channel. It can be shown as
follows:
Dependency
Film Clip
nam e
Channel
playon()
s tart()
s top()
res et()
Fig 4.5 Dependency
4.6. Interface
Interfaces define a line between the specification of what an abstraction does and the
implementation of how that abstraction does it. An interface is a collection of operations that
are used to specify a service of a class or a component. These are used to visualize, specify,
construct, and document the seams within your system. A well structured interface provides a
clear separation between the outside view and the inside view of an abstraction, making it
possible to understand and appro ach an
Third Year Engineering Programming Laboratory - III
18 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
abstraction without having to dive into the details of its implementation.
Every interface must have a name that distinguishes it from other interface. An interface is
drawn showing only its name, as in figure.
An interface is a named collection of operations used to specify a service of a class or of a
component. Like a class, an interface may have any number of operations. These operations
may be adorned with visibility properties, concurrency properties, stereotypes, tagged values,
and constraints.
Stereotype
<<Interfac e>> URL
StreamHandler
OpenConnect ion() Operat ions
ParseURL()
Set URL()
ToExternal Form ()
Fig 4.6 Interface
4.7. Operation Constraint: The name of the operation plus its parameters (including
return type, if any) is called the operation’s signature.
In its full form, the syntax of an operation in the UML is
[visibility] name [(parameter-list)]
[: return-type] [{property-string}]
For example, the following are all legal operation declaration:
1 Display Name only
2 +Display Visibility and name
3 Set (n: Name, s: String) Name and parameters
4 getId() : Integer Name and return type
5 restart() {guarded} Name and property
Third Year Engineering Programming Laboratory - III
19 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
In an operation signature, you may provide zero or more parameters, each of which
follows the syntax
[Direction] name: type [= default-value]
Direction may be of the following values:
In an input parameter; may not be modified
Out an output parameter; may be modified to communicate information to the caller In
out an input parameter; may be modified.
4.8 Different Stereotypes:
A plain, unadorned dependency relationship is sufficient for most of the using
relationships. However, if you want to specify a shade of meaning, the UML defines a
number of stereotypes that may be applied to dependency relationships. There are 17 such
stereotypes, all of which can be organized in 6 groups.
1. First, there are eight stereotypes that apply to dependency relationships among classes
and object in class diagrams.
Table: 4.1
Bind Specifies that the source instantiates the target template using the given
actual parameters.
Derive Specifies that the source may be computed from the target
Friend Specifies that source is given special visibility into the target
Instance Of Specifies that the source object is an instance of the target classifier
Instantiate Specifies that source creates instances of the target
Power type Specifies that the target is a power type of the source; a power type is a
classifier whose objects are all the children of given parent.
Refine Specifies that the source is at a finer degree of abstraction that the target
Use
Specifies that the semantics of the source element depends on the semantics of
the public part of the target
Third Year Engineering Programming Laboratory - III
20 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
.
2. Continuing, there are two stereotypes that apply to dependency relationships among
packages.
Table: 4.2
Access Specifies that the source package is granted the right to reference the
element of the target package.
Import A kind of access that specifies that the public contents of the target
packages enter the flat namespace of the source, as if they had been
declared in the source.
3. Two stereotypes apply to dependency relationship among use cases:
Table: 4.3
Extend Specifies that the target use case extends behavior of the source
Include Specifies that the source use case explicitly incorporates the behavior of
another use case at a location specified by source.
3.1 You will encounter three stereotypes when modeling interactions among objects:
Table: 4.4
Become Specifies that the target is the same object as the source but at a later
point in time and with possibly different values, state, or roles
Call Specifies that the source operation invokes the target operation.
Copy Specifies that the target object is an exact, but independent, copy of the
source.
3.2 One stereotype will encounter in the context of state machine.
Table: 4.5
Third Year Engineering Programming Laboratory - III
21 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Send Specifies that the source operation sends the target event.
3.3 And the final stereotype will encounter in the context of organizing the elements of
your system into subsystem and model is
Table: 4.6
Trace
4.8. Oral Questions
1 What is use of class diagram?
2 Explain the structure of class and its graphical notation? 3 What
are different types of relationship in UML diagrams?
4 Explain with graphical notation and Example a) Association b) Generalization c)
Aggregation d) Dependency e) Composition
Specifies that the target is a
historical ancestor of the
source
Third Year Engineering Programming Laboratory - III
22 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Assignment: 4d
Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign
Title of Assignment: Sequence Diagram
Problem Definition: Design the behavior of the system /application using state machine
diagram and sequence diagram.
4.1 Perquisite: Understanding of software development lifecycle
4.2 Learning Objective: using sequence diagrams to understand their message
exchanges.
4.3 Relevant Theory / Literature Survey:
Interaction diagram shows an interaction, consisting of a set of object and their
relationships, including the messages that may be dispatched among them.
Interaction diagrams commonly contain
1 Objects
2 Links
3 Messages
A sequence diagram is an interaction diagram that emphasizes the time ordering of
messages. Graphically, a sequence diagram is a table that shows objects arranged on X-Axis
and messages, ordered in increasing time, along Y-axis.
4.4 Message type:
4.4.1 Synchronous and asynchronous: The first message of a sequence diagram
always starts at the top and is typically located on the left side of the diagram for readability.
To show an object sending message to another object, you draw a line to the receiving object
with a solid arrowhead (if a synchronous call operation) or with a stick arrowhead (if an
asynchronously).The message/method is placed above the arrowed line.
In the example as shown below, the analyst object makes a call to the system object
Third Year Engineering Programming Laboratory - III
23 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
which is an instance of the Reporting System Class. The analyst object is calling the system
object’s get Available Report method. The system object then calls the gets security
Clearance method with the argument of UserID on the sec System object, which is of the
class type Security System.
Analyst:Financial System:Reporting SecSystem:
Analyst System Security System
1: getAvailableReports() 2: getSecurityClearance(UserID)
3: UserClearance
5: available reports
4: Determice available report s
Fig 4.1 Messaging System
4.4.2 Signal: A signal represents a named object that is dispatched (thrown) asynchronously
by one object and then received by another. Exceptions are supported by most contemporary
programming languages and are the most common kind of internal signal that you will need
to model.
Signals have a lot in common with plain classes. For example, signals may have instances,
although you don’t generally need to model them explicitly. Signals may also be involved in
generalization relationships, permitting you to model hierarchies of events. Some of which
are general and some are specific. As also for classes, signals may have attributes and
operations. A signal may send as the action of a state transition or the sending of a message in
an interaction. The execution of operation can also send signals.
4.4.3 Notation: The relationship between operations and the events that it can send by using
a dependency relationship, stereotyped as send.
Fig 4.2 Signal Signal
Third Year Engineering Programming Laboratory - III
24 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
signal
<<signal>> Movement Agent
Collision positionVelocit y
force : t ype = float <<send>> moveto()
4.4.4 Message reply: Return message are optional. It is drawn as dotted line with open
arrowhead back to the originating lifeline and above this line you place the return value from
the operation.
In above figure of reporting system, system object returns available Reports when they get
Available Reports method is called. Return messages are useful if finer detail is required;
otherwise invocation message is sufficient.
4.4.5 Frame:
The frame element is the graphical boundary of a diagrams used as a basic for many
diagrams. A frame element provides a consistent place a frame element is as the graphical
boundary for the diagrams. The diagram’s label is placed in the top left corner which is called
as call the frame’s ―name box,‖ a sort of dog-eared rectangle, And the actual UML diagram
within the body of the larger enclosing rectangle.
In addition to providing a visual border, the frame element also has an important functional
use in diagrams depicting interactions, such as sequence diagram. On sequence diagrams
incoming and outgoing messages for a sequence can be modeled by connecting the message
to the border of the frame element.
4.4.6 Constraints:
Timing: Modeling the absolute time of an event, modeling the relative time between events,
and modeling the time it takes to carry out an action are the three primary time-critical
properties of real time systems for which you’ll use timing constraints.
To model timing constraints,
For each event in an interaction, consider whether it must start at some absolute time. Model
that real time property as a timing constraint on the message.
For each interesting sequence of message in an interaction, consider whether there is
an associated maximum relative time for that sequence. Model that real time property as a
timing constraint on the sequence.
For each time critical operation in each class, consider its time complexity. Model
those semantics as timing constraints on the operation.
Third Year Engineering Programming Laboratory - III
25 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
a : s t a rt T im e e v e r y a m s
S : S y s t e m A g e n t p : S e r v e r P a g e c : C a m e r a
1 : a : r e fr e s h () 2 : b : g e t Im a g e ()
3 : b . e x e c u t i o n T i m e < 1 0 0 n s
4 :
Fig 4.2.1 Constraints
The left-most constraint specifies the repeating start time the call event refresh. Similarly, the
center timing constraint specifies the maximum duration for calls to get Image. Finally, the
right-most constraint specifies the time complexity of the call event get Image.
4.5 Interaction Operator:
A combined flow is used to group sets of messages together to show conditional flow in
sequence diagram.
4.5.1. Alteration: Alteration fragment is used to model a sequence diagram in case if
alternative solution is present to draw the sequence diagram.
4.5.2. Option: The option combination fragment is used to model a sequence that, given a
certain condition, will occur; otherwise does not occur.
4.5.3. Parallel: If two activities are going simultaneously, then parallel fragment is
used.
4.5.4. Loop: When modeling a sequence diagram, there will be times that an object will need
to send message to it. To draw an object calling itself, you draw a message as you would
normally, but instead of connecting it to another object; you connect the message back to the
object itself.
4.6 Comparisons between sequence and communication:
Sequence diagram is more focused on time. It has two features that are not present in
communication and collaboration 1. Object lifeline: An object lifeline is the vertical line that
represents the existence of an object over a period of time.
Third Year Engineering Programming Laboratory - III
26 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
2. Focus of Control: It is a tall, thin rectangle that shows the period of time during which an
object is performing an action, either directly or through a subroutine procedure.
Communication diagram is more focused on showing the collaboration of objects rather that the
time sequence. Collaboration emphasizes the organization of the object that participates in an
interaction. It has two features 1. Path: To indicate how one objects if linked to another. 2:
Sequence number: To indicate the time order of a message.
Fig 6.2 GUI interact with object
4.6. Oral Questions
1 What is Use of Sequence diagram?
2 What are elements of activity diagram?
3 What are the types of messages in Interaction diagram? 4
What is activation of objects?
Third Year Engineering Programming Laboratory - III
27 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Assignment: A5
Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign
Title of Assignment: Software Requirement Specification (SRS)
Problem Definition: Create Project plan, SRS, Design document and Test Plan for one
group-C assignment from embedded operating system or Concurrent and Distributed
Programming
Problem Definition: Develop Robotics(stepper motor) Application using Beagle Board.
1.1 Perquisite: Beaglebone Black, minicom
1.2 Learning Objective: To simulate the operations of LIFT on BBB.
1.3 Relevant Theory / Literature Survey:
1.3 Introduction
The element14 BeagleBone Black is identical in technical design and functionality as the
specified BeagleBoard.org product (BeagleBone Black) and runs on the version of the software
provided by BeagleBoard.org to element14. General support for this board is available from the
BeagleBoard.org community.
1.4 CONNECTOR DETAILS:
Connector PIN PIN Description PIN connects to board Function
Number
Number
P9 1,2 GND GND(25pin) GND
P9 5 VCC(5V) VCC(26pin) VCC
P9 11 GPIO0[30] FRC-21pin Out
P9 12 GPIO1[28] FRC-22pin Out
P9 13 GPIO0[31] FRC-19pin Out
Third Year Engineering Programming Laboratory - III
28 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
P9 14 GPIO1[18] FRC-20pin Out
Table 1: Pins for stepper motor
1.5 How Stepper Motors Work
Stepper motors consist of a permanent magnetic rotating shaft, called the rotor, and
electromagnets on the stationary portion that surrounds the motor, called the stator. Figure 1
illustrates one complete rotation of a stepper motor. At position 1, we can see that the rotor is
beginning at the upper electromagnet, which is currently active (has voltage applied to it). To
move the rotor clockwise (CW), the upper electromagnet is deactivated and the right
electromagnet is activated, causing the rotor to move 90 degrees CW, aligning itself with the
active magnet. This process is repeated in the same manner at the south and west electromagnets
until we once again reach the starting position.
Figure 1
In the above example, we used a motor with a resolution of 90 degrees or demonstration
purposes. In reality, this would not be a very practical motor for most applications. The average
stepper motor's resolution -- the amount of degrees rotated per pulse -- is much higher than this.
For example, a motor with a resolution of 5 degrees would move its rotor 5 degrees per step,
thereby requiring 72 pulses (steps) to complete a full 360 degree rotation.
You may double the resolution of some motors by a process known as "half-stepping". Instead
of switching the next electromagnet in the rotation on one at a time, with half stepping you turn
on both electromagnets, causing an equal attraction between, thereby doubling the resolution. As
you can see in Figure 2, in the first position only the upper electromagnet is active, and the rotor
is drawn completely to it. In position 2, both the top and right electromagnets are active, causing
the rotor to position itself between the two active poles. Finally, in position 3, the top magnet is
Third Year Engineering Programming Laboratory - III
29 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
deactivated and the rotor is drawn all the way right. This process can then be repeated for the
entire rotation.
Figure 2
There are several types of stepper motors. 4-wire stepper motors contain only two
electromagnets, however the operation is more complicated than those with three or four
magnets, because the driving circuit must be able to reverse the current after each step. For our
purposes, we will be using a 6-wire motor.
The specific stepper motor we are using for our experiments (ST-02: 5VDC, 5 degrees per step)
has 6 wires coming out of the casing. If we follow Figure 3, the electrical equivalent of the
stepper motor, we can see that 3 wires go to each half of the coils, and that the coil windings are
connected in pairs. This is true for all four-phase stepper motors.
Figure 3
However, if you do not have an equivalent diagram for the motor you want to use, you can make
a resistance chart to decipher the mystery connections. There is a 13 ohm resistance between the
center-tap wire and each end lead, and 26 ohms between the two end leads. Wires originating
from separate coils are not connected, and therefore would not read on the ohm meter.
1.6 Advantages and disadvantages of stepper motors
Third Year Engineering Programming Laboratory - III
30 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
The reason for using a stepper motor is to achieve precise control: you can make it move
through a defined angle.
Stepper motors can sometimes be quite jerky, because they start and stop each step with a
sudden impulse, which isn't always what you want if you're trying to build a precision machine.
1.7 Oral Questions
1.11.1 What is Software Requirements Specification?
1.11.2 What are the Characteristics of a Good Software Requirements Specification
(SRS)
1.11.3 What does Module mean?
1.11.4 What is the difference between functional and nonfunctional requirements in software
engineering? Can you give examples of each?
Third Year Engineering Programming Laboratory - III
31 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Assignment: Group A 6
Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign
Title of Assignment: Lex and Yacc
Problem Definition: Write an application to parse input text file concurrently and compare
the result of concurrent parsing with serial parsing ( Use concurrent YACC parser)
6.1 Perquisite: lex and yacc, openmp
6.2 Learning Objective: To achieve concurrent parsing and compare result with serial .
6.3 Relevant Theory / Literature Survey:
6.3.1 Introduction
Compilation steps: following diagram shows the compilation steps.
Third Year Engineering Programming Laboratory - III
32 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
The patterns in the above diagram is a file you create with a text editor. Lex will read
your patterns and generate C code for a lexical analyzer or scanner. The lexical analyzer
matches strings in the input, based on your patterns, and converts the strings to tokens. Tokens
are numerical representations of strings, and simplify processing. When the lexical analyzer
finds identifiers in the input stream it enters them in a symbol table. The symbol table may also
contain other information such as data type (integer or real) and location of each variable in
memory. All subsequent references to identifiers refer to the appropriate symbol table index.
The grammar in the above diagram is a text file you create with a text edtior. Yacc will
read your grammar and generate C code for a syntax analyzer or parser. The syntax analyzer
uses grammar rules that allow it to analyze tokens from the lexical analyzer and create a syntax
tree. The syntax tree imposes a hierarchical structure the tokens. For example, operator
precedence and associatively are apparent in the syntax tree. The next step, code generation,
does a depth-first walk of the syntax tree to generate code. Some compilers produce machine
code, while others, as shown above, output assembly language.
6.4 Lex Theory
During the first phase the compiler reads the input and converts strings in the source to
tokens. With regular expressions we can specify patterns to lex so it can generate code that will
allow it to scan and match strings in the input. Each pattern specified in the input to lex has an
associated action. Typically an action returns a token that represents the matched string for
subsequent use by the parser. Initially we will simply print the matched string rather than return
a token value. The following represents a simple pattern, composed of a regular expression,
that scans for identifiers. Lex will read this pattern and produce C code for a lexical analyzer
that scans for identifiers.
letter(letter|digit)*
Table 1. Pattern matching
Third Year Engineering Programming Laboratory - III
33 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Table 2.Pattern matching examples
6.5 Yacc Theory
Grammars for yacc are described using a variant of Backus Naur Form (BNF). This technique,
pioneered by John Backus and Peter Naur, was used to describe ALGOL60. A BNF grammar
can be used to express context-free languages. Most constructs in modern programming for an
expression that multiplies and adds numbers is
E -> E + E E -> E * E E -> id
Three productions have been specified. Terms that appear on the left-hand side (lhs) of a
production, such as E (expression) are nonterminals. Terms such as id (identifier) are terminals
(tokens returned by lex) and only appear on the right-hand side (rhs) of a production. This
grammar specifies that an expression may be the sum of two expressions, the product of two
expressions, or an identifier. We can use this grammar to generate expressions:
E -> E * E (r2) -> E * z (r3) -> E + E * z (r1) -> E + y * z (r3) -> x + y * z (r3)
At each step we expanded a term and replace the lhs of a production with the corresponding
rhs. The numbers on the right indicate which rule applied. To parse an expression we need to do
the reverse operation. Instead of starting with a single nonterminal (start symbol) and generating
an expression from a grammar we need to reduce an expression to a single nonterminal. This is
known as bottom-up or shift-reduce parsing and uses a stack for storing terms.
6.6 Procedure Run Program for serial parsing:
1. $lex abc.l
2. $yacc –d abc.y
3. $gcc y.tab.c lex.yy.c
4. $./a.out file1.txt
Third Year Engineering Programming Laboratory - III
34 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Figure 2. Building a Compiler with Lex/Yacc
1.8 Procedure Run Program for concurrent parsing:
1. $lex abc.l
2. $yacc –d abc.y
3. $gcc y.tab.c lex.yy.c –ll
4. $gcc openmp.c –fopenmp –o p
5. ./p file1.txt file2.txt file3.txt
Figure 1:Package diagram
Third Year Engineering Programming Laboratory - III
35 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
figure 2:Activity diagram with fork
figure 3:Activity diagram
Third Year Engineering Programming Laboratory - III
36 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
1.11.4
figure 4:Sequence diagram
figure 5:Deployment diagram
Third Year Engineering Programming Laboratory - III
37 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
figure 6: Use Case diagram
1.9 Oral Questions:
1) What is lex?
2) What is yacc?
3) What is difference between serial and concurrent execution and how you have achieved
in your program?
Third Year Engineering Programming Laboratory - III
38 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Assignment: B1
Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign
Title of Assignment: PWM
Problem Definition: Write an application to and demonstrate the change in BeagleBoard/
ARM Cortex
A5 /Microprocessor /CPU frequency or square wave of programmable frequency.
1.1 Perquisite: Beaglebone Black, minicom
1.2 Learning Objective: To simulate the operations of LIFT on BBB.
1.3 Relevant Theory / Literature Survey:
1.3 Introduction
The element14 BeagleBone Black is identical in technical design and functionality as
the specified BeagleBoard.org product (BeagleBone Black) and runs on the version of the
software provided by BeagleBoard.org to element14. General support for this board is available
from the BeagleBoard.org community.
Pulse Width Modulation (or PWM) is a technique for controlling power. We also use it
here to control the brightness of each of the LEDs.
The diagram below shows the signal from one of the GPIO pins on the BBB.
Third Year Engineering Programming Laboratory - III
39 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Every 1/5000 of a second, the PWM output will produce a pulse from 3.3V down to 0V.
The length of this pulse is controlled by the 'set_duty_cycle' function.
If the output is high for 90% of the time then the load will get 90% of the power delivered to it.
We cannot see the LEDs turning on and off at that speed, so to us, it just looks like the
brightness is different.
1.4 Configuring Pin 13 on P8 Header for PWM
The BBB was specifically designed to be a dynamic piece of hardware, enabling third-party
developers to create their own custom configurations and extensions known as capes. The board
is so flexible, it can change its hardware configuration at runtime using an in-kernel mechanism
known as the Cape Manager in conjunction with Device Tree Overlays.The Device Tree
consists of a set of human readable text files known as DTS files that end in the ―.dts‖
extension. DTS files can be edited using a simple text editor to set the configuration for a
particular pin. These source files then get compiled into DTB files, a binary format ending in
the ―.dtbo‖ extension. This process creates what are known as device tree fragments or
overlays. The kernels Cape Manager can then dynamically load and unload the DTB files post-
boot as well as at runtime to set the hardware configuration.
1 root@beaglebone:/lib/firmware# ls *pwm*
2 am33xx_pwm-00A0.dtbo
3 am33xx_pwm-00A0.dts
4 bone_pwm_P8_13-00A0.dtbo
5 bone_pwm_P8_13-00A0.dts
6 ...
All we need to do is load them using the Cape Manager, but first, lets get acquainted with a
very useful command that will help us determine if our overlays were properly loaded:
Third Year Engineering Programming Laboratory - III
40 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Programming Laboratory III Third Year Engineering
1 root@beaglebone:~# more /sys/devices/bone_capemgr.8/slots
2 0: 54:PF---
3 1: 55:PF---
4 2: 56:PF---
5 3: 57:PF---
6 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
7 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
Out of the box, the BBB shows the above slots. Lets add two more slots to configure pin 13 on
header P8 for PWM by executing the following commands:
1 root@beaglebone:~# echo am33xx_pwm > /sys/devices/bone_capemgr.8/slots
2 root@beaglebone:~# echo bone_pwm_P8_13 > /sys/devices/bone_capemgr.8/slots
To confirm the overlays loaded properly we run the slots command again:
1 root@beaglebone:~# more /sys/devices/bone_capemgr.8/slots
2 0: 54:PF---
3 1: 55:PF---
4 2: 56:PF---
5 3: 57:PF---
6 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
7 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
8 7: ff:P-O-L Override Board Name,00A0,Override Manuf,am33xx_pwm
9 8: ff:P-O-L Override Board Name,00A0,Override Manuf,bone_pwm_P8_13
Our board is now configured for PWM on pin13 of the P8 header! Before we move on,
however, it’s worth noting these changes are not permanent. If you power off the board, the
PWM slots we just added will disappear. Thankfully, we don’t have to repeat the above steps
each time we power up the board. The Cape Manager supports a method to load the overlays at
boot time by adding the following argument to the ―uEnv.txt‖ file:
1 capemgr.enable_partno=am33xx_pwm,bone_pwm_P8_13
Make sure to append the argument in a single line like this:
1 root@beaglebone:~# more /media/BEAGLEBONE/uEnv.txt
2 optargs=quiet drm.debug=7 capemgr.enable_partno=am33xx_pwm,bone_pwm_P8_13
1.5 Oral Questions:
1) What are the PWM?
2) What is use of PWM and what are the pins numbers used in BBB?
3) What is duty cycle?
Third Year Engineering Programming Laboratory - III
41 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Assignment: Group C1
Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign
Title of Assignment: Stepper Motor
Problem Definition: Develop Robotics(stepper motor) Application using Beagle Board.
1.1 Perquisite: Beaglebone Black, minicom
1.2 Learning Objective: To simulate the operations of LIFT on BBB.
1.3 Relevant Theory / Literature Survey:
1.3 Introduction
The element14 BeagleBone Black is identical in technical design and functionality as
the specified BeagleBoard.org product (BeagleBone Black) and runs on the version of the
software provided by BeagleBoard.org to element14. General support for this board is available
from the BeagleBoard.org community.
1.4 CONNECTOR DETAILS:
Connector PIN PIN Description PIN connects to board Function
Number
Number
P9 1,2 GND GND(25pin) GND
P9 5 VCC(5V) VCC(26pin) VCC
P9 11 GPIO0[30] FRC-21pin Out
P9 12 GPIO1[28] FRC-22pin Out
P9 13 GPIO0[31] FRC-19pin Out
P9 14 GPIO1[18] FRC-20pin Out
Third Year Engineering Programming Laboratory - III
42 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
Table 1: Pins for stepper motor
1.5 How Stepper Motors Work
Stepper motors consist of a permanent magnetic rotating shaft, called the rotor, and
electromagnets on the stationary portion that surrounds the motor, called the stator. Figure 1
illustrates one complete rotation of a stepper motor. At position 1, we can see that the rotor is
beginning at the upper electromagnet, which is currently active (has voltage applied to it). To
move the rotor clockwise (CW), the upper electromagnet is deactivated and the right
electromagnet is activated, causing the rotor to move 90 degrees CW, aligning itself with the
active magnet. This process is repeated in the same manner at the south and west
electromagnets until we once again reach the starting position.
Figure 1
In the above example, we used a motor with a resolution of 90 degrees or demonstration
purposes. In reality, this would not be a very practical motor for most applications. The average
stepper motor's resolution -- the amount of degrees rotated per pulse -- is much higher than this.
For example, a motor with a resolution of 5 degrees would move its rotor 5 degrees per step,
thereby requiring 72 pulses (steps) to complete a full 360 degree rotation.
You may double the resolution of some motors by a process known as "half-stepping". Instead
of switching the next electromagnet in the rotation on one at a time, with half stepping you turn
on both electromagnets, causing an equal attraction between, thereby doubling the resolution.
As you can see in Figure 2, in the first position only the upper electromagnet is active, and the
rotor is drawn completely to it. In position 2, both the top and right electromagnets are active,
causing the rotor to position itself between the two active poles. Finally, in position 3, the top
Third Year Engineering Programming Laboratory - III
43 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
magnet is deactivated and the rotor is drawn all the way right. This process can then be repeated
for the entire rotation.
Figure 2
There are several types of stepper motors. 4-wire stepper motors contain only two
electromagnets, however the operation is more complicated than those with three or four
magnets, because the driving circuit must be able to reverse the current after each step. For our
purposes, we will be using a 6-wire motor.
The specific stepper motor we are using for our experiments (ST-02: 5VDC, 5 degrees per step)
has 6 wires coming out of the casing. If we follow Figure 3, the electrical equivalent of the
stepper motor, we can see that 3 wires go to each half of the coils, and that the coil windings are
connected in pairs. This is true for all four-phase stepper motors.
Figure 3
However, if you do not have an equivalent diagram for the motor you want to use, you can
make a resistance chart to decipher the mystery connections. There is a 13 ohm resistance
between the center-tap wire and each end lead, and 26 ohms between the two end leads. Wires
originating from separate coils are not connected, and therefore would not read on the ohm
meter.
Third Year Engineering Programming Laboratory - III
44 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK
1.6 Advantages and disadvantages of stepper motors
The reason for using a stepper motor is to achieve precise control: you can make it move
through a defined angle.
Stepper motors can sometimes be quite jerky, because they start and stop each step with
a sudden impulse, which isn't always what you want if you're trying to build a precision
machine.
1.7 Oral Questions:
1) How stepper motor works?
2) What are the application of stepper motor?

More Related Content

Similar to PL-3 LAB MANUAL

Lab Manual.pdf
Lab Manual.pdfLab Manual.pdf
Lab Manual.pdf
MiniMadavKhanal
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
ijceronline
 
ECET 330 Massive Success--snaptutorial.com
ECET 330 Massive Success--snaptutorial.comECET 330 Massive Success--snaptutorial.com
ECET 330 Massive Success--snaptutorial.com
santricksapiens71
 
Ecet 330 Success Begins / snaptutorial.com
Ecet 330 Success Begins / snaptutorial.comEcet 330 Success Begins / snaptutorial.com
Ecet 330 Success Begins / snaptutorial.com
WilliamsTaylorzm
 
Ecet 330 Enthusiastic Study / snaptutorial.com
Ecet 330 Enthusiastic Study / snaptutorial.comEcet 330 Enthusiastic Study / snaptutorial.com
Ecet 330 Enthusiastic Study / snaptutorial.com
Stephenson033
 
ECET 330 Technology levels--snaptutorial.com
ECET 330 Technology levels--snaptutorial.comECET 330 Technology levels--snaptutorial.com
ECET 330 Technology levels--snaptutorial.com
sholingarjosh102
 
ELC North America 2021 Introduction to pin muxing and gpio control under linux
ELC  North America 2021 Introduction to pin muxing and gpio control under linuxELC  North America 2021 Introduction to pin muxing and gpio control under linux
ELC North America 2021 Introduction to pin muxing and gpio control under linux
Neil Armstrong
 
Verilog lab mauual
Verilog lab mauualVerilog lab mauual
Verilog lab mauual
BHUSHAN MHASKE
 
Python-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptxPython-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptx
TuynLCh
 
19 exercises v1.00_en
19 exercises v1.00_en19 exercises v1.00_en
19 exercises v1.00_en
confidencial
 
Ins and Outs of GPIO Programming
Ins and Outs of GPIO ProgrammingIns and Outs of GPIO Programming
Ins and Outs of GPIO Programming
ICS
 
Dynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfDynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdf
AgneshShetty
 
System Development for Verification of General Purpose Input Output
System Development for Verification of General Purpose Input OutputSystem Development for Verification of General Purpose Input Output
System Development for Verification of General Purpose Input Output
RSIS International
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
Eueung Mulyana
 
xapp744-HIL-Zynq-7000
xapp744-HIL-Zynq-7000xapp744-HIL-Zynq-7000
xapp744-HIL-Zynq-7000Umang Parekh
 
Atomic pi Mini PC
Atomic pi Mini PCAtomic pi Mini PC
Atomic pi Mini PC
Dwika Sudrajat
 
Atomic PI apug
Atomic PI apugAtomic PI apug
Atomic PI apug
Dwika Sudrajat
 
18CSL48.pdf
18CSL48.pdf18CSL48.pdf
18CSL48.pdf
Narayan AB
 

Similar to PL-3 LAB MANUAL (20)

Lab Manual.pdf
Lab Manual.pdfLab Manual.pdf
Lab Manual.pdf
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
LMmanual.pdf
LMmanual.pdfLMmanual.pdf
LMmanual.pdf
 
ECET 330 Massive Success--snaptutorial.com
ECET 330 Massive Success--snaptutorial.comECET 330 Massive Success--snaptutorial.com
ECET 330 Massive Success--snaptutorial.com
 
Ecet 330 Success Begins / snaptutorial.com
Ecet 330 Success Begins / snaptutorial.comEcet 330 Success Begins / snaptutorial.com
Ecet 330 Success Begins / snaptutorial.com
 
Ecet 330 Enthusiastic Study / snaptutorial.com
Ecet 330 Enthusiastic Study / snaptutorial.comEcet 330 Enthusiastic Study / snaptutorial.com
Ecet 330 Enthusiastic Study / snaptutorial.com
 
ECET 330 Technology levels--snaptutorial.com
ECET 330 Technology levels--snaptutorial.comECET 330 Technology levels--snaptutorial.com
ECET 330 Technology levels--snaptutorial.com
 
ELC North America 2021 Introduction to pin muxing and gpio control under linux
ELC  North America 2021 Introduction to pin muxing and gpio control under linuxELC  North America 2021 Introduction to pin muxing and gpio control under linux
ELC North America 2021 Introduction to pin muxing and gpio control under linux
 
Verilog lab mauual
Verilog lab mauualVerilog lab mauual
Verilog lab mauual
 
Python-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptxPython-in-Embedded-systems.pptx
Python-in-Embedded-systems.pptx
 
Sci py india_conference_2019
Sci py india_conference_2019Sci py india_conference_2019
Sci py india_conference_2019
 
19 exercises v1.00_en
19 exercises v1.00_en19 exercises v1.00_en
19 exercises v1.00_en
 
Ins and Outs of GPIO Programming
Ins and Outs of GPIO ProgrammingIns and Outs of GPIO Programming
Ins and Outs of GPIO Programming
 
Dynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfDynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdf
 
System Development for Verification of General Purpose Input Output
System Development for Verification of General Purpose Input OutputSystem Development for Verification of General Purpose Input Output
System Development for Verification of General Purpose Input Output
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
 
xapp744-HIL-Zynq-7000
xapp744-HIL-Zynq-7000xapp744-HIL-Zynq-7000
xapp744-HIL-Zynq-7000
 
Atomic pi Mini PC
Atomic pi Mini PCAtomic pi Mini PC
Atomic pi Mini PC
 
Atomic PI apug
Atomic PI apugAtomic PI apug
Atomic PI apug
 
18CSL48.pdf
18CSL48.pdf18CSL48.pdf
18CSL48.pdf
 

More from PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK

BASICS OF COMPUTER
BASICS OF COMPUTERBASICS OF COMPUTER
Unit 6 dsa SEARCHING AND SORTING
Unit 6 dsa SEARCHING AND SORTINGUnit 6 dsa SEARCHING AND SORTING
Unit 5 dsa QUEUE
Unit 5 dsa QUEUEUnit 5 dsa QUEUE
Unit 3 dsa LINKED LIST
Unit 3 dsa LINKED LISTUnit 3 dsa LINKED LIST
Unit 2 dsa LINEAR DATA STRUCTURE
Unit 2 dsa LINEAR DATA STRUCTUREUnit 2 dsa LINEAR DATA STRUCTURE
Unit 1 dsa
Unit 1 dsaUnit 1 dsa
Wt unit 2 ppts client side technology
Wt unit 2 ppts client side technologyWt unit 2 ppts client side technology
Wt unit 2 ppts client side technology
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Wt unit 1 ppts web development process
Wt unit 1 ppts web development processWt unit 1 ppts web development process
Wt unit 1 ppts web development process
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
OPERATING SYSTEM
OPERATING SYSTEMOPERATING SYSTEM
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERINGCOMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Deld model answer nov 2017
Deld model answer nov 2017Deld model answer nov 2017

More from PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK (20)

BASICS OF COMPUTER
BASICS OF COMPUTERBASICS OF COMPUTER
BASICS OF COMPUTER
 
Wt unit 6 ppts web services
Wt unit 6 ppts web servicesWt unit 6 ppts web services
Wt unit 6 ppts web services
 
Wt unit 5 client &amp; server side framework
Wt unit 5 client &amp; server side frameworkWt unit 5 client &amp; server side framework
Wt unit 5 client &amp; server side framework
 
Wt unit 4 server side technology-2
Wt unit 4 server side technology-2Wt unit 4 server side technology-2
Wt unit 4 server side technology-2
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
 
Wt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technologyWt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technology
 
web development process WT
web development process WTweb development process WT
web development process WT
 
Unit 6 dsa SEARCHING AND SORTING
Unit 6 dsa SEARCHING AND SORTINGUnit 6 dsa SEARCHING AND SORTING
Unit 6 dsa SEARCHING AND SORTING
 
Unit 5 dsa QUEUE
Unit 5 dsa QUEUEUnit 5 dsa QUEUE
Unit 5 dsa QUEUE
 
Unit 3 dsa LINKED LIST
Unit 3 dsa LINKED LISTUnit 3 dsa LINKED LIST
Unit 3 dsa LINKED LIST
 
Unit 2 dsa LINEAR DATA STRUCTURE
Unit 2 dsa LINEAR DATA STRUCTUREUnit 2 dsa LINEAR DATA STRUCTURE
Unit 2 dsa LINEAR DATA STRUCTURE
 
Unit 1 dsa
Unit 1 dsaUnit 1 dsa
Unit 1 dsa
 
Wt unit 2 ppts client side technology
Wt unit 2 ppts client side technologyWt unit 2 ppts client side technology
Wt unit 2 ppts client side technology
 
Wt unit 1 ppts web development process
Wt unit 1 ppts web development processWt unit 1 ppts web development process
Wt unit 1 ppts web development process
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
LANGUAGE TRANSLATOR
 
OPERATING SYSTEM
OPERATING SYSTEMOPERATING SYSTEM
OPERATING SYSTEM
 
LEX & YACC TOOL
LEX & YACC TOOLLEX & YACC TOOL
LEX & YACC TOOL
 
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERINGCOMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
 
Deld model answer nov 2017
Deld model answer nov 2017Deld model answer nov 2017
Deld model answer nov 2017
 

Recently uploaded

block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 

Recently uploaded (20)

block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 

PL-3 LAB MANUAL

  • 1. Subject : ___________________________________________________________ Department : ____________________________________________________ Class : ________________________ Semester : ___________________ AY – 2016-17 Pune Vidyarthi Griha’s LAB MANUAL Faculty : ___________________________________________________________ ( PROGRAMMING LABORATORY - III ) College of Engineering, Nasik.
  • 2. A Laboratory Manual for Programming Laboratory - III (310254) Semester – VI (Computer Engineering) Bachelor Degree in Engineering UNIVERSITY OF PUNE Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK DEPARTMENT OF COMPUTER ENGINEERING
  • 3. 1 Develop an application using Beeglebone Black/ ARM Cortex A5 development board to simulate the operations of LIFT 2 Develop an application using Beeglebone Black/ ARM Cortex A5 development board to simulate the working of signal lights. 3 Implement an calculator (64 bit Binary Multiplication) application using concurrent lisp 4 Apply the Following Software Engineering to all assignments(No 1,2,3 of Group A and B). Mathematical Modeling must result into UML Requirements. Apply Assignment No 4a to 4d for all Group A and Group B assignments of Embedded Operating system and Concurrent and Distributed Programming. Use tools Open source tools like ArgoUML, UMLLet, StarUML or equivalent tools for UML models) Or Use Agile or Scrum-Agile ethodologies and Tools.Use of Possitive and Negative Testing. 5 Design mathematical model of the application/system using set theory, algebraic system, relations and functions, Deterministic and Non-Deterministic entities 6 Analyze requirements from the Problem statement, mathematical model, Domain requirements and identify Functional, Non functional, Actors, Usecases for the application/system. Create usecase diagram, activity diagram/swimlane diagram for each usecase. 7 Design the architecture for the system/application using package diagram , deployment diagram. Design classes using class diagram 8 Design the behavior of the system/application using state machine diagram and sequence diagram. 9 Create Project plan, SRS, Design document and Test Plan for one group-C assignment from embedded operating system or Concurrent and Distributed Programming 10 Write an application to parse input text file concurrently and compare the result of concurrent parsing with serial parsing ( Use concurrent YACC parser) 11 Write an application to and demonstrate the change in BeagleBoard/ ARM Cortex A5 /Microprocessor /CPU frequency or square wave of programmable frequency. 12 Vedic Mathematics method to find square of 2-digit number is used in a distributed programming. Use shared memory and distributed (multi- CPU) programming to complete the task. 13 Implement a Parallel ODD-Even Sort algorithm using GPU or ARM equivalent. GROUP - A GROUP - B Sr. No Name of Experiment/ Assignment Page No. Date Of Perfomance Date of Completion Signature INDEX
  • 4. 14 Implement nxn matrix parallel multiplication using CUDA/OpenCL GPU, use shared memory. 15 Develop a network based application by setting IP address on BeagleBoard/ ARM Cortex A5 16 Implement a Multi-threading application for echo server using socket programming in JAVA 17 Implement Reader-Writer problem using OPENMP 18 Develop Robotics(stepper motor) Application using Beagle Board. GROUP - C Subject Teacher H.O.D.
  • 5. Third Year Engineering Programming Laboratory - III 1 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Assignment: 1 Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: Simulation of LIFT operations Problem Definition: Develop an application using Beaglebone Black/ ARM Cortex A5 development board to simulate the operations of LIFT. 1.1 Perquisite: Beaglebone Black, minicom 1.2 Learning Objective: To simulate the operations of LIFT on BBB. 1.3 Relevant Theory / Literature Survey: 1.3 Introduction The element14 BeagleBone Black is identical in technical design and functionality as the specified BeagleBoard.org product (BeagleBone Black) and runs on the version of the software provided by BeagleBoard.org to element14. General support for this board is available from the BeagleBoard.org community. 1.4 Setup: 1. Connect beaglebone black to PC with +5v supply and USB cable. 2. Open terminal in ubuntu. 3. Type sudo su --- enter Type password--enter 4. Then type minicom –s---enter 5. Goto serial port setup- • Press A • Change /dev/ttyxx to /dev/ttyACM0—enter • Press G • Press Enter 6. Save setup as dfl – enter 7. Goto EXIT – enter 8. Now system will boot and then type username and password and you booted into beaglebone black. 9. Type su –enter.
  • 6. Third Year Engineering Programming Laboratory - III 2 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK 1.5 CONNECTOR DETAILS: Connector PIN PIN Description PIN connects to board Function Number Number P9 1,2 GND GND(25pin) GND P9 3,4 VCC(3.6V) VCC(26pin) VCC P8 7 GPIO2[2] FRC-6pin In P8 8 GPIO2[3] FRC-5pin In P8 9 GPIO2[5] FRC-4pin In P8 10 GPIO2[4] FRC-3pin In P8 11 GPIO1[13] FRC-13pin Out P8 12 GPIO1[12] FRC-14pin Out P8 13 GPIO0[23] FRC-11pin Out P8 14 GPIO0[26] FRC-12pin Out P8 15 GPIO1[15] FRC-9pin Out P8 16 GPIO1[14] FRC-10pin Out P8 17 GPIO0[27] FRC-7pin Out P8 18 GPIO2[1] FRC-8pin Out P8 19 GPIO0[22] FRC-23pin Out P8 21 GPIO1[30] FRC-24pin Out P9 11 GPIO0[30] FRC-21pin Out P9 12 GPIO1[28] FRC-22pin Out P9 13 GPIO0[31] FRC-19pin Out P9 14 GPIO1[18] FRC-20pin Out P9 15 GPIO1[16] FRC-17pin Out P9 16 GPIO1[19] FRC-18pin Out
  • 7. Third Year Engineering Programming Laboratory - III 3 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK TABLE 1 1.6 How to get GPIO pin number: •Once you have decided the pin number which you would like to use as a GPIO, you need to find out its corresponding reference number. •For example, if you would like to use pin 12 on P8 expansion header, Then find out its default function. Note down the entire signal name. In this case, pin 12 is GPIO1_12.So any GPIO you come across would be referenced as GPIOX_Y. Identify X,Y. • Use the formula below to find the corresponding reference number: Reference number =( (X*32 )+ Y ) Hence, pin 12 would be referenced as gpio 44 in the kernel. 1.7 To use GPIO pin as GPIO in programs follow the steps : • To make GPIO pin xx as output type command in terminal(xx—pin number) echo xx > /sys/class/gpio/export -- press enter echo out > /sys/class/gpio/gpioxx/direction --press enter for example: echo 44 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio44/direction • To make GPIO pin xx as input type command in terminal(xx—pin number) echo xx > /sys/class/gpio/export -- press enter echo in > /sys/class/gpio/gpioxx/direction --press enter for example: echo 44 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio44/direction • After making GIPO pin as output, To change the initial value of output pin type command in terminal(x—1/0,xx—pin number) echo x > /sys/class/gpio/gpioxx/value –press enter for example: echo 0 > /sys/class/gpio/gpio44/value OR echo 1 > /sys/class/gpio/gpio44/value 1.8 PROCEDURE: 1. Make a connection as shown in above Table1. 2. Make pin as input or output as told in function block of Table1. Export pins : echo 45 > /sys/class/gpio/export P9 23 GPIO1[17] FRC-16pin Out P9 24 GPIO0[15] FRC-15pin Out
  • 8. Third Year Engineering Programming Laboratory - III 4 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK 3. Make New folder with name Lift elevator and go to that folder using command mkdir lift_elevator—press enter cd lift_elevator—press enter 4. Create and open a file with command vim lift_elevator.cpp 5. Write a program and save it. 6. Now compile and run the program using command g++ lift_elevator.cpp -o lift_elevator –press enter ./lift_elevator –press enter 1.9 Oral Questions: 1) What are the steps to enter BBB? 2) What is difference between OS and EOS?
  • 9. Third Year Engineering Programming Laboratory - III 5 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Assignment: Group A2 Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: Simulation of signal lights operations Problem Definition: Develop an application using Beeglebone Black/ ARM Cortex A5 development board to simulate the working of signal lights. 2.1 Perquisite: Beaglebone Black, minicom 2.2 Learning Objective: To simulate the operations of signal lights operations on BBB. 2.3 Relevant Theory / Literature Survey: 2.3.1 Introduction: The element14 BeagleBone Black is identical in technical design and functionality as the specified BeagleBoard.org product (BeagleBone Black) and runs on the version of the software provided by BeagleBoard.org to element14. General support for this board is available from the BeagleBoard.org community. 2.3.2 Setup: 2. Connect beaglebone black to PC with +5v supply and USB cable. 3. Open terminal in ubuntu. 3. Type sudo su ---enterType password. 4. Then type minicom –s---enter 5. Goto serial port setup- • Press A • Change /dev/ttyUSBxx to /dev/ttyACM0—enter • Press G • Press Enter 6. Save setup as dfl – enter 7. Goto EXIT – enter 8. Now system will boot and then type username and password and you booted into beaglebone black. 9. Type su –enter.
  • 10. Third Year Engineering Programming Laboratory - III 6 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK 2.4 CONNECTOR DETAILS: TABLE 1 Connector PIN PIN Description PIN connects to accessory Function Number Number board P9 1,2 GND GND(25pin) GND P9 5 VCC(5V) VCC(26pin) VCC P9 11 GPIO0[30] FRC21pin Out P9 12 GPIO1[28] FRC-22pin Out P9 13 GPIO0[31] FRC-19pin Out P9 14 GPIO1[18] FRC-20pin Out P9 15 GPIO1[16] FRC-17pin Out P9 16 GPIO1[19] FRC-18pin Out P9 24 GPIO0[15] FRC-15pin Out P9 23 GPIO1[17] FRC-16pin Out P8 11 GPIO1[13] FRC-13pin Out P8 12 GPIO1[12] FRC-14pin Out P8 13 GPIO0[23] FRC-11pin Out P8 14 GPIO0[26] FRC-12pin Out P8 15 GPIO1[15] FRC-9pin Out P8 16 GPIO1[14] FRC-10pin Out P8 17 GPIO0[27] FRC-7pin Out P8 18 GPIO2[1] FRC-8pin Out
  • 11. Third Year Engineering Programming Laboratory - III 7 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK 2.5 How to get GPIO pin number: • Once you have decided the pin number which you would like to use as a GPIO, you need to find out its corresponding reference number. • For example, if you would like to use pin 12 on P8 expansion header, Then find out its default function. Note down the entire signal name. In this case, pin 12 is GPIO1_12.So any GPIO you come across would be referenced as GPIOX_Y. Identify X,Y. • Use the formula below to find the corresponding reference number: Reference number =( (X*32 )+ Y ) Hence, pin 12 would be referenced as gpio 44 in the kernel. 2.6 To use GPIO pin as GPIO in programs follow the steps: • To make GPIO pin xx as output type command in terminal(xx—pin number) echo xx > /sys/class/gpio/export -- press enter echo out > /sys/class/gpio/gpioxx/direction --press enter for example: echo 44 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio44/direction • To make GPIO pin xx as input type command in terminal(xx—pin number) echo xx > /sys/class/gpio/export -- press enter echo in > /sys/class/gpio/gpioxx/direction --press enter for example: echo 44 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio44/direction • After making GIPO pin as output, To change the initial value of output pin type command in terminal(x—1/0,xx—pin number) echo x > /sys/class/gpio/gpioxx/value –press enter for example: echo 0 > /sys/class/gpio/gpio44/value OR
  • 12. Third Year Engineering Programming Laboratory - III 8 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK echo 1 > /sys/class/gpio/gpio44/value 2.7 PROCEDURE: 1. Make a connection as shown in above Table1. 2. Make pin as input or output as told in function block of Table1. Export gpio pins: echo 45 > /sys/class/gpio/export Set direction for pins: echo out > /sys/class/gpio/gpio45/direction 3. Make pin as input or output as told in function block of Table1. 4. Make New folder with name Lift elevator and go to that folder using command mkdir traffic_light—press enter cd lift_traffic_light—press enter 5. create and open a file with command vim traffic_light.c 6. write a program and save it. Now compile and run the program using command gcc traffic_light.c -o traffic_light –press enter ./traffic_light –press enter OR g++ stepper.cpp –o stepper –press enter ./stepper -- enter 2.8 Oral Questions: 1 How to activate any pin as Input or output? Using command and through program? 2 What is GPIO? 3 How many pins are there of GPIO ? 4 What is minicom?
  • 13. Third Year Engineering Programming Laboratory - III 9 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Assignment: 4b Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: Use Case Diagram Problem Definition: Analyze requirements from the Problem statement, mathematical model, Domain requirements and identify Functional, Non functional, Actors, Usecases for the application/system. Create usecase diagram, activity diagram/swimlane diagram for each usecase. 4.1 Perquisite: Understanding of software development lifecycle 4.2 Learning Objective: To understand what happens in the system 4.3 Relevant Theory / Literature Survey: 1. Activity diagrams are used to model the dynamic aspects of a system. An activity diagram is essentially a flow chart showing flow of central from activity to activity. 2. Activity diagrams may stand alone to visualize, specify construct and document the dynamics of a society of objects or they may be used to model the flow of control of an operation. 3. Activity diagrams are not only imp for modally the dynamic aspects of the systems but also but constructing executable systems through forward and reverse engineering. 4. An Activity diagram shows flow from activity to activity. An activity is a non-atomic execution within a state machine. 5. An Activity diagram is basically a projection of elements found in an activity in which all or most transitions are triggered by completion of activities in the source state. 4.4 Contents of an activity
  • 14. Third Year Engineering Programming Laboratory - III 10 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK diagram: Activity diagram commonly contains 1. Activity, states and actions states. 2. Transitions 3. Objects Notions used for activity diagrams 4.4.1. Action starter 1. Evaluation of expressions, settings values and attributes, or returns some values, a call operation on an object, sending a signal to an object or even creates or destroy and object these executions are called action states 2. Action states are represented using a oblong shape inside which expression is written. 3. Action states can be decomposed. 4. The work of an action state is assumed to take a significant execution time. For ex 4.4.2. Activity states 1. Simple branching, sequential transitions are Activity states can be further decomposed, their activity being represented by other activity diagrams. 2. They are not atomic. Hence they may be interrupted and are considered to take some finite time to complete. 3. Action state is a special state of activity state. 4. An activity state is composite and its flow of control is made up of other activity states and action states. 5. Activity states have additional parts like entry and exit actions and some machine specifications. 4.4.3. Transitions 1. When the action or activity of state completes, flow of control passes immediately to next action or activity state.
  • 15. Third Year Engineering Programming Laboratory - III 11 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK 2. This flow is specified by using transitions to show path from one action or activity state to the next action or activity state. 3. The transition is a simple directed line. 4. The flow of control has to start and end of some place. 5. The start state is specified by a solid ball the end state is specified by a solid ball in a circle 6. Trigger less transitions are those where control passes immediately once work of source is done. 7. Once the work of a state is done, its exit action is executed. Immediately control is transferred without delay to the next state. 8. Then the entry action is executed and the process continues. Once the work of that state is done this process continues indefinitely. 3.4.4. Branching 1. Simple sequential transitions are common. But they are not only kind of path we need to module. 2. As in a flow chart a branch maybe included to show any alternate flow if required. 3. These alt paths are taken on evaluation on Boolean expressions. 4. A branch may have one incoming transition and two or more outgoing ones. On each outgoing one, a Boolean expression is placed, which is evaluated only on entering the branch. 5. The effect of iteration can be achieved by using one action state that sets value of an iterator and a branch that evaluates if the iterate is finished. 3.4.5 Forking and Joining most common paths found in activity diagrams but while modeling work flows of business processors that are concurrent, may be encountered. 1. Synchronization bars are used to specify the forking the joining of parallel flows of control. 2. A synch bar is thick horizontal line. 3. Joins and forks should balance, meaning that the number of flows that lead a fork
  • 16. Third Year Engineering Programming Laboratory - III 12 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK should match the number of flows that enter its corresponding joins. 4.4.6 Swim lanes 1. Swim lanes are of great use while modeling work flows or business processes to partition activity states on an activity diagram into groups, each group representing business organizations responsible for those activities. 2. Each swim lane has a unique name. it may represent some real world entity. 3. There is a loose connection between swim lanes and concurrent flows of control. 4. Activities of swim lanes are considered separate from activities of the neighboring swim lanes. 5. These swim lanes are independent and concurrent. Fig 3.1 to meet the client
  • 17. Third Year Engineering Programming Laboratory - III 13 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK 4.4.7 Object flow 1. Objects may be involved in flow of control associated with an activity diagram. 2. Instances of classes are created by certain activities which may be modified by other activities 4.3.5 Applications of activity diagrams Activity diagrams are used to typically two ways: 1. To model a work flow: Work flow often lie on fringe of software intensive systems and are used to visualize, specify, construct and document business processor that involve the system of that is being developed. 2. To model an operation: we use flow chart like activity diagrams to model details of a computation. Here modeling of branch, fork and join states are particularly important. 4.6 Forward and reverse engineering Forward engineering (The creation of code from a model) This is possible for activity diagrams especially if context of diagram is an operation. Reverse engineering (Creation of model from code) This is possible for activity diagrams esp. if context of code is the body of an expression. In particular previous diagram could have been generated from the implementation of the class line. 4.7 Oral Questions 1 What is activity diagram? 2 What are the elements of activity diagram? 3 What is fork (split) and join (merge)? 4 What is use of swim lanes? 5 What is difference between activity diagram and use case diagram?
  • 18. Third Year Engineering Programming Laboratory - III 14 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Assignment: 4c Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: Class Diagram Problem Definition: Design the architecture for the system /application using package diagram , deployment diagram. Design classes using class diagram. 4.1 Perquisite: Understanding of software development lifecycle 4.2 Learning Objective: To understand how classes are related to each other with their basic as well as advanced notation 4.3 Relevant Theory / Literature Survey: To identify and describe key concepts like classes, types in the system and their relationships and advanced relationships, other classifier like interfaces. A class diagram shows a set of classes, interfaces, and collaboration and their relationships. Class diagram commonly contains the following things: 1 Classes 2 Interfaces 3 Collaboration 4 Dependency, generalization, and association relationship Fig 4.1 Class of Washing Machine
  • 19. Third Year Engineering Programming Laboratory - III 15 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK 4.4 Relationships: 4.4.1 Association: An association is structural relationship, specifying that objects of one thing are to objects of another. Given an association connecting two classes, you can navigate from an object of the other class, and vice versa. There are four basic adornments that apply to an association: a name, the role at each end of the association, the multiplicity at each end of the association, and aggregation. Notation: Graphically, an association is rendered as a solid line connecting the same or different classes. Example: Consider two classes Recruitment Manager and Student. Recruitment Manager Recruits Student is 1 to 0….* kind of relationship which is shown in following figure Association Name Recruits Recruiment Manager Student 1 0..* Multi plici ty Fig 4.2 Multiplicity 4.4.2 Aggregation: A plain association, between two classes represents a structural relationship between peers, meaning that both classes are conceptually at the same level, no one more important that the other. Sometimes, we want to model a ―whole/part‖ relationship, in which one class represents a larger thing (the ―whole‖), which consists of smaller things (the ―parts‖). This kind of relationship is called aggregation, which represents a ―has a!‖ relationship. Notation: It is specified by adorning a plain association with an open diamond at the whole end. Example: Consider the two classes Company and department. In these two classes Company acts as a whole part. The association between them is shown as follows:
  • 20. Third Year Engineering Programming Laboratory - III 16 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Company Whole 1 Aggregation Part 1..* Department Fig 4.3 Aggregation 4.4.3 Composition: Composition is a form of aggregation, with strong relationship and coincident lifetime as part of the whole. Parts with non-fixed multiplicity may be created after the composite itself, but once created they live and die with it. This means that, in a composite aggregation, an object may be a part of only one composi te at a time. Notation: It is specified by adorning a plain association with a filled diamond at the whole end. Example: In windowing system, a Frame belongs to exactly one Window. When you create a Frame in a system, you must attach it to an enclosing Window. Similarly, when you destroy the window, the Window object must in turn destroy its Frame parts. It is shown in following figure. 4.4.4 Generalization: It is the relationship between a general thing (called super class or parent) and a more specific kind of that thing (called sub class or child). Generalization is called an ―is-a –kind-of‖ relationship. Notation: Generalization among classes is rendered as a solid directed line with a large open arrowhead Example: Consider a parent class Shape and child classes Rectangle, Circle, The generalization between them is as shown in figure.
  • 21. Third Year Engineering Programming Laboratory - III 17 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Base class Shape Generalization Ci rcle Rectangle Leaf Classes Fig 4.4 Generalization 4.5 Dependency: A dependency is a using relationship that states that a change in specification of one thing may affect another thing that uses it, but not necessarily reverse. Notation: Graphically, a dependency is rendered as a dashed line, directed to the thing being depended on. Example: Consider Film Clip class which completely depends on Channel. It can be shown as follows: Dependency Film Clip nam e Channel playon() s tart() s top() res et() Fig 4.5 Dependency 4.6. Interface Interfaces define a line between the specification of what an abstraction does and the implementation of how that abstraction does it. An interface is a collection of operations that are used to specify a service of a class or a component. These are used to visualize, specify, construct, and document the seams within your system. A well structured interface provides a clear separation between the outside view and the inside view of an abstraction, making it possible to understand and appro ach an
  • 22. Third Year Engineering Programming Laboratory - III 18 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK abstraction without having to dive into the details of its implementation. Every interface must have a name that distinguishes it from other interface. An interface is drawn showing only its name, as in figure. An interface is a named collection of operations used to specify a service of a class or of a component. Like a class, an interface may have any number of operations. These operations may be adorned with visibility properties, concurrency properties, stereotypes, tagged values, and constraints. Stereotype <<Interfac e>> URL StreamHandler OpenConnect ion() Operat ions ParseURL() Set URL() ToExternal Form () Fig 4.6 Interface 4.7. Operation Constraint: The name of the operation plus its parameters (including return type, if any) is called the operation’s signature. In its full form, the syntax of an operation in the UML is [visibility] name [(parameter-list)] [: return-type] [{property-string}] For example, the following are all legal operation declaration: 1 Display Name only 2 +Display Visibility and name 3 Set (n: Name, s: String) Name and parameters 4 getId() : Integer Name and return type 5 restart() {guarded} Name and property
  • 23. Third Year Engineering Programming Laboratory - III 19 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK In an operation signature, you may provide zero or more parameters, each of which follows the syntax [Direction] name: type [= default-value] Direction may be of the following values: In an input parameter; may not be modified Out an output parameter; may be modified to communicate information to the caller In out an input parameter; may be modified. 4.8 Different Stereotypes: A plain, unadorned dependency relationship is sufficient for most of the using relationships. However, if you want to specify a shade of meaning, the UML defines a number of stereotypes that may be applied to dependency relationships. There are 17 such stereotypes, all of which can be organized in 6 groups. 1. First, there are eight stereotypes that apply to dependency relationships among classes and object in class diagrams. Table: 4.1 Bind Specifies that the source instantiates the target template using the given actual parameters. Derive Specifies that the source may be computed from the target Friend Specifies that source is given special visibility into the target Instance Of Specifies that the source object is an instance of the target classifier Instantiate Specifies that source creates instances of the target Power type Specifies that the target is a power type of the source; a power type is a classifier whose objects are all the children of given parent. Refine Specifies that the source is at a finer degree of abstraction that the target Use Specifies that the semantics of the source element depends on the semantics of the public part of the target
  • 24. Third Year Engineering Programming Laboratory - III 20 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK . 2. Continuing, there are two stereotypes that apply to dependency relationships among packages. Table: 4.2 Access Specifies that the source package is granted the right to reference the element of the target package. Import A kind of access that specifies that the public contents of the target packages enter the flat namespace of the source, as if they had been declared in the source. 3. Two stereotypes apply to dependency relationship among use cases: Table: 4.3 Extend Specifies that the target use case extends behavior of the source Include Specifies that the source use case explicitly incorporates the behavior of another use case at a location specified by source. 3.1 You will encounter three stereotypes when modeling interactions among objects: Table: 4.4 Become Specifies that the target is the same object as the source but at a later point in time and with possibly different values, state, or roles Call Specifies that the source operation invokes the target operation. Copy Specifies that the target object is an exact, but independent, copy of the source. 3.2 One stereotype will encounter in the context of state machine. Table: 4.5
  • 25. Third Year Engineering Programming Laboratory - III 21 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Send Specifies that the source operation sends the target event. 3.3 And the final stereotype will encounter in the context of organizing the elements of your system into subsystem and model is Table: 4.6 Trace 4.8. Oral Questions 1 What is use of class diagram? 2 Explain the structure of class and its graphical notation? 3 What are different types of relationship in UML diagrams? 4 Explain with graphical notation and Example a) Association b) Generalization c) Aggregation d) Dependency e) Composition Specifies that the target is a historical ancestor of the source
  • 26. Third Year Engineering Programming Laboratory - III 22 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Assignment: 4d Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: Sequence Diagram Problem Definition: Design the behavior of the system /application using state machine diagram and sequence diagram. 4.1 Perquisite: Understanding of software development lifecycle 4.2 Learning Objective: using sequence diagrams to understand their message exchanges. 4.3 Relevant Theory / Literature Survey: Interaction diagram shows an interaction, consisting of a set of object and their relationships, including the messages that may be dispatched among them. Interaction diagrams commonly contain 1 Objects 2 Links 3 Messages A sequence diagram is an interaction diagram that emphasizes the time ordering of messages. Graphically, a sequence diagram is a table that shows objects arranged on X-Axis and messages, ordered in increasing time, along Y-axis. 4.4 Message type: 4.4.1 Synchronous and asynchronous: The first message of a sequence diagram always starts at the top and is typically located on the left side of the diagram for readability. To show an object sending message to another object, you draw a line to the receiving object with a solid arrowhead (if a synchronous call operation) or with a stick arrowhead (if an asynchronously).The message/method is placed above the arrowed line. In the example as shown below, the analyst object makes a call to the system object
  • 27. Third Year Engineering Programming Laboratory - III 23 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK which is an instance of the Reporting System Class. The analyst object is calling the system object’s get Available Report method. The system object then calls the gets security Clearance method with the argument of UserID on the sec System object, which is of the class type Security System. Analyst:Financial System:Reporting SecSystem: Analyst System Security System 1: getAvailableReports() 2: getSecurityClearance(UserID) 3: UserClearance 5: available reports 4: Determice available report s Fig 4.1 Messaging System 4.4.2 Signal: A signal represents a named object that is dispatched (thrown) asynchronously by one object and then received by another. Exceptions are supported by most contemporary programming languages and are the most common kind of internal signal that you will need to model. Signals have a lot in common with plain classes. For example, signals may have instances, although you don’t generally need to model them explicitly. Signals may also be involved in generalization relationships, permitting you to model hierarchies of events. Some of which are general and some are specific. As also for classes, signals may have attributes and operations. A signal may send as the action of a state transition or the sending of a message in an interaction. The execution of operation can also send signals. 4.4.3 Notation: The relationship between operations and the events that it can send by using a dependency relationship, stereotyped as send. Fig 4.2 Signal Signal
  • 28. Third Year Engineering Programming Laboratory - III 24 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK signal <<signal>> Movement Agent Collision positionVelocit y force : t ype = float <<send>> moveto() 4.4.4 Message reply: Return message are optional. It is drawn as dotted line with open arrowhead back to the originating lifeline and above this line you place the return value from the operation. In above figure of reporting system, system object returns available Reports when they get Available Reports method is called. Return messages are useful if finer detail is required; otherwise invocation message is sufficient. 4.4.5 Frame: The frame element is the graphical boundary of a diagrams used as a basic for many diagrams. A frame element provides a consistent place a frame element is as the graphical boundary for the diagrams. The diagram’s label is placed in the top left corner which is called as call the frame’s ―name box,‖ a sort of dog-eared rectangle, And the actual UML diagram within the body of the larger enclosing rectangle. In addition to providing a visual border, the frame element also has an important functional use in diagrams depicting interactions, such as sequence diagram. On sequence diagrams incoming and outgoing messages for a sequence can be modeled by connecting the message to the border of the frame element. 4.4.6 Constraints: Timing: Modeling the absolute time of an event, modeling the relative time between events, and modeling the time it takes to carry out an action are the three primary time-critical properties of real time systems for which you’ll use timing constraints. To model timing constraints, For each event in an interaction, consider whether it must start at some absolute time. Model that real time property as a timing constraint on the message. For each interesting sequence of message in an interaction, consider whether there is an associated maximum relative time for that sequence. Model that real time property as a timing constraint on the sequence. For each time critical operation in each class, consider its time complexity. Model those semantics as timing constraints on the operation.
  • 29. Third Year Engineering Programming Laboratory - III 25 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK a : s t a rt T im e e v e r y a m s S : S y s t e m A g e n t p : S e r v e r P a g e c : C a m e r a 1 : a : r e fr e s h () 2 : b : g e t Im a g e () 3 : b . e x e c u t i o n T i m e < 1 0 0 n s 4 : Fig 4.2.1 Constraints The left-most constraint specifies the repeating start time the call event refresh. Similarly, the center timing constraint specifies the maximum duration for calls to get Image. Finally, the right-most constraint specifies the time complexity of the call event get Image. 4.5 Interaction Operator: A combined flow is used to group sets of messages together to show conditional flow in sequence diagram. 4.5.1. Alteration: Alteration fragment is used to model a sequence diagram in case if alternative solution is present to draw the sequence diagram. 4.5.2. Option: The option combination fragment is used to model a sequence that, given a certain condition, will occur; otherwise does not occur. 4.5.3. Parallel: If two activities are going simultaneously, then parallel fragment is used. 4.5.4. Loop: When modeling a sequence diagram, there will be times that an object will need to send message to it. To draw an object calling itself, you draw a message as you would normally, but instead of connecting it to another object; you connect the message back to the object itself. 4.6 Comparisons between sequence and communication: Sequence diagram is more focused on time. It has two features that are not present in communication and collaboration 1. Object lifeline: An object lifeline is the vertical line that represents the existence of an object over a period of time.
  • 30. Third Year Engineering Programming Laboratory - III 26 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK 2. Focus of Control: It is a tall, thin rectangle that shows the period of time during which an object is performing an action, either directly or through a subroutine procedure. Communication diagram is more focused on showing the collaboration of objects rather that the time sequence. Collaboration emphasizes the organization of the object that participates in an interaction. It has two features 1. Path: To indicate how one objects if linked to another. 2: Sequence number: To indicate the time order of a message. Fig 6.2 GUI interact with object 4.6. Oral Questions 1 What is Use of Sequence diagram? 2 What are elements of activity diagram? 3 What are the types of messages in Interaction diagram? 4 What is activation of objects?
  • 31. Third Year Engineering Programming Laboratory - III 27 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Assignment: A5 Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: Software Requirement Specification (SRS) Problem Definition: Create Project plan, SRS, Design document and Test Plan for one group-C assignment from embedded operating system or Concurrent and Distributed Programming Problem Definition: Develop Robotics(stepper motor) Application using Beagle Board. 1.1 Perquisite: Beaglebone Black, minicom 1.2 Learning Objective: To simulate the operations of LIFT on BBB. 1.3 Relevant Theory / Literature Survey: 1.3 Introduction The element14 BeagleBone Black is identical in technical design and functionality as the specified BeagleBoard.org product (BeagleBone Black) and runs on the version of the software provided by BeagleBoard.org to element14. General support for this board is available from the BeagleBoard.org community. 1.4 CONNECTOR DETAILS: Connector PIN PIN Description PIN connects to board Function Number Number P9 1,2 GND GND(25pin) GND P9 5 VCC(5V) VCC(26pin) VCC P9 11 GPIO0[30] FRC-21pin Out P9 12 GPIO1[28] FRC-22pin Out P9 13 GPIO0[31] FRC-19pin Out
  • 32. Third Year Engineering Programming Laboratory - III 28 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK P9 14 GPIO1[18] FRC-20pin Out Table 1: Pins for stepper motor 1.5 How Stepper Motors Work Stepper motors consist of a permanent magnetic rotating shaft, called the rotor, and electromagnets on the stationary portion that surrounds the motor, called the stator. Figure 1 illustrates one complete rotation of a stepper motor. At position 1, we can see that the rotor is beginning at the upper electromagnet, which is currently active (has voltage applied to it). To move the rotor clockwise (CW), the upper electromagnet is deactivated and the right electromagnet is activated, causing the rotor to move 90 degrees CW, aligning itself with the active magnet. This process is repeated in the same manner at the south and west electromagnets until we once again reach the starting position. Figure 1 In the above example, we used a motor with a resolution of 90 degrees or demonstration purposes. In reality, this would not be a very practical motor for most applications. The average stepper motor's resolution -- the amount of degrees rotated per pulse -- is much higher than this. For example, a motor with a resolution of 5 degrees would move its rotor 5 degrees per step, thereby requiring 72 pulses (steps) to complete a full 360 degree rotation. You may double the resolution of some motors by a process known as "half-stepping". Instead of switching the next electromagnet in the rotation on one at a time, with half stepping you turn on both electromagnets, causing an equal attraction between, thereby doubling the resolution. As you can see in Figure 2, in the first position only the upper electromagnet is active, and the rotor is drawn completely to it. In position 2, both the top and right electromagnets are active, causing the rotor to position itself between the two active poles. Finally, in position 3, the top magnet is
  • 33. Third Year Engineering Programming Laboratory - III 29 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK deactivated and the rotor is drawn all the way right. This process can then be repeated for the entire rotation. Figure 2 There are several types of stepper motors. 4-wire stepper motors contain only two electromagnets, however the operation is more complicated than those with three or four magnets, because the driving circuit must be able to reverse the current after each step. For our purposes, we will be using a 6-wire motor. The specific stepper motor we are using for our experiments (ST-02: 5VDC, 5 degrees per step) has 6 wires coming out of the casing. If we follow Figure 3, the electrical equivalent of the stepper motor, we can see that 3 wires go to each half of the coils, and that the coil windings are connected in pairs. This is true for all four-phase stepper motors. Figure 3 However, if you do not have an equivalent diagram for the motor you want to use, you can make a resistance chart to decipher the mystery connections. There is a 13 ohm resistance between the center-tap wire and each end lead, and 26 ohms between the two end leads. Wires originating from separate coils are not connected, and therefore would not read on the ohm meter. 1.6 Advantages and disadvantages of stepper motors
  • 34. Third Year Engineering Programming Laboratory - III 30 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK The reason for using a stepper motor is to achieve precise control: you can make it move through a defined angle. Stepper motors can sometimes be quite jerky, because they start and stop each step with a sudden impulse, which isn't always what you want if you're trying to build a precision machine. 1.7 Oral Questions 1.11.1 What is Software Requirements Specification? 1.11.2 What are the Characteristics of a Good Software Requirements Specification (SRS) 1.11.3 What does Module mean? 1.11.4 What is the difference between functional and nonfunctional requirements in software engineering? Can you give examples of each?
  • 35. Third Year Engineering Programming Laboratory - III 31 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Assignment: Group A 6 Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: Lex and Yacc Problem Definition: Write an application to parse input text file concurrently and compare the result of concurrent parsing with serial parsing ( Use concurrent YACC parser) 6.1 Perquisite: lex and yacc, openmp 6.2 Learning Objective: To achieve concurrent parsing and compare result with serial . 6.3 Relevant Theory / Literature Survey: 6.3.1 Introduction Compilation steps: following diagram shows the compilation steps.
  • 36. Third Year Engineering Programming Laboratory - III 32 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK The patterns in the above diagram is a file you create with a text editor. Lex will read your patterns and generate C code for a lexical analyzer or scanner. The lexical analyzer matches strings in the input, based on your patterns, and converts the strings to tokens. Tokens are numerical representations of strings, and simplify processing. When the lexical analyzer finds identifiers in the input stream it enters them in a symbol table. The symbol table may also contain other information such as data type (integer or real) and location of each variable in memory. All subsequent references to identifiers refer to the appropriate symbol table index. The grammar in the above diagram is a text file you create with a text edtior. Yacc will read your grammar and generate C code for a syntax analyzer or parser. The syntax analyzer uses grammar rules that allow it to analyze tokens from the lexical analyzer and create a syntax tree. The syntax tree imposes a hierarchical structure the tokens. For example, operator precedence and associatively are apparent in the syntax tree. The next step, code generation, does a depth-first walk of the syntax tree to generate code. Some compilers produce machine code, while others, as shown above, output assembly language. 6.4 Lex Theory During the first phase the compiler reads the input and converts strings in the source to tokens. With regular expressions we can specify patterns to lex so it can generate code that will allow it to scan and match strings in the input. Each pattern specified in the input to lex has an associated action. Typically an action returns a token that represents the matched string for subsequent use by the parser. Initially we will simply print the matched string rather than return a token value. The following represents a simple pattern, composed of a regular expression, that scans for identifiers. Lex will read this pattern and produce C code for a lexical analyzer that scans for identifiers. letter(letter|digit)* Table 1. Pattern matching
  • 37. Third Year Engineering Programming Laboratory - III 33 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Table 2.Pattern matching examples 6.5 Yacc Theory Grammars for yacc are described using a variant of Backus Naur Form (BNF). This technique, pioneered by John Backus and Peter Naur, was used to describe ALGOL60. A BNF grammar can be used to express context-free languages. Most constructs in modern programming for an expression that multiplies and adds numbers is E -> E + E E -> E * E E -> id Three productions have been specified. Terms that appear on the left-hand side (lhs) of a production, such as E (expression) are nonterminals. Terms such as id (identifier) are terminals (tokens returned by lex) and only appear on the right-hand side (rhs) of a production. This grammar specifies that an expression may be the sum of two expressions, the product of two expressions, or an identifier. We can use this grammar to generate expressions: E -> E * E (r2) -> E * z (r3) -> E + E * z (r1) -> E + y * z (r3) -> x + y * z (r3) At each step we expanded a term and replace the lhs of a production with the corresponding rhs. The numbers on the right indicate which rule applied. To parse an expression we need to do the reverse operation. Instead of starting with a single nonterminal (start symbol) and generating an expression from a grammar we need to reduce an expression to a single nonterminal. This is known as bottom-up or shift-reduce parsing and uses a stack for storing terms. 6.6 Procedure Run Program for serial parsing: 1. $lex abc.l 2. $yacc –d abc.y 3. $gcc y.tab.c lex.yy.c 4. $./a.out file1.txt
  • 38. Third Year Engineering Programming Laboratory - III 34 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Figure 2. Building a Compiler with Lex/Yacc 1.8 Procedure Run Program for concurrent parsing: 1. $lex abc.l 2. $yacc –d abc.y 3. $gcc y.tab.c lex.yy.c –ll 4. $gcc openmp.c –fopenmp –o p 5. ./p file1.txt file2.txt file3.txt Figure 1:Package diagram
  • 39. Third Year Engineering Programming Laboratory - III 35 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK figure 2:Activity diagram with fork figure 3:Activity diagram
  • 40. Third Year Engineering Programming Laboratory - III 36 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK 1.11.4 figure 4:Sequence diagram figure 5:Deployment diagram
  • 41. Third Year Engineering Programming Laboratory - III 37 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK figure 6: Use Case diagram 1.9 Oral Questions: 1) What is lex? 2) What is yacc? 3) What is difference between serial and concurrent execution and how you have achieved in your program?
  • 42. Third Year Engineering Programming Laboratory - III 38 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Assignment: B1 Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: PWM Problem Definition: Write an application to and demonstrate the change in BeagleBoard/ ARM Cortex A5 /Microprocessor /CPU frequency or square wave of programmable frequency. 1.1 Perquisite: Beaglebone Black, minicom 1.2 Learning Objective: To simulate the operations of LIFT on BBB. 1.3 Relevant Theory / Literature Survey: 1.3 Introduction The element14 BeagleBone Black is identical in technical design and functionality as the specified BeagleBoard.org product (BeagleBone Black) and runs on the version of the software provided by BeagleBoard.org to element14. General support for this board is available from the BeagleBoard.org community. Pulse Width Modulation (or PWM) is a technique for controlling power. We also use it here to control the brightness of each of the LEDs. The diagram below shows the signal from one of the GPIO pins on the BBB.
  • 43. Third Year Engineering Programming Laboratory - III 39 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Every 1/5000 of a second, the PWM output will produce a pulse from 3.3V down to 0V. The length of this pulse is controlled by the 'set_duty_cycle' function. If the output is high for 90% of the time then the load will get 90% of the power delivered to it. We cannot see the LEDs turning on and off at that speed, so to us, it just looks like the brightness is different. 1.4 Configuring Pin 13 on P8 Header for PWM The BBB was specifically designed to be a dynamic piece of hardware, enabling third-party developers to create their own custom configurations and extensions known as capes. The board is so flexible, it can change its hardware configuration at runtime using an in-kernel mechanism known as the Cape Manager in conjunction with Device Tree Overlays.The Device Tree consists of a set of human readable text files known as DTS files that end in the ―.dts‖ extension. DTS files can be edited using a simple text editor to set the configuration for a particular pin. These source files then get compiled into DTB files, a binary format ending in the ―.dtbo‖ extension. This process creates what are known as device tree fragments or overlays. The kernels Cape Manager can then dynamically load and unload the DTB files post- boot as well as at runtime to set the hardware configuration. 1 root@beaglebone:/lib/firmware# ls *pwm* 2 am33xx_pwm-00A0.dtbo 3 am33xx_pwm-00A0.dts 4 bone_pwm_P8_13-00A0.dtbo 5 bone_pwm_P8_13-00A0.dts 6 ... All we need to do is load them using the Cape Manager, but first, lets get acquainted with a very useful command that will help us determine if our overlays were properly loaded:
  • 44. Third Year Engineering Programming Laboratory - III 40 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Programming Laboratory III Third Year Engineering 1 root@beaglebone:~# more /sys/devices/bone_capemgr.8/slots 2 0: 54:PF--- 3 1: 55:PF--- 4 2: 56:PF--- 5 3: 57:PF--- 6 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G 7 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI Out of the box, the BBB shows the above slots. Lets add two more slots to configure pin 13 on header P8 for PWM by executing the following commands: 1 root@beaglebone:~# echo am33xx_pwm > /sys/devices/bone_capemgr.8/slots 2 root@beaglebone:~# echo bone_pwm_P8_13 > /sys/devices/bone_capemgr.8/slots To confirm the overlays loaded properly we run the slots command again: 1 root@beaglebone:~# more /sys/devices/bone_capemgr.8/slots 2 0: 54:PF--- 3 1: 55:PF--- 4 2: 56:PF--- 5 3: 57:PF--- 6 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G 7 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI 8 7: ff:P-O-L Override Board Name,00A0,Override Manuf,am33xx_pwm 9 8: ff:P-O-L Override Board Name,00A0,Override Manuf,bone_pwm_P8_13 Our board is now configured for PWM on pin13 of the P8 header! Before we move on, however, it’s worth noting these changes are not permanent. If you power off the board, the PWM slots we just added will disappear. Thankfully, we don’t have to repeat the above steps each time we power up the board. The Cape Manager supports a method to load the overlays at boot time by adding the following argument to the ―uEnv.txt‖ file: 1 capemgr.enable_partno=am33xx_pwm,bone_pwm_P8_13 Make sure to append the argument in a single line like this: 1 root@beaglebone:~# more /media/BEAGLEBONE/uEnv.txt 2 optargs=quiet drm.debug=7 capemgr.enable_partno=am33xx_pwm,bone_pwm_P8_13 1.5 Oral Questions: 1) What are the PWM? 2) What is use of PWM and what are the pins numbers used in BBB? 3) What is duty cycle?
  • 45. Third Year Engineering Programming Laboratory - III 41 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Assignment: Group C1 Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: Stepper Motor Problem Definition: Develop Robotics(stepper motor) Application using Beagle Board. 1.1 Perquisite: Beaglebone Black, minicom 1.2 Learning Objective: To simulate the operations of LIFT on BBB. 1.3 Relevant Theory / Literature Survey: 1.3 Introduction The element14 BeagleBone Black is identical in technical design and functionality as the specified BeagleBoard.org product (BeagleBone Black) and runs on the version of the software provided by BeagleBoard.org to element14. General support for this board is available from the BeagleBoard.org community. 1.4 CONNECTOR DETAILS: Connector PIN PIN Description PIN connects to board Function Number Number P9 1,2 GND GND(25pin) GND P9 5 VCC(5V) VCC(26pin) VCC P9 11 GPIO0[30] FRC-21pin Out P9 12 GPIO1[28] FRC-22pin Out P9 13 GPIO0[31] FRC-19pin Out P9 14 GPIO1[18] FRC-20pin Out
  • 46. Third Year Engineering Programming Laboratory - III 42 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK Table 1: Pins for stepper motor 1.5 How Stepper Motors Work Stepper motors consist of a permanent magnetic rotating shaft, called the rotor, and electromagnets on the stationary portion that surrounds the motor, called the stator. Figure 1 illustrates one complete rotation of a stepper motor. At position 1, we can see that the rotor is beginning at the upper electromagnet, which is currently active (has voltage applied to it). To move the rotor clockwise (CW), the upper electromagnet is deactivated and the right electromagnet is activated, causing the rotor to move 90 degrees CW, aligning itself with the active magnet. This process is repeated in the same manner at the south and west electromagnets until we once again reach the starting position. Figure 1 In the above example, we used a motor with a resolution of 90 degrees or demonstration purposes. In reality, this would not be a very practical motor for most applications. The average stepper motor's resolution -- the amount of degrees rotated per pulse -- is much higher than this. For example, a motor with a resolution of 5 degrees would move its rotor 5 degrees per step, thereby requiring 72 pulses (steps) to complete a full 360 degree rotation. You may double the resolution of some motors by a process known as "half-stepping". Instead of switching the next electromagnet in the rotation on one at a time, with half stepping you turn on both electromagnets, causing an equal attraction between, thereby doubling the resolution. As you can see in Figure 2, in the first position only the upper electromagnet is active, and the rotor is drawn completely to it. In position 2, both the top and right electromagnets are active, causing the rotor to position itself between the two active poles. Finally, in position 3, the top
  • 47. Third Year Engineering Programming Laboratory - III 43 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK magnet is deactivated and the rotor is drawn all the way right. This process can then be repeated for the entire rotation. Figure 2 There are several types of stepper motors. 4-wire stepper motors contain only two electromagnets, however the operation is more complicated than those with three or four magnets, because the driving circuit must be able to reverse the current after each step. For our purposes, we will be using a 6-wire motor. The specific stepper motor we are using for our experiments (ST-02: 5VDC, 5 degrees per step) has 6 wires coming out of the casing. If we follow Figure 3, the electrical equivalent of the stepper motor, we can see that 3 wires go to each half of the coils, and that the coil windings are connected in pairs. This is true for all four-phase stepper motors. Figure 3 However, if you do not have an equivalent diagram for the motor you want to use, you can make a resistance chart to decipher the mystery connections. There is a 13 ohm resistance between the center-tap wire and each end lead, and 26 ohms between the two end leads. Wires originating from separate coils are not connected, and therefore would not read on the ohm meter.
  • 48. Third Year Engineering Programming Laboratory - III 44 | Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASIK 1.6 Advantages and disadvantages of stepper motors The reason for using a stepper motor is to achieve precise control: you can make it move through a defined angle. Stepper motors can sometimes be quite jerky, because they start and stop each step with a sudden impulse, which isn't always what you want if you're trying to build a precision machine. 1.7 Oral Questions: 1) How stepper motor works? 2) What are the application of stepper motor?