Professional Documents
Culture Documents
Lab1 sbRIO Familiarity v1
Lab1 sbRIO Familiarity v1
Analog IO
Digital IO
ethernet
connection
P3 connector P2 connector
ethernet
connection
UserGuide_sbRIO_96xx.pdf
ME 379M/397 – Prof. R.G. Longoria Department of Mechanical Engineering
Cyber Vehicle Systems The University of Texas at Austin
Ultimately, we want to study the code that is used to control the
motors and understand how the drive signals are sent to the motor
controller used on the DaNI and also how the wheel speed is
measured using the built-in encoders. We’ll try to get there in 3
exercises.
P Connect an LED
4
across an available
port and D GND
Press Finish.
Expand the “Chassis (sbRIO-963x0) and you will see the FPGA
Target (RIO0, sbRIO-963x). For DaNI 2.0, the ‘x’ is a ‘2’.
Right click on the FPGA target and create a new VI. A blank VI will
be created. On the block diagram, develop a VI to control the digital
I/O to turn on and off. Here is one way to do this:
The stop terminal is for a control and the iterations terminal is an indicator. These should
appear on the front panel. It is assumed you know how to build this type of block
diagram in LabVIEW. If not, you need to complete the introductory online tutorials.
ME 379M/397 – Prof. R.G. Longoria Department of Mechanical Engineering
Cyber Vehicle Systems The University of Texas at Austin
You should be using the pop-up menus to access the FPGA I/O items.
Here you’ll need the I/O Node:
For this simple program, it will take about 5-7 min to compile locally, depending
on your host computer. Selecting the local compile server, first you will see some
work on generating intermediate files, then the Compilation Status window will
open up. Let it run. You may get an initially busy message, just ignore and it will
usually get started. While you are waiting, see the next slide.
The next step is to build a real-time VI that runs on the sbRIO that
can call this FPGA VI.
Read over the next slide which has an excerpt from the LabVIEW
context help.
Select ‘VI’
then browse
your project
(to right) to Select the FPGA
select the VI you created,
FPGA VI. and hit OK.
Reference wire
FPGA
Read/Write
You should now be able to blink the LED a given number of times.
We may later want to gather data from analog sensors or send out
analog drive signals.
You will measure signals from an accelerometer, and use that signal
to drive an analog dial gauge.
Use the +5 V DC output from one of the digital I/O connectors as the
power input to the accelerometer. Connect the accelerometer ground
to D GND.
Then, choose the accelerometer output and connect this to one of the
analog input channels.
tri-axial accelerometer
If you now shake it with your hand in the plane of the table, you
should get a signal that varies about 2.5 V.
NOTE: Make sure to design your VI so that when you stop it the
AO goes to zero. We don’t want to leave the ‘meter’ at a high
value (e.g., ~2.5 V for zero g).
ME 379M/397 – Prof. R.G. Longoria Department of Mechanical Engineering
Cyber Vehicle Systems The University of Texas at Austin
Here is what you need to assemble for exercise 2. Note
that when you hook up the analog voltmeter, you will
need to use a series resistor in the circuit or you will over-
range the meter. This series resistor will be provided.
Next slide shows ‘most’ of the RT VI. Don’t have to do it this way.
The point is to drive the DaNI with open loop levels of PWM
modulation while also measuring the Tetrix motor output shaft speed
(in rad/sec) using the integrated encoder.
1 ‘tick’ is one
‘cycle’ on the
FPGA, which
runs at 40 MHz.
640000 ticks is
equivalent to 16
msec.
Let’s look at
what is in this
loop.
ME 379M/397 – Prof. R.G. Longoria Department of Mechanical Engineering
Cyber Vehicle Systems The University of Texas at Austin
Side bar: If you’ve never used local and global variables in LabVIEW before, it
is worth looking at this basic tutorial on the NI website:
http://www.ni.com/tutorial/7585/en/
global
local
Gear-head
Driving the motors with PWM. Below is the Motor Drive Control Loop on the
Custom FPGA VI for the Starter Kit 2.0 (DaNI)
First, note that this is a multi-channel drive. The For Loop will run ‘N’ times,
where N is the length of the array formed by the two motor ppi values conveyed
via these global variables.
Integer array, N =2
You also need the code here which takes ppi from the Encoder loop and converts to
rad/sec. Let’s look at what is in the ‘Convert Velocity’ subVI.
ME 379M/397 – Prof. R.G. Longoria Department of Mechanical Engineering
Cyber Vehicle Systems The University of Texas at Austin
First, here are some
particulars on the Sabertooth
motor controller.
1
Tcyc =
Note, using ‘interval’ or ‘tick’ synonymously. 40 ⋅106 ticks/sec
ME 379M/397 – Prof. R.G. Longoria Department of Mechanical Engineering
Cyber Vehicle Systems The University of Texas at Austin
Note that the PID controller (which we won’t use here) takes the converted
velocity (in rad/sec) and ‘Normalizes’ before sending it into the FPGA PID subVI.
We may look at this later, but since we won’t use it let’s not worry about that right
now.
Bottom line is you need to give an open loop command to the I32 conversion.
Remember, these values vary from [-500,500] usec.
By a smooth step, that means not a ‘harsh’ step input. However, provide a way to
‘sharpen’ the transition from initially zero to a steady-state value.
Run at least three cases, ‘stepping’ the PWM values to achieve roughly about 5, 10, and
15 rad/sec (this last being about the max speed for this motor).
Capture your speed transient response using an output graph on the front panel to
visualize the motor output shaft speed.
Assess the dynamic characteristics. Does the system appear to be dominantly 1st order,
2nd order?
As discussed in class, the goal is to identify key model parameters for an ‘experimental
model’ of the DaNI drivetrain. The working hypothesis is that the relation between motor
speed and modulation level can be represented by 1st order dynamics.