This is only a preview of the January 2024 issue of Silicon Chip.
You can view 35 of the 104 pages in the full issue, including the advertisments.
Items relevant to "Raspberry Pi Clock Radio, Pt1":
Items relevant to "WiFi Relay Modules":
Items relevant to "USB to PS/2 Keyboard Adaptors":
Items relevant to "Secure Remote Switch, Pt2":
Items relevant to "Multi-Channel Volume Control Part 2":
Purchase a printed copy of this issue for $12.50.
Raspberry Pi Clock Radio Every day for over five decades, I awoke to the mono lo-fi sound of a clock radio. On the occasions I needed to be woken for an early flight, I worried about accidentally mixing up AM and PM when resetting the alarm, and sometimes that actually happened. Twice a year, my old clock needed daylight savings adjustments, and when the power went out, it flashed 12:00. I decided to fix all that! Part 1 by Stefan Keller-Tuberg A modern alarm clock can sound great, keep precise time and support multiple alarms. Alarm settings should include the day(s) of the week as well as the time, and you should be able to decide what sound each alarm plays, for how long, at what volume, and whether it’s a one-off or will repeat indefinitely. There’s no longer any reason you should need to set the clock’s time. It can be accurately fetched over the internet, with daylight savings and leap seconds adjustments applied automatically. Also, if the clock has speakers and a wireless connection, why not support streaming audio from a LAN, the internet or a smartphone? This project is based around a Raspberry Pi and supports all of these ‘dream’ features and many more; it 28 Silicon Chip can even snooze or cancel the alarm on your partner’s clock! The Raspberry Pi is a great platform because many of the required capabilities are already built in. Also, many of us already have a Raspberry Pi or two gathering dust and waiting to be put to good use! The custom hardware can interface with any Pi that runs Linux with a network connection and a 40-pin expansion connector. It has been tested to work with the Pi 3, Pi 4 and Pi Zero 2W models. It should also work with a Pi 2 or Pi Zero W, but they haven’t been tested yet. The newly released Raspberry Pi 5 is not suitable as it lacks an analog audio output. The Pi 3 and Pi 4 have the most capable processors and are therefore the best options, especially for media Australia's electronics magazine streaming. They also have Bluetooth, so you can stream audio to the Clock from a smartphone or similar. The slower Pi variants may be suitable if you plan to integrate a traditional overthe-airwaves radio as the audio source. In general, we recommend using a Pi 3 at the minimum. Hardware features The design uses two PCBs: a display board and a main board. The clock hardware and the Pi are powered from the same 5V DC source. The Pi connects to the main board and receives power via a short ribbon cable. I have used plugpacks for the four clocks I built for myself, but if you have the space, you could integrate a power supply inside the enclosure. The display comprises large 20mm-tall hours and minutes digits with 15mm-tall seconds digits that will be prominent anywhere in the room. The minimum and maximum LED brightness range is configured via the clock’s web interface, with the brightness automatically adjusted within the set range in response to changes in ambient light conditions. At its brightest, the display can be read in a sunlit room; at its dimmest, it is unobtrusive at night. The physical user interface comprises six switches: three centre-off toggle switches and three momentary contact push buttons. The switches replicate the features commonly found on clock radios, including snooze and media player controls, but there are too many features to control with six switches alone. All features are accessible using a web browser, so you can control the clock from a computer, phone or tablet connected to WiFi. A built in stereo amplifier with digital volume control can drive internal or external speakers according to your construction preferences. The Pi is the primary audio source, but you can integrate an alternative source, such as a traditional radio, if you want to. While the Raspberry Pi analog audio is not quite hifi quality, it is not to be scoffed at. I used a pair of bookshelf speakers with one of my clocks; the sound quality far exceeds typical commercial clock radios. If you have an old pair of speakers gathering dust, why not recycle them and put them to good use with this project? A switched power output for an siliconchip.com.au external audio source is enabled when the radio is selected; you could also integrate other audio sources into the enclosure alongside the clock hardware and Raspberry Pi. The switched power output can drive a 5V-powered device directly, feed an external regulator for a lower-voltage device, or act as an open-drain switch to control higher-voltage devices. Software features The clock supports many more features than a typical commercial clock radio. Up to twenty alarms can be configured at the same time. The first four alarms can be accessed via the clock’s switches, while all alarms can be managed via the web interface. For each alarm, you set the days of the week, time, duration, media source and relative volume. Any combination of days can be specified, from a single day to all seven. For example, you can set different alarms for weekdays and on the weekend. Alarms can be configured as oneoffs or to repeat indefinitely. One-offs may be defined up to seven days in advance and, if you like, you can set a one-off to occur on all or any of the seven upcoming days. After the one-off trips, it will not recur. I use these when I need to get up early for a work trip. To confirm you’ve set your alarm correctly, simultaneously press two alarm selection switches to display the remaining time until the next scheduled alarm. The countdown to the next alarm is displayed for as long as you hold the two alarm selection switches. An alarm can have a fixed volume, as you’d have with a regular alarm clock, or it can gradually ramp the volume up (or down) in one-minute steps so that you’re gently awakened. When the media or an alarm is playing from a playlist file, the clock will remember the last track so that it continues from the following track next time. While playing, the playlist’s contents are visible via the web interface, so you can jump tracks by clicking. One of the more novel capabilities of this project is its ability to cluster multiple clocks into one system. Clustered clocks share their alarm settings via WiFi, and changes made on one clock will be reflected soon after on the other clustered clocks. Many button press events are also shared in realtime amongst clustered clocks. siliconchip.com.au The button on the top of the case is for snooze mode, the red button is for duration while the black button is media. The switch at top right is plus/minus, while the two switches below it handle alarm 1/2 and alarm 3/4 respectively. The big knob in the centre is for radio tuning. With clocks on either side of the bed, either person can invoke snooze, change volume, modify an alarm etc. You can even use clustering to coordinate clocks in different parts of the home. Circuit protection features The circuit includes reverse polarity and overvoltage protection. Raspberry Pis have an absolute maximum supply limit of 6V, beyond which they will be damaged. At our house, we have a box of spare 5V and 12V plugpacks to draw upon for our various devices, and they all share the same style of coaxial connector. If you accidentally plugged a 12V plugpack into this project, that would instantly destroy it and the Raspberry Pi. The protection circuit was included to guard against that possibility. Because the circuit mostly follows a 5V design but the Raspberry Pi expansion interface uses strictly 3.3V logic, the clock includes series protection resistances for all general purpose I/O (GPIO) lines to guard against inadvertent shorting to a 5V source. I accidentally did this when prodding around a prototype and was glad for the protection. Trying the software You may be interested to try the software, even if you’re not yet ready to WiFi can interfere with Bluetooth Bluetooth operates in the same 2.4GHz band as WiFi and different devices in that band can interfere with one other, especially when a nearby device is using a lot of bandwidth. Bluetooth interference can cause audio stutter and spontaneous disconnections. If the interference becomes annoying, reassigning the Bluetooth channel by forgetting all Bluetooth pairings and starting over can help temporarily, as can changing the access point’s WiFi channel. However, these strategies may not be effective in the long term. The Raspberry Pi 4 supports the 5GHz WiFi band, so if Bluetooth audio streaming is an important feature for you, you’ll get the best results using a Pi 4 and ensuring there are no 2.4GHz WiFi devices or access points in the same or adjacent rooms as the clock. You could also disable the 2.4GHz band in all nearby access points and WiFi extenders. However, as most of us have legacy 2.4GHz-only WiFi devices, and sometimes 2.4GHz is the only usable spectrum, implementing this drastic strategy may be difficult (5GHz WiFi doesn’t penetrate walls very well). You can avoid severe interference if your home WiFi is based on recent access point technology supporting both 2.4GHz and 5GHz WiFi bands and band-steering. Configure the band-steering to force 5GHz-capable devices to use 5GHz WiFi channels for the fullest practical signal strength range and check that your 5GHz capable devices have switched over. Also, if possible, use wired Ethernet instead of 2.4GHz backhaul for any WiFi extenders you may have deployed. Another thing to consider is that microwave ovens operate at around 2.4GHz, so if a kitchen is nearby, an operating microwave oven can interfere with WiFi and Bluetooth in that band. Australia's electronics magazine January 2024 29 commit to the construction. The software can be installed onto any Linuxbased Raspberry Pi with a 40 pin expansion connector (the GPIO library currently does not support the Pi 5). Without the clock hardware, you can use the web GUI to set up and configure alarms, watch the alarms trip, pair your phone or tablet with the ‘clock’ to use it as a Bluetooth speaker 30 Silicon Chip or play media from the Pi’s flash card, an attached USB drive, a network share or from the internet. A script simplifies installing and configuring the Pi. It fetches the required libraries, installs them, then configures the clock, a file server, web interface, media player, automatic updates, NTP and time monitoring processes. Australia's electronics magazine You can optionally enable a firewall so the clock cannot be accessed from outside your home network and/or turn off the Pi’s power and activity LEDs so they don’t keep you awake at night. You can download the ZIP file from siliconchip.au/Shop/6/278 containing a Linux ‘tarball’ of the software and a PDF document explaining how to prepare the SD card, copy the tarball and siliconchip.com.au Fig.1: the clock display includes three dual-digit seven-segment displays (hours, minutes and seconds), two colon LEDs, eight ICs to drive the LEDs and Mosfet Q2 for PWM display brightness control. IC4-IC9 are seven-segment display drivers, while IC11 is an eight-bit latch that drives the decimal points and colons. run the installation script. There are also notes about software debugging modes for testing. See the panel on page 36 of this article for instructions on installing the software. Circuit details The Clock Radio circuit diagram is shown in Figs.1 & 2. Fig.1 is the display siliconchip.com.au section with the LED arrays and their drivers. That section is driven by the control section shown in Fig.2, which also has the audio, user interface (switch/button) and power portions. The 5V and 3.3V power rails for the display circuitry shown in Fig.1 come from the Raspberry Pi controller in Fig.2, along with the following digital data lines via 1kW resistors: Australia's electronics magazine an 8-bit data bus (D0-D7), a two-bit address bus (A0 & A1), a latch signal (EN) and a PWM brightness control line (DIM_PWM). By setting the eight data lines and the address, then ‘strobing’ (pulsing) the latch, the software on the Pi can update the digits for the hours, minutes and seconds, the six decimal points and two colon LEDs. January 2024 31 Fig.2: the Raspberry Pi connects to the display circuitry shown in Fig.1 using 12 digital lines that go via 1kW resistors. The switches and buttons also connect to the Pi’s digital I/O pins with pull-up resistors, while the ambient brightness monitoring and audio amplification circuitry are at upper right. The section at bottom left protects against power supply over-voltage and reversed polarity. 32 Silicon Chip Australia's electronics magazine siliconchip.com.au The seven-segment displays are driven by six BCD-to-seven-segment display drivers, IC4 to IC9, and the dots and colon from IC11. IC4 to IC9 convert binary numbers to segment patterns on the seven segment displays and can deliver the necessary LED drive current. IC11 works like a one byte (eight bit) memory to remember which dots are turned on. These chips have 3.3V-compatible inputs, suiting the Pi’s GPIO bus, and 5V outputs that can draw from the higher-current 5V supply rail. It is important to use 74HCT chips rather than 74HC because the latter are marginal at recognising 3.3V as a high level while the former have a maximum high threshold of 2V. Decoding the address bus and latching of the data is performed by IC10. As the decoding logic is all at the same level (3.3V), IC10 can be of the 74HC variety. IC4 to IC9 and IC11 drive all the LED display anodes via nominally 430W resistors while the LED display cathodes all go to the drain of N-channel Mosfet Q2. A PWM signal applied to Q2’s gate therefore determines the overall brightness of all the LEDs. A 1MW resistor holds it off whenever the Pi is not actively driving it, so the display is blank when the Pi software is not running. The software cannot determine whether all LEDs are present because the display section is a ‘write-only interface’. If you don’t need them, you could leave off the seconds LEDs and associated BCD driver chips, and no software changes will be required. Matching LED brightness Theoretically, identical displays from the same vendor should have the same brightness. As the project uses a combination of 0.8-inch 7-segment displays, 0.56-inch 7-segment displays and discrete LEDs, they might not all be the same efficiency. In that case, they can be equalised by adjusting the values of the 430W current- limiting resistors. Four of the five clock prototypes used Lumex 7-segment displays, and both sizes produced identical brightnesses. One prototype used Multicomp Pro devices, resulting in the smaller digits being slightly brighter than the larger digits. The larger Multi-comp Pro displays were slightly less bright siliconchip.com.au Australia's electronics magazine January 2024 33 than the equivalent Lumex devices, but the clock’s brightness adjustment had the headroom to compensate. To equalise the Multicomp Pro display intensities, I changed the smaller display’s current limiting resistors to 820W on that Clock Radio. If you construct the board using Multicomp Pro parts, we suggest not populating the small display’s current limiting resistors until you’ve built and tested your clock and can determine the optimal resistance. If constructing with Lumex, as Dirty Harry said, you’ve got to ask yourself a question: “Do I feel lucky?”. You can populate the 430W resistors for the small display as we did, but there’s a chance you might need to adjust them if they don’t match adequately (we didn’t need to). The two discrete 3mm LEDs that make up the colon (“:”) have characteristics independent from the 7-segment displays. For the devices specified in the parts list, we found 1.3kW series resistors illuminated the colon about the same as the 7-segment displays Fig.3: you can add a radio receiver board, which will only be powered on when needed, via CON5. Here are three ways to connect it depending on its power requirements. 34 Silicon Chip from either vendor. Any 3mm LEDs will work in this design, but be prepared to experiment with those resistor values if you use different parts. Dimming The dimming function of the circuit comprises an ambient light level monitor and the PWM control mentioned above. The ambient light level is sampled by a light-dependent resistor (LDR), which forms a voltage divider with a 10kW resistor across the 3.3V rail. The brighter the ambient light level, the lower the LDR/resistor junction voltage. IC12 is an MCP3201 12-bit analog- to-digital converter (ADC) used to measure this voltage. The raw number read from the ADC becomes smaller as the ambient light level increases; the software processes it into a value with 0 indicating darkness and 4095 being the maximum measurable brightness, as shown on the web setup page. The MCP3201 comes in two versions with different accuracies labelled B & C. You can save yourself a dollar because the cheaper, less-accurate part (C) works fine in this circuit. The parts list specifies two LDRs that will work well. Ideally, the LDR dark resistance should be at least 10 times its light resistance. The setup page on the web GUI includes four sliders for adjusting the minimum and maximum LED brightness and specifying the corresponding LDR levels. The sliders provide a lot of flexibility to adjust for minor differences in LDR characteristics so that the display achieves the full range of potential LED brightness. If you choose a different LDR and can’t get the dimming to work over the whole range, the 10kW resistor value will need to change. In response to the ambient light level, the software generates a 50Hz PWM waveform that drives the gate of Mosfet Q2 and continuously updates the PWM duty cycle according to the ambient light measurements. Although the Pi has two high- resolution timers that could be used for hardware PWM timing, neither is available in this design. One is used for the Pi’s analog audio output, while the other is commandeered by the Pi’s GPIO daemon (service). The LED brightness PWM is therefore generated in software by the GPIO daemon. You’re unlikely to notice that; the worst case is when the display is at its dimmest and the CPU is heavily loaded, such as when an alarm has tripped and it is downloading, decompressing and playing a media file. In that case, the software reduces the PWM frequency to minimise the jitter induced in the PWM signal. The two PCBs for the Raspberry Pi Clock Radio are mounted perpendicular to each other and then soldered together. Australia's electronics magazine siliconchip.com.au Audio The audio section includes the amplifier that drives the speakers and an audio input for an external radio. The amplifier (IC13) is a PAM8407 Class-D low-distortion filterless amplifier chip. At typical listening volumes, it has a distortion below 0.1% across most of the audible band. It is more than adequate for a clock radio and media player and comparable with the Pi analog audio output quality. Three GPIO pins are dedicated to putting the amplifier into and out of standby and adjusting its volume. The audio source is selected by DPDT relay RLY1, driven by Mosfet Q4. The GPIO line that drives Q4 also operates a second Mosfet, Q3, to act as a power switch for the external audio source. The switched external power is available at three-pin header CON5. Fig.3 shows three possible ways to power an external radio from CON5. Q3 has a maximum voltage rating of 30V so, if using an external power source, do not exceed that. If you don’t plan to integrate an external radio or audio input, you could omit Q3 and Q4, the associated resistors, PCB headers and the relay, and fit wire links to the relay pads on the PCB to connect the Pi’s audio output to the amplifier permanently. User interface Each switch pole or button has a 10kW pull-up resistor to the 3.3V rail and is connected to one of the Raspberry Pi’s GPIO pins that’s configured as a digital input. Therefore, when a button is pressed or a switch is toggled, the corresponding pin goes low and is detected by the software. Power supply and protection The reverse polarity and overvoltage protection section consists of diodes D1 & ZD1, SCR1, Mosfet Q1 and associated passive components. It protects the Clock Radio from an incorrect power supply that could otherwise damage it. D1 protects against reverse polarity by effectively short-circuiting the supply rail if power is applied with the wrong polarity. It will get hot, but it gets the job done. A switch-mode plugpack will enter overcurrent shutdown if shorted by D1, and your Clock Radio will not power on, allowing you to discover siliconchip.com.au Parts List – Raspberry Pi-Based Clock Radio 1 instrument case, 200 × 155 × 65mm [Jaycar HB5912, Altronics H0480F] 1 Raspberry Pi (model 3, 4, Zero 2W or similar) 1 sheet of green acrylic/Perspex, sized and shaped for the front panel 1 double-sided PCB coded 19101241, 150 × 83mm 1 double-sided PCB coded 19101242, 150 × 44mm 1 5V DC 2A+ plugpack 1 16-33kW light-dependent resistor (LDR1) [DigiKey PDV-P8103-ND, element14 3168335] 3 panel-mount SPDT centre-off momentary toggle switches (S1, S5, S6) 3 panel-mount SPST momentary pushbuttons (S2-S4) 1 J104D style 5V DC coil, 2A DPDT relay (RLY1) [DigiKey 2449-J104D2C5VDC.20S-ND, element14 1652604] 1 2×20-pin header, 2.54mm pitch 1 2.5mm chassis-mounting DC barrel socket (CON1) [Jaycar PS0524] 1 2-way right-angle pluggable terminal block, 5.08mm pitch 6 3-way, 2.54mm pitch polarised headers with matching plugs and pins 5 2-way, 2.54mm pitch polarised headers with matching plugs and pins 2 40-pin IDC line sockets 1 20-pin DIL IC sockets 7 16-pin DIL IC sockets 1 8-pin DIL IC sockets 1 panel-mount barrel socket to suit plugpack 2 red panel-mount banana socket 2 black panel-mount banana socket 1 short stereo audio cable with a 3.5mm jack plug at one end 1 15cm length of 40-way ribbon cable 1 50cm length of figure-8 speaker cable 1 1m length of 3-way ribbon cable 2 M3 × 32mm panhead machine screws 10 M3 × 6mm panhead machine screws 2 M3 hex nuts and flat washers 6 12mm-long M3-tapped Nylon spacers 2 short lengths of medium-duty hookup wire (red & black) Semiconductors 6 74HCT4511 7-segment display driver ICs, DIP-16 (IC4-IC9) 1 74HC139 dual 2-to-4 decoder IC, DIP-16 (IC10) 1 74HCT374 8-bit parallel latch IC, DIP-20 (IC11) 1 MCP3201-CI/P 12-bit ADC, DIP-8 (IC12) 1 PAM8407DR filterless Class-D stereo amplifier IC, SOIC-16 (IC13) 3 IRLB4132PbF 30V 78A N-channel Mosfets, TO-220 (Q1-Q3) 1 2N7000 small signal N-channel Mosfet, TO-92 (Q4) 1 C106D1G sensitive-gate SCR, TO-126 (SCR1) 2 0.8in/20.3mm green dual 7-segment display, eg, LDD-C812RI or LD0805GWK [DigiKey 67-1473-ND, element14 2627654] 1 0.56in/14.2mm green dual 7-segment display, eg, LDD-C512RI or LD0565GWK [DigiKey 67-1459-ND, element14 2627648] 2 green diffused 3mm LEDs (LED1, LED2) [DigiKey 754-1609-ND, element14 2112096 or equivalent] 1 5.1V 1W zener diode (ZD1) 2 1N4004 400V 1A diodes (D1, D5) Capacitors 2 470μF 16V electrolytic (2.5mm lead pitch) 1 47μF 16V electrolytic (2mm lead pitch) 2 1μF 50V (multi-layer) ceramic 4 470nF 50V (multi-layer) ceramic ● values may need to vary to match 10 100nF 50V (multi-layer) ceramic or MKT the display segment brightness. 1 10nF 50V (multi-layer) ceramic or MKT Resistors (all 1/4W 1% axial unless noted) 2 1MW 2 1.3kW SMD M3216/1206 1% ● 1 470W 1/2W axial 10 10kW 1 1.3kW 48 430W SMD 1206 1% ● 1 2.7kW 26 1kW 2 390W Australia's electronics magazine January 2024 35 Installing the software on a Raspberry Pi You will need an SD card with at least 4GB capacity. Larger is fine; you can use the extra storage to hold your media library. With Raspberry Pis, the read/write speed and quality of the SD card make a difference. Cheap SD cards often perform poorly. The SD card must be loaded with either the Debian Bullseye Lite or Debian Bookworm Lite operating systems. Debian images older than Bullseye are not suitable. The easiest way to prepare the SD card is with “Raspberry Pi Imager”, freely available for Windows, macOS and Linux. Launch Raspberry Pi Imager, insert the SD card into your computer (via a card writer if it doesn’t have a slot) and click the CHOOSE DEVICE button, then select “No Filtering”. For a Pi 4 or Pi Zero 2W, choose Raspberry Pi OS (Other) → Raspberry Pi OS Lite (64-bit). For other models, select Pi Raspberry OS (Other) → Raspberry Pi OS Lite (32-bit). Then click CHOOSE STORAGE to select the SD card, click NEXT, pick EDIT SETTINGS and fill out the form: 1. Set a unique hostname for your clock (“clock” if you can’t think of anything else). 2. Enable SSH using password authentication. 3. Set a username and password for logging in via SSH. 4. Enter your wireless LAN details (SSID, password and country). 5. Set the locale settings for your area. 6. Deselect the option to eject media (the SD card) when finished, as you’ll also be copying the clock software to the SD card before ‘ejecting’. Write down the hostname, username and password so you can log into the Pi later. Next, click SAVE, then YES then WRITE. When the card has been written, download the clock software zip file from the Silicon Chip website. Inside the zip file is a file named “alarm-clock_v01.tgz” that you need to copy onto the SD card. Copy the TGZ file from the ZIP archive to the root of the “bootfs” directory on the SD card the same way you transfer files to a thumb drive. The v01 number could increase in future if there are updates to the software. Finally, eject the SD card, insert it into the Pi and apply power. The ZIP archive also contains a PDF document with screenshot of the installation, and post-publication notes. Connecting to the Pi Because there’s no video output, the only way to know the Pi is ready to proceed is to connect to it over your network (wired or WiFi). The first time a Pi boots, it could take a few minutes longer than usual. To avoid frustration, apply power and make a cup of tea or coffee. You will need an SSH client to connect to the Pi. In Windows, you can use PuTTY or OpenSSH; macOS and Linux have ‘ssh’ command line tools. You can connect using its IP address or the hostname specified when you prepared the SD image. Most home routers generally publish local hostnames using a “.local” suffix, as suggested in Raspberry Pi Imager. So you can try to connect to “clock.local” (or whatever other name you chose). If that does not work, consult your router’s documentation or look at the router’s DHCP leases table to find the IP address allocated to the Pi. When you connect, the Pi will prompt for the username and password that you specified during the SD card setup. Enter them to log in and get the remote command prompt. Finishing the clock software installation On the Pi, the file you copied to the SD card earlier is available within the bootfs partition at /boot. You can now extract the contents using the command: tar zxf /boot/firmware/alarm-clock_v01.tgz tar zxf /boot/alarm/alarm-clock_v01.tgz ← for Bookworm OS ← for Bullseye OS This command creates a subdirectory called “alarm-clock” containing the source code and will also leave an installation script in your current directory. The last stage in the software installation is to run that installation script (you must copy this exactly, including the letter case): sudo ./Install_Clock.sh The installation script asks for your password twice, whether you would like to install firewall rules that prevent access from IP addresses originating on a different subnet (you will probably want to say yes) and then asks if you would like to attempt to disable the power and activity LEDs. Web-based configuration To reach the web interface, open a browser and surf to http://clock.local or whatever system name or IP address you used to ssh into the clock. You’re greeted by the clock’s home page, which contains links to the various configuration and media player functions, a summary of the configured alarms, the playlist if media is currently playing, and a list of any other clocks found on the local network. We’ll have more information on configuring the clock in part two next month, along with instructions on updating the software, using it as a Bluetooth speaker, testing and more information on the clock software. If you run into trouble during installation you should check the instructions included with the software download, as steps may have changed after publication. These instructions are for the 1.8.1 version of Raspberry Pi Imager, but earlier versions will work with slight changes. 36 Silicon Chip Australia's electronics magazine the mistake without losing any smoke. The over-voltage protection isolates the rest of the circuit from the supply if the supply voltage exceeds about 5.7V. With a normal supply of around 5V, zener diode ZD1 does not conduct, so the gate of SCR1 remains at 0V. The 2.7kW pull-up resistor pulls the gate of Mosfet Q1 up to +5V, switching it on and connecting circuit ground to the incoming supply’s negative terminal. If the supply voltage exceeds 5.7V, there is around 0.6V at the gate of SCR1, so it switches on, pulling the gate of Mosfet Q1 to 0V. That switches Q1 off, allowing the circuit ground to rise to the positive supply rail, leaving no voltage to power the remainder of the circuit. The potential for damage to the Pi starts at around 6V, so the SCR trigger voltage is just slightly below that. SCRs behave a little like bipolar NPN transistors acting as switches, except that SCRs latch themselves on after their trigger voltage has been reached. This way, Q1 remains off until the offending power supply is disconnected, at which point it resets. Component selection When purchasing components for this project, note that electrolytic capacitors come in all shapes and sizes. The hole spacing for the two 470μF electrolytics is 2.5mm, while the 47μF electrolytic holes are spaced at 2mm. Most 16V rated capacitors will have similar lead spacings but higher- voltage electros may not fit well. If possible, measure the actual component or check the catalog or data sheet to find a good match. The clock will work with higher-voltage or larger components, but they may not fit as neatly on the board. Sockets are recommended for the DIP ICs. If ever you need to replace a chip, extracting the IC from a socket will be much easier than desoldering it from the joined main and display board assembly. However, sockets can slowly oxidise over time and eventually cause problems; soldered chips are generally more reliable in the long term. Removing the chip from its socket and then reinserting may be all that’s required to re-establish good contact. The second article next month will have all the construction details, usage instructions and information on updating the firmware. SC siliconchip.com.au