loading

We've had one of those fibre optic Christmas trees for some years. The base contains a 12V halogen reflector bulb, and a coloured disk driven by a motor is placed between the bulb and the base of the tree. The bulb and the motor are powered by a 12V AC "wall cube" type mains adapter. But the colours are rather washed out and repeat every 10 seconds or so, and some people with similar trees find the motor a bit noisy. It struck me we could do much better in this day and age!

Having replaced the bulb by a 7-pixel Neopixel ring driven by an Arduino Pro Mini, it now no longer needs the coloured disk or the motor driving it, and gives much more intense colours using less electricity. The video doesn't really do justice to the colours - the high contrast of LEDs against any background makes them very difficult to photograph effectively

The Arduino sketch I've written embodies 2 programs which alternate every 5 - 10 minutes. In one, all the Neopixels follow the same random sequence of colours, but each is slightly delayed from the previous, giving an effect of colours sweeping across the tree. In the other, all 21 coloured LEDs (one red, one green and one blue in each Neopixel) are faded in and out at random, giving a very pleasing show of intense and continually changing colours.

Since your tree is unlikely to be the same as mine and you may not wish to power it in the same way I can't give detailed instructions for a complete beginner, but hopefully you will learn something in adapting them to your tree.

You will need:

  • Adafruit Jewel Neopixel ring, or Far Eastern equivalent.
  • Arduino Pro Mini or Nano (it needs to be a 5V part)
  • If you use the Pro Mini, an FTDI USB to serial adapter
  • Stripboard, pin strip, soldering iron, solder, connecting wire etc.

You can use one of the ATTiny85 boards (Trinket, Lily Tiny, Gemma) instead of the Pro Mini or Nano but it may not have room for the full sketch with both programs - see Step 5.

If you reuse an exiting 12V AC adapter, you will need:

  • 1N4004 rectifier diodes - 4 off
  • 1000uF 35V electrolytic capacitor
  • 5V step-down switching regulator module (one based on the LM2596 chip should do), or cannibalise an old car satnav or USB charger delivering 5V as I did.

Otherwise:

  • Reuse a old 5V USB charger, such as an Apple or Blackberry charger, or get a new one.

Step 1: Disassemble Your Tree

As you will see from the pictures, my tree has a circular base containing the works, with a hole in the top which takes the tree itself.

It shouldn't be hard to disassemble the base. Mine simply has 3 screws in the bottom. Remove these and the cover comes straight off. Check it works the same as mine, with a halogen reflector bulb, a motor and a coloured disk.

Remove the bulb (2 screws hold a retaining ring) and the coloured disk (secured with a single nut in the top of the spindle).

Follow through the wiring to see how it works. The conversion is easiest if you can assemble the new electronics as a module to directly replace he bulb, fitting into and taking power from its socket. You will probably want to disconnect the motor and maybe remove it altogether.

Step 2: Assembling the Electronics

The photo shows the end result, before replacing the cover.

The electronics comprise up to 3 parts:

  • The Arduino and Neopixel ring

and if you are using an existing 12V AC mains adapter:

  • 1N4004 rectifier diodes and smoothing capacitor
  • DC-DC step-down regulator.

I will describe each in turn, but first, consider how you are going to mount them in order to fit in place of the bulb.

I soldered a 3-pin-wide piece of pin strip with the middle pin removed to the bottom of a piece of stripboard. This fits into the bulb socket.

I ensured that the stripboard was the same height as the bulb, and that the top of the stripboard was the same width as the bulb diameter. That way the stripboard could directly replace the bulb, retained at the top with the ring that used to retain the bulb.

Step 3: The Arduino and Neopixel Ring

If your Arduino comes without the pin strips ready soldered you can mount it directly onto the stripboard, by running short lengths of bare wire through the pins on the Arduino and through the stripboard, soldered on both sides. The Arduino Pro Mini needs a 6-way pin strip soldered to the serial port pads for programming.

You only need connect the +5V, GND and D8 pins on the Arduino, but cut the tracks on the stripboard between the two row of pins anyway, for safety. That will allow you to solder one or two more pins to secure it without creating any short circuits.

