Silicon ChipMains Power-Up Sequencer, Pt1 - February 2024 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Check your backups
  4. Feature: Computer Storage Systems, Pt1 by Dr David Maddison
  5. Project: Microphone Preamplifier by Phil Prosser
  6. Project: Mains Power-Up Sequencer, Pt1 by John Clarke
  7. Review: ESP32-CAM WiFi Camera Module by Tim Blythman
  8. Feature: Electronic Markets in Singapore by Tim Blythman
  9. Project: Raspberry Pi Clock Radio, Pt2 by Stefan Keller-Tuberg
  10. Project: Model Railway Points Controller by Les Kerr
  11. Serviceman's Log: The things we do for our pets by Dave Thompson
  12. Product Showcase
  13. PartShop
  14. Vintage Radio: STC Radiotym model 5160 by Associate Professor Graham Parslow
  15. Market Centre
  16. Advertising Index
  17. Outer Back Cover

This is only a preview of the February 2024 issue of Silicon Chip.

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

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

Articles in this series:
  • Computer Storage Systems, Pt1 (February 2024)
  • Computer Storage Systems, Pt2 (March 2024)
  • Flowcode (March 2024)
Items relevant to "Microphone Preamplifier":
  • Microphone Preamplifier full PCB [01110231] (AUD $7.50)
  • Microphone Preamplifier embedded PCB [01110232] (AUD $7.50)
  • Model Railway Points Controller receiver PCB [09101242] (AUD $2.50)
  • Microphone Preamplifier short-form kit (Component, AUD $70.00)
  • Microphone Preamplifier PCB patterns (PDF download) [10108231/2] (Free)
  • Panel label and drilling diagrams for the Microphone Preamplifier (Panel Artwork, Free)
Items relevant to "Mains Power-Up Sequencer, Pt1":
  • Mains Power-Up Sequencer PCB [10108231] (AUD $15.00)
  • Firmware (ASM and HEX) files for the Mains Power-Up Sequencer (Software, Free)
  • Mains Power-Up Sequencer PCB pattern (PDF download) [10108231] (Free)
  • Panel labels and cutting diagrams for the Mains Power-Up Sequencer (Panel Artwork, Free)
  • PIC16F1459-I/P programmed for the Mains Power-Up Sequencer (1010823A.HEX) (Programmed Microcontroller, AUD $10.00)
Articles in this series:
  • Mains Power-Up Sequencer, Pt1 (February 2024)
  • Mains Power-Up Sequencer, Pt2 (March 2024)
  • New use for Mains Sequencer (July 2024)
  • Mains Power-Up Sequencer, part one (February 2025)
  • Mains Power-Up Sequencer, part two (March 2025)
Items relevant to "ESP32-CAM WiFi Camera Module":
  • Software download package for the ESP32-CAM module review (Free)
Items relevant to "Raspberry Pi Clock Radio, Pt2":
  • 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)
Items relevant to "Model Railway Points Controller":
  • Model Railway Points Controller transmitter PCB [09101241] (AUD $5.00)
  • PIC16F1455-I/P programmed for the Model Railway Points Sequencer transmitter (0910124A.HEX) (Programmed Microcontroller, AUD $10.00)
  • PIC16F1455-I/P programmed for the Model Railway Points Sequencer receiver (0910124B.HEX) (Programmed Microcontroller, AUD $10.00)
  • Firmware for the Model Railway Points Controller (0910124A/B.HEX) (Software, Free)
  • Model Railway Points Controller PCB patterns (PDF download) (09101241-2) (Free)

Purchase a printed copy of this issue for $12.50.

