Silicon ChipTwo Large LED Christmas Stars - November 2020 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Why is electronics male-dominated?
  4. Feature: MEMS (Micro-Electromechanical Systems) by Dr David Maddison
  5. Project: Eight Small LED Christmas Ornaments by Tim Blythman
  6. PartShop
  7. Project: Two Large LED Christmas Stars by Barry Cullen & Tim Blythman
  8. Project: Balanced Input Attenuator for the USB SuperCodec by Phil Prosser
  9. Serviceman's Log: One repair leads to another by Dave Thompson
  10. Vintage Radio: RCA BP-10 "miniature" valve portable radio by Ian Batty
  11. Feature: A Rundown on New 8-pin PIC Microcontrollers by Tim Blythman
  12. Feature: The Vintage Matrox ALT-512 Graphics Card by Hugo Holden
  13. Project: Flexible Digital Lighting Controller, part 2 by Tim Blythman
  14. Feature: Electronic ‘Wearables’ and the Jaycar Sparkle Stitch by Tim Blythman & Nicholas Vinen
  15. Market Centre
  16. Advertising Index
  17. Notes & Errata: USB SuperCodec, August-October 2020; History of the Australian GPO, September 2020; Shirt Pocket Oscillator, September 2020; Frequency Reference Signal Distributor, April 2020; 45V 8A Linear Bench Supply, October-December 2019
  18. Outer Back Cover

This is only a preview of the November 2020 issue of Silicon Chip.

You can view 44 of the 112 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Eight Small LED Christmas Ornaments":
  • Tiny LED Cap PCB [16111193] (AUD $3.00)
  • Tiny LED Stocking PCB [16111194] (AUD $3.00)
  • Tiny LED Reindeer PCB [16111195] (AUD $3.00)
  • Tiny LED Bauble PCB [16111196] (AUD $3.00)
  • Tiny LED Sleigh PCB [16111197] (AUD $3.00)
  • Tiny LED Star PCB [16111198] (AUD $3.00)
  • Tiny LED Candy Cane PCB [16111199] (AUD $3.00)
  • PIC12F1572-I/SN (or equivalent) programmed for the Tiny LED Christmas Ornaments (Programmed Microcontroller, AUD $10.00)
  • Tiny LED Christmas Ornament complete kit (Component, AUD $15.00)
  • Firmware for the LED Christmas Ornaments (Software, Free)
  • Eight Tiny LED Xmas Ornament PCB patterns (PDF download) [16111191-16111199] (Free)
Articles in this series:
  • Eight Small LED Christmas Ornaments (November 2020)
  • Eight Small LED Christmas Ornaments (November 2020)
  • Christmas LED Icicle Decoration (November 2022)
  • Christmas LED Icicle Decoration (November 2022)
Items relevant to "Two Large LED Christmas Stars":
  • Stackable LED Star PCB [16109201] (AUD $12.50)
  • RGB Stackable LED Star PCB [16109202] (AUD $15.00)
  • ATmega328P-AUR or ATmega88PB-AUR programmed for the RGB Stackable LED Star [1620920A.HEX or 1620920B.HEX] (Programmed Microcontroller, AUD $10.00)
  • Kit for the RGB Stackable LED Christmas Star (Component, AUD $40.00)
  • Firmware for the 30 RGB LED Xmas Star (Software, Free)
  • RGB Stackable LED Star PCB pattern (PDF download) [16209202] (Free)
  • Stackable LED Star PCB pattern (PDF download) [16109201] (Free)
Items relevant to "Balanced Input Attenuator for the USB SuperCodec":
  • USB SuperCodec PCB [01106201] (AUD $12.50)
  • USB SuperCodec Balanced Input Attenuator add-on PCB [01106202] (AUD $7.50)
  • Parts source grid for the USB SuperCodec (Software, Free)
  • USB SuperCodec PCB pattern (PDF download) [01106201] (Free)
  • USB SuperCodec Balanced Input Attenuator add-on PCB pattern (PDF download) [01106202] (Free)
  • USB SuperCodec front panel artwork (PDF download) (Free)
  • Drilling and cutting diagrams for the USB SuperCodec Balanced Input Attenuator (PDF download) (Panel Artwork, Free)
