Silicon ChipMax’s Cool Beans - January 2025 SILICON CHIP
  1. Contents
  2. Publisher's Letter: Two new series for the magazine
  3. Feature: The Fox Report by Barry Fox
  4. Feature: Net Work by Alan Winstanley
  5. Feature: Max’s Cool Beans by Max the Magnificent
  6. Project: High-quality Microphone Preamplifier by Phil Prosser
  7. Feature: The History of Electronics, part one by Dr David Maddison
  8. Feature: Circuit Surgery by Ian Bell
  9. Feature: Techno Talk by Max the Magnificent
  10. Feature: The Quason VL6180X laser rangefinder module by Jim Rowe
  11. Project: USB to PS/2 Keyboard & Mouse Adaptors by Tim Blythman
  12. Project: Raspberry Pi-based Clock Radio, part two by Stefan Keller-Tuberg
  13. Subscriptions
  14. Feature: Precision Electronics, part one by Andrew Levido
  15. Project: Secure Remote Mains Switch, part two by John Clarke
  16. PartShop
  17. Market Centre
  18. Advertising Index
  19. Back Issues

This is only a preview of the January 2025 issue of Practical Electronics.

You can view 0 of the 80 pages in the full issue.

Articles in this series:
  • The Fox Report (July 2024)
  • The Fox Report (September 2024)
  • The Fox Report (October 2024)
  • The Fox Report (November 2024)
  • The Fox Report (December 2024)
  • The Fox Report (January 2025)
  • The Fox Report (February 2025)
  • The Fox Report (March 2025)
  • The Fox Report (April 2025)
  • The Fox Report (May 2025)
Articles in this series:
  • Win a Microchip Explorer 8 Development Kit (April 2024)
  • Net Work (May 2024)
  • Net Work (June 2024)
  • Net Work (July 2024)
  • Net Work (August 2024)
  • Net Work (September 2024)
  • Net Work (October 2024)
  • Net Work (November 2024)
  • Net Work (December 2024)
  • Net Work (January 2025)
  • Net Work (February 2025)
  • Net Work (March 2025)
  • Net Work (April 2025)
Articles in this series:
  • Max’s Cool Beans (January 2025)
  • Max’s Cool Beans (February 2025)
  • Max’s Cool Beans (March 2025)
  • Max’s Cool Beans (April 2025)
  • Max’s Cool Beans (May 2025)
  • Max’s Cool Beans (June 2025)
Articles in this series:
  • The History of Electronics, Pt1 (October 2023)
  • The History of Electronics, Pt2 (November 2023)
  • The History of Electronics, Pt3 (December 2023)
  • The History of Electronics, part one (January 2025)
  • The History of Electronics, part two (February 2025)
  • The History of Electronics, part three (March 2025)
  • The History of Electronics, part four (April 2025)
  • The History of Electronics, part five (May 2025)
  • The History of Electronics, part six (June 2025)
