0% found this document useful (0 votes)
29 views22 pages

Lab 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views22 pages

Lab 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)

Main IJP Road, Sector I-12, Islamabad


Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

IDE-2005-L: Robotics and Automation Lab


Batch: 2020-2024 Semester: 7th Session: Fall-2023

Exp No Title of Exp CLO PLO


Demonstrate TETRIX Prime Robots, NI my RIO and Lab
3 View Software CLO-2 PLO-5

Student Name:
Registration No:
Date of Experiment:
Affective Domain Rubric Based Assessment
Levels of Achievement
Unacceptable Just acceptable Basic Good Excellent Marks
(1) (2) (3) (4) (5)
I. Adherence to Safety
Procedures for completing task
II. Attitude and Goal Setting for
completing task
III. Individual & Group Engagement
for completing task

Psychomotor Domain Rubric Based Assessment


Levels of Achievement
Unacceptable Just acceptable Basic Good Excellent Marks
(1) (2) (3) (4) (5)
I. Ability to conduct experiment on
PLC/ROBOT
II. Demonstrate proper uses of
PLC/ ROBOTIC software and
hardware
III. Implementation and Result.

Lab Report Rubric Based Assessment


Levels of Achievement
Unacceptable Just acceptable Basic Good Excellent Marks
(1) (2) (3) (4) (5)
I. Organization/
Structure
II. Data Presentation.

Submitted To: L.E Haji Ahmed


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Introduction to TETRIX Prime Robotic Kit for NI my RIO and Lab View Software
NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Objectives:
This builder’s guide has been developed to provide students with positive experiences in robotics engineering.
With the assistance of this guide, students will learn to use the TETRIX® PRIME parts to design and construct
three different robots. After using this guide, students should be able to use the TETRIX PRIME parts to construct a
robot of their own design.
Equipment/Components:
This guide includes:

• Full list of set components, including part numbers for reference


• Set up instructions and construction tips
• Getting started with NI myRIO and LabVIEW
• Test instructions for sensors and actuators
• Complete step-by-step build and automation instructions for three model robots

Safety Information

Mechanical
• Keep fingers, hair, and loose articles of clothing clear of gears and moving parts.
• Never pick up the robot while it is moving, or the servo motors are running.
• Remove any burrs caused by cutting the metal beams.

Electrical
• Make sure the power is turned off when the robot is not in operation.
• Do not operate the robot in a wet environment.
• Always power down the robot before making any changes.
• Use caution when working with bare wires to avoid creating a short circuit situation.
• Route wires carefully and secure them if necessary to avoid damage to the wire or its insulation.
• Mount the battery pack and all electronic components securely.

Note:

For complete detail for set components, setup/Hookup Tips, set up control system hardware and software,
building instructions for rover vehicle assembly, balancing arm assembly and self-balancing robot assembly
follow the soft copy of PITSCO TETRIX PRIME Robot Builder’s Guide for NI myRIO.

Getting Started with myRIO 37


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Introduction to NI myRIO and Lab View Software

Introduction to NI myRIO
NI myRIO is an embedded hardware device designed for students and based on technology usedin industry
for controls and robotics. It has all the I/O and processing power you need to control therobots you create using
this kit and more!

Using myRIO you can . . .


• Implement simple to complex controls algorithms such as PWM and PID
• Communicate over Wi-Fi to control and monitor your robot remotely
• Deploy programs to allow your robot to run autonomously
• Use the motor board to interface with all the sensors and actuators in this kit
. . . and much more! To learn more about myRIO, visit ni.com/myrio.

Introduction to Lab View Software


LabVIEW™ is a graphical programming language used all over the world in industry and academia to create
systems that interact with the real-world. In this kit, you will use LabVIEW to program myRIO to run controls
algorithms, interact with sensors and actuators, communicate with other devices, and
implement other innovative functionality you’d like your robot to have. To learn more about LabVIEW,visit
ni.com/labview.

38 Getting Started with myRIO


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Set Up Your Control System


