Silicon Chip800W (+) Uninterruptible Power Supply (UPS) Part II - June 2018 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: I, for one, welcome our new farm robot overlords
  4. Feature: AgBots – robots working on the farm of tomorrow! by Dr David Maddison
  5. Project: The USB Flexitimer: accurately timed switching by John Clarke and Nicholas Vinen
  6. Project: Wide-range digital LC Meter by Tim Blythman
  7. PartShop
  8. Project: Switch on or off anything with a Temperature Switch by John Clarke
  9. Subscriptions
  10. Serviceman's Log: Repairing ‘proper’ stereo gear is satisfying by Dave Thompson
  11. Project: 800W (+) Uninterruptible Power Supply (UPS) Part II by Duraid Madina and Tim Blythman
  12. Review: Degen’s wind-up or solar-powered AM/FM/SW radio by Ross Tester
  13. Feature: El Cheapo Modules 17: 4GHz digital attenuator by Jim Rowe
  14. PartShop
  15. Vintage Radio: 1952 Astor GP/PS Hybrid Portable by Associate Professor Graham Parslow
  16. Product Showcase
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: 6GHz+ Touchscreen Frequency Counter / 800W+ Uninterruptible Power Supply / Deluxe Frequency Switch / USB Port Protector
  20. Outer Back Cover

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

You can view 38 of the 104 pages in the full issue, including the advertisments.

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

Articles in this series:
  • AgBots – robots working on the farm of tomorrow! (June 2018)
  • AgBots – robots working on the farm of tomorrow! (June 2018)
  • The farm of the future . . . Part II (July 2018)
  • The farm of the future . . . Part II (July 2018)