Articles in this series:
  • Circuit Surgery (April 2024)
  • STEWART OF READING (April 2024)
  • Circuit Surgery (May 2024)
  • Circuit Surgery (June 2024)
  • Circuit Surgery (July 2024)
  • Circuit Surgery (August 2024)
  • Circuit Surgery (September 2024)
  • Circuit Surgery (October 2024)
  • Circuit Surgery (November 2024)
  • Circuit Surgery (December 2024)
  • Circuit Surgery (January 2025)
  • Circuit Surgery (February 2025)
  • Circuit Surgery (March 2025)
  • Circuit Surgery (April 2025)
  • Circuit Surgery (May 2025)
  • Circuit Surgery (June 2025)
Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 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 4 (February 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 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 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 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 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: 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, Part 2 (June 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: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "Raspberry Pi-based Clock Radio, part two":
  • Raspberry Pi Clock Radio main PCB [19101241] (AUD $12.50)
  • Raspberry Pi Clock Radio display PCB [19101242] (AUD $7.50)
  • Software for the Raspberry Pi based Clock Radio (Free)
  • Raspberry Pi Clock Radio PCB patterns (PDF download) [19101241-2] (Free)
Articles in this series:
  • Raspberry Pi Clock Radio, Pt1 (January 2024)
  • Raspberry Pi Clock Radio, Pt2 (February 2024)
  • Raspberry Pi-based Clock Radio, part two (January 2025)
Articles in this series:
  • Precision Electronics, Part 1 (November 2024)
  • Precision Electronics, Part 2 (December 2024)
  • Precision Electronics, part one (January 2025)
  • Precision Electronics, Part 3 (January 2025)
  • Precision Electronics, part two (February 2025)
  • Precision Electronics, Part 4 (February 2025)
  • Precision Electronics, Part 5 (March 2025)
  • Precision Electronics, part three (March 2025)
  • Precision Electronics, part four (April 2025)
  • Precision Electronics, Part 6 (April 2025)
  • Precision Electronics, Part 7: ADCs (May 2025)
  • Precision Electronics, part five (May 2025)
  • Precision Electronics, part six (June 2025)
Items relevant to "Secure Remote Mains Switch, part two":
  • Secure Remote Mains Switch receiver PCB [10109211] (AUD $7.50)
  • Secure Remote Mains Switch transmitter PCB [10109212] (AUD $2.50)
  • PIC16F1459-I/P programmed for the Secure Remote Mains Switch receiver (1010921R.HEX) (Programmed Microcontroller, AUD $10.00)
  • PIC16LF15323-I/SL programmed for the Secure Remote Mains Switch transmitter (1010921A.HEX) (Programmed Microcontroller, AUD $10.00)
  • Firmware and ASM source code for the Secure Remote Mains Switch [1010921A/R] (Software, Free)
  • Secure Remote Mains Switch PCB patterns (PDF download) [10109211/2] (Free)
  • Front panel label and drilling diagrams for the Secure Remote Mains Switch (Panel Artwork, Free)
Articles in this series:
  • Secure Remote Mains Switch, Part 1 (July 2022)
  • Secure Remote Mains Switch, Part 2 (August 2022)
  • Secure Remote Switch, Part 1 (December 2024)
  • Secure Remote Mains Switch, part two (January 2025)
Max’s Cool Beans By Max the Magnificent Weird & Wonderful Arduino Projects Part 1: DIP LED bar graph displays W ell, hello there. It’s so nice to see you. I can’t believe we’re meeting in the January 2025 issue of Practical Electronics. I don’t want to scare you, but do you realise that we are now a quarter of the way through the 21st Century? I graduated from high school towards the tail-end of the last millennium. That was in the summer of 1975, when the year 2000 was still a quarter of a century into my future. It feels like I only recently recovered from my enthusiastic contributions to the Y2K celebrations, yet I now find them to be well in the rearview mirror of my life, rapidly receding at a pace that appears to be irresponsibly increasing. I’m too young for all this excitement! Originally aimed at the experimenter, PE began publication in the UK in December 1964. My parents took out a subscription for me starting on my They call me “Mad Max”, but I’ve never been able to figure out why... twelfth birthday, in May 1969. At that time, I envisaged the authors of the articles I was eagerly devouring as being an august ensemble of stately scientists, distinguished technologists, and erudite engineers. I visualised them in deep discourse, capturing their cunning circuits on colossal chalkboards, wearing crisp white lab coats, sporting pocket protectors, wielding slide rules and boasting super­-size brains. It never struck me that I would one day count myself as a member of their guild. I even have my own lab coat, as shown in the photo on my driver’s license, reproduced below! When I became a member of the PE community in 1969, the introduction of the first commercial microprocessor, the Intel 4004, was still two years away. Most of the magazine’s construction projects in those halcyon days fea- tured discrete (individually packaged) resistors, capacitors, inductors, diodes, and transistors. Some of the projects still employed vacuum tubes. Now we’re going to turn our attention to the shiny new series we have promised above. If you’ve been a fan of our Arduino Bootcamp series, fear not, for towards the end of this article, we shall turn our attention to it one last (?) time. We will help out a reader who ran into some difficulty driving the 7segment LED displays (Fig.1) in our example clock circuit. We’ll also ponder what could be done to enhance the clock we finished creating last month. Weird and wonderful The subtitle to this section does not, in fact, refer to me. Rather, it reflects the fact that, as our new column banner suggests, this article marks the first in a series of Weird & Wonderful Arduino Projects. As usual, my poor old noggin is buzzing with ideas. At some stage, we might even decide to use our existing chronometer as the foundation for our very Fig.1: a trusty 7-segment display. Practical Electronics | January | 2025 7 own Vetinari Clock (to be discussed later in this column), for example. In addition to building some mindboggling devices, mad scientist style, we will also consider the code required to power them. Along the way, we will explore fundamental hardware and software concepts. The more we know, the easier things become, and I don’t recall ever learning anything that didn’t eventually come in handy (sometimes when I least expected it). And, just for giggles and grins, we are going to peruse and ponder any nuggets of knowledge and tidbits of trivia that tickle my fancy, commencing with… LED bar graph displays If you’ve been implementing the circuits in our Bootcamp series, you are already the proud processor of a collection of useful bits and pieces, such as breadboards, jumper wires, resistors, capacitors, LEDs etc. By comparison, if you are starting from scratch, then I’ve listed the parts we are going to reuse in the “Components” table towards the end of this column. I should note that the experiments we are going to perform in this column could be implemented using discrete LEDs from your existing ‘box of bits’. For myself, however, I really, really like LED bar graph displays presented in dual in-line (DIL) packages (DIL package can be abbreviated to “DIP”). These little rascals come in many versions and colours, such as 5segment displays (https://pemag. au/link/ac28), 10-segment displays (https://pemag.au/link/ac29), threecolour 10-segment displays (https:// pemag.au/link/ac2a), and four-colour 10-segment displays (https://pemag.au/ link/ac2b), to name but a few. We are going to use yet another variation, a single 8-segment red LED display (Fig.2), but it’s always a good idea to get one or more spares. I found a five-pack of these little scamps on Amazon for £7.66 (https://pemag.au/link/ac2c), but I’m sure you can obtain them cheaper elsewhere (eg, try AliExpress). Setting up our breadboard For the purposes of these experiments, we are going to employ a single full-size breadboard. We will set this up in the usual way (Fig.3). Any newcomers to our party who are unfamiliar with breadboards can peruse a handy-dandy column on the subject “wot I wrote earlier” (https:// pemag.au/link/ac17). There’s a lot going on in this diagram, so let’s take things step-by-step, starting with the fact that I like to orientate my breadboards such that I have a red power rail at the top and a blue ground rail at the bottom. In this case, we’re bringing the power (5V) and ground (0V) from our Arduino Uno into the lower left-hand corner of the breadboard. The first thing we do is use jumper wires to connect the lower pair of power and ground rails to the upper pair. Also, we insert a 16V 100µF electrolytic capacitor straddling the power and ground rails, as close as possible to where the wires from the Arduino enter the breadboard. As we discussed in an earlier column (PE, August 2024), this type of capacitor looks like a small drink can with two legs. It’s a polarised component, which means there are two ways around you could connect it, but only one is correct. The longer lead is the ‘anode’, which must connect to the more positive rail (the 5V rail, in our case). The shorter lead is the ‘cathode’, which is connected to the more negative rail (the 0V rail, in our case). The cathode side of the can is also marked with a stripe with minus signs, to give us a clue. This capacitor filters out any electrical noise from the power source, which is the Arduino in our case. It will also help to smooth out any power dips caused by components switching and briefly drawing extra current. With some breadboards, the power and ground rails span the length of the board. Other boards have split rails, in which the rails on the left- and righthand sides of the board are separated. Split rail boards are useful if we wish to employ multiple power supplies (eg, 5V and 3.3V) and/or multiple ground rails (eg, analog and digital grounds). However, they can be a pain in the rear if you don’t realise you are working with this type of board. If you aren’t careful, you can spend an inordinate amount of time trying to debug a seemingly faulty project, only to discover that one side of your circuit is without power! Even worse, the unpowered part of the board can ‘appear’ to have at least partial power for a variety of reasons, such as power flowing into chips via their signal inputs. I learned this at my cost, which is why I always add wires linking both sides of the power and ground rails in the centre of the board ‘just in case’. Another thing I do is add a longtailed header pin somewhere on the lower ground rail. I’ve shown this on the right-hand side of the rail in Fig.3, but I typically locate it as close as possible to the ground wire coming from the Arduino. This pin often proves useful later for probing things with our multimeter (it doesn’t hurt to have a few more distributed around the ground rails). Last, but not least, I like to add LEDs at the opposite ends of the power and ground rails to where the power is coming into the board. Whenever I power my board up in the future, these Links in case this happens to be a split rail board Top view a Side view k a = anode k = cathode a k Soldered joints 0.1" pitch header pin pair Top view 16V 100µF Electrolytic Capacitor +5V GND Fig.2: an 8-segment red LED bar graph. 8 From Arduino Header pin (GND connection) 16V 100µF Electrolytic Capacitor 16v100uF Side views a k k a = anode (+ve) k = cathode (-ve) Fig.3: our initial breadboard setup. Practical Electronics | January | 2025 LEDs immediately inform me that all is right with the world (at least, my breadboard world from a power and ground perspective). I’m showing green and blue LEDs here. I’m also showing current-limiting resistors of 470Ω (with yellow-violetbrown colour bands). I’m assuming that these green and blue LEDs have a forward voltage drop of 3V (we discussed the concept of a diode’s forward voltage drop in PE, March 2024). Our Arduino Uno gives us a 5V supply, so using Ohm’s law of V = I × R, and rearranging things to give I = V / R, we know that I = (5V – 3V) / 470Ω = ~4mA, which will make our LEDs bright enough to be seen without making our eyes water. We could connect these LEDs and their current-limiting resistors directly into the breadboard. However, as we discussed in a previous column, and as illustrated in Fig.3, it’s a good idea to build a bunch of little LED-resistor assemblies, each mounted on a pair of 0.1-inch (2.54mm) pitch long-tailed header pins, that can be quickly and easily reused in future projects. It doesn’t matter whether the resistor is soldered to the anode or cathode terminal of the LED; they just need to be in series with each other. Having said that, I always connect the resistor in-line with the anode terminal because it makes it easy for me to remember which way to plug them into my breadboard. As we discussed in a previous column, and based on what is to come, if you aren’t used to soldering, now is a good time to start learning. A great resource is The Basic Soldering Guide Handbook, which was written by PE’s a 14 1 2 3 4 13 5 12 6 7 8 9 1 2 3 4 16 5 6 7 8 9 k 15 11 10 (a) 8-segment bar display very own Alan Winstanley and is available on Amazon (https://pemag.au/ link/ac2d). To aid in setting up our breadboard, you can download a PDF of our new setup (with a file name of CB-Jan25brd-01.pdf). As usual, all the files mentioned in this column are available from the January 2025 page of the PE website: https://pemag.au/link/ac2e Testing, testing… If you don’t already own a digital multimeter, now would be a really good time to invest in one (we discussed different types, tradeoffs, and how to use these in PE, August 2024). For what we are doing here, I suggest a cheap-and-cheerful manualranging device, such as the ULTRICS Digital Multimeter, which is available for only £7.99 from Amazon at the time of writing (https://pemag.au/link/ac2f). Let’s start by verifying the probe connections at the multimeter end. The black wire should be plugged into the “COM” port and the red wire should be plugged into the “VΩmA” port. Plug the USB cable into your Arduino to power everything up and verify that the green and blue LEDs straddling the power and ground rails at the top and bottom of the breadboard light up. Now, set your multimeter to the 20V DC range and use its probes to check the voltage across the power and ground rails. The easiest (most accessible) points to probe are the header pin connections forming the LED assemblies. As a rule-of-thumb, I typically apply the black probe first (although the multimeter doesn’t ‘care’ which you connect first). Start with the pair of rails at the bottom of the board and then the pair at the top of the board. Ideally, you should get 5V readings, but the Arduino’s supply isn’t ferociously robust, so you may have a slightly lower reading, like 4.9V, for example. If your reading is sub(c) 8-resistor SIP stantially lower than that, you have a problem, possibly even a bad breadboard. If you get a negative reading like –5V, you’ve probably applied your probes the wrong way around. Adding our bar graph (b) Using discrete resistors (d) Using an 8-resistor SIP Fig.4: adding an 8-segment bar graph display. Practical Electronics | January | 2025 Before you do anything else, unplug the USB cable from your Arduino to power everything down. Remember that LEDs can be damaged by electrostatic discharge (ESD), so make sure you are doing everything on your antistatic mat and that you are wearing your antistatic wristband (all this was discussed in PE, January 2023). Observe the 8-segment bar display illustrated in Fig.4(a). As we previously discussed, this is in a DIP. It can be tricky to determine which is pin 1 on the package. If you look closely, you’ll discover that there’s a slight chamfer on the pin 1 corner of the plastic. I’ve shown a zoomed in view of this chamfer in Fig.4(d). To the best of my knowledge, the LEDs are always presented as shown in Fig.4(a), with their anodes on the left and their cathodes on the right. However, I don’t know if this is a rule that’s set in stone, and it can be tortuously tricky to track down the data sheets for these components, so I always test things first. Happily, if you do happen to deploy the device the wrong way around, the only thing that will happen is that your LEDs won’t light up. Plug your bar display and resistors into your breadboard as shown in Fig.4(b). I’m going to use discrete 560Ω resistors (with green-blue-brown bands) as shown. Why 560Ω? In the future, we are going to use a 74xx595 shift register to drive this display. As we know from our previous column (PE, December 2024), the 74xx595’s outputs can supply only 6mA. We know that the supply voltage from the Arduino Uno is 5V. We also know that our red segment LEDs have a voltage drop of 2V. Using Ohm’s law of V = IR, and rearranging things to give R = V / I, our ideal resistors would be (5V – 2V) / 0.006A = 500Ω, and 560Ω is the closest (higher) value I have on hand. And why am I using discrete resistors, instead of the DIL resistor packs we used before? When we look at Fig.4(b), we see that we would have to add a second breadboard to use those devices (we will require the remainder of our current board for future experiments). There is another alternative: single in-line (SIL) resistor package, where SIL package can be abbreviated to “SIP”. These come in myriad sizes and flavours. The one we would use would be a 9-pin package containing eight 560Ω resistors sharing a common pin, as in Fig.4(c). Using a SIL package would make our lives easier, but I don’t have one to hand, which is why I’m using discrete resistors. Next, add a flying lead as shown in Fig.4(b) and Fig.4(d). Power up your Arduino and use the flying lead to 9 probe each segment anode as indicated by the red circles. If only one or two LEDs fail to light, you may have a bad display, so try swapping it with your spare. If none light up, the three prime possibilities are: (a) you have a broken flying lead, (b) you’ve inserted your display the wrong way around, or (c) your display has the anodes and cathodes in the opposite orientation than expected. Once you have everything up and running and you’ve verified that all your LEDs are working as expected, power everything down and proceed to the next section. Connect your Arduino This is where things start to get even more exciting. Connect digital outputs D2 through D9 from your Arduino to your breadboard as shown in Fig.5 (you can download a PDF of our new setup with a file name of CB-Jan25brd-02.pdf). Next, let’s create a simple program as illustrated in Listing 1 (you can access this code in the file named CB-jan25code-01.txt). Most of this is self-explanatory. The interesting part occurs in the for( ) loop that starts on Line 36. The index to this loop, iSeg, will count from 0 to 7. For each index value, we call the digitalWrite() function. This function has two arguments. The first is the pin to which we wish to write a value. In this case, we are using the current value of iSeg to retrieve the required pin number from our PinsSegs[] array. The second argument is the value we wish to write to the selected pin. In this case, we are using Arduino’s built-in random() function to generate a random value between 0 and 1 (like flipping a coin). So, why are we using random(0,2)? This function generates a random integer between the minimum value (0 in our case) and the maximum value minus 1 (don’t ask). Since we’ve defined our maximum value to be 2, the result will be a random 0 or 1. The bottom line is that our for( ) loop will assign random 0 and 1 values to the 8 pins driving our display. As we discussed in PE, March 2023, the Arduino treats 0 and 1 as being synonymous with LOW and HIGH, respectively. Once we’ve assigned these random values and activated or deactivated the segments on our display, the delay on Line 40 causes it to pause for a second before it does it all again. The result is to present a never-ending series of random bit patterns on the display. While we’re waiting for next month’s column, let’s all think about some other interesting patterns to display—we can compare ideas when next we meet. A retro games console We still have some more experiments to perform before we proceed to our first Weird and Wonderful creation. To give you a tiny teasing taste of what is to come, I just tossed a metaphorical penny in the air. Wow! Our virtual coin landed furble side up, which means our first project is going to be a retro games console. I was hoping this would be the case (what are the odds?). I feel the use of the word “retro” adds a certain something to the proceedings. However, “retro” in this context may be taken to mean “big, bulky, and somewhat ungainly” while, ironically, combining a lack of processing power with a huge hunger for electrical power). In addition to boasting a 14 × 10 array of tri-coloured LEDs, this will also involve six 7-segment displays // 8-Segment Displays (General) #define NUM_SEGS 8 #define SEG_ON HIGH #define SEG_OFF LOW // Extras #define CYCLE_TIME 1000 // Declare pins driving the display int PinsSegs[NUM_SEGS] = {2, 3, 4, 5, 6, 7, 8, 9}; // Do this one time void setup () { // Initialize everything { for (int iSeg = 0; iSeg < NUM_SEGS; iSeg++) { pinMode(PinsSegs[iSeg], OUTPUT); digitalWrite(PinsSegs[iSeg], SEG_OFF); } } ~10 ~9 8 7 ~6 ~5 4 ~3 2 TX-1 RX-0 } DIGITAL I/O (PWM ~) Arduino Fig.5: connecting the Arduino. 10 delay(1000); // Just because // Do this over and over again void loop () { for (int iSeg = 0; iSeg < NUM_SEGS; iSeg++) { digitalWrite(PinsSegs[iSeg], random(0,2)); } delay(CYCLE_TIME); } Listing 1: our first test program! Practical Electronics | January | 2025 Photo 1: an early version of our retro games console (courtesy Joe Farr). driven by… wait for it… wait for it… you’ve guessed it… shift registers! (It’s almost as if we have a clue where we are going and what we are doing, but let’s not get carried away). We will, of course, be powering this beast with our trusty Arduino Uno. However, my chum, Joe Farr, has already implemented a PIC-based version of this bodacious beauty (see Photo 1). Apart from anything else, once we’ve built the base, we can use it as a platform to experiment with various sensors and actuators. I’m already researching all the bits and pieces we’ll need. We’ll reconvene in next month’s column and commence work on this awesome device that will make you the envy of your family and friends. You will be the first on your street to own one of these soon-to-be collector’s items! Now let’s have a look at some of the leftovers relating to last month’s final Arduino Bootcamp instalment. Tick, tock, tick…… TOCK! It probably won’t surprise you to learn that I’m a huge fan of the Discworld novels by the late, great Terry Pratchett. One of Terry’s characters, Lord Vetinari, is the dictator of the city-state of Ankh-Morpork. The clock in Lord Vetinari’s waiting room maintains accurate time overall, but it sometimes ticks and tocks out of Practical Electronics | January | 2025 sync: “tick-tock, tick-tock… tick-tocktick… … tock.” In fact, it occasionally misses a tick or a tock altogether. According to the author, the result is somewhat discombobulating for those for whom an audience is looming. Why am I waffling on about clocks? Well, if you’re a long-standing subscriber to PE, you’ll know that we’ve just finished a series of Arduino Bootcamp columns. In those, we used an Arduino Uno R3 microcontroller board and two breadboards to connect various bits and pieces, including a real-time clock (RTC) breakout board (BOB) and four 7-segment displays. In turn, we used our displays to present the current time in HH:MM format. Internally, these displays are implemented using light-emitting diodes (LEDs). While LEDs are a relatively recent development, a 7-segment display illuminated by incandescent bulbs was used on a power-plant boiler room signal panel as far back as 1910. Useful Bits and Pieces from Our Arduino Bootcamp series Arduino Uno R3 microcontroller module Solderless breadboard 8-inch (20cm) jumper wires (male-to-male) Long-tailed 0.1-inch (2.54mm) pitch header pins LEDs (assorted colours) Resistors (assorted values) Ceramic capacitors (assorted values) 16V 100µF electrolytic capacitors Momentary pushbutton switches Kit of popular SN74LS00 chips 74HC595 8-bit shift registers https://pemag.au/link/ac2g https://amzn.to/3O2L3e8 https://amzn.to/3O4hnxk https://pemag.au/link/ac2h https://amzn.to/3E7VAQE https://amzn.to/3O4RvBt https://pemag.au/link/ac2i https://pemag.au/link/ac2j https://amzn.to/3Tk7Q87 https://pemag.au/link/ac2k https://pemag.au/link/ac1n Other stuff Soldering guide Basic multimeter https://pemag.au/link/ac2d https://pemag.au/link/ac2f Components for Weird & Wonderful Projects, part 1 4-inch (10cm) jumper wires (optional) 8-segment DIP red LED bar graph displays https://pemag.au/link/ac2l https://pemag.au/link/ac2c 11 Before we proceed, it’s worth reminding ourselves that so-called 7-segment displays have an eighth decimal point segment that, as we will discuss, can reflect additional information. During our Bootcamp columns, we experimented with various components. We practised making sounds and playing notes using a passive piezoelectric buzzer. We detected the level of ambient light using a sensor called a light-dependent resistor (LDR), then we used the readings from this sensor to control the brightness of our displays. We also employed an ultrasonic sensor to annoy our household pets measure distances and present the resulting values on our displays. Of particular interest were the different techniques we used to drive our displays. We commenced by using eight pins from the Arduino to directly drive the segments on one of our displays. Next, we learned how to multiplex multiple displays. We then took an in-depth look at binary coded decimal (BCD) and used BCD decoder integrated circuits (ICs) to drive our displays. Finally, we moved to using shift register ICs to control our displays (phew!). Wait! What? Literally as I was scribing the preceding section, I received an email from a PE community member we’ll call Ian (because that’s his name). It seems that Ian had just battled his way through the PE November 2024 column in which we transitioned from using 74LS48 (TTL technology) BCD decoders to using CD4511 (CMOS technology) BCD decoders. In his plaintive plea for assistance, Ian spake as follows: Hi Max, I need some help. I’ve had significant success with my clock over the last couple of months, but this latest incarnation is driving me mad. Apart from its other faults, it hates the number 8. Below is an example of what it displays (the dash characters appear as blanks on the displays). Actual time 14:30 14:31 14:32 14:33 14:34 14:35 14:36 14:37 14:38 14:39 14:40 14:41 14:42 Displayed time 14:30 14:31 14:37 14:37 14:34 14:37 14:37 14:37 14:3– 14:3– 14:44 14:41 14:47 Every time it gets to an 8, the display goes blank. It’s even worse at 8am when it is supposed to display 8:00 but I get 9:9–. This continues until 8:07 when it displays 9:97, then at 8:10 it displays 8:11. Every component on the board has been replaced at least once, but it made no difference. I have even completely rewired the board. See the attached photo. I have checked this a million times and am convinced there are no errors. If you have any suggestions as to what I can try, I would be extremely grateful. Best regards, Ian. Ian’s photo is reproduced below with his permission. Take a few moments to ponder this image. Can you perceive any potential problems? I did what I usually do at times like this. I FaceTimed my chum Joe Farr This sort of pattern repeats itself. Photo 2: see if you can figure out why it doesn’t work... 12 Practical Electronics | January | 2025 because (a) debugging someone else’s project can be a real pain, (b) “two heads are better than one,” as they say, and (c) Joe and I are constantly bouncing ideas back and forth, so this was a good excuse for a chat. In fact, resolving this one proved to be easy-peasy lemon squeezy (which is rarely the case). When we looked closely at Ian’s photo, several problems became apparent: 1. The use of wood screws to secure the breadboards and their power strips to the wooden baseboard is a big “No-No!” These are short circuits waiting to happen. Ian is lucky he didn’t short out his power and ground rails. 2. Ian is powering his Arduino via its 5V pin but this is intended to be used as an output, not an input. Supplying power via the 5V pin bypasses the onboard voltage regulator, so any fluctuations or spikes in his power supply could damage the Arduino. Similarly, connecting the USB cable to the Arduino while applying power via the 5V pin also runs the risk of damaging the Arduino. 3. Ian said, “I have checked this a million times and am convinced there are no errors”. Well, we’ve all ‘been there and done that’. A closer look at Ian’s photo reveals that he forgot to connect the pin 16s (the power pins) on his CD4511s to his 5V supply. So, how did Ian’s circuit manage to work at all? His chips were drawing parasitic power from their data inputs. Most ICs have normally reverse-biased protection diodes from each input to each supply pin. These are intended to provide protection against static shocks (ESD protection) and also against the accidental application of voltage to pins when the chip is not powered. Because of these diodes, if you apply a voltage to a pin of an IC that’s outside its supply range (or any voltage when it is not powered), that voltage can become a power source for the IC. But it won’t provide the full voltage or necessarily much current. This explains why the 8s didn’t display because that requires all the segments to be lit and there simply wasn’t enough parasitic power to perform the task. As a related aside, there’s an amusing story about the first ARM processor. When engineers at Acorn Computers developed the first ARM (Acorn RISC Machine) processor prototype in 1985, they were surprised to discover that it didn’t appear to be drawing any energy from its power supply! Although they had focused their design on minimising power consumption, they felt the fact it wasn’t drawing any power at all was a little extreme. It turned out that, like Ian, they had neglected to connect the power pin, but the chip was drawing just enough power to function from its inputs via tiny leakage currents. However, we digress… As soon as Ian added those four little wires and properly powered his CD4511s, everything worked as expected and the radiance of his smile brightened the world once more. All I can say is that I’m scared what Ian thought when he read my column in the December 2024 issue of PE, only to discover that I decided to discard our CD4511 BCD decoders and replace them with 74HC595 shift registers! Endless possibilities Although our bootcamp clock project is officially over, there are lots of things we could do to enhance its functionality. For example, we could add some pushbuttons and create a menu system. If so, one of the first tasks we might use our menu system to accomplish is to implement some way to set the current time. Also, we could use it to select between 12- and 24-hour display modes. We could also add an LDR and use it to implement a nighttime mode, dimming the displays when the ambient light falls below a certain level, such as when the bedroom lights are turned off at night, for example. Also, we could use our piezoelectric buzzer to add audible accompaniments, such as playing the Westminster Quarters (aka. Westminster Chimes) to mark each quarter-hour. Furthermore, we could use our menu system to implement an alarm function, setting an alarm time and using our piezoelectric buzzer to play an appropriate wake-up tune. What about daylight saving time (DST)? We could modify our clock to implement this automatically. Alternatively, we could add a DST On/ Off button, or we could employ our menu system to activate/deactivate a DST mode. Since we ended by using four 8-bit shift registers to control our four 7segment displays, we now have access to our displays’ dp (decimal point) segments. In fact, we aren’t actually obliged to use the dp segments on the displays. We could, instead, use these bits from our shift registers to drive standalone LEDs. And what could we use these four dp segments or standalone LEDs for? Well, we could flash one on and off to mark the passing of the seconds. We could use one to indicate if the clock was currently in its 12- or 24hour mode. We could use another to indicate if the clock was displaying regular time or DST. And we could use one to indicate if an alarm has been set. All the ideas mentioned here are just things I came up with off the top of my head. I’m sure you can think of many more features and functions that, if implemented, would make your cunning chronograph stand proud in PE the crowd! 1550ZF IP68 flanged die-cast aluminium Learn more: hammondmfg.com/1550zf uksales<at>hammondmfg.com • + 44 1256 812812 Practical Electronics | January | 2025 13