by Floris Wouterlood – Leiden, The Netherlands – January 22,2017
Series of leds that light up in patterns are very attractive to the eye. Here we discuss the construction of a ‘cyclotron’: a circularly arranged series of 24 leds controlled via three shift register chips. There are two parts: a disc carrying the leds and a cyclotron ‘engine’. A challenge was to construct the cyclotron engine as compact as possible: Arduino Nano, shift registers, resistors and pin header connectors together on a 80×60 mm mounting board.
One of the attractive features of the Arduino Uno family of microcontroller platforms is the ability to power scores of leds in all sorts of sequences. These boards: Uno, Duemilenova, Nano, are equipped with 14 digital output pins that can be programmed to switch leds on or off. Less well known is that the 6 additional analog pins (A0 through A5) can be programmed to ‘act’ as digital output pin, increasing the number of addressable leds to 20. The most primitive (and easy) way of lighting up a sequence of leds is to connect the anode pin of each led with an available output pin on the Arduino. The number of leds on such a primitive led strip equals the maximum number of available pins: 20. With an Arduino Mega the situation is much better since this board is equipped with 54 digital output pins. One way to play with more leds is to arrange leds in grids, with anode and cathode wires to the leds in crossed arangement. Theoretically the number of leds that can be programmed with an Arduino Uno in grid fashion is 20 x 20, and with a Mega the number adds up to 54×54. The ultimate way of addressing led is to apply so-called charlieplexing. A most elegant way of dealing with firing rows of leds compared with primitive one-pin-one-led wiring is to use shift registers. One example of a shift register chip that can easily be used in combination with an Arduino board is the 74HC595. This is a cheap 8-bit chip that handles 8 leds. For the addressing of one 74HC595 only three pins on the Arduino are required which makes the remaining pins available for other activities. Very attractive is the daisy chain feature of the 74HC595 that is effectuated via one of the pins of the chip itself. This implies that no more pins on the Arduino than the initial three are required to activate a score of 74HC595s and through these assistants an almost indefinite number of leds. One example of the potential of shift registers is the 3D led cube whose construction requires third power numbers of leds (a simple 4x4x4 led cube consumes 64 leds while a larger cube, e.g., 8x8x8 requires 512 leds). Another example of a multi-led construction supported by shift registers is the dot led matrix newsreel. The daisy chain feature of the 74HC595 is the center in the present project where I constructed a disc with 24 leds at the outer edge. Lighting patterns of these leds are produced via a compact ‘cyclotron engine’ consisting of an Arduino Nano assisted by three shift registers.
Basics and schematic wiring
The concept of working with the 74HC595 is shown in figure 1. The main component is of course an Arduino, in this project a Nano because of its small form factor. Most important is a disc with 24 leds mounted on it, and the third component consists of three 74HC595 shift registers. Three pins on the Nano do the work: data, clock and latch. Note that the ‘data’ connection is from the Nano to shift register A and from one of the pins of this chip to shift register B, and from there to shift register C. This is the only daisy chained connection. ‘Clock’ and ‘latch’ connectivity is different. These wires run from the Nano in parallel to all shift registers. On each shift register eight pins are available to drive an equal amount of leds. In my design, shift register A controls leds 1 to 8, register B controls leds 9 to 16, and register C controls leds 17 to 24. Thus, there are in fact three similar building blocks where each block consists of a shift register and 8 corresponding leds. The construction of each part / building block is described below in detail.
figure 1. Basics of the construction of the cyclotron: microcontroller, three shift registers and 24 leds. Note the connectivity of ‘data’, ‘clock’ and ‘latch’. Only ‘data’ is daisy chained; ‘clock’ and ‘latch’ are parallel.
1 x Arduino Nano
1 x spinning disc 110 mm diameter
1 x soldering board 80×60 mm
24 x 3.3V led (any color)
3 x 16 pin chip socket
3 x 74HC595 shift register
24 x 560 Ω resistor
3 x 8 pin female pin header
1 x 4 pin female pin header (GND)
3 x 8 pin male pin header
2x 16-pin connector type 3.5-16P (one cut in half to get a 3.5-8P)
8 x spacers 25 mm long
1 x acrylic photo stand
The disc (figure 2) consists of a cardboard carrier disc diameter 110 mm with a nylon spinner glued on its front. The spinner is just for decoration. With a small pin 24 series of equidistant holes were made along the outer edge of the cardboard disk to accommodate the anode and cathode pins of the leds. On the back of the disc all cathode led pins were soldered to a single copper wire (common GND). The anode pins of each group of 8 leds were soldered to wires recovered from a piece of 8-wire UTP network cable: leds 1 through 8 with blue – blue/white – orange – orange/white – green – green/white – brown – brown/white wires.
figure 2. The cyclotron disc, front and back, made of cardboard and a plastic spinner. It carries 24 leds.
The completed disk has 25 wires coming from it: 8 group ‘A’ wires (cathodes of leds 1 through 8), 8 group ‘B’ wires (cathodes of leds 9 through 16), 8 group ‘C’ wires (cathodes of leds 17 through 24), and one common GND wire (standard color: black). The disc has a wooden strip glued to it (visible in fig. 10) that fits a ‘receptacle’ piece of plastic glued to the acrylic photostand that holds also the cyclotron ‘engine.
Cyclotron ‘engine’ and its building blocks
The cyclotron engine consists of a board on which are mounted one Arduino Nano, three 74HC595 shift register chips, 24 resistors and the pin headers for output connectivity. For the sake of convenience the 74HC595s are mounted on chip sockets. A Nano was selected as the Arduino microcontroller to keep the form factor of the cyclotron engine as compact as possible.
74HC595 shift register chip
A standard 74HC595 chip has 16 pins (figure 3) of which eight are to be connected with leds while the other pins serve various vital functions: power, GND, data, clock, latch. Throughout the project I used the following color coding in the diagrams and for the actual wiring:
‘data’ — green
‘clock’ — yellow
‘latch’ — white
5V — red
GND — black
Group A: wires from engine (shift register A) to disc connector: magenta
Group B: wires from engine (shift register B) to disc connector: brown
Group C: wires from engine (shift register C) to disc connector: grey
Figure 3 shows that the ‘top’ of the chip is recognizable by a notch. To improve the recognizability of the top I put a drop of white paint next to the notch.
figure 3. Pictures of a 74HC595 shift register chip from above. On the left the official designation of the pins; on the right the connectivity. Connection of serial In (data) is with pin 11 of he Nano. RCK (latch) is connected with pin 8 of the Nano, and the clock pin of the shift register with pin 12 of the Nano. Connectivity according to common practice in the shift register ‘community’; however, pin selection on the Nano is not critical.
The pins of the chip are numbered counterclockwise from the top (in top view – remember that during soldering one continuously works on the sockets in bottom view!) 1 through 16. These pins are by some manufacturers indicated with letter combinations. Numbers nor letters are printed on the chip. According to the manufacturer’s info sheet, pins QA through QH are the output pins that must be connected via resistors with the anodes of the leds, usually 470 or 560 ohm resistors. The relative high resistance is required to limit the current load of the chip. According to the manufacturer the output current of a 74HC595 shift register may not exceed 70 mA. For each pin with all pins set ‘high’ this means 70/8= approximately 9 mA. One single pin may not draw more current than 35 mA. The relatively high value of the resistors thus limits power output and makes it safe to operate one shift register with 8 leds all burning at the same time. The datasheet refers to the 74HC595 as an “8-bit serial-in, serial or parallel-out shift register with output latches; 3-state.” In other words, you can use it to control 8 outputs at a time while only taking up a few pins on your microcontroller. The “serial output” part of this component comes from its extra pin (pin 16, or QH’) which can pass the serial data information received from the microcontroller out again unchanged. This feature underlies the daisy chaining of several shift registers.
Wiring the cyclotron engine
A big challenge in this project was to construct a cyclotron engine with the smallest manageable footprint. The layout of the components on the board is provided in figure 4. To achieve the desired small form factor a 80×60 mm double-sided soldering board was selected. Boards of this type have 27×22 perforations. First I determined the relative position of the Nano and the sockets for the three shift registers, reserving space for resistors and (female) pin headers. These pin headers add some flexibility. A design with pin headers allows easy montage and decoupling of engine and disk and prepares the project for future mounting of differently designed discs.
figure 4. Positioning of the main components on the mounting board: Nano, and three 16-pin sockets with each a 74HC595 shift register: A, B and C. The yellow arrow indicates the orientation. Dimensions of the board are 60 mm width, 80 mm long (22×27 perforations).
figure 5. Wiring of shift register A. Pins 10 and 16 of the shift register are connected to the 5V pin of the Nano, pins 8 and 13 to GND, while pins 11, 12 and 14 receive respectively the clock wire (pin 12 of the Nano), latch wire (pin 8 of the Nano) and data wire (pin 11 of the Nano). Pin 15 will drive led #1 of group A, while pins 1 through 7 will drive leds #2 through #8 of group A.
After soldering the Nano and the chip sockets in place the wire connections between the Nano and the pins of the socket for shift register A were determined. The wiring is shown in the diagram of figure 5. The wiring for shift registers B and C is similar to that for shift register A, except for the data wire, which is soldered between pin 9 of shift register A and pin 14 of shift register B. The same was repeated for shift registers B and C (figure 6).
figure 6 Wiring diagram of three shift register. Note the daisy chaining: pin 9 of shift register A is connected with pin 14 of shift register B, and pin 9 of shift register B is connected with pin 14 of shift register C.
The next step was to add groups of 8 resistors and pin headers. Resistors are necessary elements between the output pin on the shift register and the corresponding led. This resistor must be present in the anode wire of the led. Soldering a resistor on the cathode pin of the led, or using a common resistor between the led cathodes and GND, will not work.
figure 7. Top view of the completed cyclotron engine: board, Nano and three groups of identical components: shift register, resistors, pin header.
Actual construction of the cyclotron engine
After having figured out the wiring and the positioning of all components on the board the actual construction could start. The sockets for the shift registers, and the resistors and pin headers were soldered on the board group after group (A first, then B and finally C). As every group consists of one 16-pin chip socket with connections, and of 8 resistors with wires to the shift registers and its corresponding pin header, plus GND, approximately 65 connections had to be soldered on a small surface. All wires were soldered on the ‘belly’ side of the board. After the completion of each individual group the correct functioning was tested by connecting the engine to a prototyping board equipped with 8 leds. Spacers with a length of 25 mm were attached to every corner of the board, two on each corner with the board held in between: one pointing up and one pointing down. The purpose of these spacers is twofold. The four top spacers are the pylons that attach the engine to the acrylic photoframe while the bottom spacers primarily serve to protect the delicate solderwork. A transparent plastic rectangle or box may be attached on the bottom spacers after completion and testing to provide extra protection. During construction I took photographs to document progress. Figure 8 shows two production stages. The left picture was taken after the completion of the construction of the first group (A): socket, connectivity with the Nano, wires from the chip sockets to the resistors, wires from the resistors to the pin header.The right pictures shows the engine with all shift register sockets soldered, ready for connecting and initial testing.
figure 8. Bottom views of the cyclotron engine at two stages of production. Left: after completion of the first group of components, right after completion of all groups.
Wire connectivity between engine and disc
After completing and testing the engine and the disc an exciting moment arrived: connecting these two components to each other. The schematics of the wiring of each group, from their shift register on the engine to the leds on the disc, is shown in figure 9. To make life easier the schematics was created in a vector drawing program with extensive use of ‘layer’ functionality.
figure 9: Various stages of the wiring of shift register, resistors and anode wires to the leds. A: all wiring for led group A, B, same for led group B, C, same for led group C, D, all wiring superimposed.
Assembling 25 wires (3 groups plus GND) that connect the engine with the disc was a time-consuming job. During construction it was taken into mind that in the final product it should be possible to disconnect the disc from the engine without much effort to replace it with another disc. For this purpose I bought 16-pin universal connectors (type 3.5-16P) and used one complete connector (led groups B, C) and cut another connector in half (led group A) (figure 10). GND had a separate wire from the disc to the GND pin header on the engine. An advantage of the 3.5-16P type of connector is that the wires in the male connector are fastened with little screws, thus making it possible to change wires easily during test sessions.
Once the connectors had been prepared, final assembly of disc and engine on the acrylic photostand finished the job. Time to test the end product!
figure 10. Left: wires and connectors on the engine, Right: three groups of color-coded anode wires (A, B, C) soldered to the leds on the disc, just before final assembly.
figure 10. Engine and disc fully assembled on an acrylic stand, working. This is testing mode: all leds on the cyclotron switched on to embellish the photograph.
The goals of the present project were successfully achieved: constructing an Arduino Nano powered ‘engine’ with a small footprint, driving 24 leds in a circular display, with ony three output pins of the Nano engaged. To achieve this I incorporated three 74HC595 shift registers in the design. Various publications and forum discussions focus on the value of the resistor in the anode wire running to each led. This has to do with the allowed current load of the 74HC595 shift register. Reported resistor values vary between 220Ω and 560Ω. Obviously, at a ‘standard’ 220Ω the current drawn from the shift register’s pin is about 18mA. This current is not a big problem for the chip since it can handle 70 mA, and each pin is allowed 35 mA. Problems may arise when for instance all eight leds connected to one chip are lighted and 8×18 mA could be drawn (144 mA) which overloads the register with a factor 2. Conversely, a resistor in the 400-500Ω may be sufficient, and the 560Ω applied in the current design may be well within the safety limit. Another issue in discussions about shift registers is whether or not to solder a capacitor between 5V and GND on each shift register. Capacitors reduce noise in DC wires. Successful application of 100nF capacitors in multi-shift register designs have been reported. Capacitors have not been implemented in the present engine, however they may be necessary with longer daisy chains of shift registers than the modest number in the present design. While the 74HC595 can be considered a good and cheap companion to an Arduino, a disadvantage of this chip remains its limited load. If higher current loads are desired, a heavier chip like the high-current 595 driver chip such as the TPIC6C595 may be useful. Leds arranged in a circle are not a novelty. A design with 60 leds in five circular rings that require 17 pins on the Arduino is presented on YouTube (youtube.com/watch?v=RJRt94Rdzbc). User-ready devices can be found on the internet. A slick construction is for example a circular arrangement of leds named ‘Fusion Core 32’ (see youtube.com/watch?v=RIZ2wUPACvM). Complete led strips can be purchased from several manufacturers and laid out in a circular fashon. Another design found on YouTube was the Medaillon: 12 leds arranged in a circular fashion and directly driven by a PIC16F628A chip (youtube.com/watch?v=vNmzvsnXBAw). Sophisticated, 12, 24 of 60 led RGB Neopixel rings are presented by Adafruit (adafruit.com/?q=neopixel&). In sum, there is ample choice in user-ready circular led devices. However, the challenge, excitement and learning experience is to construct one’s own circular led arrangement.
More discussions on led arrays on the Arduino forum: forum.arduino.cc
Sketches in ZIP file
There are two sketches in the zip file: ‘cyclotron.ino’ and ‘complex_cyclotron.ino‘.