Hardware Setup
1. Insert your myRIO Motor Controller Board.
The motor board add-on to myRIO easily interfaces with the sensors and actuators needed to build
robots using this kit. The motor board will be plugged into MXP Bdapter A on myRIOas shown
below.

Connect your system to power.


The control system is powered by a battery, which can be charged using the included char-ger. Refer
to the following figure to properly connect the battery pack female connector to the motor board.

Battery See page 25 for larger


Cable with
Tamiya view of this image.
Male
Connector

2. Refer to the motor board pinout below when you are connecting sensors and actuators tothe
board.

Getting Started with myRIO 39


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

40 Getting Started with myRIO


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Software Setup
1. Install the software required to program myRIO. You can find this software on the disks provided
with myRIO as well as ni.com/downloads. Disk 1 includes the minimum software required to use
myRIO. Disk 2 includes additional software you can use to expand the func-tionality of myRIO.
The minimum software required to use myRIO is:
1. LabVIEW
2. LabVIEW Real-Time Module
3. LabVIEW myRIO Toolkit
Activate the software using your software serial number.
2. After connecting myRIO to power and to your PC using the included USB cable, the myRIOdevice
monitor will appear and will provide some options. For your first time connect-
ing myRIO to your computer, select “Launch the Getting Started Wizard.” This will lead you
through identifying myRIO, renaming myRIO,
installing software onto myRIO, and testing theonboard
devices.
3. At the end of the Getting Started Wizard, select
“Start my first project now” to be guided through
your first experience in LabVIEW using the locally
hosted web tutorial.
4. After completing the tutorials in the tab named “Your
First NI myRIO Program,” move on to the tutorial in
the tab “Configuring WiFi on the NI myRIO.” Scroll
down to the section named “Creat-ing a Wireless
Network.” Follow the instructions in this section to
use myRIO as an access point to
create wireless networks. Take note of the SSID youchose
and the IPv4 address myRIO was assigned.
You will need this information to wirelessly con-nect to
myRIO from your computer.
5. For more information about getting started with the
myRIO, visit ni.com/myrio/setup/getting-started.
6. Download software to test your system and control the robots described in this guide from
ni.com/tetrix-prime. This code will also be helpful to reference when building your own designs.
7. Install setup.exe. This will place the example code for testing your control system

Getting Started with myRIO 41


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Test Your Control System


After completing your hardware and software setup, test your control system setup using code foundon your
computer here: c:/users/…/desktop/PITSCO TETRIX PRIME for NI myRIO/Control System Test Code.
DC Motors
The Digilent DC motor features a geared motor package with encoders that can be used for position and speed
control. The DC motor actuates based on a PWM signal with a 5 V high and 0 V low. The cabling for the motor
includes wires for the 5 V, Ground, positive and negative references for the motor,and two encoder channels.
Follow the steps below to test the DC motors.
Step 1: Refer to the following figures to connect both extension cables included in your kit to themotor board.

Figure 1: Connected Motor Figure 2: Final Cable ExtensionConnection


Extension Cable

Step 2: Connect the other end of the extension cables from Step 1 to each of the Digilent DC motorsincluded in the
kit.

Figure 3: Connecting ExtensionMotor Figure 4: Final Extension andMotor


Connection

42 Getting Started with myRIO


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Step 3: Connect the motor board to the myRIOand


plug in the DC connector to power it on.
Ensure the myRIO ad hoc network appears on your
computer with the name you specified fromthe
Software Setup section.
Step 4: Open the “Control System Test Project,” connect
the myRIO in the project, open the drop-down of the
myRIO and navigate to “Testing YourSystem ->
Main_DC.”
Step 5: Open and run the VI and click on the Reset
Counter button two times to set the encoder Counter
Value to 0. Keeping the frequency of Motor 1 at 10000,
set Motor 1 PWM duty cycle to10 and confirm Motor 1
starts to spin. The encoderin the code is reading from Figure 5: Motors Connected to
Motor 1, so confirm that Counter Value is increasing. myRIO with Motor Board

