Morse Code Christmas Lights Powered by an Arduino

Christmas Lights for the Kidnapped Tree.

This is a rather simple project, that uses an arduino to flash and pulse lights, the pattern of flashes and pulses can be used to signal Morse code messages.

In the days leading up to Christmas, while I was sitting in one of the camping chairs that make up the sole furnishings of my living room, I decided I needed a tree. Luckily I spied a wooden tree through the hole in one of my neighbour’s windows, I decided to borrow it. Getting into his house is quite easy, since he drove his car though his prefab wall one night when he came home drunk.

Bill of Materials

1x Arduino (Available at Sparkfun)
20x Red LED (Available at Sparkfun)
1x 100Ω resistor (Available at Sparkfun)
1x NPN transistor (Available at Sparkfun)
1x 1kΩ resistor (Available at Sparkfun)


The ciruit uses a NPN transistor as a low side switch. The transistor allows the arduino to provide more current and voltage. The Vin pin of the arduino can provide up to 1A, as opposed to the 40mA of the I/O pins. The Vin pin provides the same voltage as the Arduino is powered by, in this case it is using a 12V power supply.

The led chain is made up of a single LED colour, otherwise only the colour with the lowest voltage drop will be lit brightly. More chains can be added with a different colour each and the resistor values will need to be calculated accordingly. Many beginner tutorials suggest arranging LEDs in parallel to overcome the voltage drop in series, but this can cause diode current hogging.


Here is code use to control the lights, it is explained in the comments.


The following shows the process of calculating the values for the resistors used in the low side switch.

We want:
\(I_{L}=40mA\), the current will be the same in all LEDs in series.

We Know:
\(V_{CE}=0.2V\), transistor voltage drop when the transistor is saturated.
\(V_{L}=1.8V\), LED voltage drop.
\(I_{B}\ge\frac{I_{C}}{10}\), percent of current at base to cause saturation.
\(V_{pin 9}=5V\), Voltage from Arduino I/0 pin.
\(V_{BE}=0.7V\), Voltage drop over PN junction of transistor.

To find \(R_{B}\):
\(R_{B}=\frac{V_{R_{B}}}{I_{B}}\)\(=\frac{V_{pin 9}-V_{BE}}{I_{B}}=\frac{5-0.7}{4mA}\)\(=1075\Omega\approx1k\Omega\)

To find \(n\), number of resistors in series:

To find \(R_{C}\):
\(R_{C}=\frac{V_{in}-V_{CE}-V_{L}\times n}{I_{R_{C}}}\)\(=\frac{12-0.2-1.8\times6}{40mA}=\frac{1}{0.04}\)\(=25\Omega\approx27\Omega\)

Written on the 14th day of January in the year of our Lord two thousand and seventeen