I used 3 pieces of thick copper wire to both support the Neopixel ring and to connect it to the stripboard.

The Neopixel ring has 4 connections: Vcc, Gnd, D-In and D-Out. We only use the first 3 of these.

Having mounted the Neopixel ring as shown, use short lengths of connecting wire to connect Vcc to the Arduino +5V pin, Gnd to the Arduino Gnd pin, and D-In to the Arduino pin D8, or D1 if you are using one of the ATTiny85 boards.

Check to ensure the stripboard conductors you soldered the Neopixel ring to don't make unwanted connections with the Arduino, and cut them if necessary to break any such connections.

Step 4: The Power Supply

If you're using a 5V power supply all you need do is connect the positive connection to Vcc/+5V and the negative to Gnd on the Arduino and the Neopixel ring, and you can skip forward to Programming.

The 12V AC supply first has to be rectified with 4 diodes (turning into DC), then smoothed with an electrolytic capacitor.

I mounted the diodes and capacitor on the same piece of stripboard as the Arduino. In the photos, the copper strips run vertically.

Mount the 4 diodes as shown, alternate ways round. The positive end of each diode is marked with a white band. Cut each of the 4 copper strips between the two ends of each diode.

The 12V AC comes in through the white wires from the pins which plug into the bulb socket. At the AC end, the diodes are connected in adjacent pairs as shown by the white lines, each AC input wire going to one positive end and one negative end of a diode.

At the other end the diodes are connected with positive ends together (red lines) and negative ends together (blue lines).

Solder the capacitor to the strips marked red and blue. I soldered it further up the board then bent the leads to allow the capacitor to sit neatly over the diodes.

Very important: one side of the capacitor is marked negative (with minus signs). You must connect that to the strip marked blue!

Now you can connect the red and blue to the positive and negative inputs respectively of the DC-DC step-down converter.

If you're using a step-down converter with adjustable output, be sure to measure the output voltage with a multimeter and adjust it to 5V before going any further or you may damage your Arduino and Neopixel ring.

Finally, connect the positive and negative outputs of the converter to the Vcc or 5V and the Gnd on the Arduino and Neopixel ring.

You may be able to mount a small DC-DC converter on the stripboard with the other components, but mine was too big, so I had to connect it with flying leads and tie it to a couple of convenient posts.

Step 5: Programming

If you don't already have it, you need to download and install the Arduino IDE. It's free. Make sure you have the latest version (1.6.13 or later - some earlier versions contain bugs which wasted a lot of my time).

In your Arduino folder (by default under Windows this is in My Documents) create a folder called Neopix_colours3. Copy the file Neopix_colurs3.ino into this folder.

Now launch the Arduino IDE and locate the sketch Neopix_colours3 in your sketchbook.

If you are using an ATTiny85 board there may not be room for the full sketch. Comment out the definition of FUNCTION_1 or FUNCTION_2 near the start of the sketch. Alternatively you may be able to squeeze the whole sketch in if you sacrifice the bootloader and program it using another Arduino.

