Introduction: Project 1.2

In this exercise, we will control a fan's speed using a potentiometer.

For this lab exercise you will need:

1 Arduino Micro-controller

1 Breadboard

1 Transistor PN2222

1 Diode

1 220 Ohm Resistor

Jumper Wire Pack

Step 1: Connect the Fan

At this point you should have all of the required materials for the exercise.

Begin by connecting a jumper wire from your 5V pin into the power rail and continue by connecting a wire from the GND pin to the ground rail (-). To continue this process, the resistor will be placed connected to pin 9 and to the middle prong of the transistor. The transistor's left side will be grounded, and the right side will be connected to the ground portion of the DC motor. Also, the diode will be connected to the same ground rail as the dc motor and it will also be connected to the power rail on the opposing side. Using this setup, we will control the amount of energy sent to the DC motor at any given time.

Step 2: Add the Potentiometer

At this point the DC motor should be connected to the Arduino properly. We will now add the potentiometer. Connect analog pin 2 to the back side of the potentiometer. Furthermore, connect the ground rail and power rail to the correct positions on the potentiometer.

Step 3: Input Source Code

At this point everything should be connected and ready to go. I have attached source code below. The DC motor should be controlled with the potentiometer. As the analog input increases, so does the speed of the fan.