Crystal Ball Lamp, part 3

—— The Electronics ——

In this post I’ll discuss the design of the electronics part of the Crystal Ball Lamp.

The lamp is controlled by an Arduino Mega microcontroller board.  I was originally going to use a less expensive Arduino Pro Mini.  It doesn’t provide enough PWM outputs for the nine LED channels I wanted to control, but I could do some multiplexing to get an approximate PWM signal to each of the channels independently; it would complicate the circuitry, but I could endure that if it saved enough money.  As I worked through the design, I began to get concerned about the small amount of RAM available on the ATmega328 used by the Pro Mini (2 KB), fearing that this would not be enough to run my lightshow programs for nine channels and be able to run a scaled-down graphical-user-interface through the oLED display (mostly just menus that a user scrolls through).  Furthermore, the Pro Mini only has one hardware serial port.  I wanted to communicate with two serial devices – the XBee module and the oLED display – so with the Pro Mini one would have to be handled through software, which would use even more RAM and slow down the performance of the whole device.  So with all these concerns, I just went ahead and splurged on the Arduino Mega.  It had more than enough PWM outputs for my nine channels, more RAM (8 KB), and more than enough hardware serial ports.

The electronics for this design will be discussed as four sections:

  • Nine-channels of LED control.
  • User-interface (oLED display, navigation switches, and button).
  • Temperature monitoring.
  • Wireless communication with my home’s sensor network.

A complete list of the parts used and schematics for the circuitry are given at the end of this post.  I’ll explain in words the basics and then you can refer to the schematics for the details.  Because of space constraints in the lamp, I broke the circuitry into mutiple boards – a main board that connects to the Arduino Mega and three boards, one for each “crystal ball”, that contains the driver circuitry for the LEDs and the temperature monitoring.

LED Control

The LEDs I’m using consume way less power than an incandescent bulb of similar output, but they still require much more power than can be supplied directly from the outputs of the microcontroller.  When fully on, each blue and green LED consumes about 2.4 watts (0.7A × 3.4v), while the red ones consume about 2.5 watts (0.7 A × 3.6v).  (approximately 22 watts total for all nine LEDs)  After playing around with various driver circuitry and searching for existing products that would do the job, I decided to use LUXdrive’s BuckPucks to drive the LEDs.  They provide a nice constant current output to the LEDs and are easily controllable from a microcontroller.

My circuit for controlling the LEDs is very much like Figure 13 in the datasheet for the 3021 BuckPuck:

Note that this means that the light is on when the output from the microcontroller is low, and off when the ouput is high; so it’s kind of backwards.  Once the microcontroller’s software is running, then it’s no problem, since the software can output highs just as easily as lows; but this does mean that the light will be on while the micrcontroller is starting up (since the pins’ outputs default to low).  If I were making another lamp, I would take the trouble to invert the microcontroller’s output in hardware.  Then the light wouldn’t flash on for a second whenever I first plug it in.

User Interface

For those times when I just want to turn the lamp on or off without getting bogged down by all the special features, I have a simple push button on the front.  Pushing it toggles between having all the LEDs on full power and having them all completely off.  To access the more complicated features (various static color settings, lightshows, etc.), there is a little screen with menus.  Users can scroll up/down and select menu items with a three-way navigation switch.  The display I’m using is an oLED screen from 4D Systems.  I used this because I had it on hand (I had purchased it for a different project and then decided not to use it there).  If I were purchasing a display specifically for this lamp, I probably would have gone with a cheaper LCD screen.  The display is controllable through a simple serial interface, so that just gets hooked up to one of the Arduino Mega’s hardware serial ports.  The button and navigation switch are connected to various digital inputs of the microcontroller.

Temperature Monitoring

Even though each LED consumes and dissapates only about 2.5 watts when completely on, they are so tiny that the heat buildup can be a concern.  My design doesn’t help since I wanted the crystal balls to be lit from below and I didn’t want light escaping from the top of each light tower, other than through the crystal ball, but this also effectively keeps the heat from escaping from the top.  Furthermore, for the center light, I have a narrow beam lens sitting on top of the LEDs, trapping the heat even more.  I mounted the LEDs on heatsinks and the walls of each of the light towers are made of aluminum, all of which helps to dissipate the heat.  While experimenting with my lamp, I found that, if on at full power in a room with an ambient temperature of 23 °C, after about an hour the temperature at the LEDs would level off to about 85 °C.  (side note: the temperature rise is not at all linear – when running at half power, the temperature would level off at around 40 °C.)  Heat can hurt the life of the LEDs.  The datasheet says that the blue and green LEDs will maintain 70% of their output after 50,000 hours if the junction temperature is kept below 135 °C; for the red LEDs, the junction temperature should be kept below 110 °C.  For my tests, I couldn’t measure the junction temperature itself but I mounted thermistors as close as possible to the LEDs so hopefully I was measuring something sort of representative of the junction temperature. 

So I probably wasn’t hurting the life of the LEDs with the temperatures I saw (knock on wood), but since I wasn’t really sure how much warmer the temperatures inside the LED junctions were, I was a bit concerned.  I also started checking the temperature specifications for the other parts near the LEDs and found that the plastic lens I was using on the center light might have trouble.  It doesn’t melt until around 160 °C, so no problem there; but if exposed to temperatures above 80 °C for long periods of time, it could get discolored or brittle.  So I decided that my microcontroller should also monitor the temperatures.  I mounted a thermistor on each RGB LED board as close as I could get to the red LED (since that seemed to be the least efficient and the one that would get hurt most by temperature).  These are connected to analog inputs on the microcontroller.  The software periodically checks the temperature.  If any of the thermistors report a temperature above 75 °C, the entire lamp is throttled back to half of its current intensity until it gets below 70 °C.  If throttling to half intensity isn’t enough to drop the temperature, then it shuts the lamp off completely.  (N.B. It probably will never need to go that far – the LEDs cool off fairly quickly at half intensity.)

Wireless Communication

I’ve been using wireless XBee modules in the various sensor nodes around my home, so I threw one of them into this lamp as well.  This allows the lamp to be controlled by my digital assitant software or by me from my desktop computer.  It’s connected to the primary serial port of the microcontroller.  A small switch allows me to disconnect this when I’m programming the microcontroller (since the USB connection for the programmer also uses the primary serial port).  If I were redesigning this, I would probably move the XBee to another serial port.  The Arduino Mega has four of them, and I’m currently only using two, so using one more wouldn’t be a problem.

Wiring Schematics and Circuit Boards

And whew, that was a lot of text.  We finally get to the actual schematics.  The following pictures show the schematics and circuit board designs for the main board and the light boards.  I did these designs using Cadsoft Eagle.  If you want, you can download my Eagle files from the green box below all the pictures.

Main Board Schematic
Main Board (piggybacks on Arduino Mega)
Light Board Schematic
Light Board (one per crystal ball)


Cadsoft Eagle Files:

I created the schematics and the PCB design using Cadsoft Eagle.  You can download the files using the following links:

Bill of Materials:

Posted in Crystal Ball Lamp and tagged , , .

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>