Articles in this series:
  • USB SuperCodec (August 2020)
  • USB SuperCodec (August 2020)
  • USB SuperCodec – part two (September 2020)
  • USB SuperCodec – part two (September 2020)
  • USB SuperCodec – part three (October 2020)
  • USB SuperCodec – part three (October 2020)
  • Balanced Input Attenuator for the USB SuperCodec (November 2020)
  • Balanced Input Attenuator for the USB SuperCodec (November 2020)
  • Balanced Input Attenuator for the USB SuperCodec, Part 2 (December 2020)
  • Balanced Input Attenuator for the USB SuperCodec, Part 2 (December 2020)
Articles in this series:
  • The Matrox ALT-256 Graphics Card (October 2020)
  • The Matrox ALT-256 Graphics Card (October 2020)
  • The Vintage Matrox ALT-512 Graphics Card (November 2020)
  • The Vintage Matrox ALT-512 Graphics Card (November 2020)
Items relevant to "Flexible Digital Lighting Controller, part 2":
  • Flexible Digital Lighting Controller main PCB [16110202] (AUD $20.00)
  • Flexible Digital Lighting Controller Micromite Master PCB [16110201] (AUD $5.00)
  • Flexible Digital Lighting Controller CP2102 Adaptor PCB [16110204] (AUD $2.50)
  • Flexible Digital Lighting Controller LED slave PCB [16110205] (AUD $5.00)
  • PIC16F1705-I/P programmed for the Flexible Digital Lighting Controller [1611020A.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC32MX170F256B-50I/SP programmed for the Flexible Digital Lighting Controller Micromite master [1611020B.hex] (Programmed Microcontroller, AUD $15.00)
  • PIC16F1455-I/P programmed for the Flexible Digital Lighting Controller WS2812 Slave [16110205.HEX] (Programmed Microcontroller, AUD $10.00)
  • Si8751AB 2.5kV isolated Mosfet driver with integral power supply (Component, AUD $10.00)
  • Micromite LCD BackPack V3 complete kit (Component, AUD $75.00)
  • Hard-to-get parts for the Flexible Digital Lighting Controller (Component, AUD $100.00)
  • Flexible Digital Lighting Controller front panel PCB [16110203] (AUD $20.00)
  • Firmware and software for the Fiexible Digital Lighting Controller (Free)
  • Firmware and PC software for the Digital Lighting Controller [1611010A.HEX] (Free)
  • Flexible Digital Lighting Controller mains slave PCB patterns (PDF download) [16110202-3] (Free)
  • Flexible Digital Lighting Controller Master PCB patterns (PDF download) [16110201, 16110204] (Free)
  • Flexible Digital Lighting Controller LED slave PCB pattern (PDF download) [16110205] (Free)
  • Drilling and cutting diagrams for the Flexible Digital Lighting Controller Micromite master (PDF download) (Panel Artwork, Free)
  • Cutting diagram for the Flexible Digital Lighting Controller mains slave rear panel (PDF download) (Panel Artwork, Free)
  • Cutting diagrams and front panel artwork for the Flexible Digital Lighting Controller LED slave (PDF download) (Free)
  • Matte/Gloss Black UB3 Lid for Micromite LCD BackPack V3 or Pico BackPack using 3.5in screen (PCB, AUD $5.00)
Articles in this series:
  • Flexible Digital Lighting Controller, part 1 (October 2020)
  • Flexible Digital Lighting Controller, part 1 (October 2020)
  • Flexible Digital Lighting Controller, part 2 (November 2020)
  • Flexible Digital Lighting Controller, part 2 (November 2020)
  • Flexible Digital Lighting Controller, part 3 (December 2020)
  • Flexible Digital Lighting Controller, part 3 (December 2020)
  • Digital Lighting Controller Translator (December 2021)
  • Digital Lighting Controller Translator (December 2021)

Purchase a printed copy of this issue for $10.00.

More bling for your festivities!   Two   LE   T   Two   LED L ED Christmas Stars Either of of these these two Either two Christmas Stars Christmas Stars will willlook spectacular atop atop look spectacular tree –– or or anywhere anywhere aatree else.They They certainly certainly else. provide aa better better display provide display than an angel on than an angel on aa stick! They They can also stick! also sit atop our Stackable sit atop our Stackable LEDChristmas Christmas Tree LED Tree from late 2018 and from late and will integrate with will integrate with thatTree. Tree. But they that they work perfectly work perfectly wellstandalone standalone well too,requiring requiring too, onlyUSB USB only power for for power operation. operation. That means means That youcan can you alsouse use also them them outdoors! outdoors! 34 Silicon Chip Design by Barry Cullen Words & software by Tim Blythman See page 43 for details of the special SILICON CHIP LED Christmas Star kit offer Australia’s electronics magazine siliconchip.com.au The two versions of our Christmas Star: on the left (black PCB) is the more complicated RGB LED Star (here shown not powered) while on the right (green PCB) is the basic LED Star with a time exposure allowing most LEDs to light up. These images are about half life size. Yep, they’re big, bold and beautiful! T he reason that we’re presenting two different Christmas Stars is to give you a choice. One is slightly simpler to build, the other is a bit more time-consuming and expensive to put together, but it also gives a much fancier display. So you can choose one or the other depending on how much time and money you want to invest in the project. The Basic Star features 30 single-colour LEDs arranged in any colour pattern you like, while the RGB Star has 30 RGB LEDs which can each display one of seven colours. So with the RGB Star, you can have various different colourshifting patterns; we have programmed several different patterns like that into its onboard microcontroller. Both Stars use relatively simple circuitry, with each LED being driven from the output of a simple shift register IC via a current-limiting resistor. The shift registers are daisychained so that a stream of serial data can be used to update the pattern in the Star. It’s the same scheme used in our November 2018 Stackable LED Christmas Tree (siliconchip. com.au/Series/329). The main difference is that in that project, each little tree board had eight LEDs driven from a single shift register, and you connected multiple boards to add more LEDs. The Star has almost four times as many LEDs on board; hence, they are driven from multiple shift registers. Because it uses the same daisy-chaining scheme, one (or more!) Stars can be placed at the end of each of the LED tree ‘branches’. We’d wager that a large Stackable Tree with multiple Stars on it would make for a spectacular sight! As mentioned earlier, the RGB LED Star has an onboard micro to provide patterns so that it can be used in a standalone manner; for example, atop a regular Christmas tree (real, plastic or other). This is the simpler of the two LED Stars but it gives a great display with singlecolour LEDs. With high-brightness LEDs the display is really good indoors during daylight . . . but it’s at night when the flashing LEDs really come into their own! Because it’s operated on low voltage DC (5V; ie USB) it can be used outdoors as well. Incidentally, the camera sees the white LEDs as much brighter but they’re really quite well matched in real life. siliconchip.com.au Australia’s electronics magazine November 2020  35                                       SC  30 LED STACKABLE STAR Fig.1: this version of the LED Star uses single-colour LEDs – your choice of which LED goes where to achieve the patterns you want. It’s slightly simpler and a little cheaper to build. The random number generation circuitry is in the lower left-hand corner of the circuit, and below that are the four links which configured it to operate either standalone or atop the Stackable LED Tree. 36 Silicon Chip Australia’s electronics magazine siliconchip.com.au The more basic LED Star can also be operated in this manner, but rather than using a micro to generate patterns, it has an onboard discrete random number generator to make its LEDs twinkle nicely. ment, it can produce much more complicated and dazzling patterns. We have programmed it to cycle through ten different amazing patterns automatically over time. You could modify the software to add even more. Circuit description Basic Star details The circuits of both versions of the Stackable LED Star (shown in Figs.1 & 3) are quite similar to the Stackable LED Christmas Tree. The main difference is that the Tree used a single shift register to drive eight single-colour LEDs, while the Stars use four shift registers to drive 30 singlecolour LEDs or twelve shift registers to drive 30 RGB LEDs. In each case, the shift registers are daisy-chained, similarly to how the individual chips in the Stackable Tree could be daisy-chained by plugging the Tree PCBs together. In this case, though, the chained connections are made via tracks on a single PCB. The other major difference in Fig.1 is that the clock and latch lines feeding from input connector CON1 to the shift registers are joined together on this board and routed as a single track, while they were routed separately on the Tree boards. This is a trade-off which simplifies the PCB routing, while slightly complicating how data is routed to the shift registers. Also, while the Stackable Tree used a separate  driving arrangement to create control data for the LEDs, either based on a random number genera tor or software running on a PC or an Arduino, both stars have the option to use onboard circuitry to drive the LEDs. This allows them to be used as self-contained ornaments, needing only a source of 5V DC (eg, from a USB charger) to operate. Fig.1 is the circuit of the basic Star, with 30 single-colour LEDs labelled LED1-LED30. You can choose whichever colours take your fancy, although we suggest that if you decide to use any white LEDs, you should probably use all high-brightness types. Otherwise, the white LEDs are liable to out-shine the others! The LEDs are driven from the outputs of daisy-chained serial-to-parallel shift registers IC1-IC4, with 1k currentlimiting resistors meaning that each LED receives about 1.5-3.5mA, depending on its forward voltage. That can be as low as about 1.5V for a high-brightness red LED, or over 3V for a blue or white LED. As the four 8-bit registers have a total of 32 outputs, two are unused (outputs Q0 of IC2 & IC3). Each shift register has a high-value bulk bypass capacitor plus a lower value high-frequency bypass capacitor. There is also an electrolytic capacitor near input connector CON1 to provide bulk bypassing for the whole board.  With links LK1-LK4 in one position, power and data for the shift registers are routed from pin header CON1, which can be plugged into  a Stackable Tree or any of the driving circuits we published for it. In this case, the output of the last shift register is also routed back to CON1, so that it  can finish making its way through a Stacka-               In the    case of the  simpler Star  with single-colour  LEDs, this circuitry is  virtually identical to the  Discrete LFSR Random Number Generator from our August 2019 issue (siliconchip.com.au/  Article/11775). That project  was mainly designed to drive   the Stackable Tree, producing an LED twinkling pat  tern, and it does the same job with the Star. However, the Star  which uses RGB LEDs    has an onboard ATmega328P (ie, the same micro used in the Ardui no Uno). That means Fig.2: full-size PCB layout for the simpler that, when used as LED star, as seen in Fig.1 opposite. This version uses a standalone orna-  single-colour LEDs – your choice as to which goes where. siliconchip.com.au Australia’s electronics magazine ble Tree, should one be attached. In the alternative link positions, power instead comes from micro USB connector CON2 and data to control the LED states comes from the random number generator comprising shift registers IC5 and IC6, XOR gates IC8a-IC8d and diodes D1-D16. This is clocked by an RC oscillator circuit  based on schmitt trigger inverters IC7a & IC7b. For a full explanation of how this part of the circuit operates, see the  August 2019 article. Essentially,  November 2020  37 l l l l l l l l l l l l l l l l l l l l l l l l SC Ó RGB LED STACKABLE STAR Fig.3: this version of the LED Star uses RGB LEDs, with the pattern determined either by data shifted in via pin header CON1, or by the variety of patterns produced by microcontroller IC13. These patterns have been specially designed to suit the layout of the LEDs on the star, including taking into account the way they have been wired to the twelve shift registers. 38 Silicon Chip Australia’s electronics magazine siliconchip.com.au ‘random’ bits appear at the output of buffer IC7d at a rate of one bit for each pulse from the oscillator. The oscillator frequency is set to around 5Hz due to the time constant of the 100µF timing capacitor and 1k charge/discharge resistor. One slight change in how this circuit works compared to the August 2019 version is that a 2N7002 small-signal Mosfet (Q1) has been used in place of NPN transistor Q1 in the original design. But they do the same job, which is to ensure that the circuit does not get stuck in the ‘all zeros’ state, which would result in no more random data being produced. RGB LED Star details The circuit of the RGB version is shown in Fig.3. The LED-driving portion of the circuit is identical to the other version, except that there are three times as many serial-to-parallel shift registers. This is because they must drive the three individual elements in each RGB LED (ie, red, green & blue) separately. Similarly to the more basic version, with links LK1-LK5 in the positions shown, data is fed to the shift registers from input connector CON1, and this can come from a Stackable Tree or any of the suitable drivers for it. However, this time, the clock and latch lines are not wired in parallel. Instead, they are routed to the twelve shift registers separately, making it a bit easier to drive (and more readily compatible with an existing Stackable Tree arrangement). That’s why there are five jumper links on this board, rather than four as before. The other difference is in the onboard driving circuitry. With LK1-LK5 in the alternative positions, the serial data and clocks come from microcontroller IC13, an Atmel ATmega328P. It can be clocked either using an internal 8MHz RC oscillator, or external 8MHz ceramic resonator X1. In the latter case, capacitors internal to the resonator provide the required load capacitance. Our software configures the internal RC oscillator, so X1 is not required unless you plan to reprogram it using the standard Arduino bootloader, which expects an external crystal or resonator to be present. IC13 also has the required bypass casiliconchip.com.au Australia’s electronics magazine pacitors for its power supply pins, plus an RC reset circuit on its pin 29 (not required, but it doesn’t hurt). There’s an antenna connected to the analog input on pin 25, to act as a source of random noise. The micro can be programmed using a standard six-pin AVR programming header, although we can supply the chip pre-programmed to save you the effort. To create a pattern, the software in IC13 simply has to produce 96 bits of serial data in SPI fashion from pins 9 and 10 (digital output PD5 for data and PD6 for the serial clock) and then pulse pin 12 (PB0) high and then low again, to update the colours of the 30 RGB LEDs. As each LED is effectively driven with a three-bit signal, that means there are eight possible states: off, red, green, blue, yellow (red+green), magenta (red+blue), cyan (green+blue) or white (red+green+blue). These are then changed for each LED at set intervals to create pleasing patterns of light on the Star. Programming link JP1 can be removed to disconnect IC13 from the 5V power supply during programming, although you could also just unplug the power supply from CON1 or CON2 for the same effect. Construction Despite the circuit differences, the procedure for building the two Stars is quite similar. Both use mostly SMD parts except for the connectors and LEDs. It’s best to fit all the SMDs first. Refer to the relevant PCB overlay diagram, Fig.2 or Fig.4, depending on which version of the Star you’re building. All of the SMDs are relatively easy to solder, but you still need to use the right procedure to get the best results. Essentially, once you have located the right part and orientated it correctly, you tack one pin to a pad and check its alignment. If it’s correct, then you solder the opposite pin and then all the rest; otherwise, you re-melt the first joint and gently nudge the part to get it into the correct position. Once all the pins have been soldered, you refresh the original, tacked joint with some extra flux and/or solder, then clean up any accidental bridges between pins with flux paste and solder wick. November 2020  39 There are a couple of different approaches to tacking that first pin. You can add a little flux to the pad, locate the part on it and then touch it with the tip of a soldering iron pre-loaded with a bit of solder. Or, you can add a little solder to the pad and heat it while sliding the part into place. Both methods work; the former perhaps gives a neater result while the latter is a bit quicker. SMD parts Start by fitting the 74HC595 ICs, which come in 16-pin SOIC packages. Pin 1 is marked either with a dot on the top face in one corner, or a bevelled edge along the pin 1 side. Make sure you have correctly located the LEDs at a different current level than specified). On the single-colour board, there is one 10k resistor and all the rest are 1k. Next, mount the SMD ceramic capacitors. There is a 100nF bypass capacitor for each IC on both boards, except IC13 on the RGB board, which has three (two for bypassing and one for reset). So there are eight on the basic board and 16 on the RGB board. Now fit the micro USB socket. This is also a surface-mounting device, although it also has pins that go through the board to hold it in place. Apply flux to its pads. Make sure it’s flat on the board and its signal pins are correctly located over their pads, then solder one of the mounting pins. Recheck the signal pin alignment before soldering the pin 1 and other mounting orientated pins. it as shown in The next step is to the corresponding load a little solder on the overlay diagram before tip of your iron and touch it soldering each IC in place. to the two signal pins at either There are either four or 12 end, so that some solder flows of these, depending on which onto each pin and pad with the version you’re building. aid of the flux paste applied For the RGB Star, the only earlier. remaining IC is microconYou don’t need to solder troller IC13 which has 32 the three middle pins, but pins, eight per side. Use you can if you want to. the same basic technique Regardless, check for to solder it, again makbridges with a magnifier ing sure its pin 1 dot is and if you find any, clean in the location shown. them up with more flux But be extra careful paste and some solder to check that the pins wick. on all four sides are Next, fit the surfacecorrectly aligned Fig.4: this PCB layout matches the circuit on page 38, mounting electrolytic after you’ve tackthe RGB LED Star. While it’s slightly more complicated to capacitors. There are soldered that first build, it can give much more exciting displays. eight for the basic pin. version or five for Ironically, the the RGB version. Seven (or five) of these can be substitutsituation is a bit more complicated with the single-colour ed with 22µF SMD ceramics. These cost about the same, LED version as there are four more 14-pin ICs to solder: and while they have less capacitance, they are significanttwo 74HC164s, one 74HC14 and one 74HC86. ly smaller, have much lower ESR and ESL and better long Don’t get these mixed up and make sure they are orienreliability. It will work either way, so the choice is yours. tated correctly, then solder the single SOT-23 package tranThe final SMD component is the ceramic resonator, sistor (Q1), followed by diodes D1-D16. Make sure their which is only on the RGB board. This part is a bit tricky cathode stripes all face to the right, as shown. to solder because it has no leads, only pads on the underAlso, don’t sneeze while handling these diodes or you side. That means you need either a hot air reflow system might lose half a dozen! If dropped on the floor, they’re or reflow oven to solder it. almost impossible to find (unless your floor is white viThe good news is that, as described above, it’s entirely nyl perhaps). optional; we expect most constructors will simply leave The next job for both boards is to fit all the SMD resisits pads empty. tors. For the RGB version, fit the 1M and 10k resistors That just leaves the LEDs and the headers. For the RGB near IC13 where shown, then the remaining 90 resistors, version, the LEDs are all the same, so the only thing you which are all 1k (or a different value if you want to drive 40 Silicon Chip Australia’s electronics magazine siliconchip.com.au Parts list – basic Stackable LED Star Parts list – RGB Stackable LED Star 1 double-sided PCB coded 16109201, 194 x 185mm 1 6-pin right-angle header (CON1) 1 SMD USB socket with through-hole mounting pins (CON2) 4 3-pin headers with jumper shunts (LK1-LK4) 1 double-sided PCB coded 16209202, 194 x 185mm 1 6-pin right-angle header (CON1) 1 SMD USB socket with through-hole mounting pins (CON2) 5 3-pin headers with jumper shunts (LK1-LK5) 1 2-pin header with jumper shunt (JP1) 1 3x2-pin header (optional; for programming IC13) 1 8MHz ceramic resonator, 3.2x1.3mm SMD package (X1) Semiconductors 4 74HC595 8-bit serial-to-parallel shift registers, SOIC-16 (IC1-IC4) 2 74HC164 8-bit shift registers, SOIC-14 (IC5,IC6) 1 74HC14 hex schmitt trigger inverter, SOIC-14 (IC7) 1 74HC86 quad 2-input XOR gates, SOIC-14 (IC8) 1 2N7002 small-signal N-channel Mosfet, SOT-23 (Q1) 30 5mm LEDs (LED1-LED30; any mix of colours) 16 1N4148WS small signal diodes, SOD-323 (D1-D16) Capacitors 1 100µF 10V SMD electrolytic, 5x5mm 7 100µF 10V SMD electrolytic, 5x5mm OR 7 22µF 10V X7R SMD ceramic, 3216/1206 size 8 100nF 50V X7R SMD ceramic, 2012/0805 size Resistors (all SMD 2012/0805 size) 1 10kW 30 1kW (or value[s] to suit LEDs) Abracon AWSCR-8.00CELA-C10-T3; optional – see text Semiconductors 12 74HC595 8-bit serial-to-parallel shift registers, SOIC-16 (IC1-IC12) 1 ATmega328P-AUR 8-bit microcontroller programmed with 1620920A.hex, TQFP-32 (IC13) 30 5mm RGB LEDs (4-pin common cathode type) Capacitors 5 100µF 10V SMD electrolytic, 5x5mm OR 5 22µF 10V X7R SMD ceramic, 3216/1206 size 16 100nF 50V X7R SMD ceramic, 2012/0805 size 3 1kW need to be careful of is to make sure that they are all orientated correctly. The PCB overlay diagram and PCB silkscreen shows which way the flat side (cathode end) of each one goes. Note that the LEDs are installed proud of the board by around 10mm. This is because the leads have a small section that’s slightly thicker around 10mm from the base of the lens, so you can’t push them all the way down onto the PCB. We reckon that this doesn’t matter too much, and in fact might make the LEDs a bit more visible at an angle. The basic procedure is the same for the non-RGB board, except that you will probably want to mix up the colours. You can use the same pattern that we did, or come up with your own one entirely. You could even just install different colours randomly if all you’re after is a ‘twinkle’ type effect. Once the LEDs are in place, fit the vertical headers for the links. If you’re going to put the Star on top of the stackable Tree, also fit the right-angle header at the bottom (CON1). You can mount this on either the front or the back of the board, depending on which is best for plugging into your existing Tree. Now is also a good time to fit the 3x2 pin programming header on the RGB Star, if you intend to reprogram IC13. If you’re using a pre-programmed chip and don’t want to Resistors (all SMD 2012/0805 size) 1 1MW 1 10kW 90 1kW (or value[s] to suit LEDs) change its coding, then there’s no need to fit this header. You can always solder it in later if necessary. Finally, plug in the jumper shunts onto the appropriate headers. Use the configurations shown in our PCB overlay diagrams if you want the Star to be self-contained and powered from the USB socket. Alternatively, place all the 3-pin shunts in the opposite positions (LK1-LK4 or LK5) if the Star will sit atop a Stackable LED Tree, or be driven via external circuitry at CON1. Programming the RGB LED Star If you’re building the RGB LED Christmas Star, you’ve most likely used a pre-programmed ATmega328 chip, so it will happily be flashing away with its default patterns as soon as power is applied. But if your ATmega328 is not programmed, or you are interested in changing the default patterns, read the following text which explains how to program the chip. If you have a blank microcontroller, you just need to download the HEX file from our website and use the following procedure to upload this into the flash memory of the micro. Or you can use the free Arduino IDE (integrated development environment) software to create your own patterns. In this case, you can use our source code as a starting point. Fig.5: if you don’t have an Atmel AVR programmer, you can use an Arduino Uno or similar to program the chip on this board. To do that, you need to make up a cable with 6-pin sockets at each end, wired as shown here. SC  siliconchip.com.au Australia’s electronics magazine November 2020  41 The rear of the RGB LED Star leaves you in no doubt as to which version it is! But more importantly, it has instructions for running the star in various modes. We’ll assume that you’re comfortable using the Arduino IDE, which you can download from siliconchip.com.au /l/aatq The programmer You’ll need an Atmel AVR programmer. Unlike an Arduino board, the RGB LED Christmas Star does not have a serial upload capability; it lacks the serial/USB converter and the bootloader firmware which are needed for the Arduino IDE to program it directly. Instead, we use an I(C)SP programmer. ISP here simply stands for “in-circuit serial programmer”. You might already have one of these, like Jaycar Cat XC4627. You’ll need one with a six-pin header. If your programmer has a 10-pin header, then adaptors like Jaycar’s XC4613 are available. But you don’t need a dedicated programmer if you have a spare Uno board lying around. It’s pretty easy to make a cable that turns the Uno into an AVR programmer. In any case, the process is much the same. Just make sure you choose the programmer type (instead of ‘Arduino ISP’) as instructed by your programmer manual. We used a pair of 6-pin (2x3) header sockets. These plug directly into the ISP header on Arduino boards; the RGB LED Star also has a matching header. Alternatively, you could make do with a set of six jumper wires temporarily rigged up to match our wiring. The ISP wiring harness is worth having as it isn’t difficult to make and it can be used to rescue some ‘bricked’ Arduino boards; our article about Fixing Busted Unos from March (siliconchip.com.au/Article/12582) has some more background to this. The first thing to do is to make up the harness, as shown in Fig.5. Five wires go between the corresponding pins on the six-pin header, while the sixth pin on one header goes to a flying lead which plugs into I/O pin D10 on the programmer board. We soldered a single pin header to the end of that wire. Before connecting the harness, configure the ‘spare’ Uno as a programmer by uploading the “ArduinoISP” sketch to it. This can be found under the Files -> Examples -> 11.ArduinoISP menu. Other boards can be used. We’ve had success using a Mega, but had trouble with a Leonardo. We suspect that this is due to the way the bootloaders work on the different boards. R3 clones of these boards (which have the ISP header) should also work. Now connect the five-wire end of the harness to the programmer Uno. The sixth wire should be plugged into digital pin 10. This is what allows the ‘master’ micro to control and program the slave. Note that pin 1 (as shown in Fig.5) should go to pin 1 on the Uno; it will typically have a dot or other marking nearby. There is one more step to complete our programmer. Run a male-male jumper wire between the 5V and RST pins on the Uno’s header. This pulls the RST pin high, preventing the host from programming the programmer instead of its attached target. Making a board profile The RGB LED Christmas Star is obviously not an Arduino, so we need to make a special board profile to program it from the Arduino IDE. This isn’t too complicated, just some text to tell the IDE how to work with something similar to (but not the same as) the Uno. The ATmega328P on the RGB LED Christmas Star is the same processor as used in the Uno, after all. But it lacks the serial interface and bootloader, and it also runs on an internal 8MHz oscillator instead of an external 16MHz crystal. Close the Arduino IDE and find the “boards.txt” file in our software download for this project (as shown in Screen1). This contains the profile which needs to be imported. We have Screen1: once you’ve added our custom board profile to your IDE, you can select it as shown here to program the micro on the RGB Star. 42 Silicon Chip Australia’s electronics magazine siliconchip.com.au found a few similar profiles around, but all required some changes to work correctly; our version has been tested with the Arduino IDE version 1.8.5. The contents of this file need to be added to your existing “boards.txt” file. On our Windows PC, this was found at “C:\Program Files (x86)\Arduino\ hardware\arduino\avr”; it may be different if you have installed the IDE to a different location. If you have trouble with this file, you can also type in the additions manually. Once you have done that, restart the IDE. Manual changes require a restart of the IDE to be loaded. If you look in the Tools menu, you should see a new board, as shown in Screen1. Select this as the board and select the serial port of the programmer. Now click on “Burn Bootloader” from the Screen2: the above text should be added to your Arduino IDE ‘boards.txt’ file. Sketch menu. If you don’t feel like typing it out by hand, it can be found in our software This doesn’t actually burn a bootdownload for this project. loader, but it does set the configuration fuses which allows the 8MHz internal oscillator to work. So unless you’ve fitted a crystal and are confident it will You might get an error message that the bootloader file work, you should simply use the internal oscillator option. cannot be found; that is fine, as there is no bootloader file If you have used a 16MHz crystal or resonator, the Uno required. board type can be used. While it is not the same as the Uno, Now open the “RGB_Christmas_Star” sketch. Instead of it is the closest match. For an 8MHz crystal or resonator, using the “Upload” command, we need to use the “Upload use the board “Lilypad Arduino”. using Programmer” command. The keyboard shortcut for Once you’ve programmed the RGB LED Christmas Star this is Ctrl-Shift-U. The upload process here is a bit slower, to your satisfaction, detach the programming lead and rebut should still complete in under 10 seconds, after which turn the jumpers to their original positions (if changed) the Star will start to cycle through its patterns. by reinstating the jumper next to the ISP header. Plug in a micro-USB lead to power the unit, and it should light up The sketch with the programmed patterns. The sketch we have written is made of subroutines which By connecting the DO connection from one Star to the rely on other, simpler subroutines. While this might seem DI connection on another Star (and also connecting the complicated, it makes the code quite modular. other four wires on the headers in parallel), the main Star The clockSequence() routine, which is the first to run, can also drive those Stars, as long as their jumpers are set calls the clockCycle() subroutine in each of the seven colto the appropriate positions. SC ours (red, yellow, green, cyan, blue, magenta and white). This, in turn, calls the setSnake() routine with differing parameters, which generates several different patterns. The setSnake() routine works by putting red, green and blue values (corresponding to the LEDs) into an array. M Chri erry ! The clockCycle() routine also calls the mapBits() subroustma o H o Mila oel! s! tine, which translates an array of colour values (the LEDS Ho H Joyeux N dM ajid array) into a bitmap which can be written directly into the shift registers (dataBits). This is followed by the sendBits() routine, which shifts and latches this data onto the LEDs. Bon While it appears a complicated way of doing things, you God Nata le Jul! can make simple customisations by changing what is present in the loop() function. Or you can make more elaboFeliz Shen Dan rate patterns by modifying the other functions. Navidad! Ku CHRISTMAS STAR KITS RGB VERSION ai Le Conclusion If you have fitted an external oscillator or crystal to the RGB LED Christmas Star, then there are equivalent board options, although there is little reason to do so when the 8MHz internal oscillator works just fine. There’s also the complication that once the fuses are set to use a crystal, they can’t be set back without a crystal. siliconchip.com.au COMPLETE KIT: just $3850    INC GST PLUS P&P* Comes with all parts including the black PCB, programmed micro and LEDs with diffused lenses for better visibility at wider angles. We have plenty of stock (at press time) ready for you to build for this Christmas Season. But don’t delay or you may miss out! See www.siliconchip.com.au/shop/20/5525 Australia’s electronics magazine *P&P $10 – Flat rate for any size order (in Aust) November 2020  43