Step 6: Set the Motor 1 PWM duty cycle to 0 and confirm Motor 1 stops and the Counter Value stopsincreasing.
Set the Motor 1 PWM duty cycle to -10 and confirm Motor 1 starts to spin in the opposite direction and Counter
Value starts to decrease.
Step 7: Set the Motor 1 PWM frequency to 6000 and take note of any changes in the motor. Set Motor1 PWM duty
cycle to 0 and click on the Reset Counter button two times to reset the encoder Counter Value back to 0.
Step 8: Set the Motor 2 PWM duty cycle to 10and
confirm it starts to spin. Ensure that it is spinning in
the same direction as Motor 1 wasspinning when its
PWM duty cycle value wasset to 10.
Step 9: Set the Motor 2 PWM duty cycle to 0 and
confirm Motor 2 stops spinning. Set the Motor 2
PWM duty cycle to -10 and confirm Motor 2 starts
to spin in the opposite direction.
Step 10: Set the Motor 2 PWM frequency to6000 and
take note of any changes in the motor. Set Motor 2
PWM duty cycle to 0 andthen stop the VI.
Note: You may continue adjusting the duty cycle and
frequency values to see their effects.

Getting Started with myRIO 43


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Servos
The servos provided offer the full package of a motor, gear box, potentiometer, and comparator circuitry to achieve
position control using PWM signals. The cabling comprises Power, Ground, and thePWM signal line.
Step 1: Testing the servo will be similar to testing the DC motors. We must first connect the servo to the
appropriate port. If the servo is not already connected, refer to the following figures on connectinga servo properly
to one of the available servo ports.

Figure 7: Connecting Figure 8: Completed


Servo to Port 0 Servo Connection

Step 2: (If not already completed from Step 3 of the DC Motors section) Connect the motor board to the myRIO and
plug in the DC connector to power it on. Ensure the myRIO ad hoc network appears onyour computer with the name
you specified from the Software Setup section.

44 Getting Started with myRIO


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Figure 9: myRIO with Servo Connected to Pitsco Motor Board

Getting Started with myRIO 45


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Step 3: Open the “Control System Test Project,” connect the myRIO in the project, open the drop-downof the myRIO,
and navigate to “Testing Your System -> Main_SERVO.”
Step 4: Open and run the VI. Set the dial for Servo 0 to 0.9 and confirm the servo turns and stays at aset position.
Figure 10: Servo Testing VI

Step 5: Set the Servo 0 dial to 2.1 and confirm the servo moves to a new position.
Step 6: Stop the VI. Unplug the servo from Servo Port 0 and reconnect it to Servo Port 1 and thenrerun the VI.
Now, set the Servo 1 dial to 0.9 and confirm the servo moves to a specified position.
Step 7: Set the Servo 1 dial to 2.1 and confirm the servo moves to its new position.
Step 8: Stop the VI. Unplug the servo from Servo Port 1 and reconnect it to Servo Port 2 and thenrerun the VI.
Now, set the Servo 2 dial to 0.9 and confirm the servo moves to a specified position.
Step 9: Set the Servo 2 dial to 2.1 and confirm the servo moves to its new position. Stop and close theVI.

46 Getting Started with myRIO


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Gyroscope Sensor

The Digilent PModGYRO measures angular velocity and returns data using either the SPI or I2C protocol. The
sensor also includes an onboard temperature sensor. The PmodGYRO pinout includes achip select signal, power
ground, and the data lines for I2C and SPI.
Step 1: The Pitsco motor board includes a connector where the gyroscope sensor can directly connect. Reference the
following figures to properly connect the sensor to the motor board.
Step 2: (If not already completed from Step 2 of the Servos section) Connect the motor board to themyRIO and
plug in the DC connector to power it on. Ensure the myRIO ad hoc network appears on your computer with the
name you specified from the Software Setup section.
Step 3: Open the “Control System Test Project,” connect the myRIO in the project, open the drop-downof the myRIO,
and navigate to “Testing Your System -> Main_Gyro.”

Figure 11: PmodGYRO Connection Figure 12: Completed PmodGYRO Connection

