Friday, October 18, 2013

Dimmable LED Street Lights

Leave a Comment
What's a city play mat without street lights? These model train set street lights I purchased from eBay arrived and I incorporated them into the previous "Potentiometer Controlled LEDs" circuit.
One complicating factor is that these LEDs operate on 12 Volts. Technically, it's the LED together with the attached 400 Ω resistor that requires 12V. Each LED also draws about 20mA of current, and a simple calculation using Ohm's Law (Voltage = Current x Resistance) yields the result that the resistor consumes about 8V leaving 4V for the actual LED itself. So if I had a 4V power source then I could cut off the resistor completely and power just the LED by itself, but since I already have a 12V power source ready I decided to just stick to "stock." Also, I plan to string together 10 of these street lights together, which would draw far more current than the max 40mA that each digital output pin on the Arduino is capable of. So an external power supply would be necessary anyway.

Transistors

However, the inclusion of an external power supply requires using a transistor in order to interface with an Arduino. This adafruit tutorial gives a great basic lesson on transistors. Essentially, the transistor acts as an electronic switch that allows a small current flow from the digital output of the Arduino to "switch on" a much larger flow of electricity (provided by the external power supply) through the circuit loop that the LEDs are connected to.
By Simon Monk, from http://learn.adafruit.com/assets/2348


Here is the complete circuit showing how the PN2222 transistor and the potentiometer are connected to control the LEDs, powered by the external 12 Volt power supply:
The Arduino sketch is the same as the earlier "Potentiometer Controlled LEDs," with analog input A1 reading the potentiometer and then translating that input to a PWM signal through digital pin 3.

Below are a couple pictures of the messy, but working prototype for this circuit.

Debugging

It actually took quite some time to get this circuit to finally work, and again a multimeter was invaluable in the debugging process. First, the multimeter helped me determine that my power supply (which was a 12 Volt "wall wart" that had the adapter end cut off, leaving separate + and - wires) went against convention and had the striped wire as negative, opposite to what I had determined with a quick Google search. But the LEDs still wouldn't light, so using the multimeter I was able to determine that proper signals were coming out from the Arduino.

The LEDs also lit up when I connected the power supply to them directly. I then remembered that I needed to have the all the components tied to a common ground, and one extra jumper from the GND pin of the Arduino to the breadboard pins that the negative wire of the power supply was connected to completed the circuit and the lights were able to be dimmed and controlled by the potentiometer.

Next step, actually mounting these lights to the play mat and wiring it up more neatly!

Additional References:

bildr >> High-Power Control: Arduino + TIP120 transistor

0 comments:

Post a Comment