Silicon ChipOh Christmas tree, oh Christmas tree... - November 2018 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Are electronic medical records privacy concerns overblown?
  4. Feature: Which tiny country is about to launch a lunar lander? by Dr David Maddison
  5. Project: Oh Christmas tree, oh Christmas tree... by Tim Blythman
  6. Project: USB digital and SPI interface board by Tim Blythman
  7. Feature: Australians develop a "supercomputer" by Geoff Graham
  8. Serviceman's Log: It's torture having a broken phone by Dave Thompson
  9. Project: Insomnia and Tinnitus killer by John Clarke
  10. Feature: El cheapo modules, part 20: two tiny compass modules by Jim Rowe
  11. Project: GPS-synched, lab-quality frequency reference (Part 2) by Tim Blythman and Nicholas Vinen
  12. Product Showcase
  13. Subscriptions
  14. Vintage Radio: The 1939 HMV 904 5-inch TV set and 3-band radio receiver by Dr Hugo Holden
  15. PartShop
  16. Market Centre
  17. Advertising Index
  18. Notes & Errata: Super Digital Sound Effects Module, August-September 2018
  19. Outer Back Cover: Trio Test & Measurement - Siglent test equipment

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

You can view 41 of the 104 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 "Oh Christmas tree, oh Christmas tree...":
  • Software for Amazing Light Patterns for the LED Christmas Tree (Free)
  • Stackable LED Christmas Tree PCB [16107181] (AUD $5.00)
  • Kit for the Stackable LED Christmas Tree (Component, AUD $10.00)
  • Kit for the Digital Interface Module (Component, AUD $15.00)
  • Arduino sketch (.ino) files and sample Python software for the LED Christmas Tree (Free)
  • LED Christmas Tree PCB pattern (PDF download) [16107181] (Free)
Articles in this series:
  • Oh Christmas tree, oh Christmas tree... (November 2018)
  • Oh Christmas tree, oh Christmas tree... (November 2018)
  • Amazing light display from our LED Christmas tree... (December 2018)
  • Amazing light display from our LED Christmas tree... (December 2018)
