ME 445 – Lab 3 part 2: Basic DC motor control Objective: As mechanical engineers, motion control is one of our most common uses of mechatronics. We will frequently use DC motors to produce motion; however, the task of controlling these motors is made more difficult by several details which you will look at in this lab. 1) DC motor control with a single transistor Using a single MOSFET transistor and a flyback protection diode, create a driver circuit that can run a Lego motor in one direction at different speeds. Note that the black and white wires on the Lego wiring harness control the motor. We will talk later about what the other wires do in a later lab, but leave those unconnected for now. Use the +5V supply on your breadboard for this driver. Read the output of a potentiometer in to your Arduino and use that value to control the speed of the motor. Report: What is the voltage across the motor terminals while the motor is running at full speed? Is the voltage across the motor terminals a function of motor load? If so, describe the variation you observe. The flyback diode prevents damage to your circuits from inductive spikes. Explain in detail where these spikes come from and how the diode reduces their magnitude. Would you need a flyback diode if you were controlling a solenoid with this circuit? Explain. If you use a 50 percent duty cycle signal to control your motor, what do you expect will be the average voltage across the motor? Do a quick experiment with the Arduino and report the actual voltage across the motor when controlled with a 50 percent duty cycle. Why are these two numbers different? Look at the voltage across the motor with you PMD-1208 to get some insight into the problem. Report: Include a well formatted figure showing the voltage across the motor with a 50 percent duty cycle used for control. 2) DC motor control with an L293D chip Connect a Lego motor to an L293D chip for bidirectional control as shown on the left side of the diagram on the next page. Use +5V for logic control VCC1. Use +5V for motor power VCC2. Connect motor leads directly to pins 3 and 6. You do not need to connect the four clamp diodes on either side of the motor. They are included in the L293D chip. Verify operation manually using +5V and GND as inputs to ENABLE pin 1, CCW pin 2 and CW pin 7. Note that inputs 1, 2, 7, 9, 10 and 15 have internal pull-up resistors and default to HI for no connection to them. After you have verified operation, connect CCW pin 2, CW pin 7 and ENABLE pin 1 to Arduino PWM outputs. There are two different ways to control motor speed and direction. First, you can set the CCW and CW pins as described in the datasheet and use the enable pin to control speed. Second, you can leave the enable pin HI and do PWM on either the CCW or the CW pin while setting the opposite pin LO to control speed and direction. Create two functions (one for each control method) in Arduino that take as an input a number between -100 and 100 and set the duty cycle of the motor as the absolute value of the input and the direction based on whether the input is positive or negative. Now using each of the control methods, send a command signal with a 50 percent duty cycle and measure the voltage across the terminals of the motor. page 1 of 3 ME 445 – Lab 3 part 2: Basic DC motor control Report: Include a well-commented and organized version of your two motor control functions as described above. Report: Include two well-formatted figures showing the voltage across the motor with a 50 percent duty cycle for both modes of control. Save your L293D code as you will need it again for lab 5. L293D Report: What is the maximum allowable voltage and current for the L293D? What was the mean voltage across your motor when you used a constant 5V signal on the enable pin to control speed? What was the mean voltage across your motor when you used a 50 percent duty cycle on the enable pin to control speed? What was the mean voltage across your motor when you used a 50 percent duty cycle on either CW or CCW with the enable pin high? Why is the mean voltage with a 50 percent duty cycle different for the L293D’s two modes of operation? Which value more closely matches your expectations? Provide some data to explain any effects in your explanation. Describe why you would or would not use a 754410 chip to replace an L293D in terms of functionality, speed, power and reliability. page 2 of 3 ME 445 – Lab 3 part 2: Basic DC motor control Troubleshooting question: Pick the biggest problem you ran into while working on this lab and describe the problem in your report. Also provide the steps you followed to solve the problem. Think about how you could have determined what the problem was as quickly as possible and write about a method you would use to diagnose similar problems in the future. If you didn’t run into any problems, you write about what you think could have been a major issue. page 3 of 3