Items relevant to "The USB Flexitimer: accurately timed switching":
  • USB Flexitimer PCB [19106181] (AUD $7.50)
  • PIC16F1455-I/P programmed for the USB Flexitimer [1910618A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (C and HEX) files for the USB Flexitimer [1910618A.HEX] (Software, Free)
  • USB Flexitimer PCB pattern (PDF download) [19106181] (Free)
Items relevant to "Wide-range digital LC Meter":
  • Wide-range digital LC Meter PCB with stackable headers [04106181] (AUD $7.50)
  • Wide-range digital LC Meter PCB [04106181] (AUD $5.00)
  • Pair of PCB-mounting right-angle banana sockets (red/black) (Component, AUD $6.00)
  • 1nF ±1% polypropylene (MKP) or C0G/NP0 ceramic capacitor (Component, AUD $2.50)
  • 20x4 Alphanumeric serial (I²C) LCD module with blue backlight (Component, AUD $15.00)
  • Case pieces for the Wide-range Digital LC Meter (PCB, AUD $7.50)
  • Arduino Sketch (.ino) and libraries for the Wide-Range Digital LC Meter (Software, Free)
  • Wide-range digital LC Meter PCB pattern (PDF download) [04106181] (Free)
Items relevant to "Switch on or off anything with a Temperature Switch":
  • Temperature Switch Mk2 PCB [05105181] (AUD $7.50)
  • PIC12F617-I/P programmed for the Temperature Switch Mk2 [0510518A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (ASM and HEX) files for the Temperature Switch Mk2 [0510518A.HEX] (Software, Free)
  • Temperature Switch Mk2 PCB pattern (PDF download) [05105181] (Free)
Items relevant to "800W (+) Uninterruptible Power Supply (UPS) Part II":
  • 800W+ Uninterruptible Power Supply control shield PCB [11106181] (AUD $5.00)
  • Arduino Sketches (.ino) and library for the 800W+ Uninterruptable Power Supply (Software, Free)
  • 800W+ Uninterruptible Power Supply control shield PCB pattern (PDF download) [11106181] (Free)
  • 800W+ Uninterruptible Power Supply front panel artwork (PDF download) (Free)
Articles in this series:
  • 800W (+) Uninterruptible Power Supply (UPS) (May 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) (May 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part II (June 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part II (June 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part III (July 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part III (July 2018)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)

Purchase a printed copy of this issue for $10.00.

Building our all-new 800 W plus! Part 2: by Duraid Madina and Tim Blythman Uninterruptible U ninterruptible Power Supply S upply Keep mains-powered equipment running during blackouts with this high-power, high-capacity Uninterruptible Power Supply. It uses modern lithium-iron-phosphate batteries which will withstand being repeatedly discharged without damage. This makes it considerably lighter and more compact than most equivalent commercial UPSes. L ast month, we described the overall concept of our new LiFePO4-powered UPS and explained how it was designed. We also provided a list of parts needed to build it, including information on where to get them. In this article, we provide a list of the parts you need to build the control shield, explain how the shield works and how to assemble it. We’ll then go through the steps required to prepare the case, mount all the parts and wire them up. It’s a fairly elaborate unit which includes high-voltage and high-current wiring, so take your time and make sure you follow all the instructions carefully to ensure that you build it safely and so that it works first time. Control circuit description The circuit details for the Arduino control shield are shown in Fig.2. So 64 Silicon Chip that you can see how it fits into the overall scheme, we’ve also reproduced the block diagram (Fig.1) from the first article, which incorporates the corrected wiring for relay RLY3. The relay driver shield plugs into the Arduino board and is connected via four pins: Vin (the 12V supply), ground and two I2C bus control lines, SDA (data) and SCL (clock). The Arduino sends commands over the I2C bus to set the state of the eight relay driver outputs. Six are used, three to drive the mains switching relays and three for indicator LEDs. The control shield is stacked on top of the relay driver shield and contains the additional circuitry shown in Fig.2. These components allow it to monitor the inverter’s state, the shape and voltage of the mains waveform and the battery voltage. They also let it switch the inverter on and off, “bootCelebrating 30 Years strap” itself to power up with (automatically) or without (manually) the mains supply present and sound an audible alarm to indicate the loss of mains power or low battery voltage. Monitoring the mains waveform The centre-tapped secondary of a 12.6V mains transformer is wired to CON1. The 6.3V tap is connected to analog input pin A1 of the Arduino via a 75kΩ resistor. This forms a voltage divider in combination with the two 10kΩ DC bias resistors, to keep the voltage at this pin within the range of 0-5V. The transformer secondary voltages will be higher than 6.3VAC because it is lightly loaded and since the mains voltage can go above 230VAC; perhaps to as high as 250VAC or more. A 6.3VAC sine waveform has peak voltages of ±8.9V but if the mains voltsiliconchip.com.au Fig.1: the block diagram of the UPS, re-published from last month, gives a good overview of how the unit operates. Note that the wiring for RLY3 was incorrect in the article last month but has been fixed in this diagram. The circuit of the Arduino control shield (highlighted at centre left) is shown in Fig.2, overleaf. age goes to 250VAC (as it can in areas with lots of domestic solar installations) we expect it could be as much as ±10.76V at the centre tap of the transformer. The three resistors between the transformer and input A1 translate this ±10.76V swing to 2.5V ±1.43V, (ie, about 1.07-3.93V), to suit the Arduino’s internal analog-to-digital converter (ADC). This allows it to monitor the mains voltage in real-time. The full 12.6VAC (~20V peak) output of the transformer is also fed through one of relay RLY4’s normallyclosed set of contacts to schottky diode D1 and into a 1000F filter capacitor. If the Arduino is not powered but mains is present, this capacitor will charge up to around 20V. This then feeds the input of REG1, a 12V linear regulator, to power the circuit. Once the software has determined that the mains waveform is normal and has switched the UPS output on, this is no longer necessary as the unit is powered from the 12V switchmode supply. So the Arduino drives its D8 output pin high, energising relay RLY4. This disconnects the transformer secondary from D2 while leaving its centre tap connected to analog input A1. Diode D1 prevents the back-EMF from RLY4’s coil from damaging the Arduisiliconchip.com.au no when it powers off and the relay is de-energised. Diode D3 isolates the output of REG1 from the output of the 230VAC to 12V DC switchmode supply, so that when that supply powers up, it doesn’t interfere with the operation of REG1 and vice versa. This also means that the VIN rail will be a bit lower (around 11.3V) when REG1 is providing power. This can be sensed by the Arduino via a 100kΩ/10kΩ resistive divider at analog input A3. This divider reduces the VIN voltage by a factor of 11 so the A3 pin will normally be around 1.09V when running from the switchmode supply and about 1.03V when running off REG1. So if you switch S1 off, the Arduino can sense the voltage drop at VIN. It will then perform a clean shut-down, sequencing the relays to turn the UPS output off cleanly. Inverter interface The telephone-style control cable supplied with the inverter plugs into CON4 (RJ14; 6P4C). Its control lines are not ground-referenced so it is necessary to optically isolate it using two PC817 optocouplers, OPTO1 and OPTO2. When the inverter is operating, the voltage at the green wire (pin 4) goes Celebrating 30 Years low compared to the common black wire connection at pin 2. This causes current to flow through the internal LED of OPTO1 and the 10kΩ currentlimiting series resistor, pulling digital input D4 of the Arduino low. It’s normally held high by a current source within the microcontroller. The Arduino software can therefore sense the state of this pin to determine whether the inverter is powered up. To switch the inverter on or off, the Arduino drives digital output pin D2 high for around 500ms. About 18mA then flows through the internal LED in OPTO2, limited by the 220Ω series resistor. This switches on the output transistor, pulling up the voltage at pin 3 of CON4 (the red wire). This is equivalent to pressing the button on the supplied remote control unit and if the battery voltage is sufficient, the inverter will switch on. If it’s already on, it will switch off. The Arduino can check the state of the D4 input pin to verify that it has done so. Battery monitoring and switch-on The 24V (nominal) battery is wired to CON2 and its voltage is divided down by a factor of 11 by the 100kΩ/10kΩ resistors. With the maximum battery voltage of 29.2V, this gives 2.65V at the Arduino analog input A2. June 2018  65 Fig.2: the circuit of the Arduino control shield. This gives the Arduino board the ability to monitor the mains waveform (via CON1 and the external transformer), control the inverter (via CON4 and OPTO1/2) and “bootstrap” the power supply after a long blackout or when the unit is being used away from mains power. The Arduino uses this voltage to display warnings to the user via the front panel LEDs and piezo buzzer PB1. If the battery voltage gets too low, it will shut down the inverter and this will also cause the Arduino to power down. If you manually shut it down via S1 but the batteries are still charged, you can power it up by holding down the momentary pushbutton switch on the front panel (S2). This connects the terminals of CON3, feeding 24V to the anode of diode D4, which then charges up the 1000F capacitor at the input of REG1. REG1 then powers up the Arduino using the same procedure as described above. But since the mains waveform is not present, it will switch the output over to the inverter which then 66 Silicon Chip powers the 230VAC to 12V DC switchmode supply once the pushbutton is released. You need to hold down this button for a few seconds to allow this procedure to complete. The 10Ω 1W series resistor reduces the inrush current when charging up the 1000F capacitor and also reduces the dissipation in REG1 during the start-up period. Additional components A two-pin header labelled JP1 (“RST DIS.”) can be used to connect a 10F capacitor between the Arduino’s RESET-bar pin and ground. If this jumper is fitted, it will block reset pulses from the USB interface, preventing the Arduino from rebooting when it’s Celebrating 30 Years plugged into a computer. This allows a computer to get information about the UPS state via USB without interfering with the operation of the UPS. The Arduino can still be manually reset for uploading a new sketch by pressing the reset button or by temporarily removing the shunt from JP1. We’ll have more details in the third article next month on how standard UPS software can be used to get information from the UPS over a USB interface, allowing you to monitor the battery state and even shut the computer down before the battery goes flat. Shield construction Use the PCB overlay diagram, Fig.3, as a guide during construction. The siliconchip.com.au Fig.3: the PCB overlay diagram and the photo at right show where the parts are fitted on the control shield. Be careful to ensure that RLY4, REG1, OPTO1, OPTO2, the diodes and electrolytic capacitors are mounted with the correct orientation. Also, the wire entry holes of CON1-CON3 should face towards the top edge of the PCB. shield is built on a double-sided PCB, coded 11106181 and measuring 68.5 x 54mm. It’s available from the SILICON CHIP Online Shop. Start by fitting the resistors. It’s best to check the value of each using a DMM before soldering them in place. Next, fit the four diodes, ensuring that the cathode stripes are orientated as shown. D2 is a 1N5819 while the other three are 1N4004s. Then install the two optocouplers. They are the same type but have a different orientation; ensure the pin 1 markings are located as shown in Fig.3. Follow with the three terminal blocks, ensuring their wire entry holes are facing the adjacent edge of the PCB before soldering the pins. Then move on to the small relay, RLY4. It will have a stripe at the pin 1 end and this must go towards the left side of the PCB, as shown in Fig.3. The piezo buzzer can be fitted next, with its positive terminal towards the bottom of the PCB. Then solder the two 100nF capacitors in place, followed by CON1 and the two larger capacitors. REG1 is mounted next, with its metal tab orientated as shown. Finally, solder the four pin headers in place where shown. These are inserted from the bottom side of the PCB and soldered to the top. You may find it easier to plug the headers into the Arduino, flip it over and solder them to the shield board, as this will keep them straight during the soldering process. That completes assembly of the shield board. Locating the components in the case The UPS has a number of fairly large components and some of them get quite warm during operation. The specified case has plenty of room for the components to fit and lots of ventilation for cooling air to circulate. Note that a bigger case would be necessary if you are going to use larger batteries or more than two. We spent quite a bit of time planning the layout of the UPS so we sug- gest you use the same layout. If you vary the layout, keep in mind that you should keep the 230VAC mains wiring away from any low-voltage wiring, as we have done. Since almost all suitable cases would be made of metal, all panels must be solidly earthed. You will also need to ensure that there is adequate venting and space around the components to handle the expected heat dissipation. One of the advantages of the case we are using is that the rear panel can be pivoted on the bottom pair of screws and folded down by removing the top two screws. This makes assembly considerably easier. Case assembly You don’t need any special tools; a standard assortment of screwdrivers and pliers is sufficient. You will need a decent drill and 3mm, 4mm and 5mm bits. A drill press is helpful but not required. There are a couple of larger holes which will need Parts list – UPS control shield 1 double-sided PCB, 68.5 x 54mm [SILICON CHIP code 11106181] 1 set of pin headers (1x6 pin, 2x8 pin, 1x10 pin) 1 3-way mini terminal block, 5.08mm pitch (CON1) 2 2-way mini terminal blocks, 5.08mm pitch (CON2, CON3) 1 6P4C PCB-mount socket (CON4) [Altronics P1442] 1 DPDT DIL telecom relay, 5V DC coil (RLY4) [Omron G6H-2 5V or equivalent] 1 5V self-oscillating piezo sounder (PB1) Semiconductors 2 PC817 optocouplers (OPTO1,OPTO2) 1 7812 linear 12V regulator, TO-220 (REG1) 3 1N4004 1A 400V diodes (D1,D3,D4) 1 1N5819 1A 40V schottky diode (D2) siliconchip.com.au Capacitors 1 1000F 25V electrolytic 1 10F 10V electrolytic 2 100nF ceramic or MKT (code 0.1F, 104 or 100n) Resistors (all 0.25W, 1% metal film unless otherwise stated) 4-band code    5-band code 2 100kΩ (brown black yellow black brown black black orange brown) 1 75kΩ (violet green orange black violet green black red brown) 5 10kΩ (brown black orange black brown black black red brown) 1 220Ω (red red brown black red red black black brown) 1 10Ω 1W 5% carbon (brown black black gold) CAUTION! This project involves mains voltages which can be dangerous if not handled correctly. Always be careful when dealing with this level of voltage. THIS IS NOT A PROJECT FOR ANYONE NOT EXPERIENCED WITH MAINS DEVICES. Celebrating 30 Years June 2018  67 Drilling the mounting holes With everything laid out comfortably, mark out the required location of the mounting holes for each component in the bottom of the case, using a permanent marker. Holes will be drilled in these locations later. It’s also a good idea to mark out the outlines of the components, to assist with picturing the layout as it progresses. In the case of the top plates for the batteries, the outlines make it easy to mark out the mounting holes, af68 Silicon Chip HEATSHRINK SLEEVES 4–WAY POWER OUTLET GLAND FOR MAINS CABLE ENTRY 10A FUSE S1 MAINS SENSING TRANSFORMER 12V POWER SUPPLY UNIT SOCKET ON CHARGER OUTPUT LEAD – RLY1 RLY2 RLY3 MAINS CHANGE OVER INVERTER 12V BATTERY (OUTPUT) + – 24V BATTERY CHARGER 12V BATTERY 24V DC TO 240VAC INVERTER (1.2kW) (DOUBLE INSULATED, HAS NO EARTH) CON1 CON2 CON3 D0 4004 D8 D7 TO CT MAINS TRANSFORMER BAT. MON. TO S2 + D4 4004 CON4 0V A5 + 5819 4004 GND A0 VIN RST DI S 5V JP1 RST + + COIL + COM 24V 11106181 ARDUINO UNO + RELAY SHIELD + CONTROL SHIELD SC Ó2018 INSULATED 2-CORE CABLE HARD WIRED TO CHARGER + BATTERY BALANCER to be made with a hole saw, stepped drill or tapered reamer. You will also need a needle file to create the correct profile for some of the component mounting holes. It will also come in handy to even out any rough edges left after drilling. And you will need access to a vice and some large pliers to bend a few of the pieces into the required shape. Start by putting the case together using the supplied instructions. It is sold in three parts: one includes the front, back and sides while the lid and base are sold separately. We found it easier to fit the sides to the base with the included self-tapping screws, followed by the front and back, which are attached with bolts and nut swhich include integrated shake-proof washers. Having assembled the bottom, front, rear and sides, we found that the lid would not fit until we loosened the front panel nuts. Once you’re happy with how all the case parts fit together, remove the lid. Next, lay out the components in the case, using our photos and Fig.4 as a guide. Remember to allow space for wiring up the components. The inverter, Arduino assembly, battery balancer, mains transformer and relays all have their own mounting holes and so are easily attached to the base using machine screws and nuts. The batteries have no mounting provisions so we secured them in place using six brackets placed around their periphery, bolted to the bottom of the case. We then fitted large straps over the top so that they cannot lift off the base. These are held down with long bolts and nuts. You will need to ensure there is enough space around the batteries for the brackets to be mounted. In our prototype, the brackets are almost, but not quite, touching the sides of the case. GREEN AMBER LED LED RED LED S2 (INPUT) + – UNINTERRUPTIBLE POWER SUPPLY: MAINS AND 24V POWER WIRING Fig.4: this shows the placement of the components in the UPS case and both the mains and 24V DC supply wiring. All wiring, but especially the mains connections, should be cable tied together and anchored to prevent movement. The mains wiring should also be kept as short as practical and insulated with heatshrink tubing where possible. ter removing the batteries. Once all the holes have been marked out, we suggest that you detach the base from the rest of the case as this makes drilling easier. Now is also the time to mark out the locations to drill holes for attaching the feet. Make sure they won’t interfere with mounting any of the other components. We ended up sharing a single mounting screw between one of the feet and one of the relay bases but you may prefer to move them slightly Celebrating 30 Years apart to avoid this. All holes are 3mm except those for the battery brackets (5mm) and a single 4mm hole for the panel earth. The earth mounting hole is placed between the inverter and relays, near the rear panel; its exact placement is not critical. Drill all of the holes in the base before mounting anything and ensure they have been cleaned of any swarf before proceeding. A larger drill bit, rotated by hand siliconchip.com.au 4–WAY POWER OUTLET 12V POWER SUPPLY UNIT 6.3V – 6.3V 0V MAINS SENSING TRANSFORMER + – RLY1 RLY2 RLY3 MAINS CHANGE OVER INVERTER 12V BATTERY (6-CORE FLAT CABLE) RJ12 PLUG + – 24V BATTERY CHARGER 12V BATTERY 24V DC TO 240VAC INVERTER (1.2kW) + 6 D8 D7 TO CT MAINS TRANSFORMER BAT. MON. TO S2 + CON1 CON2 0V D0 D4 4004 CON4 6.3V 0V 6.3V CON3 4004 5 4 3 2 1 + 4004 GND A5 RST DIS A0 5819 JP1 VIN + 5V + 11106181 COIL + COM 24V RST BATTERY BALANCER RJ12 PLUG ARDUINO UNO + RELAY SHIELD + CONTROL SHIELD SC GRLEEDEN AMLEBDER Ó2018 RED LED S2 S2 + – UNINTERRUPTIBLE POWER SUPPLY: LOW VOLTAGE SIGNAL WIRING Fig.5: use this diagram as a guide for connecting and routing the low-voltage, low-current wiring. It’s easiest to make the relay coil connections before completing the mains wiring (see text) and bundle up each set of cables using cable ties or tubing to keep everything neat. in the hole, is very handy for removing swarf. Fitting the components Re-check that the holes are in the correct positions to suit all the components before you start mounting them. The order of assembly is not critical but there are a few things which make the process easier. Leave the batteries and inverter until last as they are the heaviest items. For each component, insert screws siliconchip.com.au from the underside of the panel and fit nuts and lockwashers on the inside of the case. If you have an L-shaped bench, you can position the case across the two edges so that you can access the underside to do up screws while its weight is supported. Be careful to ensure it is stable before proceeding, though. Start by mounting the relay bases using M3 x 15mm machine screws with a nut and washer on each. Mount them with the round hole in the top surface Celebrating 30 Years closer to the rear panel. Leave the relays off for now. The transformer is next and only needs two M3 x 10mm machine screws. Orientate the transformer with the primary (blue and brown wires) facing towards the relays and the secondary (white and yellow wires) facing away. This will help to keep the mains and low voltage wiring separate. The balancer is another simple item to mount, needing four M3 x 10mm machine screws with nuts and lockwashers. If you are using our Battery Balancer from last month’s issue instead, you could mount the PCB to a piece of PCB prototyping board such as Jaycar’s HP9556 or Altronics’ H0701 by soldering some short stiff wires between the two. This can then be mounted to the case using the holes provided in the prototyping board and some tapped spacers. To lift the Arduino Uno up so it was more accessible (especially the USB socket), we used a number of tapped and untapped spacers and long screws. Start by threading 25mm Nylon machine screws through the holes in the Arduino and into pairs of 15mm-long Nylon tapped spacers on top of each other. The use of Nylon is important, to avoid accidental short circuits. We had to trim the head of the machine screw nearest the SCL pin due to low clearances on the board. In this case, the tapped spacer needed to be threaded onto the machine screw, as the machine screw will not be able to rotate. Now feed M3 x 32mm machine screws up through the holes in the panel underneath, place 25mm untapped spacers over their shafts and screw them into the tapped spacers already attached to the underside of the Uno. You can now plug the relay driver shield into the Arduino and then plug the control shield that you built earlier into the sockets on the top of that. Next, mount the inverter using four M3 x 10mm machine screws, nuts and lockwashers. Finally, we come to the batteries. We started by mounting the six angle brackets using M5 x 10mm machine screws, M5 nuts and lockwashers, ensuring that the batteries are a snug fit and cannot move around (see photo on page 72). Next, feed the eight M5 x 90mm June 2018  69 LOOKING FOR A PCB? PCBs for most recent (>2010) SILICON CHIP projects are available from the SILICON CHIP PartShop – see the PartShop pages in this issue or log onto siliconchip.com.au/shop. You’ll also find some of the hard-to-get components to build your SILICON CHIP project, back issues, software, panels, binders, books, DVDs and much more! Please note: the SILICON CHIP PartShop does not sell kits; for these, please refer to kit supplier’s adverts in this issue. machine screws through the base and attach one M5 nut to each, holding them steady. This is important as otherwise, you risk contact with the battery terminals which could possibly short them out once the wiring is in place. Test fit the batteries and flat plates to ensure that everything lines up and then clamp the plates down on top of the batteries using another eight M5 nuts and lockwashers. It should look like the photo on page 72. Having determined that everything fits, remove the plates for now, giving better access to the battery terminals. We mounted the charger on the side panel to save space. It’s prevented from moving forward and back by screws through the side panel (the holes just happen to be spaced perfectly for this) and in the other dimensions by a metal clamp which we have fitted over the top and bent to provide plenty of friction (see photos on pages 72 & 73). This clamp is made by cutting a 15cm length of Carinya 20 x 200 x 1mm Flat Make-a-Bracket (Bunnings Cat 3975816). This was not included in the parts list last month but you could just as easily use a 20mm x 150mm strip of aluminium or thin steel plate with a couple of 3mm holes drilled in it. Bend it into a “Z” shape in a vice so that when one section is attached to the side of the case, the other two sections clamp the charger in place. Attach it via the existing side panel holes using two short 3mm machine screws, lockwashers and nuts. Front and rear panel preparation Re-assemble the enclosure to double-check that everything fits properly. Then remove the back panel. Unclip the front from the four-outlet Detail of the control shield installed. This prototype version is electrically indentical to the PCB described earlier in this article. 70 Silicon Chip Celebrating 30 Years GPO to reveal its six mounting holes and mark out the hole positions on the rear panel. To save space, we mounted the 12V switchmode power supply directly behind it. To do this, you need to drill the six mounting holes for the GPO, then measure the distance between the mounting holes on the PSU and locate them relative to the existing GPO mounting hole. The shared screw is the one which goes into the GPO mounting location just to the right of the left-most outlet. You need to use a 6mm machine screw here; the other GPO mounting screws are 10mm and have nuts and lockwashers on the back. Having prepared the GPO and PSU mounting holes, you now need to make a large hole for the central protruding part of the GPO to fit through (ie, where the wiring is attached). You will also need to drill holes for the mains input lead/cable gland, fuse holder, on/ off rocker switch and a 4mm hole for the rear panel earth bolt. We chose to space the switch, fuse holder and mains cable gland out evenly along the centre-line of the panel. Ideally, the earth bolt hole should be located between the mains input lead and fuse holder. The hole for the GPO protrusion is the largest and its size is not particularly critical, as long as it’s large enough and doesn’t extend outside the GPO outline. We made it by drilling a number of 6mm holes around the perimeter of the opening, then nibbled and filed away the remaining material until we could knock out the central panel. Test-fit the GPO and make sure the locations where the Active and Neutral wires are terminated are not too close to the edges of the hole. Because the switch, fuse holder and mains cable entry holes need to be more precise, drill a pilot hole for each and then opened them up to as large as possible with drill bits, followed by careful use of a tapered reamer to get them to their final dimensions. Test fit along the way to ensure the holes don’t get too large. Make sure to clean away any swarf or sharp edges with a file and use the same file to cut a slot to allow the tab on the switch to fit through the panel. You can now mount the components on the rear panel, starting with the switchmode power supply on the siliconchip.com.au siliconchip.com.au Celebrating 30 Years June 2018  71 Looking into the completed UPS with the front panel at left, rear panel at right. The front panel has only the three indicator LEDs and bootstrap switch, while the rear panel houses the mains input lead with safety fuseholder alongside, the enable switch (almost hidden). the 12V PSU and the four-way switched mains outlet at top right of this photo. inside, which is attached using 6mm M3 machine screws into its tapped holes. Remove the screw which is shared with the GPO, then mount the GPO using a 6mm screw in the shared position and 10mm screws, nuts and washers for the other five. The rocker switch is a snap fit while the fuseholder attaches by means of the included nut and washer, as does the cable gland for mains entry. Now remove the front panel and marked it out to suit the three LED indicators and the momentary pushbutton. Given that there is even more space on the front panel, this is not so critical, so again we aimed for placing these items evenly along the front centreline. We drilled the holes to suit (6mm for the LED indicators and 13mm for 72 Silicon Chip the pushbutton) and test mounted all the items before removing them again. Given that we will have to solder wires to them, and the front panel does not have a convenient fold-down feature, it is much easier to remove them at this stage. When positioning these holes, keep in mind that they need to be inside the locations where the side panels meet the front panel. Wiring it up There is a lot of wiring in this project, including 250VAC-rated mains wiring, high-current 24V DC wiring and also low-current, low-voltage wiring. Take care to ensure that the mainspotential wires are kept away from the others and that they are not needlessly Celebrating 30 Years long and free to move about. Once fitted, the 3-pin mains plug MUST be removed any time you are working on the UPS. But you shouldn’t be too careless with the batteries either as they can deliver in excess of 100A when shorted. So be very careful when making or changing any wiring to the batteries. Keep in mind that the inverter output is also a high-voltage risk and it can be powered up even when the unit is disconnected from mains! Battery wiring The battery wiring is a good place to start and the details are shown in Fig.4. Use electrical tape to insulate the bare ends of wires while doing this, to avoid accidental short circuits. Be careful to avoid shorts while doing siliconchip.com.au this wiring since the batteries can supply a lot of current. There are three buses that connect to the batteries. These are: • The 0V bus, which connects the battery negative terminal to the charger, balancer and inverter negative terminals and the Arduino ground (black wires). • The 12V bus, which joins the two batteries and also connects to the balancer (white wires). • The 24V bus, which connects the battery positive terminal to the charger, balancer and inverter positive terminals and the Arduino 24V input (red wires). The inverter is supplied with thick red and black leads with eyelets at each end. We used these to connect the batteries to the inverter inputs and made up wires for the remaining connections. Use 10mm M4 machine screws, shakeproof washers and nuts to attach the leads to the battery terminals. Our charger came with quite a lengthy output lead, as depicted in Fig.4, so we only had to solder short lengths of wire to a matching socket to connect to the batteries. You will need longer wires if your charger lead is shorter. To complete the 0V bus, we need to connect the charger, balancer and Arduino to the battery 0V terminal. The charger wiring will carry several amps while the other connections are well under 1A but you can use medium-duty or heavy-duty hookup wire for all these connections. We used a 40cm length of black wire from the battery to the charger connection and a 100cm length from the battery to the balancer. These were both crimped into a single 4mm eyelet. Attach this eyelet with the same screw that’s holding the inverter cable onto the battery negative terminal. While making this connection, slip a 50mm length of 20mm diameter heatshrink tubing (ideally, clear or black) over the whole assembly – both eyelets, the battery terminal and the screw. This should cover all the exposed metal and later, when we shrink it down, it will prevent any stray wires from contacting this terminal. Solder the shorter black wire onto the charger socket negative terminal and screw the longer one into the battery balancer negative terminal, along with a second 30cm length of black wire which is then attached to the BAT - terminal on the Arduino shield. Similarly, for the battery positive connections, cut a 60cm length of medium-duty red wire (for the charger) and a 30cm length of medium-duty red wire (for the balancer) and crimp these into a single 4mm eyelet. This is attached to the battery positive terminal using another M4 machine screw, nut and shakeproof washer. Solder the longer wire to the positive terminal on the charger socket and screw the shorter wire into the positive terminal of the battery balancer, along with a 30cm length of red medium-duty wire, which you can then connect to the BAT + terminal on the Arduino shield. This connection should have no effect until the pushbutton is wired up later. The link between the two batteries is made from a short length of very heavy-duty wire with a large 4mm eyelet crimped onto each end. We suggest you use a vice to crimp these (unless you have a special tool) since these will carry the full battery current (30A+) and the connections need to be good! Then we just need to run a wire from one of the two joined battery terminals to the centre tap on the balancer. Crimp a 40cm length of white light or medium-duty wire into a 4mm eyelet and attach this to one end of the heavy inter-battery cable, then screw the other end to the COM (common) terminal of the balancer. Before proceeding, ensure that the We've "folded down" the rear panel in this photo to show its contents clearly: from left, the mains input lead, 10A safety fuseholder, the enable switch, the 12V PSU and the four-way switched mains outlet. Note the liberal use of heatshrink sleeving. siliconchip.com.au Celebrating 30 Years June 2018  73 Projects with SIZZLE! Two high-voltage projects which use the same PCB: High Energy Electronic Ignition for Cars Jacob's Ladder Published in Nov/Dec 2012 (siliconchip.com.au project/ignition) Special components for both Published in projects are available from Nov/Dec 2013 (siliconchip.com.au/ the SILICON CHIP On-Line Shop: project/jacobs) PCB, programmed PIC, IGBT Look for details of all projects at siliconchip.com.au/articles/contentssearch screws holding the terminals onto the batteries are all very tight, along with the inverter input terminals. All the battery terminal connections need to be done up tight or they could overheat when the unit is operating due to a high resistance. Mains wiring You need two mains leads with moulded plugs. These are for the incoming mains connection and the output of the inverter. They can be cut from spare equipment power cables or purchased separately. The incoming mains lead should be at least one metre long, as this will need to reach a nearby GPO. The mains cord needs to be held securely with the cable gland so it cannot be pulled out. Additionally, the securing nut on the gland should be locked using super glue around the thread before tightening to prevent its being easily removed. The inverter lead should be around 50cm long and does not exit the case. Note that all the wires used for Active, Neutral and Earth should either be stripped from mains cords or mains flex or be rated for a minimum of 250VAC at 10A or more. They must be colour coded correctly: brown for Active, blue for Neutral and yellow/green striped for Earth. The correct colours are shown in Fig.4. The three relays (left to right) are for mains switching (RLY1), output changeover (RLY2) and inverter switching (RLY3). This keeps the wiring as short and neat as possible. The wiring from each relay to the incoming mains, inverter and output GPOs all attaches to the relay bases close to the rear panel. 74 Silicon Chip The connections on the other side are between adjacent relays only and as you can see from the photos and diagrams, are fairly simple. Keep these wires short (around 10cm) and cable tie them together once they have been finalised. Make sure to do the screw terminals up nice and tight so they won’t come loose. These short wires can be stripped out of the off-cuts from the lead used to connect to the inverter. Start by making these four short connections. Expose a minimal amount of copper at the end of each wire (about 5mm) and be careful to avoid nicking the conductors when stripping the wires. Earth connections Now do the Earth wiring. Take one of the pieces of yellow/green striped wire you stripped out of the mains cable and cut it so that it will reach from the rear panel Earth bolt to the bottom panel Earth bolt. Strip both ends and crimp 4mm eyelets onto each. You will also need an intact 40cm length of mains flex (which you may be able to make from the left-over length of mains cable). Strip back 5cm of outer insulation from each end and 5-10mm from each of the inner conductors. Crimp a 4mm eyelet onto the Earth wire at one end. Then strip 5cm of the outer insulation from the end of the mains input cable and 5-10mm from the inner conductors and after feeding it through the cable gland on the rear panel, crimp a 4mm eyelet onto the Earth wire. Do exactly the same with the inverter output cable. All four Earth eyelets can now be attached to the rear panel Earth bolt (M4 x 10mm) with a shakeproof washer between each and an M4 hex nut on top. Do this up nice and tight. The other end of the wire with the second eyelet connector is then attached to the bottom of the case using a similar arrangement. By the way, it would be perfectly valid to connect all the mains Earth wires together at the case bottom Earth bolt rather than the rear panel, as long as the rear panel is still Earthed to the base separately (since it can be detached when working on the unit). We simply used the rear panel because it kept the wiring neater. Celebrating 30 Years Relay coil wiring While not mains wiring, it’s easiest to wire up the relay coil terminals before we complete the rest of the mains wiring. Use two short lengths of red light-duty hookup wire to join the three relay coil positive terminals, as shown in Fig.5. Then cut four 1m-long lengths of light-duty hookup wire: red, orange, yellow and white. Connect them to the coil terminals at one end and the Arduino relay driver outputs as shown in the diagram. Remaining mains wiring The Active and Neutral wires of the length of mains flex can now be terminated to the two spare terminals on the back of the middle relay – see Fig.4 for details. Similarly, the Active and Neutral wires of the inverter output cable go to the terminals on the back of the relay closest to the corner of the case, and the plug on this cable can then go into one of the inverter outputs. Before fitting the fuse holder into the case, solder a short length of brown wire to the terminal closest to the threading. Mount it in the rear panel and slip a long piece of 20mm diameter heatshrink tubing over the incoming mains cable. Next, solder the brown wire in that mains cable to the remaining fuse holder terminal (the one near the end). Now move the heatshrink tubing up over the body of the fuse holder so that it covers both solder joints and shrink it in place. We can then connect the Active and Neutral wiring for the third relay, closest to the transformer. There are three wires to go into each of these terminals: one from the incoming mains lead (or fuse holder, in the case of Active), one for the battery charger and one for the small mains transformer that’s mounted next to the relay. Cut the charger cable to 30cm, retaining the moulded figure-8 plug on one end. Strip the outer insulation back by 5cm and then strip around 5mm of the insulation from each of the inner conductors. The transformer wires should be supplied already stripped and the incoming mains lead should have been prepared earlier. So now it’s just a matter of feeding the sets of three wires into each terminal, careful to avoid any stray strands of copper sticking out, then do them up nice and tight. siliconchip.com.au The other end of the 40cm length of mains flex you cut earlier goes to the terminals on the four-outlet GPO. The Active, Neutral and Earth connections for the switchmode power supply units are attached to these same terminals. Before making these connections though, cut a short (~5cm) length of brown wire, strip it at both ends and crimp a 6.3mm spade connector onto one end. This plugs into one of the rocker switch terminals, with the other end terminated to the Active input of the switchmode PSU. Now cut 20cm lengths of blue, brown and yellow/green mains-rated wire and strip the ends, then attach these to the relevant switchmode PSU terminals, except for the brown wire. Crimp another 6.3mm spade connector to one end and plug this into the free terminal on the rocker switch. You can now feed the other ends of these three wires into the GPO terminals, along with the wires from the central relay. Do this one terminal at a time, making sure you don’t get them mixed up (follow the labels printed on the GPO terminals) and do them up firmly. A quick test Now it’s time for a quick test. Insulate the transformer secondary wires and leave the relays out of their sockets, then stand clear of the unit and plug it into a wall socket. The battery charger should start up and you should be able to see the battery voltage rising using a DMM connected between the 0V and 24V terminals on the shield board. You should also be able to measure around 13-14VAC across the transformer secondaries. The inverter can be tested by holding the power button next to its mains output socket for a second or so (without touching any of the other components). You can plug a lamp or other test load into the spare output socket to see that it’s working properly. Shut the inverter down by pushing the power button again. After ensuring the UPS not plugged into mains and the inverter is off, tidy up the mains wiring. Wherever two or more wires are terminated next to each other, cable tie them tightly together to provide a degree of security should one of them come loose. Where the cables run next to each other, bundle them together. Your wiring should look like that in our photos. siliconchip.com.au Running the control wires Now we can finish the control wiring shown in Fig.5. To connect the inverter to the Arduino, simply plug the telephone-style cable supplied with the inverter into the socket on the UPS shield and the other end into the inverter. Bundle the excess cable up with a cable tie and tuck it out of the way. Use three 50cm lengths of light-duty hookup wire, two yellow and one white, to extend the secondary wires on the small mains transformer. Shrink short lengths of small diameter heatshrink tubing over the joins and terminate the wires into the three-way screw terminal on the control shield, with the white centre tap wire to the middle terminal. Next, cut 70cm lengths of red and black medium-duty hookup wire and connect them to the DC outputs of the mains switchmode power supply mounted on the rear panel. Route these to the Arduino and connect them to the DC input terminals on the relay driver shield. Make sure the red wire goes to the +12V output and 5-24V DC input connections. All the wires that run from the back to the front of the UPS are now in place, so take this opportunity to tidy them up using some self-adhesive cable clamps, P-clamps and a generous number of cable ties. If any of the cables are too long, bundle them up using cable ties so they won’t move. The remaining eight wires connect the 12V LED indicators and pushbutton on the front panel to the relay shield and UPS shield. The button wires are not polarised but the LED wires are. Connect these up as shown. Solder the wires to the LEDs and button terminals and cover the joints with heatshrink tubing; clear is best as this allows you to see which wires go to the LED anodes and cathodes. The LEDs may have a small red dot on their positive (anode) terminal. When finished, cable tie the bundle of eight wires together and strap it down. The wiring is now complete, go back over your work and closely compare it to our diagrams and photos to make sure everything is as it should be. SC In the third and final article on our UPS next month, we will test the completed UPS and explain how to interface it with a computer. Celebrating 30 Years June 2018  75