An Arduino powered LED lamp based on WS2812 LEDs. It consists of a circular cylindrical LED matrix encased in a glass jar with defusing material inside to spread the light and give it a softer look.
The given lamp.ino
only loads one effect at a time. You need to
change which effect is imported in that file and recompile to change the shown
effect. Some effects are declared in the effects folder, but the
code is designed to make it easy to add your own effects.
The size of the matrix is defined in the effect definition. The given file defines a matrix of 14x16 LEDs, because that was the size my lamp could fit, but all given effects should scale pretty well to any reasonable size.
To compile and upload the code to the Arduino you need to:
- Download and install the Arduino IDE.
- Open the program and in
Tools > Manage Libraries...
install FastLED. - Open the
lamp.ino
file. - In
Tools > Board
andTools > Processor
select the correct Arduino model you are using. - In
Tools > Port
select the correct port where your device is connected to your computer. - Press the
Upload
button (the right pointing arrow). - C'est fini. As long as there was no error in the previous steps, the code should've been uploaded to your Arduino device.
Wiring should be relatively simple. From the Arduino Nano, pins GND
and VIN
should be used to supply power to the device, and any data pin (in this example,
D13
) should be connected to the DIN
from the first LED in the strip. Then,
use the same power supply to connect to pins VSS
and VDD
of the strip (aka
GND
and VCC
/VIN
/5V
, respectively). For other Arduino models, refer to
their pinouts
to know their correct connections (should be pretty much the same, but just in
case).
A detailed schematic is included in lamp.sch (a KiCAD schematic file), with the exact wiring for everything.
Depending on the size of the matrix, you might want to split the power input into multiple parts to avoid problems. Otherwise this could cause, for example, that the LEDs further down the line do not turn on because powers has dropped too far, or decreased brightness at the end of the strip. This is accomplished by instead of daisy chaining the power from one column to the next, to instead connect new wires coming straight from the power supply (the data wire should still be connected as usual).
Do not use the power of the Arduino itself to drive the LEDs except for really small cases (I'd say 20 LEDs tops, depending on brightness and RGB values), since that could overload its circuits. Instead, use and power both the Arduino and the LEDs that way (as detailed above).