How To Make a Dimmer for a Light Fixture w/ High-Powered LEDs
With the following parts, including some aluminium and walnut I made an LED lighting fixture with a PWM dimmer switch.
The code at the bottom will run on any arduino, although I used a 5 volt Adafruit trinket running at 8 mhz to control the switching on the transistor.
LED Lighting Fixture Parts - (Affiliate Links)
- Adafruit Trinket - http://amzn.to/1UPAyYx
- LEDs - http://amzn.to/1KdHh91
- Voltage Booster - http://amzn.to/1UPAkR2
- Pigtail Connectors - http://amzn.to/1KdHwAU
- Heat Sinks - http://amzn.to/1UPAp7k
- Thermal Adhesive - http://amzn.to/1KdHAAH
- AC/DC Adapter - http://amzn.to/1UPACYb
- Circuit Board - http://amzn.to/1UPAR5z
- Tip31 Transistor - http://amzn.to/1Rm84aS
Arduino-Based Dimmer Code for the Light
const byte potIn = 2; // reads the value from the potentiometer const byte ledOut = 0; // assigns the output to pin #0 on the trinket int potValue; int ledValue; void setup() { pinMode(ledOut, OUTPUT); } void loop() { potValue = analogRead(potIn); // reads value of the potentiometer ledValue = map(potValue, 0, 1024, 0, 255); // assigns a number relative to the voltage output analogWrite(ledOut, ledValue); // outputs a voltage number to the led }