A Christmas Star with Neopixel LEDs

By on December 15, 2016
Pin It


A tech Christmas decoration, created by means of Neopixel LEDs and controlled via an Arduino Micro board, that takes up a minimal amount of space.

With the Xmas holidays approaching, we always try to propose a solution or another, one that is capable of combining tradition and innovation, so to avoid the usual or the trivial – even if always welcome – gadget, that is used as a Christmas decoration: and they cannot be missing from the Christmas tree, the window and the doorstep. For such matters, RGB LEDs and light strips have become a must-have and therefore we could not exempt ourselves from proposing a classic light decoration (the more lights there are for Christmas, the better, as they are a symbol of life and hope…) that has been reconsidered in a modern key, since it has been entrusted to the adaptable and powerful Neopixel LEDs. With a certain amount of the latter, that have been connected in queue and managed in cascade by an Arduino board, we gave life to a 5-star Christmas star, that will show-off at the top of the tree, or wherever you might want to place it (as an example, at the doorstep).

Let’s see therefore what it is all about, by analysing the circuit diagram, that is made of a part that is composed by the LEDs and the control board, that in our case is an Arduino Micro, just for the purpose of minimizing the amount of space occupied by the star.



Circuit diagram

Let’s take a look, therefore, at the project’s electrical section, that is essentially composed of a set of 56 Neopixel LEDs, that have been arranged so to form two concentric stars; the first 35 RGB LEDs (out of 56) form the bigger, external star, while the other 20 ones form the smaller and internal star. The LED number 56 is placed exactly at the center of the printed circuit board, that has the shape of a five-pointed star.

The Neopixel LEDs are connected in cascade but powered in parallel; such a configuration enables to address each single LED and to individually choose the colour; among the possible hues, the 256 possible combinations for each primary colour (therefore we have 256x256x256 combinations!) determine a total of 16,777,216 colours: that’s what one would call true colours!



Neopixel provides you with the integration of a driver for each RGB LED and therefore of a LED by LED driving capability. The data channel for the communication is of the serial, oneWire kind, and the power source is a 5 volt one; the Neopixel LEDs are connected in cascade, meaning that the input data line – in addition to reach the corresponding controller – is repeated at the output.  The communication on the data channel is carried out at a maximum of 800 kbps and is of the type having an embedded clock. The serial control is indispensable since otherwise – in order to individually manage the single LEDs that form our star – we would need a lot of lines, even if adopting a multiplex matrix command. On the contrary, we need a single data channel, to be managed by means of a single line of the Arduino board, for reasons of simplicity and space occupied. The solution we adopted allows to rely on a very small Arduino Micro, while if we had to implement the multiplex for our 56 LEDs, the amount of lines would have forced us to adopt the “big ones” of the Arduino family.



While it is true that the LEDs of the Neopixel system may be connected in cascade, so that the data line from one goes to the next one, the collateral effect is that – after a certain amount of LEDs – the management speed must be considerably reduced; because of that, if we have to create matrices in order to show some quick graphic artwork, it is better to use many lines with just a few LEDs for each one; this is not our case, however, since for our Christmas star, even though some animations determines a variation of the individual brightness in order to compose the various light effects, the execution speed for the games is such to not reach the data-rate limit for the Neopixels.

The implementation of all the “effects” is available on Listing 1.



If you’d like to apply some modifications to the firmware, in order to create some effects that have not been designed by ours (Listing 2 shows a sample one, that deals with the fade-in start for the two stars…), please remember that the refresh frequency – and therefore the switching on/off speed as for the single LEDs – is inversely proportional to the amount of LEDs to be managed.



For each LED strip, it is possible to set the refresh frequency at leisure, so to make some tricks of the light imperceptible. In our case, the scan frequency for the LEDs is 400 Hz. The maximum data sending speed influences – the number of commandable LEDs being equal – the refresh frequency; this means that the more the LEDs to be managed, the less the refresh frequency and so the moving speed of the picture shown.


The command protocol of the Neopixel system provides a cyclical sending (at a frequency depending on the one of the desired refresh) of data strings, each one is composed of 24 bits, divided in groups having three bytes each (therefore, 3×8 bits); each one of the bytes of a 24-bit string contains the lighting state for each primary colour, in this order: first the eight bits for the green colour, then the ones for the red and finally the ones for the green. In the circuit diagram, the connection in cascade of the Neopixel LEDs is shown: the data line entering the DI terminal exits from the DO one, that repeats its data; the DI of the first LED (LD1) refers to the IN contact of the circuit, to which the data supplied by Arduino is applied. The reference ground for the power source and the data is a single one and refers to the GND contact of the printed circuit board; the 5 volt power source, too, and refers to the 5V contact. With reference to the wiring diagram, we may see that Arduino drives the star’s circuit by using the data line only, therefore the IN contact is connected to the said I/O of the board, that is the digital pin 9, that in this application has been set as an output in the sketch. The star’s power is drawn from Arduino Micro’s 5V and GND lines; for obvious reasons regarding the absorption, the Arduino board must be powered by an external power source, one that is capable of supplying about 800 mA (stabilised) on the 5V. It is possible to obtain the power from the microUSB socket or to supply it between Vin and GND, but in this case the power source will have to supply at least 7 volts.



Practical implementation

Let’s move on now to the building of our star, that requires a double sided printed circuit board, that may be obtained via photoengraving, by starting from the tracks on the bottom-side that you will find on our website, along with all the other files of the project. Once it has been engraved and drilled, the PCB (we will start from a double-sided board having a size that is such to host a star) must be processed, by cutting it and smoothing it down by means of coarse or medium sand paper, so to give it its definitive shape for a 5-pointed star.

Once this has been done, it is possible to mount the Neopixel LEDs and the capacitors, to be placed as shown in the assembly diagram that you will find in these pages; the components are SMD ones, exception made for the connector having the 90° pins, that must be mounted lastly, on the opposite side of the one where the LEDs and the capacitors are placed. The creation requires a bit of dexterity and practice with the SMDs; therefore please acquire a fine tip soldering iron, some solder wire (having a maximum diameter of 0.5 mm), some flux paste (one that has low density) and a small brush so to spread it, in addition to tweezers (so to handle the components) and a magnifying glass (so to verify – as a first thing – that they have been correctly placed and then correctly solded). It will be useful to have some desoldering braid, so to remove some excess tin that may shortcircuit pins or pads.

Mounting the connector does not create any problem: it is enough to insert the terminals in the corresponding holes and to solder them from the side where the components are found. In order to connect Arduino Micro you will have to use some jumpers whose ends you will have to cut, in order to solder them to the contacts of the detached female connector that you will insert in the star’s 3-poles plug; please remember that the ground (GND) goes on the middle contact, the data IN to the external side of the star and the 5V in the internal one. Before connecting Arduino, you will have to connect it to the PC by means of a USB/microUSB cable and to load on it the sketch you will find available for the download at our website, along with the project files. Once the firmware has been loaded, and the whole has been connected and powered, you will be able to verify that everything works properly: the animations should start a few moments after having supplied the power, since the sketch we have written allows to generate different effects that are sequentially cycled, as soon as the power has been supplied.



Please notice that if you power everything from the Vin and GND pins of the Arduino board, you must not leave the computer connected to the USB.

From openstore




About Boris Landoni

Boris Landoni is the technical manager of Open-Electronics.org. Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.

One Comment

  1. Pingback: A Christmas star with Neopixel LEDs - Electronics-Lab

Leave a Reply