Toy SMPS or an Overkill White LED Driver
Jonathan Westhues site of Intriguing Projects include A Test Instrument for HF/LF RFID and a compiler that starts with a ladder diagram and generates native PIC16 or AVR code.
Toy SMPS or an Overkill White LED Driver
I sense the load current and control the duty cycle. The PWM pin on the AVR drives the gate of the FET through a couple of BJTs. Note the absence of any input capacitance; Vin looks terrible but it works. The micro power supply section is isolated with an RC.
delabs Notes
This is a nice way to start, learn uC and Power electronics in one go. It does not matter if it an expensive solution for LED Lighting. It certainly is an excellent Educational Project.
It may also be useful to use Intelligent Systems (uC and Firmware) to monitor and manage LED Arrays and control their brightness and color. Large Arrays can be Interfaced to PC by XBee for Home/Office or Factory Lighting Automation and Energy Consumption Optimization.
uC Real World Interface
uC I/O is Keyboard and LCD when you Build a calculator or a Text/Morse Communicator. When you control a motor it is Drive/Speed and Direction for Motor and Tacho or Opto Counters for Feedback. In both cases you have Input and Output which is Logic or Analog which has to reach the CPU.