$30.00 $24.00


You'll get a: . zip file solution : immediately, after Payment



Precise control of the speed of a D.C. motor requires that one be able to accurately measure the speed so that corrective action can be taken if the speed is not the desired value. The D.C. motor used in this lab contains a tachometer that produces a sinusoidal signal as the motor rotates. The frequency of this sinusoidal waveform is proportional to the speed of the motor. The objective of this week’s lab is to convert the signal produced by the motor’s tachometer to a voltage whose value is proportional to motor speed. This will be done by converting the tachometer signal to a digital square wave, and then measuring its period with one of our timer/counter channels.

12 v dc




9 v Power







Figure 9.1. D.C. Motor Speed Controller Block Diagram


Refer to the lecture slides for this lab for a description of the ac tachometer on the Buhler motor.


Given that there are only 8 pulses produced by the tachometers on the Buehler motors per revolution of the motor, the frequency of the tachometer signal will be difficult to measure with acceptable resolution at the sampling rates required for subsequent experiments. Therefore, the “period-measurement” procedure should be used.

Refer to the lecture slides for this lab for a description of signal conditioning circuits and programmable timer setup for measuring signal periods. Note that we will use timer TIM11 for this measurement, since TIM10 is being used to generate the PWM signal that drives the motor.


ELEC 3040/3050 Lab Manual


The hardware for this lab requires the addition of the LM311 comparator to the previous lab setup, along with either a constant source or potentiometer to set the reference voltage. If there is a DC bias in the tachometer signal, then a high pass filter will be needed to remove it. The LM311 comparators will be provided in lab. There will be a variety of resistors and capacitors available in the lab in the event that your computed values do not produce acceptable results. As before, each team must have hardware and software designs ready to wire and test at the start of lab, so that lab time can be used for construction and testing.

Prior to building the circuit, it is recommended that you model and simulate the circuit in PSPICE, to verify the circuit and your choice of component values. In this simulation, model the tachometer as a “VSTIM” (voltage stimulus) source, and select the LM111 comparator component (same as LM311, except for rated temperature range.) Verify that the comparator output is a square wave with frequency equal to that of the tachometer signal.

After constructing the circuit, use the oscilloscope to ensure that the comparator inputs and output match the signals in your simulation. Then connect it to your timer input pin.

The software from the previous lab should then be modified to enable the TIM11 input capture mode to measure the period of the waveform.

NOTE: Circuits can be destroyed during these tests, just as easily as in the previous weeks! This chip can be protected by continuing to practice careful design and by observing the guidelines given in the previous lab write-ups.


  1. Prior to the start of lab, it is recommended that you design, model and simulate your comparator circuit in PSPICE, verifying that the circuit produces a square wave with frequency equal to that of the tachometer signal. In your lab notebook, include your circuit and a printout of the square wave produced by the simulator.

  1. As before, you will need to design experiments to test your hardware. Prior to the lab, design and write a test procedure in your lab books, as well as entering any component calculations.


  1. During the lab period, be sure to document each experiment in your lab notebook, and summarize the most significant ones in your report.


ELEC 3040/3050 Lab Manual

  1. Construct the comparator circuit and test it prior to connecting it to the microcontroller. Verify that the circuit produces the desired square wave frequencies over the entire range of motor speeds. (Capture and display the tachometer output and square wave on the oscilloscope.)

  1. If you wish to test your comparator circuit without the motor, you may use one of the EEboard “arbitrary waveform generators” (AWGs), in the ANALOG block at the bottom of the board. These are set up and controlled via the Waveforms WaveGen instrument.

  1. Connect the tachometer signal to the microcontroller and run your application program, measuring the tachometer signal period for each of the seven switch-selectable speeds over the motor’s operating range.

  1. Plot the measured period as a function of the duty cycle of the PWM signal used to drive the motor at these different speeds, relating observed speed to the timer control parameter(s) used in the control program.


  1. Briefly describe the circuit (but not “wire by wire”) and attach a circuit diagram. If you made changes to the test program from that used in the previous week, you should describe the changes and attach a copy of the revised program. Make sure your program includes descriptive comments.

  1. Discuss your results, including plots of comparator output frequency vs. measured speed, and measured tachometer signal period vs. PWM signal duty cycle.