Figure 13: myRIO with Pitsco Motor Board and Gyro

Getting Started with myRIO 47


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Step 4: Open and run the VI. The data in the Angular Rate graph will show a spike when the sensor isin motion.
After the sensor stops moving, confirm the data goes back to 0.

Figure 14: Gyro Sensor Testing VI

Step 5: Confirm the Angular Displacement graph holds its value when the sensor stops and does notgo back to 0.
Move the sensor around on all three axes and confirm you see three different signals changing. Stop and close
the VI.

48 Getting Started with myRIO


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Infrared Range Finder


An infrared range finder uses an infrared signal pulse of known frequency and the time taken to detect that signal’s
reflection to determine the distance from the source an object is. The range finderprovides a user-friendly pinout of
power, ground, and the analog signal returned proportional to distance.
Step 1: The Pitsco motor board includes a connector where the infrared sensor can directly connect.Reference the
following figures to properly connect the sensor to the motor board.

Figure 15: Connecting IR Sensor Cable Figure 16: IR Sensor Cable Connected

Figure 18: IR Sensor Cable Connectedto


Figure 17: Connecting IR Sensor Cableto
myRIO Motor Controller Board
myRIO Motor Controller Board

Step 2: (If not already completed from Step 3 of the Servos section) Connect the motor board to themyRIO and
plug in the DC connector to power it on. Ensure the myRIO ad hoc network appears on your computer with the
name you specified from the Software Setup section.
Step 3: Open the “Control System Test Project,” connect the myRIO in the project, open the drop-downof the myRIO,

Getting Started with myRIO 49


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

and navigate to “Testing Your System -> Main_IR Range Finder.”

50 Getting Started with myRIO


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Figure 19: IR Sensor Testing VI


Step 4: Run the VI. Place your hand about 10 inches away from the sensor and move it back and forth.Confirm the
voltage drops as you move away from the sensor and that it goes up as your hand gets closer. Stop and close the
VI.

Getting Started with myRIO 51


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Ambient Light Sensor


An ambient light sensor utilizes a phototransistor and amplifier circuit to detect intensity of light. The PMod Ambient
Light Sensor gives information back using the SPI protocol and provides a pinout thatincludes a chip select, data
line, clock line power, and ground.
Step 1: The Pitsco motor board provides a connector specifically for the ambient light sensor. Refer tothe following
figures to properly connect the sensor to the motor board.

Figure 20: Connecting Ambient Light Figure 21: Ambient Light Sensor Connectedto
Sensor to myRIO Motor Controller Board myRIO Motor Controller Board

Step 2: (If not already completed from Step 2 of the Servos section) Connect the motor board to themyRIO and
plug in the DC connector to power it on. Ensure the myRIO ad hoc network appears on your computer with the
name you specified from the “Software Setup section.”
Step 3: Open the “Control System Test Project”, connect the myRIO in the project, open the dropdownof the myRIO,
and navigate to “Testing Your System -> Main_Ambient Light Sensor.”

52 Getting Started with myRIO


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Figure 22: Ambient Light Sensor Testing VI

Step 4: Open and run the VI. Position the sensor to point toward a light source and confirm the data increases.
Completely cover the sensor and confirm the data decreases (possibly going to 0). Stop and close the VI.

Getting Started with myRIO 53


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Task-1:
To design and implement the ON/OFF control algorithm of a switch on Lab View using NImyRio.

Task-2:
To design and implement the control algorithm of LED Blinking on Lab View using NImyRio.
NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Task-3:
To design and implement the speed control algorithm of dc motor on Lab View using NImyRio.

Task-4:
To design and implement the control algorithm of seven segment display on Lab View using NImyRio.

Getting Started with myRIO 55


NATIONAL UNIVERSITY OF TECHNOLOGY (NUTECH)
Main IJP Road, Sector I-12, Islamabad
Telephone: 051-5476768/4576809, Fax: 051-5476769
Website: www.nutech.edu.pk
DEPARTMENT OF ELECTRICAL ENGINEERING

Conclusion/ Result Analysis:

You might also like