Sie sind auf Seite 1von 11

Dr.

David Kaeli
EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

Lab Assignment 8
Group #12
Jay Chinnaswamy
chinnaswamy.ja@husky.neu.edu

Colleen Gallagher
Gallagher.co@husky.neu.edu

Submit date: 1/16/17


Due Date: 12/3/2014

Abstract
The main purpose of this lab was to bring all of the components together that have been
developed thus far over the span of the course. Specifically, the programs will be designed using
hardware and software. The robotic arm is controlled through the FPGA and the ARM processor

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

on the Zedboard controls the FPGA. The program is written in C that receives signals from the
Wiimote connected via Bluetooth and sends commands to the FPGA to carry out a specific
movement by the robotic arm. The FPGA will generate the proper Pulse Width Modulation
signals to control the robotic arm using specific servo motors. This lab allowed for students to
build upon previous knowledge of digital design, programming in C, and implementing pulse
width modulation signals to control the robotic arm.

Introduction
The goal of this lab was to design digital logic in Simulink and implement C programs
using Linux to control various aspects of the robotic arm through pulse width modulation
signals. Previously, users have developed a C program to control the arm while this time, the
programmable logic side of the Zedboard will be utilized to perform similar tasks with the arm.
Previous concepts such as PWM, memory components, and switches were reviewed and applied
to digital design in order to allow the buttons and switches to control the robotic arms position
and servo motor. This lab assumes that its users know how to manipulate pulse width signals,
specifically from a 50 MHz signal on the Zedboard a 50 Hz signal which is what the servo
motors in the robotic arm expect to receive. It also assumes that its user have an in depth
understanding of how pulse width modulation works in terms of the duty cycle of oscillators and
analog signals. The constraint of this lab was that it was not as straightforward as the lab
involving code to control the arm. Instead, it involved various counters and comparator
components in order to convert the initial signal to the correct value in order to control the servo
motors.

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

Lab Discussion
The prelab for this assignment was to review the materials provided on Blackboard about
AXI-Lite protocol as well as the Simulink models (Base_Model_SW and Base_Model_HW) and
the C programs (Lab9.SW.c and Lab9_HW.c). Lastly, it was important for students to review the
steps taken and implementation processes of the previous lab, lab 8. The materials used in this
lab included the Zedboard, the Robotic arm with its 5 servo motors, the Pmod connectors (JA),
the Wiimote, and the ARM CPU as well as the Xilinx FPGA which are both part of the Zynq
system on the SOC chip. This was connected to the computer through an Ethernet adapter, the
USB port and the RJ45 connector on the board. The Zedboard runs on a version of Ubuntu called
Xillinux. The Robotic arm was connected through the Pmod connector (JA) on the Zedboard
where the black wire is GND, the red wire is VCC, and the yellow one is data. The Base servo
cable connects to JA0, the Bicep servo cable connects to JA1, the Elbow servo cable connects to
JA2, the Wrist servo cable connects to JA3, and the Gripper servo cable connects to JA4. System
Generator was used to design the digital logic for this because it is a plug-in to Simulink that
enables users to develop designs for Xilinx FPGAs using Matlab Simulink. The Wiimote control
was connected via the Bluetooth connector in the OTG slot on the Zedboard. Secure shell (SSH)
ran on the Mobaxterm program on the PC using the IP address 192.168.1.10 with the username
user112. The programs were written in C, complied using gcc, and ran using sudo.

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

Results and Analysis


The main challenge of this lab was to use the components Zedboard to control aspects of
the robotic arm through digital design downloaded onto the FPGA. Specifically, the switches on
the Zedboard would set the initial servo motor degree angle in the range of 0-180 in (unsigned
integer 8) binary form. This value read from the switches will be added to the minimum pulse
width value, 600 useconds, and for each increment by 1 of the value in the switches, the pulse
width will be increased by 10 useconds. This will be implemented for each of the 5 buttons on
the Zedboard in order to control each of the 5 servo motors on the robotic arm. New pulse width
modulation values are sent by setting the 8 switches to the desired pulse width and then pushing
the appropriate button corresponding to the servo motor that the user wants to move.
In appendix A, one of the five digital logic designs for a Zedboard button is shown,
specifically the one for the right button. In appendix B, the Zedboard switches component is
shown and in appendix C, the entire digital logic design for this lab is displayed. First, the button
needed to be debounced because when a button is pushed, multiple signals are sent whereas
only one signal output is desired. This is done through a NOT logical component, an HDL
counter component, and a comparator component. Once the button is pushed, the signal will
enable the HDL counter to start counting, incrementing by 1. While the counter is less than or
equal to 5000000, the input from the switches will be checked and added to the initial pulse
width value of 60. This is because a pulse width of 50 Hz is desired using a 10usec resolution for
the control of the servo motors. Looking at the calculations:
50 Hz
=5000000
10 usec

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

