handout

advertisement
ENGG1015: lab 6
In Search of Light
1st Semester 2012-13
The goal of this lab is to begin constructing the last stage of your project – a light tracker.
By doing so, you will learn to use a digital-to-analog converter (DAC) to bridge between the
digital logic world of an FPGA and the analog circuit world.
You will also start to build a complex analog circuit using op-amp.
......................................................................
1 Finding your lab partner
You will be working with a randomly assigned partner for this lab. To find your assigned lab
partner and the assigned table,
1. Log in to Moodle.
2. Select the assignment Lab 6 Partner
Please proceed to your assigned table.
......................................................................
2 Getting the Files
Download the files for this lab from
http://www.eee.hku.hk/~engg1015/fa12/labs/lab6.zip
......................................................................
3 Motor Driving
There are two types of motors you may use for your project. The operations of the two types of
motors are identical. The only difference is the power they generate.
Let’s begin with driving a simple motor shown below:
M+
(a) Photo
M-
(b) Schematic Symbol
Figure 1: Simple Motor
As illustrated by its schematic symbol, a motor is modeled as simple two-terminal device. Define
Vmotor to be the voltage across the two terminals M+ and M-, then a motor has the following
properties:
• The rotational speed of a motor (ω) is proportional to Vmotor ;
ENGG1015
lab 6
• The direction of rotation depends on the polarity of Vmotor .
That is,
ω = kM Vmotor
with the sign of ω representing the direction of rotation and kM is a constant.
3.1 First, we will determine some basic properties of the motor. The motor has a 3-pin connector
with the following definition:
Pin
1
2
3
Color
Black
Red
White
Signal
MM+
Not Connected
Using a digital multi-meter, determine the resistance of the motor Rmotor across the terminals
M+ and M-.
Rmotor =
3.2 Now, connect the motor to a breadboard exactly like the following diagram. You will need
to gradually build the circuit later in this part so it is important that you make your breadboard
connection exactly as shown below. Make sure you are connecting the power supply to the
BOTTOM power row. Note that we are NOT connecting the top and bottom power and
ground rows in this lab yet.
15
20
15
20
10
5
d
c
To
Power Supply
e
a
b
c
d
e
1
To Motor
10
5
1
a
b
Wire A
Figure 2: Connection of motor on the breadboard.
Now, start with ZERO volt output at the power supply, gradually turn UP the voltage from the
power supply to 6V. What is the voltage needed to turn on the motor? What is the corresponding
current? You can read these values directly from the power supply.
Vmotor, on =
Imotor, on =
3.3 Now, try reversing the connection of the motor (NOT the power supply). Is the motor
turning in an opposite direction? Does it have a similar turn-on voltage as above?
Page 2 of 8
ENGG1015
lab 6
3.4 Checkoff 1
Show the working motor to your TA and answer the following questions:
• What is the internal resistance, turn on voltage, and current of the motor?
• Given the resistance value, do you expect yourself be able to control the speed of
the motor by directly connecting a 10 kΩ potentiometer to the motor?
3.5 Disconnect the Motor
• Disconnect the motor from the breadboard.
• Remove Wire A in Figure 2.
• Keep the remaining wires intact.
......................................................................
4 Digital-to-Analog Conversion
From the labs in the past few weeks, you have already experimented with the I/O capability of
the Basys2 FPGA board. In this lab, you will connect an additional digital-to-analog convertor
(DAC) to the FPGA board. With this extra module, you can produce analog voltage using
digital control.
Figure 3(a) shows the DAC module you will use for this lab. It has two connectors. The J1
connector on the DAC module should be inserted into an I/O port of the Basys2 board. The J2
connector should be connected to the breadboard using an FPGA connector.
Pin
6
5
4
3
2
1
(a) DAC Module
Name
A1
B1
A2
B2
GND
VCC
Description
Analog Output A1
Analog Output B1
Analog Output A2
Analog Output B2
Ground
3.3V
(b) Pinout for J2 on DAC module
Figure 3: DAC module used to convert digital signals from the FPGA to the analog circuits on
the breadboard
DO NOT connect to the FPGA yet.
You will get the board once your TA has checked your circuit.
Page 3 of 8
35
30
25
20
15
10
To
DAC module
a
b
c
d
e
5
lab 6
1
ENGG1015
d
e
Pin 1
35
30
25
20
15
10
5
1
a
b
c
To
Power Supply
Figure 4: Connection of DAC module on the breadboard.
4.1 Hardware Construct the circuit in Figure 4 on the breadboard. Then connect the DAC
module to the breadboard using an FPGA connector. Note the following:
• VCC of the FPGA connector is NOT connected;
• GND of the FPGA connector is connected to the “–” row on top of the breadboard
• The “–” row at the top and bottom are connected together.
4.2 Getting the FPGA Board
Show your constructed circuit on the breadboard to your TA and answer the following
questions:
• The analog output of the DAC module is located at pin A1. Where is that connected
to on the breadboard?
• If the power supply is set to 6V, where is the 6V signal on the breadboard?
• Where can you find a 3.3V signal on the breadboard? Is it connected?
• Why do we have to connect the GND signal to the power supply?
You can take an FPGA from the TAs once you can answer the above questions.
4.3 Connect the DAC module to the JB I/O connector on the Basys2 board. The other side
of the module should be connected to the breadboard. The complete connection is shown in
Figure 5.
Figure 5: Connection of DAC module to the FPGA and to the breadboard.
Page 4 of 8
ENGG1015
lab 6
4.4 Software Load the file dac.xise from the downloaded zip file.
The DAC module has to be driven by the FPGA through a complex state machine. This control
logic as been created for you as the dactls block in the schematic dac.sch.
The dactls module takes an 8-bit data and produces the necessary control to the DAC module
such that the correct analog voltage appears at pin A1. There are 256 different possible analog
values corresponding to the 28 = 256 possible digital input combinations. In particular, let n be
the value of the 8-bit digital input din, then the output voltage at A1 can ideally be expressed
as:
Vcc
VA1 = n ×
256
where Vcc is the power supply to the DAC. In your case, it is 3.3V.
In dac.sch, the input to dactls is tied to the 8 switches on the Basys2 board. As a result,
you can control the output at the DAC using the switches. Also, a special display module
(display3v3) has been created for you. It displays the ideal analog voltage that should be
output at the DAC module.
Now, using the Xilinx ISE tools, implement and download the design to the FPGA. Use a DMM
to measure the output voltage on the bread board. Complete the following table:
din (dec)
din (bin)
VA1
0
0000 0000
20
0001 0100
128
1000 0000
200
1100 1000
255
1111 1111
4.5 Checkoff 2
Demonstrate the DAC circuit to your TA and answer the following questions:
• Are the voltage values you measured the same as the display? Why/Why not?
• What is the maximum voltage?
• What is the minimum voltage?
• The power supply is not connected in this part yet the DAC is working. Where is
the DAC circuit getting its power?
4.6 Disconnect the FPGA
• Disconnect the FPGA from the breadboard.
• Keep the remaining wires intact.
......................................................................
5 Op Amp
In class, you have learned about building amplifiers using op-amps. In this lab you will experiment with one of the configurations by building a non-inverting amplifier. The schematics of a
non-inverting amplifier is shown below:
Page 5 of 8
ENGG1015
lab 6
Vcc
Vin
+
Vout
−
R2
R1
Figure 6: A non-inverting amplifier
In this circuit, the output voltage is related to the input voltage by the formula:
R2
Vout = 1 +
Vin
R1
5.1 Construct the above non-inverting amplifier circuit using the same breadboard as in previous
steps.
Reminder: DISCONNECT the FPGA and any power supply from the
breadboard before you proceed with the construction of the op-amp circuit.
You will be using an op-amp in a standard integrated circuit package (Figure 7(a)). The op-amp
IC has 8 pins and contains two op-amps internally. Figure 7(b) shows how the two op-amps are
connected internal to the IC. Only ONE op-amp is used in this lab. You will use both in later
labs.
The power of the two op-amps are both supplied from Pin 2 and Pin 4 of the IC. Connect VCC
of the op-amp IC (pin 2) to the “+” rail at the bottom. Connect GND pin of the package (pin
4) to ground.
For this circuit, use R2 = 6.2 kΩ, R1 = 2.2 kΩ.
(a) Photo
Output A
1
8
Vcc
2
7
Output B
3
6
VEE/GND
4
5
Inputs A
Inputs B
(b) Pinout of the op-amp IC
Figure 7: Op-Amp
Your final circuit should look like the connection in Figure 8. Note the special marking (a small
half circle) on the top of the op-amp package. The location of this marking helps you to orient
the IC and identify the pins.
Page 6 of 8
20
25
20
25
15
10
e
d
c
7
6
5
3
4
8
1
e
d
c
15
10
5
1
a
b
To
Power Supply
CH2 (6V)
2
a
b
To
Power Supply
CH1 (Variable)
5
lab 6
1
ENGG1015
Figure 8: Implementation of the non-inverting amplifier on breadboard.
5.2 Test the non-inverting amplifier. On your power supply, turn VOLTAGE of CH2 on the
LEFT to 6V. Turn VOLTAGE of CH1 on the RIGHT to 0V.
Then, connect the CH2 of the power supply to the power row at the bottom and connect CH1
of the power supply to the Vin of the Op-Amp as shown in Figure 8
Now use a DMM to measure the voltage at the output and complete the following table:
Vin
0
0.5
1
1.5
2
2.5
3
Vout
5.3 Checkoff 3 Show to your TA the completed non-inverting amplifier circuit and answer the
following questions:
• What is the maximum and minimum voltage at the output of the op-amp?
• How is this maximum and minimum voltage related to the VCC and VEE of the Op-Amp?
• Where are R1 and R2 on the breadboard?
• What is the gain of the non-inverting amplifier?
• How do you connect the DAC output to the non-inverting amplifier input, how would you
do that on the breadboard?
• How do you connect the output of the amplifier to the motor?
......................................................................
6 Complete Product
With the motor, DAC and op-amp, you are now able to complete the full circuit to drive the
motor digitally by the FPGA.
Using your knowledge from above, connect the output of the DAC to the input of the op-amp.
Then, connect the output of the non-inverting amplifier to drive a motor.
Page 7 of 8
ENGG1015
lab 6
switches
Vcc
DAC
Vin
Vout
R2
R1
Figure 9: Complete motor driving block diagram.
Warning: NEVER connect the VCC pin of the DAC
module to the power supply. Only connect power supply to the op-amp VCC pin. Failure to do so will cause
permanent damage to the FPGA.
Enjoy testing your circuit!
Page 8 of 8
Download