Items relevant to "USB digital and SPI interface board":
  • USB Digital and SPI Interface PCB [16107182] (AUD $2.50)
  • PIC16F1455-I/P programmed for the USB Digital and SPI Interface Module [1610718A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Kit for the Digital Interface Module (Component, AUD $15.00)
  • Firmware (HEX and C) files for the USB Digital and SPI Interface Module (Software, Free)
  • USB Digital and SPI Interface PCB pattern (PDF download) [16107182] (Free)
Items relevant to "Insomnia and Tinnitus killer":
  • Tinnitus/Insomnia Killer PCB (Jaycar version) [01110181] (AUD $5.00)
  • Tinnitus/Insomnia Killer PCB (Altronics version) [01110182] (AUD $5.00)
  • Tinnitus/Insomnia Killer PCB (Jaycar version, manufacturing fault) [01110181] (AUD $2.50)
  • PIC12F617-I/P programmed for the White Noise Generator [0910618A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Hard-to-get parts for the Tinnitus/Insomnia Killer (Component, AUD $12.50)
  • Firmware (ASM and HEX) files for the White Noise Source and Steam Train Whistle/Diesel Horn [0910618A/M.HEX] (Software, Free)
  • Tinnitus/Insomnia Killer PCB patterns (PDF download) [01110181/2] (Free)
  • Tinnitus and Insomnia Killer panel label artwork and drilling templates (PDF download) (Panel Artwork, Free)
Items relevant to "El cheapo modules, part 20: two tiny compass modules":
  • Sample BASIC source code for interfacing a Micromite with an eCompass module (Software, Free)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "GPS-synched, lab-quality frequency reference (Part 2)":
  • GPS-synched Frequency Reference PCB [04107181] (AUD $7.50)
  • PIC32MX170F256B-50I/SP programmed for the GPS-Synched Frequency Reference [0410718A.hex] (Programmed Microcontroller, AUD $15.00)
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • Micromite LCD BackPack V2 complete kit (Component, AUD $70.00)
  • SMD parts for the GPS-Synched Frequency Reference (Component, AUD $80.00)
  • Firmware (HEX) files and BASIC/C source code for the GPS-Synched Frequency Reference [0410718A.hex] (Software, Free)
  • GPS-Synched Frequency Reference PCB pattern (PDF download) [04107181] (Free)
  • GPS-synched Frequency Reference drilling and cutting diagrams (PDF download) (Panel Artwork, Free)
Articles in this series:
  • GPS-synched Frequency Reference Pt.1 (October 2018)
  • GPS-synched Frequency Reference Pt.1 (October 2018)
  • GPS-synched, lab-quality frequency reference (Part 2) (November 2018)
  • GPS-synched, lab-quality frequency reference (Part 2) (November 2018)

Purchase a printed copy of this issue for $10.00.

The Christmas T It’s an unwritten law in Australia that your house has a better Christmas lights display than your neighbours . . . And perish the thought that you have one the same as anyone elses! By Santa’s Little Helper – Tim Blythman Well, build this one and you’ll have an awesome display, totally unlike anything else around, with the requisite flashing lights (in green, red and white, of course). You might even get some elves to give you a hand building it. See Page 101 for an exclusive PCB/kit offer! Just one of the many possible trees that you can build by stacking these boards together. This one is 80cm tall, 64cm wide and uses 38 boards with 304 LEDs. 24 Silicon Chip Australia’selectronics electronicsmagazine magazine Australia’s siliconchip.com.au Tree that Grows! A nd just how does it grow? Surely it’s not alive? Well, not quite – but it can grown from a single tree about 150mm high to a monster, as high as you want. The reason for this is that it’s made from stackable PCBs – you just build another board and plug it in! And each one is cheap and easy to build, so it won’t take much effort to make a big tree display. The concept is simple – but ingenious at the same time. Each PCB is shaped like a small tree with three branches and has eight LEDs which can be controlled in any manner that you wish, to create many different kinds of patterns. using low voltage – and you can learn about electronics at the same time. How it works If you want more, another three PCBs can be connected to the end of each branch, then another three PCBs can be stacked on those branches and so on, to form a bigger and bigger tree. When the PCBs are stacked, power and data are automatically fed through, so you need just one lowcost controller board no matter how big your tree is. If you want a huge Christmas tree, you could use, say, 38 boards, as shown in opposite, to make a big “pinetree”-shaped arrangement the best part of a metre high, with a total of 304 flashing LEDs. Wouldn’t that look absolutely spectacular? Each board contains eight LEDs with current-limiting resistors, one IC, one capacitor and four optional headers (to connect further boards). The IC is the key to this design. It is a 74HC595 eight-bit shift register with output latches. That’s a pretty complicated description but the way it works is relatively simple. Let’s discuss the output latches first. A latch is a circuit with one digital input, one digital output and a latching signal line. When you send the latch signal, the output state is set to the same as the input state (either low or high). It stays that way until you send another latch signal. So if a LED is connected to the output of a latch, you can set it to be either on or off, and it will remain that way until you decide to change it. If we connect all the latch signal lines together, we create a single wire which can be used to update the state of all the LEDs simultaneously. Therefore we can update the latch inputs several times per second and then trigger the latch signal lines, setting the state of each particular LED on or off as desired, and they will stay in that state until another update comes along. This lets us create the LED patterns on the tree. Want even bigger? Shift registers Hey, the only practical limit is how you are going to support a 20m high tree . . . and supplying enough power for the number of PCBs. (Each one draws about 25ma, so a huge tree is going to need a few amps <at> 5V. Now there’s a practical use for that old computer power supply gathering dust in the cupboard!) You could even collaborate with your friends, family and/or classmates, by each building a few boards and then bringing them all together to build a huge tree. It’s also an excellent project for beginners since it’s easy, fun and safe, So how then do we control the state of each latch input to select the LED on/off states? We could use a parallel scheme Not big enough? siliconchip.com.au with one wire per latch but then in the case of the large tree opposite, with 304 LEDs, we would need 304 wires (plus a few for the latch signal, ground, power etc). That would be far too unwieldy. This is where the shift registers come to the rescue. In addition to eight separate latches to drive eight LEDs, each 74HC595 logic IC also contains an eight-bit shift register. You can imagine this like a clear plastic tube which can hold eight coloured balls. Say the balls are black or white to represent zero and one bits. This is shown in Fig.1. If you push a new ball (of either colour) into one end of the tube, they all move along one position, and the last one falls out the end. If you feed eight new balls into one end of the tube, one at a time, once you have finished, all the old balls will have fallen out and the resulting black/white pattern will be determined by the order in which you inserted the balls. Now if we place several of these tubes end-to-end, we can keep feeding in balls into the first tube and eventually, we will have replaced all of the balls in all of the tubes. This is essentially how our chain of shift registers works. We feed bits into the first register in the chain, one at a time and they are “shifted” through the first register. Each time, the bits stored in the register move along to the adjacent bit position and the last one, which would be lost, is presented at one of the IC outputs. This can then be fed into the next register in line. So we only need two “data” wires – Fig.1: this shows how a shift register with output latches works. In this example, two 8-bit shift registers are chained to effectively form a single 16-bit shift register. When a new “1” bit is shifted in from the left (at the first register’s input), all the bits shuffle to the right by one step. Then, when the latch signal is applied, the new values within the shift registers are copied to the latches and thus the output states change. Australia’s electronics magazine November 2018  25 Fig.2: the path that serial data takes as it moves between multiple boards in the tree. You need to understand this if you want to control specific LEDs in the tree. Four PCBs are shown here but of course, larger displays are possible. Note how the top-most connectors on the “leaf” boards are wired to loop the data back into the board when no boards are plugged in at those locations. a clock signal (to indicate when to shift the bits) and a data signal (to indicate the value of the new bit to feed in) and we can update any number of registers. We just need to send exactly the right number of clock pulses. These shift registers feed into the latch inputs mentioned earlier. So after shifting all the required bits into the registers, we send the latch signal and all the LED states are updated with the values that we just transferred serially (ie, one at a time). Connecting and arranging multiple boards If we were trying to create a LED bar graph – ie, where each set of eight LEDs is simply stacked next to the last – then we could simply wire up the boards so that the output of each shift register feeds into the input of the next. Then we could easily update all the LEDs arranged in a row by sending an appropriate number of serial pulses. But a tree is not linear – it has branches – so we need to be a bit more tricky in how we wire the boards up. Our tree board has one input connector, to update the eight LEDs on the board itself, plus three outputs, going to each of the three possible branches. And you might not fit all three branches. In fact, for the “leaf” boards at the outside edge of the tree, none of the branches would be fitted. So how do we make the shift register chain work? We use something which is known in mathematics as a “depthfirst” algorithm. Imagine you have a tree made of four boards, as shown in Fig.2. There is one “root” board, plus three “leaf” boards attached to each of its branches. Data is first shifted into the eightbit register on the root board. Its output is then fed to the first leaf board, P arts List – LED Christmas Tree (for each board – build as many as you want!) 1 double-sided PCB, code 16107181, 100mm x 93mm 1 74HC595 shift register,16-pin DIL package (IC1) [Jaycar ZC4895, Altronics Z8924] 8 high-brightness 5mm LEDs (LED1-LED8; a mix of green, red and white recommended) 8 1k 1/4W or 1/2W resistors 1 47µF 16V electrolytic capacitor 1 100mm length of 0.7mm diameter tinned copper wire (to join PCBs) or 1 6-way pin header and 3 6-way female header sockets and 3 2-way pin headers 26 Silicon Chip Australia’s electronics magazine where it is shifted into the eight-bit register there. The output of this first leaf board is then fed back into the root board, and then into the second leaf board. It is then shifted through the third eight-bit register, then back into the root board, to be passed onto the fourth and final eight-bit shift register. It then returns to the root board and goes out the bottom. That data is ignored since it will be the old data, which is no longer needed. But it must go out the bottom in case there is another layer of boards underneath. You will note that the data is shown “looping back” around the branches on each leaf board, where another board could be connected but is not. This is arranged simply by bridging the input and output pads on those unused connectors. That is how each board “knows” where to route the signal. You would agree that this is a pretty clever way to get data to all the parts of the tree with minimal effort and virtually no wiring. And where does the data come from in the first place? You could use a variety of different sources such as an Arduino or Raspberry Pi, but later on in this issue, we will present a very simple and cheap control module. This can be used independently, with pre-programmed patterns, or connected to a computer via its USB port and used in conjunction with computer software to drive the LEDs on the tree. We will also provide instructions on how to control the Tree using an Arduino later in this article. Circuit details The circuit of each root/branch/ leaf board is identical and is shown in Fig.3. IC1 is the 74HC595 shift register and its latch output pins are labelled Q0 through Q7. Each of these is connected directly to the anode of one of LEDs1-8, so if the latch output is high, the LED lights up. The LED cathodes are connected to ground via 1kcurrent-limiting resistors, giving a typical current, with a 5V supply, of 3mA (5V – 2V)÷1k. This is suitable for high-brightness LEDs but you may want to reduce the resistor values (to say 220) if using standard LEDs, to give them enough current to siliconchip.com.au Fig.3: the eight LEDs are driven directly from the eight output pins of shift register IC1, with 1k current limiting resistors setting the current through each to around 3mA. produce reasonable brightness. But this would increase the overall current demand, which could be a problem if you’re using many boards to make a big tree. So we recommend that you stick with high brightness LEDs. A 47µF electrolytic bypass capacitor is connected across the supply pins of IC1. This is important since there are many connectors and tracks between the root and the leaves of a big tree and that could cause transient voltage drops due to wiring and contact resistance. A bypass capacitor helps to smooth out the local supply voltage The rest of the circuit is just wiring between IC1 and the four connectors; CON4 is at the bottom of the node and for the root board, is connected to the controller. This is where the data comes in. CON1-CON3 are on each of the three branches. On all four connectors, pin 1 is the +5V supply and pin 2 is GND (0V). These are all connected in parallel, to feed power to all the branches. Pin 5 is the latch signal while pin 6 is the serial clock signal; these are all routed in parallel to all the branch connectors too, as well as to pins 12 and 11 of IC1 respectively. When pin 12 transitions from a low (~0V) to high (~5V) voltage, that causes the eight latches inside IC1 to be upsiliconchip.com.au dated with the new values from the shift register. And since pin 12 of all the 74HC595 ICs in the tree are connected together, they all update simultaneously. All the serial clock pins are also joined and this causes all the shift registers to shift simultaneously, forming our serial data chain. The remaining two pins are for the serial data. Pin 3 on CON4 is the serial data input and pin 4 is the serial data output. Pin 3 is routed to pin 14 on IC1, the shift register serial data input. The serial output from IC1, at pin 9, goes to pin 3 of CON1, then the data from CON1 (pin 4) is routed to CON2 (pin 3), then from CON2 to CON3, and from CON3 back to CON4 – refer to Fig.2 to see how the data travels in the tree. As mentioned earlier, if there is no board connected to either CON1, CON2 or CON3 then you merely bridge pins 3 and 4 (with a short piece of wire or a blob of solder) to route the signal on to the next branch, or back up to the “parent” node, in the case where CON3’s pins are bridged. This is shown in the photo of the single board overleaf. There is just one more pin on IC1 to consider and that is pin 13, the G input, which can be used to disable all the outputs. We aren’t using this Australia’s electronics magazine and so that pin is tied to ground. The outputs are therefore always enabled. Controlling it Fortunately, controlling a shift register is quite easy, although you need to be mindful of the order in which bits need to be presented. The first thing to keep in mind is that the first bit shifted into the tree sets the state of the last LED and the last bit shifted in sets the state of the first LED. The other thing to keep in mind is that since the data “snakes” its way through the tree, as shown in Fig.2, if you need to know which LED is which, you will have to trace out this data path to figure it out. But many patterns can be generated where it doesn’t matter exactly which LED is which. For example, if you just want to make the LEDs twinkle, you can essentially feed random data into the tree and update the latches periodically. Or you can take advantage of the “snaking” pattern by slowly shifting one bit at a time and updating the latch, to make the pattern “march” through the tree. These are both modes that our controller can provide. Pretty much any device that can drive three digital outputs can be used to control the tree. You can use a 3.3V-powered deNovember 2018  27 Fig.4: here’s the component overlay for both the display board (the “branches”) with the photo at right also showing the controller board plugged in (see the article commencing on page 32). The 47µF capacitor (immediately under (IC1) is shown laid flat in the overlay but we found some very low profile capacitors for the prototype so mounted them in the normal (vertical) way. Either way is satisfactory. vice, such as a Micromite or Raspberry Pi, but in this case, you should use a power supply voltage for the tree in the range of about 3.3-4.5V, which will result in slightly dimmer LEDs (but probably still bright enough, as long as they are high-brightness types). If you power the tree from 5V but use a 3.3V signal source, it may work but it’s possible that it won’t since with a 5V supply, the 74HC595 is only guaranteed to detect a voltage above about 3.5V as a logic high level. Having said that, we’re yet to come across a 74HC595 which will not work with a 3.3V signal. Make sure you don’t feed the output from pin 4 of your tree root back to a 3.3V chip though. Generally, there is no reason to do this and it could damage the IC. If you do run into problems driving the tree from a 3.3V source, you could use a logic level translator to boost the output of your 3.3V device up to 5V. Luckily, since the control scheme is serial, you only need to translate three signals. Connection options Ideally, once you have built all the 28 Silicon Chip boards and decided on the shape of your tree, you should permanently connect the boards using short lengths of stiff wire (eg, tinned copper wire). This makes the whole tree quite rigid and able to support its own weight, unless you are creating a real monster. For example, you could hang the tree from a wire soldered to the top. This is also the cheapest construction method. If you want to experiment and play around, you can use pin headers and sockets, as shown in our photos. That makes it really easy to experiment with the boards but you need to lay them on a flat surface for this to work. Otherwise, if you try to stand the tree up or hang it, it will probably flop around and may pull itself apart under gravity. The sockets don’t have that much retention force. So it’s up to you; if you want maximum flexibility, use a six-way pin header for CON4 and female header sockets for CON1-CON3. Two-way pin headers with a solder blob across the base can be used to “terminate” the sockets with nothing plugged into them, as shown in our photos. Australia’s electronics magazine PCB assembly There are very few components needed to build a single board and it doesn’t take long to build it. Use the PCB overlay diagram, Fig.5, as a guide. The board measures 93 x 100mm and is coded 16107181. Start by fitting the resistors. Whether you use the 1k specified for high-brightness LEDs [brownblack-black-brown-brown (1% tolerance); or brown-black-red-gold (5% tolerance) or the 220 (red-red-blackblack-brown or red-red-brown-gold) for standard LEDs, the values are all the same. So all you need to do is bend their leads so they fit through the provided holes (a lead forming tool is helpful), push them down onto the board, solder the leads to the pads on the underside siliconchip.com.au and trim off the excess lead length. While it doesn’t matter which way around they go, it looks neater if the colour coding rings are all orientated the same way. It’s also a good idea to make sure they are fitted straight, again, to make it look neat. This is easier if you solder one lead first, then check that they are lined up correctly, then solder the other lead. Be sure to check all the solder joints when they are finished, to make sure they are shiny and contact both the lead and PCB pad properly. We recommend that you solder IC1 directly in place, although you could fit a socket to the board and then plug the chip in if you prefer to do so. Push the chip right down onto the board making sure that its pin 1 notch is facing towards the left, as shown in Fig.5. Also make sure the IC leads go through the holes and do not fold up underneath it. DIP ICs are designed to be installed by a machine, so their leads may be splayed outwards slightly, making it a bit more difficult to insert them by hand. If you’re having trouble, try carefully bending the leads inwards slightly. You can use pliers but a purpose-made IC lead bending tool is even better. Install the LEDs next. You can use whatever colours you like; you could make all the LEDs on one board the same colour but different to another board, or you could mix different colours on the one board. Regardless, make sure that each one is orientated correctly before soldering it in place. The longer (anode) lead must go through the hole marked “A” on the PCB. We elected to push our LEDs all the way down onto the PCB before soldering and we recommend that you do the same. Next, fit the electrolytic capacitor. It is also polarised and must be orientated correctly. In many cases the electro will be too tall to solder in the conventional way – it can be laid over on the board and the pins soldered down 90°. The longer positive lead must be soldered to the pad marked “+” on the PCB (the stripe on the can indicates the negative lead). Header As mentioned earlier, the best way to join the boards to form a big tree is siliconchip.com.au What kind of power supply do you need? These boards are designed to run off 5V, although you could get away with running them from a slightly lower voltage. But since 5V supplies are very common, you might as well stick with that. If you build the boards as specified, they will draw a maximum of about 25-30mA. That means you can run up to 16 boards (500mA ÷ 30mA ) off a single USB port. Having said that, most USB ports will deliver well over the 500mA minimum and most USB chargers are capable of at least 1A – and usually more than 2A. So you could easily run a big tree off most USB supplies – including (but not limited to) the large 38-board version shown earlier. But there’s not much to stop you from making a much bigger tree. You could combine more than 100 boards to make a huge one, well over a metre tall. You may need to attach the boards to a rigid backing for support but it should work. Such a tree would draw several amps at 5V. with short lengths of 0.7mm diameter tinned copper wire. You save the cost of headers that way. You could use right-angle headers but we have used straight headers and surface-mounted them sideways, for a couple of reasons. Firstly, right-angle female headers are very hard to get. And secondly, this makes it easier for the whole assembly to sit flat. Even if you are using fixed wires for most of the connections, we recommend that you use a female socket for CON4 on the bottom-most (root) board, to make it easier to connect up your control system. To solder straight pin headers like this, it’s easiest to hold the six-way pin header in a female socket strip. That helps to keep the pins lined up and also provides some insulation for your fingers from the heat of the iron. Solder one pin first and ensure the header strip in flat, level and flush with the PCB. If that is the case, solder the rest of the pins. If not, apply the iron to the soldered pin and adjust it before soldering the remaining pins. Testing It’s a good idea to test each PCB by itself before joining them all together, especially since a problem with one Australia’s electronics magazine You can, of course, buy plugpacks and “brick” type supplies that can deliver that much current but why not re-purpose an old PC power supply? They will usually deliver at least 5A from their 5V rail and in some cases, much more. A pinout of the 20-pin AT or 28-pin ATX connector will let you identify which wires are 5V (usually red) and which are 0V (usually black). You can then cut off the unnecessary connector, join several red wires together and several black wires together, to give you your +5V and 0V outputs, and then wire a toggle switch between the green wire and the 0V output. Toggling that switch to the on position should then cause the power supply to start up. Note that if your power supply has a brown wire (+3.3VSENSE, not present in all cases but if it is, usually on pin 13), then you will need to join it to one of the orange wires (+3.3V) to get the power supply to stay on. PCB might affect the operation of other PCBs, making it hard to work out which one actually has the problem. The easiest way to do this is to use the control system you plan to use for the whole tree but connect it up to one board at a time. If you haven’t prepared that yet, you can use an Arduino programmed with the software described below. Once you are happy that the boards are working, you can start assembling them into a larger tree. One from many If you have built all your boards with headers, you just need to plug them all together. Note that as the tree gets larger, there are some sockets that you can’t use, as the boards would overlap. You need to choose which one of the two conflicting boards you want to fit. Look at the opening page for an idea of how this can be done. Once you have finished, any boards which have nothing plugged into CON1, CON2 or CON3 will need a jumper connecting pins 3 and 4. If you have not used sockets, bend a component lead off-cut into a “U” shape, push it into the pin 3 and 4 pads for the relevant connector, solder it at both ends, then trim the excess lead. If using sockets, you can use a small November 2018  29 Controlling the Christmas Tree with an Arduino We have uploaded a simple test sketch to our website to test each board you build, by cycling through the LEDs in order. It will work with just about any Arduino; we tested it with a Uno but you can use a clone, or a Leonardo or Mega. If you haven’t used an Arduino board before, you’ll also need to install the Arduino Integrated Development Environment (IDE), which allows you to write programs (called “sketches”) and upload them to the Arduino board. This can be downloaded for free from: www.arduino.cc/en/Main/Software Once you have installed this software and opened our sketch (“Stackable_LED_Tree.ino”), you will then need to make the following connections from the Arduino to your tree root using five male-female jumper leads, as follows: Arduino Board 5V GND D2 D3 D4    Tree 5V (pin 1) GND (pin 2) DI/MOSI (pin 3) CK/SCK (pin 6) LT/RCK (pin 5) Next, select your board type and port from the Tools menu and upload the sketch to the board using the Upload button. You should then see the LEDs turn on one at a time, starting with LED1 and progressing to LED8. If more than one LED turns on, or any LED does not light, something is wrong with your board. Check your wiring and ARDUINO UNO the soldering on the board. Also, check that the orientation of your LEDs is correct. The sketch is designed to work with one board at a time but if other boards are connected, their LEDs should light up too. You might notice that the LEDs on the other boards are delayed by comparison with the previous board. This is because the data from each board gets pushed onto the next board each one cycle later. We have also written another sketch which provides a random twinkle effect, ideal for simulating a Christmas tree. It’s called “Stackable_LED_Tree_Twinkle.ino” We’ve inserted plenty of comments in both programs to help you understand and customise them. CHRISTMAS TREE PCB 5V PIN GND PIN PINS 2-4 Here’s an example of how the Tree PCB can be wired up to an Arduino board- we’ve used a Leonardo board and some plug-socket jumper wires here. The DO connection doesn’t need to be connected, and is not used by any of the sample sketches. 30 Silicon Chip Australia’s electronics magazine Any boards with nothing plugged into them need to have their DO and DI terminals shorted (in all three cases) – either with a soldered wire link or just with solder flowed between the pads. piece of tinned copper wire or component lead off-cut bent into a “U” shape, as long as it is thick enough to stay firmly in the socket. Or you can short out a two-pin header with a blob of solder (see photo above) and plug this into the middle of the socket. We even created small pluggable jumpers by taking a two way piece of male header, and bridging the two sides with a ball of solder. This is handy if you want to experiment with your tree layout. On the other hand, if you have very small kids around, it might be a good idea to use the option of permanently soldering the jumpers in place, as you don’t want them to get loose and he swallowed. By the way, if you want to be really creative, you could make several smaller trees and join them together using lengths of 6-way ribbon cable; there’s no reason why the boards have to be in direct contact with each other, as long as CON4 on one board is wired to CON1, CON2 or CON3 on another board without transposing the connections. Depending on whether you want to connect your tree to an Arduino board or our dedicated controller, see the instructions at left or the following article. We hope the Stackable LED Christmas Tree brightens up your Christmas and helps someone learn a bit about electronics! And by next Christmas you’ll be wanting to make up a whole lot more add-on boards for a monster tree! SC siliconchip.com.au