Simple Control Experiment

Flying Lunchbox
Simple Control Experiment
Control Experiment - Top View
Control Experiment - Top View

This is a simple, low cost experiment using easy to obtain materials that demonstrates closed-loop feedback control. It takes encoder input for vane angle and uses PID control to regulate a PWM signal applied to a power transistor connected to a DC motor that spins a fan blade. A set point is entered to command the motor to hold a specific vane angle. If improper gains are selected, the vane will bounce and not hold set point. With proper control, the vane will smoothly hold set point despite disturbances in air flow, or box pitch. The vane can be pushed or pulled resulting in speedup or slow down of the fan.
If you are signed in, there are downloadable VisSim diagrams to control this experiment using TI MSP430, LF2407, F2812, and F2808 at the bottom of this page.

There is also a diagram "fanSimFx.vsm" that includes a full nonlinear model of the plant in the loop with a fixed point model of the controller. The vane effective cross sectional area varies with the cosine of the vane angle, and vane restoring torque due to gravity varies with the sin of the vane angle, not to mention the turbulence of the air flow used to set the vane angle.

Fan+Vane - Plant Model
VisSim diagram of fan-vane plant

Bill of Materials for Fan experiment

  • Box - Sterilite -Wal-Mart
  • 1/4" dowel - Home Depot
  • Encoder - US Digital S4-256-B Tel: 800-736-0194
  • Propeller (Cox 994 - 3 blade - around 2.5" radius) - Hobby Shop
  • Motor - High Speed 12VDC - Radio Shack
  • Pipe Hanger for 1" pipe 6" long - Home Depot
  • Machine Screw 10/24 x 1/4 Round head - Home Depot
  • Nylon Lock Nut #10-24 - Home Depot
  • TIP120 Darlington - Radio Shack
  • Heat Sink TO220 - Radio Shack
  • Screw/Nut/washer to attach TIP120+Heatsink to box - Radio Shack
  • Coaxial DC Power Jack 5.5mm O.D 2.1mm I.D. - Radio Shack
  • 3.5mm Mono Audio Jack (for control signal) - Radio Shack
  • 3/8 O.D. 1/4 I.D. Vinyl Tube (to attach 1/4 dowel to encoder) - Home Depot
  • 1K resistor (from control plug + to left leg of darlington) - Radio Shack
  • 10K resistor (from control plug GND to left leg of darlington) - Radio Shack
  • 10uF Capacitor across PWR and GND of Coaxial DC Power Jack
  • 2x .05 uF Capacitors across encoder A/B signals and GND
  • Diode 1N4003 (across leads of motor) - Radio Shack

Cables From Controller to Box

  • 40 Pin Ribbon cable (34 Pin if connecting to EVM)
  • Cable for encoder - DA-3286-6FT US Digital
  • Control wire - cable with 3.5MM Jack - CAT# CB-361 All Electronics Tel: 800-826-5432 or

Power for Fan Motor

12V 1Amp AC-DC adapter (Can be 9 - 15v)


  • Cut out front and back. (router bit on a Dremel tool works best. A knife tends to crack the plastic) Save the plastic cut outs for later use as the paddle
  • Drill holes for dowel to hold vane - (a Dremel boring bit works well)

  • Place the dowel pivot holes about 1/2 inch from top and front. Make sure the holes for the encoder and dowel line up so paddle will be level and swing smoothly.

  • 3/8 - hole for encoder - boring bit

  • 1/4 - hole opposite encoder to hold dowel - boring bit
  • 1/4 - hole for control plug - boring bit
  • 7/16 - hole for power plug - boring bit
  • 1/8 - hole for heat sink
  • 3/16 - holes for motor mounting - I try to position so motor will be centered in box - use the pipe hanger to help position holes


  • Solder wires to the power transistor then mount and soldering to other components. Right leg of darlington (seen from top with legs pointing down) to ground of power plug and ground of control plug.
  • Middle leg of darlington to one leg of motor Left leg of darlington to control plug. Solder resistors to wire with 1K resistor to control and 10K resistor in to ground.
  • Power lead of power plug to one leg of motor NOTE: Wait to solder the leads and diode to the motor until experiment is ready. Then attach by hand to figure out which way spinning the motor to properly blow air to push the paddle.
  • Attach the propeller to motor. If the diameter of the motor shaft must be increased, speaker wire insulation can be pushed over the shaft of the motor gives the diameter (almost) needed to hold the propeller. I also add a couple of thin strips of electrical tape to the after adding the insulation. Push the propeller over the motor shaft.

Motor mounting

Bend the pipe hanger about 2.25" down from where base of motor would be held. You don't want propeller to hit base or top of box.
Attach pipe hanger to base using the 10/24 screws and lock nuts - Have the bend located at the box center.


Trim one of the cutout pieces so it will easily fit through the hole. Glue to 1/4 dowel with hot glue gun. (cut to mate with encoder shaft and poke out other side of box) Attach to dowel to encoder shaft using about 1" of clear plastic tubing.

Wiring from DSP card to box

For eZdsp use a 40 pin ribbon cable. One end will have a standard IDE connector to fit onto board, the other end must be modified to connect to fan experiment. Use sharp blade to separate the wires used in the ribbon cable for about 1.5 inches. Strip wires and solder according to the pin number from the table below. I find it easiest to wire the capacitors first.

eZdsp/EVM Pin table

WIRE/LEAD LF2407EVM 2407/2812 eZdsp 280X eZdsp
Orange 1 (Vcc +5V) 1 1
Blue 21 (Cap1) 6 6
BlueStripe 22 (Cap2) 7 7
OrangeStripe 34 (Gnd) 20 20
Capacitor1 17,21 6,20 6,20
Capacitor2 22,18 7,19 7,19
Control Cable:
+ve 12 (T1PWM) 15 9 (EPWM1A)
-ve 4 (GND) 20 20

*Control Cable +ve is inside wire, -ve is outside shield wire

Contact us to obtain these pages for use at your school.