When the button is not being pushed, the HDL counter will be reset to the initial value of 1 and
continue to take the pulse width modulation values stored in memory. This is done through the
switch component that comes next. When the button is pushed and the counter is less than or
equal to 5000000 which outputs a 1 to the switch, the first input will be outputted, in this case the
initial value stored in memory which is 150. This number was picked because it starts the robotic
arm servos at set angles that allow for good mobility. Specifically, the robotic arm is set part way
up in the air and centered on the base. When the first counter does not follow the comparators
condition the output is 0, the switch will output the second input, in this case the value from the
switches added to the minimum value of 60 (600 usec). Because of the memory component,
either input from the switch component will be saved for the next time the button is pushed.
Therefore, the previous switch value will be the initial value stored into memory to be
implemented.
The next part of the design involves two counters that are used to keep up with the
Zedboard clock cycle. They basically ensure that at only certain intervals that the buttons are
allowed to be checked and update all the values. The first counter starts at 1 and counts up until
500 and the comparator will output 1 in order to enable the next counter that counts up until
2000. This is because the Zedboard has a 50 MHz signal with a 20 nanosecond period that needs
to be converted to a 50 Hz signal with a 10 usec resolution in order to control the servo motors.
Looking at the calculations:
1
10 us
1
0.02 s
=20 ns
=500
=0.02
=2000
50 Mhz
20 ns
50 Hz
10 us
While the second counter is counting to 2000, each incremented value is being compared to the
output of the previous switch. While the value stored in memory from the Zedboard switches is
5

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

greater than or equal to the increments of the second counter, the output will be 1 and the specific
servo motor will move based on the pulse signal received.
The last part of this lab involved downloading the design onto the FPGA using the HDL
Code Advisor. The most important part was to make sure the correct inputs and outputs on the
design were connected to the appropriate components of the Zedboard and the robotic arm. Each
of the button inputs corresponded to each of the 5 buttons on the Zedboard, while only one input
component needed to be assigned for all of the switches on the Zedboard. The 5 output
components were assigned to the 5 Pmod connectors JA[0:4] for each of the 5 servo motors on
the robotic arm. Overall, the results make sense because the given instructions were followed,
the digital design was executed correctly, and the robotic arm was controlled and moved just as
expected. The only real source of error in this lab was that downloading the design onto the
FPGA took a good amount of time and it was difficult to determine what specifically was
causing the error and be able to test it in a timely manner.

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

Conclusion
The lab was definitely one of the more difficult labs because it combined pulse width
modulation with digital design logic. As a result, it provided more of a challenge, therefore
expanding the knowledge and the digital design abilities of its users. From a larger perspective,
the results of this lab show that it is important to understand how the robotic arm can be
controlled form both hardware and software frame of mind. It also shows that debugging a
digital design is certainly more time consuming and involves more analytical skills and
knowledge of the Simulink program than a C program. In the future, work could be done to
simplify the logic in the design as well as be able to control other aspects of the robotic arm, such
as speed, using pulse width modulation. Although it could be improved, the work completed
fulfils the requirements asked in this lab.

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

References
[1] Alshawabkeh, Sammy. Pulse-Width Modulation. 13 Nov. 2014. PDF file.
[2] Debouncing a Switch. 13 Nov. 2014. PDF file.
[3] "HDL Coder Getting Started Guide." Matlab. MathWorks. The MathWorks Inc. Web. 13 Nov.
2014.
[4] Patt, Yale N., and Sanjay J. Patel. Introduction to Computing Sciences: From Bits and Gates
to C & Beyond. New York: McGraw-Hill, 2004. Print.

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

Appendix
[A]

This is a picture of one part of the entire circuit diagram, specifically for the right push button.
Once the button is pushed, it is debounced to make sure that only one signal is sent instead of
multiple. Next, the signal will enable the HDL counter to start counting, incrementing by 1.
While the counter is less than or equal to 5000000, the input from the switches will be checked
and added to the initial pulse width value of 60 which will cause the robot to move based on the
value calculated and which servo motor corresponds to the right push button.
[B]

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

Here is the component of the diagram that incorporates the value from the switches on the
Zedboard. The input is being taken and added to 60 which is the initial minimum pulse width
value (600 usec).
[C]

10

Dr. David Kaeli


EECE2160

Embedded Design: Enabling Robotics


Lab Assignment 8

This is a picture of the entire diagram with all of the logic operations for each of the 5 buttons for
each of the 5 servo motors as well as the initial value taken from the switches. By downloading
this design onto the FPGA, the robots movement and position with a specific servo motor could
be controlled.

11

Das könnte Ihnen auch gefallen