Introduction: Dimming Pumpkin

About: Learn something new everyday

I got the schematic for this project online.

A transistor is used with Arduino to dim a strip of white SMD LEDs. The timing can be changed by programming the Arduino. A transistor can be used either as a switch or as an amplifier. In this application, its used to slowly amplify voltage from 0-12V and gradually back to 0V in a set amount of time. The transistor used here is a TIP120 from Fairchild, which is perfect for Arduino and this application because the Emitter-Base voltage is 5V. Basically this voltage acts like a tap and modulates the input voltage, in this case its 12V-0V.

Arduino can give PWM (Pulse width modulation) from 0-5V , which in the program in the Arduino IDE is 0-255. The rate of change isn't perfectly smooth, but it will do.

Just remember, the current adds up as you add more LED. A typical 5 meter strip can run up-to (60ma X 150) which is 3 Amperes! Luckily the TIP120 can deliver upto 5A but the chip runs quite hot(about 80 degrees). I was only using 1A, so there was no problem there. I used a 20AWG wire (basically jumper wires) and they are rated to take at least 5A ,so that's safe.

For a 12V source , I used my lead acid battery. Make sure the leads don't make contact in the breadboard. Otherwise there will be lots of sparks and melted plastic.

Step 1: Arduino Code

You can tinker with the timing setup here to your level of spookiness. But this worked for me!

const int transistorPin = 9; // connected to the base of the transistor
void setup() { pinMode(transistorPin, OUTPUT); }

void loop() {

for (int brightness = 0; brightness < 255; brightness++) { analogWrite(transistorPin, brightness);

delay(5); }

delay(5);

for (int brightness = 255; brightness >= 0; brightness--) { analogWrite(transistorPin, brightness); delay(20); }

delay(2000); }