Building an Arduino powered LED lamp


A while ago my dad acquired a large ceramic egg full of holes and a heavy metal stand from a garage sale. His idea was that these two items could be combined to form a lamp. Clearly this called for an Arduino project.

A ceramic egg

A ceramic egg

The metal stand

The metal stand

Egg and stand combined

Egg and stand combined

Development

Initially, I used an Arduino Nano without attached headers, soldering the wires directly to the Nano and components. This caused some issues as it made it more difficult to add new features later, mostly due to doing fiddly soldering without a clamp.

Given that the internals will be out of sight most of the time, I redid it with an Arduino Nano with headers attached and jumper cables for connecting components. This looks messier but makes it far easier to modify. Some parts have a female header plug on one end and the other end soldered onto the component, mostly because I wanted to reuse the components from the soldered attempt.

The LED modules by themselves did not result in a great effect as the light intensity varied too much depending on how the viewer was positioned relative to the lamp. To spread the light more evenly a diffuser was called for. I remember reading somewhere that an ping pong ball makes an excellent diffuser. One visit to a $2 shop, and a packet of ping pong balls was mine. Drilling a hole to insert the LED through worked well for mounting, but the colours were not evenly distributed when looking down on the LED. See the image titled “Colour banding”. There are many articles describing how to improve the diffusion of LEDs, such as this article.

Initial LED module, and with diffuser.

Initial LED module, and with diffuser.

Colour banding

Colour banding

I ended up changing the LED modules I was using to a different LED design. The second LED module is brighter and has an even colour, as you can see in the image titled “Second module with diffuser”. The LED appears very blue in the picture, but it is showing white, the same as the LED in the “Colour banding” image.

Second LED module with ping pong ball diffuser

Second LED module with ping pong ball diffuser

Second module with diffuser

Second module with diffuser

Once the basic design was working, I looked through my parts box to see new features could be added. A motion sensor was considered, intensifying the light of the lamp the closer you got. There were some practical difficulties with sensor range so this idea was dropped.
The next obvious candidate was an IR receiver. Because clearly you need to be able to control your lighting fixtures from the other side of the room. It is a handy interface for controlling the various lighting effects.

The final wiring diagram can be seen below.

Wiring diagram for the lamp - created with fritzing

Wiring diagram for the lamp - created with fritzing

I did think about creating a scaffold for the LED modules within the egg but it proved unnecessary.

Parts

The parts list for the final version of this project is pretty simple. The only parts I had to order were the RGB LEDs. Note that the links to parts are to show the part only, I haven’t used any of the linked stores.

The parts look rather a mess in the photo, but it doesn’t matter once they are installed in the lamp.
Shrink wrapping the IR receiver leads in white helps hide it as it needs to be mounted on the outside of the lamp.

The stand is just the right size to contain the battery pack and the arduino.

The stand is just the right size to contain the battery pack and the arduino.

Code

The initial code I wrote for the LED effects was a mess. I tidied it up and extracted it into a library called RGBEffects. See Introducing RGBEffects: An RGB LED effect library for Arduino for a detailed dissection of the library and its capabilities. I make no claims to the quality of the library, it probably uses far more memory than it needs to but it does work. The effects available include a solid colour, looping through a set of colours, transitioning between two points in a colour cube1, and fading in and out between colours2.

IRLib provides the IR command decoding functionality. It was simple to use and has been reliable. To obtain the IR codes for my remote, I used an example that came with IRLib.

Most of the logic in the lamp code is for dealing with IR commands. The remote can be used to increase or decrease the time between colour updates, pause the colour changes, as well as selecting a specific effect.

In Action

In the dark

In the dark

In brighter surroundings

In brighter surroundings

Footnotes