This is an old revision of the document!


13 | DC Motor

DC motors rotate when current is applied and are commonly used in a wide variety of applications from robot wheels to cooling fans. In this example we'll learn how to turn a motor on and off, and then use PWM to control the motor speed.

Prerequisites

Hardware


Parts List
  • Sparkfun RedBoard

  • 1x DC Motor
  • 1x NPN transistor
  • 1x 330 Ohm Resistor
  • 1x Diode 1N4148
Circuit Schematic

Software

Procedure




  • Open the LINX - Digital Write 1 Channel example from the LabVIEW Example Finder.

  • Select the DO channel connected to the transistor.

  • Run the VI, and toggle the motor on and off using the LED control on the VI front panel.

  • Modify the VI to use PWM to control the motor speed.
Challenges
  • Use the pressure sensor as an accelerator to control the DC motor speed.
  • Use the DC motor as a fan and automatically set the fan speed based on temperature.