Professional Documents
Culture Documents
The ability to translate electrical signals into motion in the real world combined with the ability to measure position can help you exploit the power of the computer to generate computer automation the source of much of the modern worlds conveniences.
Goal: In this experiment, use the power capacity of the NI ELVIS II variable power supply to run and control the speed of a small DC motor. Using a modified free space IR link, build a tachometer to measure the speed of the motor. By combining the motor and tachometer with a LabVIEW program, you can incorporate computer automation in the system. Required Soft Front Panels (SFPs) Variable power supply (VPS) Oscilloscope (Scope) LabVIEW Required Components 1 k resistor (brown, black, red) 10 k resistor (brown, black, orange) IR LED/phototransistor module OR an IR LED and a separate Phototransistor
DC motor Small punch or drill Glue Optional: Several combs with varying numbers of teeth per inch
1. On the protoboard, insert the components shown in the Figure 10.2 circuit diagram.
Emitter +5V Detector
1k Gnd
10 k
+ To ACH4 -
In the case of an LED/phototransistor module, an internal LED is used for the optical source. Power it from the +5 V power supply through a 1 k current limiting resistor Then connect a 10 k resistor from the phototransistor emitter to ground and connect the same +5 V power supply to the phototransistor collector. The voltage developed across the 10 k resistor is the phototransistor or tachometer signal. 2. Connect leads from the 10 k resistor to the AI 0+ and AI 0- pin sockets. 3. Select Scope from the NI ELVIS Instrument Launcher strip and select the settings, as shown in Figure 10.3.
Figure 10.3. Tachometer Signal Viewed on the Oscilloscope 4. Power on the protoboard and run the oscilloscope SFP. 5. Pass a piece of paper through the IR motion sensor. You should see the oscilloscope trace change (HI-LO-HI). With a narrow piece of paper, you might catch the pulse generated as you drag it through the sensor. 6. Optional: Place a comb with many teeth in the sensor IR beam. Dragging it through the sensor generates a train of pulses. You can even run it back and forth like a saw to generate a continuous stream of pulses as shown in Figure 10.3. It is interesting to try combs with different sizes and numbers of teeth. Each comb generates its own signature waveform. End of Exercise 10.2
1. Cut a 2 in. diameter disk from a piece of thin but sturdy cardboard or plastic. 2. Cut a slot about 0.25 in. wide and 0.25 in. deep near the circumference of the disk. 3. Punch or drill a small hole at the center point. 4. Glue the disk to the end of the motor shaft. 5. Mount the motor so that the slot lines up with the IR transmitter/receiver beam. In operation, each revolution generates one pulse.
Emitter +5V Detector VPS+
1k Gnd
10 k
+ To ACH4 -
Gnd 12 V DC Motor
NOTE: You can also use the CD and motor of Lab 6. Instead of a small magnet triggering the sensor, you can drill a hole about the size of the transmitter/receiver beam (3 mm) near the edge of the CD. Align the IR sensor so that the beam passes through the hole.
4. Read the pulse frequency (Freq:) from the measurement row CHO Meas: at the bottom of the oscilloscope screen. Take frequency measurements for a variety of power supply levels. A plot of frequency versus VPS voltage level demonstrates the linearity of your rotary motion system. 5. Close NI ELVIS and all SFPs. End of Exercise 10.4
You can convert the period measurement to revolutions per minute by inverting the period to get frequency and multiplying by 60 to get rpm. For scaling, divide by 1000 to get krpm.
NOTE: You can also use the Express template for Timing and Transitions Measurements and get the frequency directly. Then convert the frequency to rpm as discussed above.
Figure 10.8. kRPM Measurements using an Express VI Launch the LabVIEW program RPM.vi. Open the Block Diagram window and study the program. NOTE: This LabVIEW program is configured to connect toDev1 for your NI ELVIS workstation. If your device is configured to another device name, you need to rename your NI ELVIS workstation to Dev1, in Measurement and Automation Explorer (MAX) or modify the LabVIEW programs to your current device name.
Figure 10.9. Block Diagram of program RPM.vi Use the DAQ Assistant to collect 1000 V samples for the tachometer graph and provide an input signal array for the Pulse Measurements.vi. The rpm signal is sent to a front panel meter and displayed in krpm. The rpm signal also goes to a shift register with five elements. This provides an averaged rpm signal for the front panel. You manually control the motor speed with the front panel knob labeled Setpoint. Also available on the front panel is a graph of the tachometer signal as a function of time.
Run this VI and take your motor for a spin. See and hear how responsive the motor is to a rapid change in the rpm setpoint.
Figure 10.10. LabVIEW Tachometer and Motor Control Circuit Front Panel End of Exercise 10.5
If you are more familiar with control, you can use another VI (PID Autotuning.vi) to set the initial PID parameters automatically. Then you can fine-tune the parameters to your specific system. Search for additional LabVIEW PID resources at http://www.ni.com.
Figure 10.12. Setpoint (yellow) and RPM (red) Traces show Optimal Control PID in Action
In Figure 10.12, the setpoint (yellow trace) is changed suddenly from 3300 to 4500 krpm. The system rpm (red trace) responds by moving the motor speed smoothly and optimally from the current setpoint to the target setpoint.