arrow_backBack to Home
lightbulb
Week 3

LED Controller with PWM

Your first real synthesizable design that creates beautiful breathing LED effects using Pulse Width Modulation. This project marks the transition from simulation to actual hardware running on your Tang Primer 20K.

scheduleTime

3-4 hours including synthesis and testing

bar_chartDifficulty

Beginner-Friendly

codeCode

~120 lines

schoolWhat You'll Learn

  • check_circleHow PWM (Pulse Width Modulation) works at the hardware level
  • check_circleCreating smooth analog-like effects with digital signals
  • check_circleWriting synthesizable Verilog that runs on real silicon
  • check_circleConnecting your code to physical FPGA pins
  • check_circleUsing timing constraints for LED refresh rates
  • check_circleDebugging hardware with LEDs as output indicators

constructionWhat You'll Build

  • build_circleA breathing LED effect that smoothly fades in and out
  • build_circleMultiple LEDs with different breathing patterns
  • build_circleConfigurable PWM frequency and duty cycle
  • build_circleA reusable PWM module for future projects

settingsTechnical Details

Modules

pwm_generator.vled_controller.vtop.v

Key Concepts

Duty cycle controlCounter-based PWMPin constraintsClock dividers

Synthesis

Successfully fits in 50 LUTs on Tang Primer 20K

publicReal World Application

PWM is everywhere in hardware: motor control, servo positioning, LED dimming, power supply regulation, and audio synthesis. This fundamental technique is your first step into real-world hardware control.

checklistPrerequisites

  • arrow_rightChapters 1-3 completed
  • arrow_rightBasic counter understanding
  • arrow_rightVerilog syntax fundamentals

arrow_forwardNext Steps

Once you master PWM, you'll use this same technique in Week 5 for UART timing and in Week 9 for motor control signals.