Under Tools, select the board you are using (Pro Mini or Nano, or whatever). If you are using the Pro Mini, connect the FTDI adapter to the Arduino (make sure it's the right way round) and plug it into a USB port on your computer. In the case of the Nano you simply connect it to your computer with a USB cable.

On your computer, go into Device Manager - ports (COM & LPT) and check which COM port has been assigned to the Arduino. Set this under Tools - Port.

You can now upload the sketch and check that it works. The Neopixels are very bright so it's a good idea to place a sheet of paper over them to protect your eyes, or to temporarily change the definition of BRILL in the sketch from 255 to 50.

The sketch as I've uploaded it starts with program 1 and then switches between the two programs randomly every 5 - 10 minutes. If you prefer one or the other, find the line

function = 1;

at the end of the setup() function. Replace the 1 by -1 or -2 to lock it into program 1 or program 2. You can change the minimum and maximum times (in milliseconds) each program runs for by finding and altering the definitions of MINCHGTIME and MAXCHGTIME.

When you're happy, put everything together again, sit back and enjoy!

<p>Thank you for the instructable. I'm disappointed I just put all the Christmas stuff away so can't check out the little tree, but now I can have several months to perfect my color system. I like that you included the small controllers as possibilties.</p>
<p>You don't want to be doing it in a rush before next Christmas! There are various parameters in the sketch you can play with to change the speed or the program, or you could devise your own completely new one. I especially liked the way I got it to change seamlessly from one program to the other.</p>
<p>Thanks very much for the Instructable. I replaced the entire assembly with an Adafruit Neopixel Jewel and Adafruit Tinket 5V (I didn't want to use a Nano set aside for another project). I just clamped the Trinket down with the screws that held the lamp socket. The solid wires from the Trinket provide enough support for the Neopixel. For the power supply, I used an old long Kindle USB cable and brick, back when Amazon used to include both with the reader.</p><p>With the sketch I only had to change the pin designation for the Neopixel to 1 from 8 (and comment out the &quot;Serial&quot; calls).</p><p>Our favourite tree is now nice and quiet. So quiet we have to check it all the time to make sure it's lit. :-)</p>
<p>I've just uploaded an updated version of the sketch which combines and refines the two I originally included with this Instructable, smoothly alternating between the two patterns. Take a look - I think it's a definite improvement.</p>
<p>The new combined sketch is great on the Nano. Unfortunately it's a little too big for the Trinket. I would suggest reposting the Neopix_colours2 for those with the smaller ATTiny85 boards (Trinket, LilyTiny,Gemma). Thanks.</p>
<p>I've uploaded a new version containing conditional compilation allowing you to compile it with only Program 1 or only Program 2. See Step 5. Perhaps you could confirm it works on a Trinket. I don't have one.</p>
<p>Thanks for the update. By commenting out either function, the sketch will compile within the 5310 byte limit on the Trinket. For just checking to see if the sketch will compile, only need to select the Trinket or Gemma board in the Arduino IDE. No need to actually upload.</p><p>But when I uploaded either sketch to the Trinket, the pixels just went &quot;all bright white&quot; so it appears to be something else that I'll look at over the holidays.</p><p>No need to try fixing it if it works for you and others with other boards. I can always switch back to the previous versions. I'm already thinking ahead to next year of putting your sketch on a Adafruit Huzzah or other 8266 board for wireless control of the functions.</p><p>Thanks again and have a great holiday! Max</p>
<p>If it only overflows by a bit, try deleting the declaration of line[80] and all debug lines containing Serial.xxx or sprintf() and see if you can shoehorn it in. The technology has moved on a little since my first 2 sketches so rather than reposting them I'll see about making the current one configurable so you can select the code for just one function.</p>
<p>Just finished the upgrade, I'm amazed at the improvement. Well worth the effort. Many thanks for sharing. Great instructable.</p>
<p>See my updated sketch for an improved &quot;user experience&quot;!</p>
<p>Well done and thank you for the comment! Thank you especially for the very clear pics. Hot melt glue is wonderful stuff for holding things together and securing wires. And yes, the colours are so much more vivid, aren't they?</p><p>I'm working on upgraded firmware to alternate the two modes and hopefully will post it in a few days - watch this space.</p>
<p>Nice upgrade and very good idea.</p><p>On the original model the motor is really noisy, I had to mount it on silent blocks, the power supply is of very poor quality, it heats a lot (50&deg;C), and the color effect is repetitive. I'll test with a neopixel ring to see if colors are brilliant enough. Thx. </p>

About This Instructable

1,293views

11favorites

License:

Bio: You can also find me on iFixit.com and Twitter @pleriche. Volunteer with TheRestartProject.org and keen to share my knowledge and skills and do ... More »
More by p_leriche:USB Volume Control and Caps Lock LED - simple, cheap, extensible Fibreoptic Christmas Tree Upgrade Automatic cat flap monitor with intrusion detection and dissuasion 
Add instructable to: