TCS Pune

Closed-Loop DC Motor Speed Controller

Embedded Project Builder

Closed-Loop DC Motor Speed Controller

A guided Advanced practical covering design, wiring, firmware, measurement, troubleshooting and documentation.

Problem statement

Design and validate Closed-Loop DC Motor Speed Controller. The completed prototype must start safely, produce repeatable measurements, report faults and include recorded evidence.

System design

Circuit & Wiring Studio

Exact target required

Drag components. In Connect mode, select one pin and then another pin.

Rich media learning

Print lab worksheet

Instructor media is being prepared for this project.

Project execution and evidence

Log in to start this practical, save readings and submit evidence.

Log in to start

Recommendations & learning path

Bookmark project

Advanced project: complete at least three beginner/intermediate practicals first.

Equivalent and related projects

Components required

ComponentQtyNotes
Development board (Arduino)1Verify exact model
Breadboard and jumper wires1Prototype only
Sensor/module/load set1Project dependent
Regulated power supply1Current limiting preferred

Pin-connection table

Controller pinConnected deviceDevice pinVoltage / notes
GPIO/ADCInput moduleSignalMatch logic voltage
UART TX/RXDebug adapterRX/TX crossedCommon ground
VCC/GNDRegulated supplyPowerConfirm polarity before power

Project files

Source-code files

Instructor file pending.

PCB and Gerber files

Instructor file pending.

Enclosure design files

Instructor file pending.

Target-specific program

Toolchain: · Language:

const int PWM_PIN=5,DIR_PIN=4;
void setup(){pinMode(PWM_PIN,OUTPUT);pinMode(DIR_PIN,OUTPUT);Serial.begin(115200);}
void loop(){digitalWrite(DIR_PIN,HIGH);for(int duty=0;duty<=255;duty+=15){analogWrite(PWM_PIN,duty);Serial.println(duty);delay(150);}analogWrite(PWM_PIN,0);delay(1000);}

Testing and observations

  1. Install the exact board support package and select the correct target.
  2. Create a new project and add only the documented dependencies.
  3. Compile before connecting external hardware.
  4. Wire with power disconnected and verify continuity/polarity.
  5. Upload through a known data cable and open Serial Monitor at the configured baud rate.
  6. Run subsystem tests, then integrate one module at a time.
TestExpectedInstrumentAcceptance criteria
Controller supplyNominal board rail±5%DMM
GPIO LOWNear 0 V<0.2 V typicalDMM/scope
GPIO HIGHLogic railWithin datasheet VOHDMM/scope
Load-event railNo brownout dipBoard specificOscilloscope

Viva questions

Why is supply margin required?

Loads and radios can draw transient current above their average.

Why must voltage limits be checked?

Excess pin voltage can cause injection current, malfunction or permanent damage.

Why test subsystems separately?

It isolates faults and produces traceable evidence.

Prototype safety

Verify voltage, polarity, GPIO limits and isolation before power-up. Use current limiting and disconnect power before wiring changes.

Guided practical

Complete learning and build guide

Advanced6–10 hoursMotors, relays and robotics

Objective

Design and validate Closed-Loop DC Motor Speed Controller. The completed prototype must start safely, produce repeatable measurements, report faults and include recorded evidence.

Required knowledge

  • GPIO and electrical limits
  • Reading a schematic and pin table
  • Compiler, upload and Serial Monitor use
  • Multimeter safety and measurement uncertainty

Power and current calculation

Calculate total current before wiring: controller + sensors + display/communications + actuator peak current. Add at least 25% supply margin. Never power a motor, relay coil or high-current load directly from GPIO. Measure the regulated rail during the highest-load event.

Libraries and build procedure

Libraries: Board support package for Arduino, Only libraries explicitly required by the selected sensor/module, Use pinned, documented library versions

  1. Install the exact board support package and select the correct target.
  2. Create a new project and add only the documented dependencies.
  3. Compile before connecting external hardware.
  4. Wire with power disconnected and verify continuity/polarity.
  5. Upload through a known data cable and open Serial Monitor at the configured baud rate.
  6. Run subsystem tests, then integrate one module at a time.

Complete source code

const int PWM_PIN=5,DIR_PIN=4;
void setup(){pinMode(PWM_PIN,OUTPUT);pinMode(DIR_PIN,OUTPUT);Serial.begin(115200);}
void loop(){digitalWrite(DIR_PIN,HIGH);for(int duty=0;duty<=255;duty+=15){analogWrite(PWM_PIN,duty);Serial.println(duty);delay(150);}analogWrite(PWM_PIN,0);delay(1000);}
SectionExplanation
Pin definitionsCentralise hardware mapping so board changes are controlled.
setup()Configure safe initial outputs, communications and peripherals.
loop()/tasksSample inputs, update state and report results without unsafe output transitions.
Fault handlingDetect invalid readings/timeouts and force a defined safe state.

Expected Serial Monitor output

TCS V2.1 project start
self_test=PASS
supply=OK
state=RUN
reading=stable
PointExpectedToleranceInstrument
Controller supplyNominal board rail±5%DMM
GPIO LOWNear 0 V<0.2 V typicalDMM/scope
GPIO HIGHLogic railWithin datasheet VOHDMM/scope
Load-event railNo brownout dipBoard specificOscilloscope
SignalTest pointReference
Heartbeat/GPIOConfigured output pinClean logic transitions at programmed period
Serial TXUART TX pinCorrect baud, idle HIGH and valid frames
PWM/clockSelected timer pinFrequency and duty match firmware

Troubleshooting decision tree

SymptomCheckCorrective action
Board not detectedUSB data cable, driver and power LEDReplace cable/port and select correct board
Upload failsBoot mode, port and programmerEnter bootloader and correct target settings
Reading fixed at zero/full scalePin map, ground and referenceCorrect wiring and ADC configuration
Random resetsSupply ripple and reset reasonImprove regulator/decoupling and remove load from GPIO
Communication timeoutLogic voltage, address/baud and pull-upsLevel-shift and correct protocol settings

Extension challenges

  • Replace blocking delays with a state machine.
  • Add timestamped fault history and recovery counters.
  • Measure actual power consumption and calculate battery life.
  • Add configuration validation and factory reset.
  • Create a production self-test mode.

Project-report guidance

Include the problem statement, block diagram, schematic, BOM, pin table, power budget, firmware version, test instruments, expected versus measured results, fault log, photographs, conclusion and proposed improvements.

Ready when you are

Need help with your laptop or computer?

Send us the model and fault details. Start your repair request online or contact TCS Pune directly.

WA