Part 1 of John Clarke’s Mains Power-Up Sequencer This Mains Power-Up Sequencer solves many problems caused by powering up several devices simultaneously, including circuit breakers tripping, thumps from audio equipment and modem/router overloading. The Mains Power-Up Sequencer can also power several appliances on or off when a ‘master’ appliance switches on or off. Y ou might have run into problems switching on several appliances at once, eg, using the switch on a mains outlet. You might have a bank of equipment that all needs to be powered up, but you would prefer to do it in sequence with the convenience of a single switch. Sometimes, if you switch everything on at once, it can trip the mains circuit breaker. There can also be a sudden drop in mains voltage when switching on a bank of equipment due to the high initial current draw that causes other equipment to reset or act up. Similarly, the high initial current can trip the circuit breaker when you have several personal computers that are all switched on together, such as in a school or office. Additionally, powering up several computers at one time can cause them all to try to access the network/internet at the same time, overloading the router and causing slow startups or even lockups. Staggering the powering up of each computer by a few seconds can prevent this. The Power-Up Sequencer can 48 Silicon Chip address these concerns. It includes four mains outlets that can switch on equipment sequentially, with a delay between each. If four outlets are insufficient, then a second Sequencer can be added that daisy chains from the first unit. Daisy-chained Sequencers can be powered from a separate power circuit to the first Sequencer, allowing for more devices than can be plugged into a single GPO (general purpose mains outlet). The separate power circuit can even be from a different phase. Not only does the Sequencer power up equipment in an orderly fashion but it can also be used to power down in sequence. Another feature is the ability to Warning: Mains Voltage All circuitry within the Mains Sequencer operates at Line (mains) voltages. It would be an electrocution hazard if built incorrectly or used with the lid open. Only build this if you are fully experienced in building mains projects. Australia's electronics magazine power up and down multiple devices by switching one piece of equipment on and off. That can be useful when equipment is difficult to access and a single, more accessible switch can be used for the on and off powering sequence. For example, you could have your receiver, amplifier and DVD player automatically switch on when you power up your TV by remote control. Most equipment draws a substantial current over the first few mains cycles when powering up, often described as inrush current. With some appliances, this current is because a large capacitance needs to be charged. These draw a high initial current before the capacitor voltage rises and the current reduces. In other cases, it can be due to a motor spinning up. Typically, the inrush current won’t cause a circuit breaker to trip if only one appliance is switched on at a time. However, with more devices switched at the same time, the current is multiplied. Switching them on in sequence will avoid that. It should be noted that the Sequencer siliconchip.com.au Scope 1: the mains voltage (mauve) and current (yellow) drawn by three amplifiers in parallel that was switched on just after the mains voltage peak. After a small initial current flow, it drops to zero, followed by a big spike to 182A as the amplifiers’ capacitor bank starts to charge. is not designed for electric motors such as power tools. If you need to reduce the startup current for motorised appliances, we have published soft starters that are more applicable: • Active Mains Soft Starter (February & March 2023; siliconchip.au/ Series/395). • Soft Starter for Power Tools (July 2012; siliconchip.au/Article/601). • The SoftStarter (April 2012 issue; siliconchip.au/Article/705). Peak currents As an example of the initial surge current drawn by an appliance, we measured the current initially drawn by a 25V DC power supply that uses a 125VA toroidal transformer to charge two parallel 6800μF capacitors via a bridge rectifier. We measured current using a current transformer calibrated to produce 1V per 10A. The results can be seen in Scope 1. The cyan (channel 2) trace shows the mains voltage, while the yellow trace (channel 1) shows the current. Note that we show the current 180° out of phase with the voltage so that the two waveforms can be seen more easily, without one obscuring the other. Upon powering the 25V supply, it drew a maximum of 38A on the first half cycle, and 182A on the second half cycle. The first half cycle current is lower because the power was switched on later in the mains half cycle, but the next half cycle had the full waveform, siliconchip.com.au Scope 2: by switching the amplifiers on precisely at the zero crossing, we reduce the inrush current somewhat, to 168A. The reduction will be much greater for devices with a high power factor or power-factor correction (PFC). so the current was higher. When power is applied closer to the peak of the mains voltage, there will be a steep rise in the current drawn. If more than one of these supplies were powered up simultaneously, the current drawn from the GPO would add up. It is no wonder that a circuit breaker can trip if several appliances are switched on at the same time. For our Power-Up Sequencer, as well as staggering when power is applied to each appliance, we switch them on when the mains voltage is near the zero voltage crossing point. That allows the current to rise more slowly since the applied voltage follows the mains sinewave, instead of a peak voltage of up to about 325V applied instantaneously if power were applied at any time during the mains cycle. This is shown in Scope 2. The current rises from the start of the waveform just past the zero crossing as the mains voltage rises and results in a 168A peak. That’s still high because this appliance only really draws current near the peak of the voltage waveform. However, other appliances with a better power factor (PF) will benefit more from this zero-crossing switching. Sequencer options There are two options. The first is the master/slave feature, which involves monitoring the current drawn from the OUT1 GPO socket. The second is the Mains Detect Input, which can be used for daisy chaining. Switching on each GPO in sequence is done at an adjustable rate. The poweron and power-off sequence intervals Mains Power-Up Sequencer Features » » » » » » » » » » » » » Four independently-controlled 10A mains outputs (up to 10A total draw) Output switch on at mains zero crossing Adjustable power on & off sequence rates First on, first off (forward) or first on, last off (reverse) power-down sequence option Daisy-chaining for more outputs and extra current Master channel Current Detection option Separate Mains Input Detection option Number of outlets selection option (1-4) Relay switching for high efficiency with inrush/switch-off current spike protection Sequence indicators Multiple startup options Uses standard IEC mains cables and GPO outlets Housed in a rugged enclosure Australia's electronics magazine February 2024  49 are independent and can each be adjusted between 100ms and 23s. The order that the outputs are sequentially switched on is OUT1, OUT2, OUT3 and then OUT4. When switching off, you can select the reverse sequence order of OUT4, OUT3, OUT2 and then OUT1, or the forward sequence of OUT1, OUT2, OUT3 and then OUT4. We have provided several options so that the Sequencer can be as versatile as possible. That includes the option to build the unit with between one and four outlets, since some applications may not require four mains outlets. When the Sequencer is set up for fewer outlets, the powering sequences will be truncated to operate only over the installed number of outlets. Presentation & configurations The Sequencer comprises a rugged plastic enclosure with an IEC mains socket on the left side of the enclosure and four GPO mains sockets on the lid. The IEC mains socket provides input power using a standard IEC mains lead. A second IEC mains socket can be installed for Mains Input Detection, such as when daisy-chaining two Sequencers together. Fig.1 shows what the various inputs and outputs do. The basic configuration for building the Sequencer is without the second (lower) input, in which case, the outputs switch on in sequence when power is applied, and they all switch off at once when power is lost. It can also be built without the second input but with Current Detection for OUT1. In that case, OUT1 is the master socket and OUT2, OUT3 & OUT4 are the slaves. The slave outputs switch on in sequence when it detects the master device drawing current from OUT1. They switch off in sequence when the appliance stops drawing power from OUT1. The third configuration is with the Mains Detect Input but without Current Detection. Nothing happens when power is first applied to the unit in this case. It waits until it detects a mains voltage at the Mains Detect Input, then switches on the four outputs in sequence. If voltage is no longer detected at the Mains Detect Input, the four outputs switch off sequentially. They all switch off immediately if the main power input is lost. Note that no power is drawn from the supply fed to the Mains Detect Input. While the Mains Detect Input is primarily intended for daisy-chaining, it can also trigger switching the four outlets on in sequence when another device is switched on via a GPO switch or other mains-interrupting device. The first and most basic configuration is without the Mains Input Detect circuitry or Current Detection circuitry and is easier to build. The disadvantages are that you have to switch it on at the wall, and all the outlets switch off immediately when it is switched off, rather than in sequence. Whether or not that is a problem depends on your situation. Fig.1: the Mains Power-up Sequencer can have three primary configurations. It can be built with or without the optional Mains Detect Input that allows it to be triggered from a separate, isolated mains input (useful for daisy-chaining). It can also be built with current detection for OUT1 that will trigger the switching of OUT2-OUT4 but, in that case, the Mains Detect Input cannot be used. 50 Silicon Chip Australia's electronics magazine An example of where devices may need to be switched off in sequence is where you have an audio processor or mixer ahead of one or more power amplifiers. If the mixer or audio processor is switched on after the amplifiers or off before the amplifiers, a loud noise can be produced in the loudspeakers driven by the amplifiers. That is because the mixer or audio processor can produce a large voltage swing in the audio signal at switch-on or switch-off. So ideally, the amplifiers need to be switched on after the audio processor and off before the audio processor. Therefore, one of the options would be required. Both of the other configurations, with either the Mains Input Detect circuitry or Current Detection circuitry (but not both), offer power-on and power-off sequencing. Fig.2 shows how you can add more sequencer outputs by daisy chaining two (or more) Sequencer units. The primary Sequencer can have any of the three possible configurations. The other Sequencers need to be configured with the Mains Detect Input option. OUT4 from the primary Sequencer applies voltage to the Mains Detect Input of the second Sequencer using a piggyback mains plug lead (or double adaptor). In this way, when OUT4 of the primary Sequencer is powered, it triggers the second Sequencer to start providing power to its outputs and so on. The piggyback plug allows an appliance also to be powered from OUT4 so you don’t lose an output. A delay can be included in the second unit so that its OUT1 outlet does not switch on as soon as the OUT4 on the primary unit is powered. Note that if the primary and daisy-­ chained Sequencers are set for a forward off-sequence (OUT1, OUT2, OUT3 then OUT4), the daisy-chained off-sequence will begin after the primary sequence has finished. However, if the off-sequence is in reverse (OUT4, OUT3, OUT2 then OUT1), the daisy-­ chained off cycle will start as soon as the primary Sequencer begins its off-sequence. Besides using the forwards off-­ sequence, there are ways to deal with this. One is to set a greater delay for the daisy-chained off-sequence so that it starts after the primary sequence has finished, despite being triggered earlier. Also, if the primary Sequencer siliconchip.com.au Fig.2: this shows how to daisy-chain two or more Sequencers to give eight or more controlled outputs. There are other ways to expand it, but this is the easiest way and should suit most applications. off-rate is twice the daisy-chained Sequencer off rate, the outputs from each will switch off alternately between the two. There’s also the possibility of connecting the Mains Detect Inputs of secondary Sequencers to each of the OUT1-OUT4 outputs of a primary Sequencer if you need them to switch on and off in a neat sequence, with primary delays set to be longer than the secondaries. Circuit details Fig.3 shows the full circuit for the Power-Up Sequencer. It is based around microcontroller IC9, which monitors the Mains Detect Input or the current flow through an appliance plugged into OUT1. It also drives the circuitry that powers the four GPOs that supply power to the appliances. Other connections to the microcontroller are for setting the on and off sequence delays and other options. Switching mains to each GPO at OUT1-OUT4 is achieved using a relay and a Triac in parallel for each outlet. The Triacs are 600V bidirectional switches capable of conducting 30A continuously and up to 270A over one 20ms mains cycle. The Triac is included to protect the relay contacts from damage and a short life due to high initial surge currents drawn by appliances at power-up. So, instead of using the relay contacts directly, we first switch on the Triac and then the relay some 300ms later. This means that the initial startup current by an appliance is connected via the Triac, with the relay contact closing afterwards, once the current has dropped. siliconchip.com.au In the same way, the Triac is used to hold power on when the relay is switched off for 100ms, giving time for the relay contacts to fully open before the Triac switches off. That protects the relay contacts from voltage transients that may damage the relay contacts over time. The Triac is protected from voltage transients by a snubber circuit across it that comprises a 10nF X2 rated capacitor and 330W 1W resistor in series for the OUT2, OUT3 and OUT4 circuits. These values are labelled as R1 and C1 for OUT1 because they depend on whether this mains channel is used to detect whether an appliance is switched on or off for Current Detection. If Current Detection is being used, a 220nF X2-rated capacitor and series 470W 1W resistor are used instead of the values mentioned above. The relay and the Triac for each output are driven using separate optically-­ coupled Triac driver ICs. These incorporate lower current rated Triacs that are switched on via LEDs within the ICs. The optically-coupled Triac drivers (IC1 and IC2 for OUT1) are similar. However, IC1 will only trigger the internal Triac near the zero-voltage crossing of the mains waveform, when the instantaneous voltage is under 25V. So IC1 will only trigger TRIAC1 at the start of the mains waveform, and any surge current drawn by the appliance will be very low to begin with (since the voltage is low) and The finished Mains Power-Up Sequencer fitted into a standard ABS enclosure that measures 222 × 146 × 55mm. Australia's electronics magazine 51 only rise as the mains voltage increases over time. The inductor (eg, L1) in series with the Triac reduces the maximum current rise rate to a safe level. Driving the relay For the OUT1 mains channel, IC2 drives the relay coil directly. The snubber across the coil comprising a 10nF 52 Silicon Chip X2 rated capacitor and 1kW 1W resistor limits voltage spikes when the IC switches off and current flow through the relay coil ceases. This snubber also prevents the relay from buzzing when powered off due to current leakage through IC2’s internal Triac. In a typical circuit, the snubber would be across the Triac pins, but Australia's electronics magazine for our purposes, this would provide current through the relay coil when the Triac is off, so the relay will tend to vibrate (buzz). This leakage current is insufficient to switch the relay, but it can still cause it to vibrate. By placing the snubber across the relay coil, this current bypasses the coil. Both types of Triac drivers have siliconchip.com.au Fig.3: the complete Sequencer circuit. It consists of five main blocks: output switching (the entire right-hand page), power supply (upper-left corner), optional Mains Detect Input (below the power supply), Current Detection (lower left plus T1 at top middle) and control (IC9 and surrounding components). special voltage-clamping features that prevent them from conducting (switching on) when mains power is suddenly applied to the circuit. That can happen even with the internal opto-coupled LED off. The clamping siliconchip.com.au feature allows a voltage rise of up to 10kV per microsecond (10kV/μs) to occur without the internal Triac self-triggering. The LED drive current for the Triac drivers is low compared to many other Australia's electronics magazine similar devices, with a lower limit of just 2mA (or 5mA for entirely inductive loads) for the IL4108 (or IL410) and 2mA for the IL4208 or IL420. That means we can get away with a simpler power supply for this part of February 2024  53 the circuit that only has to deliver a modest current, even when all mains outputs (OUT1, OUT2, OUT3 and OUT4) are switched on. The IL4108 or IL410 IC used for switching the Triac is only switched on momentarily before the relay driver is switched on using the IL4208 or IL420. This means that when all outlets are on, the total drive for the opto-­ coupled Triac drivers will be around 8mA. We actually drive each at a little more than the required 2mA to allow for a safety margin. The Triac and relay driving circuitry is the same for all four channels. The only difference is the aforementioned snubber component value variation for OUT1 if current sensing is used. Microcontroller functions Digital outputs RC1 (pin 15) and RA4 (pin 3) of microcontroller IC9 drive the opto-couplers to control OUT1, while other similar digital outputs control the other three channels. A 680W resistor limits the current to IC1’s LED to a little over 5mA. For IC2, there is an indicator LED (LED1) in series with the LED within IC2, so we use a 750W resistor in series to ensure the current is at least 2mA. Switches S1 to S3 connect to the RB5, RB7 and RB6 digital inputs (pins 12, 10 & 11) of IC9, respectively, and these inputs have internal pullups. So each input is sensed as a high level when the switch is open and as a low when the switch is closed, pulling the input to the 0V rail. Switch S1 selects whether the sequencer detects appliance current or uses mains detection. When S1 is open, no current or mains detection is used, so the sequencer starts up whenever mains power is applied. Switch S2 selects whether the sequencer switches power to the first output immediately or after a delay when triggered. When S2 is closed, there is a delay before switching on or off, equal to the on/off sequence delay. When S2 is open, there is no such delay. Switch S3 selects whether VR1 adjusts the on-sequence or off-­ sequence rates. It can also determine whether the off-sequence runs in a forward direction or reverse. VR1 is connected across the 5.1V supply, so the wiper provides a varying voltage to the AN7 analog input of IC9 (pin 7). This voltage is bypassed 54 Silicon Chip Parts List – Mains Power-Up Sequencer 1 double-sided PCB coded 10108231, 203 × 134mm 1 222 × 146 × 55mm ABS or polycarbonate IP65 enclosure [Jaycar HB6130, HB6220] 1 set of panel labels (top and side panel) 1 IEC panel-mount mains input connector with integral fuse (CON5) [Altronics P8324, Jaycar PP4004] 1 10A mains IEC lead 1 10A M205 fast blow fuse (F1) 51 vertical-mounting 15A 300V two-way pluggable terminal blocks, 5.08mm pitch (CON1-4, CON6) [Altronics P2512 + P2572, Jaycar HM3112 + HM3122] 41 10A side-entry chassis-mount GPO sockets (OUT1-OUT4) ● [Altronics P8241, Jaycar PS4094] 41 28 × 14 × 11mm compressed powdered iron toroidal cores (L1-L4) [Jaycar LO1244 (two per packet)] 41 Schrack RT33473 16A NO 230VAC coil relays (RLY1-RLY4) [element14 2748015] 3 SPDT subminiature toggle switches (S1-S3) [Altronics S1415, Jaycar ST0310] 1 9mm PCB-mount vertical 10kW linear potentiometer (VR1) [Altronics R1946] 1 20-pin DIL IC socket 51 16kV isolation Fresnel 5mm LED bezels (Cliplite CLB300CTP) [element14 2748731] Wire/cable/hardware 41 50cm lengths of 1.25mm diameter enamelled copper wire (for L1-L4) 1 820mm length of blue 10A mains-rated wire 1 900mm length of brown 10A mains-rated wire 1 500mm length of green/yellow striped 10A mains-rated wire 1 75mm length of 10mm diameter heatshrink tubing 1 60mm length of 5mm diameter heatshrink tubing 1 250mm length of 1mm diameter heatshrink tubing (for LED leads) 2 M3 × 10mm Nylon countersunk head machine screws (for CON5) 4 M3 × 6mm panhead machine screws (for attaching the PCB to the enclosure) 2 M3 hex nuts 41 200mm cable ties (for L1-L4) 15 100mm cable ties Semiconductors 41 IL410 or IL4108 zero-switching Triac output opto-couplers, DIP-6 (IC1, IC3, IC5 & IC7) [element14 1045434, 1612489] 41 IL420 or IL4208 random-switching Triac output opto-couplers, DIP-6 (IC2, IC4, IC6 & IC8) [element14 1469488] 1 PIC16F1459-I/P microcontroller programmed with 1010823A.hex, DIP-20 (IC9) 41 T3035H-6G 30A Triacs (TRIAC1-TRIAC4), D2PAK [element14 2778110] 1 400V 1A W04 bridge rectifier (BR1) 1 5.1V 1W zener diode (ZD1) 51 5mm high-brightness LEDs (eg, one green and four red) (LED1-LED5) Capacitors 1 1000μF 16V PC electrolytic 1 10μF 16V PC electrolytic 1 470nF X2-rated mains capacitor 1 220nF X2-rated mains capacitor (10nF if current detect feature is not used) 2 100nF MKT polyester 71 10nF X2-rated mains capacitors Resistors (all ¼W 1% unless otherwise specified) 61 1MW 1W 5% 1 100kW 1 10kW Australia's electronics magazine siliconchip.com.au 1 1.5kW 1 1kW 5W 5% 41 1kW 1W 5% 41 750W 41 680W 72 330W 1W 5% (8 if current detection is not used) 41 300W Alternative parts instead of GPO sockets (●) 4 cordgrip grommets [Altronics H4280] 4 2m mains extension cords (or 4 mains line sockets and 8m of 10A mains cable) 5 crimp eyelets suitable for 4-6mm2 wire 1 M4 × 20mm panhead machine screw 1 M4 hex nut 1 M4 star washer Extra parts for Current Detection feature ____________________ 1 vertical-mounting 15A 300V two-way pluggable terminal block, 5.08mm pitch (CON7) [Altronics P2512 + P2572, Jaycar HM3112 + HM3122] 1 AC1010 10A current transformer (T1) 1 MCP6272-E/P dual rail-to-rail op amp, DIP-8 (IC10) 1 8-pin DIL IC socket 1 (P)4KE15CA transient voltage suppressor (TVS1) 2 10μF 16V PC electrolytic capacitors 1 200mm length of 10A brown mains-rated wire 1 200mm cable tie Resistors (all ¼W 1%) 1 30kW 1 20kW 1 18kW 1 15kW 2 10kW 1 2.2kW 1 470W 1W 5% Extra parts for Mains Input Detection feature________________ 1 IEC panel-mount mains input connector with integral fuse (CON8) [Altronics P8324, Jaycar PP4004] 1 mains IEC lead 1 1A M205 fast blow fuse (F2) 1 vertical-mounting 15A 300V two-way pluggable terminal block, 5.08mm pitch (CON9) [Altronics P2512 + P2572, Jaycar HM3112 + HM3122] 2 M3 × 10mm Nylon countersunk head machine screws (for CON8) 2 M3 hex nuts 1 75mm length of brown 7.5A mains-rated wire 1 75mm length of blue 7.5A mains-rated wire 1 40mm of 0.5mm diameter heatshrink tubing 1 4N25 phototransistor opto-coupler, DIP-6 (IC11) 1 400V 1A W04 bridge rectifier (BR2) 1 12V 1W zener diode (ZD2) Hard-to-get parts (SC6871, $95): 1 10μF 16V PC electrolytic capacitor includes the PCB, programmed micro, all 1 22nF X2-rated mains capacitor other semis and the Fresnel lens bezels. 1 1MW 1W 5% resistor Current detection add-on (SC6902, $20): 1 10kW ¼W 1% resistor includes the AC-1010 current transformer, 1 4.7kW ¼W 1% resistor (P)4KE15CA TVS and MCP6272-E/P dual rail-to-rail op amp. 1 1kW 1W 5% resistor 1 reduce quantities by one for each output not fitted 2 reduce quantity by two for each output not fitted siliconchip.com.au Australia's electronics magazine by a 100nF capacitor to present a low impedance when IC9 reads the voltage using its internal analog-to-digital converter. Any parameters set using VR1 are stored in flash memory within IC9, so they remain even if power is switched off. Reduced output channels Initially, all four outputs are active. However, if you don’t need all four, you can leave them off and tell the microcontroller not to use those outputs. The RA0 and RA1 digital inputs (pins 19 & 18) are initially tied to ground on the PCB. The small tracks connecting RA0 and RA1 to 0V can be broken and connected to the nearby track on the PCB’s top side, which joins to the +5.1V supply. A table next month will show which connections are required for any number of outputs. That changes how the output sequence operates in software. Unused output channels do not need to have their components populated on the PCB. Mains detection The separate mains presence detection is via input IEC connector CON8. A series 22nF X2 capacitor is used to apply and limit current to bridge rectifier BR2, while 12V zener diode ZD2 limits the voltage across the output of the bridge. The resulting DC supply is filtered with a 10μF capacitor. The 22nF capacitor provides an impedance of 144.7kW at 50Hz (1 ÷ [22nF × 2π × 50Hz]). Therefore, the current that can be drawn is 230V AC ÷ 144.7kW = 1.59mA. The 1kW 1W resistor in series with the 22nF capacitor limits the surge current through the capacitor when power is first applied, while the 1MW 1W resistor across the capacitor discharges it when power is off. When power is on, the DC supply drives the LED within optically-­ coupled transistor IC11 via a 4.7kW resistor. ZD2 will not normally clamp the voltage to 12V since the current drive to the LED within IC11 means that the rectified voltage is about 8.5V, ie, 1.59mA × 4.7kW plus IC11’s LED voltage of about 1V. The zener diode is included just for protection should there be an open-­ circuit condition. Without it, the 10μF capacitor could be charged to nearly the peak mains voltage (325V) with February 2024  55 We fitted both options for testing but you should pick one (or none). catastrophic results, such as the 10μF 16V capacitor exploding. Current Detection Current transformer T1 is used for the Current Detection feature of OUT1. It produces a current from its secondary winding that’s proportional to the current flow through the Active mains wire. The 10kW loading resistor gives about 4V AC output with a current flow of 1A and one turn of the Active mains wire through the current transformer core. We use four turns through the core, giving about 4V AC with 250mA of current through the primary. The transformer’s primary winding is terminated at the CON7 screw terminal socket. If Current Detection is not used, the two CON7 terminals still need to be joined so that the mains Active connects to OUT1. Current flowing through an appliance connected to the OUT1 GPO outlet also goes through T1’s primary winding, inductor L1 and the snubber comprising a 220nF X2-rated capacitor and series 470W 1W resistor. The impedance provided by the 220nF capacitor at 50Hz is around 14.5kW, allowing about 15.9mA to flow through the switched-on appliance when OUT1 is off. Once current is detected, the sequencer will switch full mains power to the appliance. While T1’s transimpedance is not very linear using a 10kW loading resistance, we use that relatively high value to improve sensitivity. A 100W loading resistor would provide a more linear relationship for accurately measuring current, but only gives a 1V output for a 10A primary current with a single turn through the transformer. We just need to sense when current flows. Voltage rectification The output voltage of T1 is positive and negative on each mains half-cycle, but we want a positive voltage to feed Fig.4: a subsection of the circuit shown in Fig.3, responsible for rectifying the output of current sense transformer T1. 56 Silicon Chip Australia's electronics magazine to the microcontroller, so we need to rectify it. But it’s a small voltage, so we must use precision rectification to avoid any diode voltage losses. A precision full-wave rectifier is used, made from dual op amp IC10 and associated resistors. The rectification is done purely by the op amps, without added diodes. The gain of this precision rectifier is 1.5 times. Transient voltage suppressor TVS1 clamps the output from T1 to about 13.8V AC. That limits the current into the following op amp inputs to a safe level. While it may seem impossible to rectify the incoming AC voltage without diodes, it is possible, provided that the op amp has specific characteristics. These include operating correctly (without output phase reversal) with input voltages below its negative supply rail. In addition, the op amp must be able to pull its output close to the negative rail (ground, in this case). To put it another way, diode junctions within the op amps perform this function without us needing to add external diodes. We use an MCP6272 dual op amp (IC10) for this full-wave rectification. One stage (IC10a) is connected as a unity gain buffer, while the other (IC10b) provides the 1.5 times gain. To understand how the rectification works, refer to Figs.4 & 5; A to E in Fig.5 correspond to the waveforms at the identically labelled parts of the circuit in Fig.4. Consider the operation using a 2V peak-to-peak sinewave at point ‘A’. This makes the description easier since the waveform has a peak voltage of 1V. Rectification of the negative and positive waveforms will be described separately. For the negative half of the cycle, the signal applied to the non-inverting pin 3 input of IC10a via the 15kW resistor will cause the voltage at that pin (point B) to be clamped at around -0.3V due to IC10a’s internal input protection diode. The output of IC10a (point C) therefore sits at 0V during negative portions of the cycle, since its negative supply rail is at 0V, and it cannot pull its output lower than that. IC10b adjusts its output (point E) so that the voltage at its inverting input pin 6 (point D) matches the voltage at non-inverting input pin 5 (point C). Since the 10kW resistor from point D to ground has no voltage across it, it siliconchip.com.au plays no part in the circuit during the negative portions of the cycle. With the 10kW resistor essentially out of the circuit, IC10b operates as a standard inverting amplifier with both inputs (points C and D) at 0V. Its gain is therefore -30kW divided by 20kW, which equals -1.5 times. So, the -1V peak of the waveform is amplified and inverted to produce +1.5V at point E. Rectifying positive voltages The way it works for a positive voltage at the input (point A) is more complicated. Firstly, the voltage at pin 3 (point B) is reduced compared to the 1V peak at the input. That is because of the divider formed by the 15kW and 18kW resistors, so the voltage becomes 0.5454V (1V × 15kW ÷ [15kW + 18kW]). Point C will also peak at 0.5454V since IC10a is working as a unity-gain buffer, producing the same voltage at its output as its non-inverting input. Once again, op amp IC10b adjusts the output voltage (point E) so that the voltage at the inverting input at pin 6 (point D) matches the voltage at the non-inverting input, pin 5 (point C). We know that point D is at 0.5454V, so the current through the 10kW resistor to ground is 54.54μA (0.5454V ÷ 10kW). With point A at 1V, there is 22.73μA [(1V − 0.5454V] ÷ 20kW) flowing in through the 20kW resistor. That leaves 31.82μA (54.54μA - 22.73μA) to flow from output pin 7 of IC1b and through the 30kW resistor. Therefore, the voltage across the 30kW resistor is 0.9546V (31.82μA x 30kW). With point D at 0.5454V, point E must be at 1.5V (0.5454V + 0.9546V). So, the circuit operates as a fullwave rectifier with a gain of 1.5. The degree of precision depends on the op amp parameters and resistor tolerances. The lower the offset voltage of the op amp and the lower the op amp input bias current, the more accurate the full-wave rectification will be, particularly at low signal levels. Fortunately, we are not overly concerned with absolute accuracy here. We just need full-wave rectification of the incoming AC signal from the current transformer that works down into the tens of millivolts range. This circuit is more than capable of that. Scope 3 shows the operation of the full-wave rectifier for a 1V peak (2V peak-to-peak) sinewave at the input to the full wave rectifier (point A) on channel one, shown in yellow. siliconchip.com.au The channel two cyan waveform is the full-wave rectified waveform (point E). That measures as a 1.48V peak output waveform at 100Hz, compared to 1V peak at 50Hz for the input sinewave. The 20mV discrepancy from the expected 1.5V is due to tolerances in the 1% resistors and the accuracy of the oscilloscope readings. A 2.2kW resistor and 10μF capacitor filter the rectified waveform to produce a smoothed DC voltage suitable for IC9 to monitor via its AN4 analog input (pin 16) and internal analog-to-digital converter (ADC). Power supply Power for circuitry is derived directly from the mains via the IEC connector, CON5. A 470nF X2 mainsrated safety capacitor transfers charge each half cycle to a 1000μF capacitor via bridge rectifier BR1. Zener diode ZD1 clamps the voltage to 5.1V. The supply can be visualised as rectifying a current-limited version of the mains waveform via the series impedance of the 470nF capacitor. The impedance at 50Hz is 6.77kW (1 ÷ [470nF × 2π × 50Hz]). The current that can be drawn is equal to the mains voltage (230VAC) divided by the impedance, or about 34mA. As mentioned earlier, it takes around 8mA to drive all four optos continuously, leaving plenty of overhead for the microcontroller and other components. The 1kW 1W resistor in series with the 470nF capacitor limits the surge current through the capacitor when power is first applied, especially if power is switched when the mains is at a high instantaneous voltage when the switch is thrown. The 1MW 1W Fig.5: the expected waveforms at points A-E on the circuit (Fig.4) for a 1V peak sinewave from transformer T1. The output (E) is a rectified version of the input (A) but 50% higher in amplitude. resistor across the capacitor discharges it when power is off. LED5 connects in series with a 1.5kW resistor to indicate when power is on. IC9 and IC10 include bypass capacitors to stabilise their 5.1V supplies, with IC9 having a 10μF & 100nF capacitor while IC10 has a 10μF capacitor. Next month Having described how the Mains Power-up Sequencer works, we have run out of space in this issue. The final follow-up article next month will cover building it, testing it and SC setting it up. Scope 3: the measured input (A) and output (E) waveforms of the precision rectifier circuitry with a resistive load, giving a sinusoidal current waveform. You can see how perfectly the input is rectified; using diodes for rectification (unless used within a precision rectifier) would not work this well (if at all) with such low voltages. Australia's electronics magazine February 2024  57