Silicon ChipMulti-Stage Buck/Boost Charger - October 2022 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: I3C: Coming soon to an IC near you
  4. Feature: Display Technologies, Part 2 by Dr David Maddison
  5. Project: 30V 2A Bench Supply, Part 1 by John Clarke
  6. Feature: New PICs & AVRs from Microchip by Tim Blythman
  7. Project: PIC & AVR Breakout Boards by Tim Blythman
  8. Subscriptions
  9. Feature: Buck/Boost Battery Charging by Tim Blythman
  10. Project: Multi-Stage Buck/Boost Charger by Tim Blythman
  11. Project: Automatic Train Controller by Les Kerr
  12. Serviceman's Log: Fixing feline follies by Dave Thompson
  13. Feature: Mouser Q & A by Nicholas Vinen & Mark Burr-Lonnon
  14. Project: WiFi Programmable DC Load, Part 2 by Richard Palmer
  15. PartShop
  16. Vintage Radio: STC model 510 portable by Associate Professor Graham Parslow
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: History of Op Amps, August 2021; AVO Valve Testers, August 2022; iSoundbar, August 2022
  20. Outer Back Cover

This is only a preview of the October 2022 issue of Silicon Chip.

You can view 44 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:
  • Display Technologies, Part 1 (September 2022)
  • Display Technologies, Part 1 (September 2022)
  • Display Technologies, Part 2 (October 2022)
  • Display Technologies, Part 2 (October 2022)
Items relevant to "30V 2A Bench Supply, Part 1":
  • 30V 2A Bench Supply front panel control PCB [04105222] (AUD $2.50)
  • 30V 2A Bench Supply main PCB [04105221] (AUD $5.00)
  • INA282AIDR shunt monitor IC and 20mΩ 1W shunt resistor for 30V 2A Bench Supply (Component, AUD $10.00)
  • 30V 2A Bench Supply PCB patterns (PDF download) [04105221/2] (Free)
  • 30V 2A Bench Supply front panel artwork (PDF download) (Free)
Articles in this series:
  • 30V 2A Bench Supply, Part 1 (October 2022)
  • 30V 2A Bench Supply, Part 1 (October 2022)
  • 30V 2A Bench Supply, Part 2 (November 2022)
  • 30V 2A Bench Supply, Part 2 (November 2022)
Items relevant to "PIC & AVR Breakout Boards":
  • PIC16F18xxx DIP Breakout PCB [24110222] (AUD $2.50)
  • PIC16F18xxx SOIC Breakout PCB [24110225] (AUD $2.50)
  • AVRxxDD32 TQFP Breakout PCB [24110223] (AUD $2.50)
  • PIC & AVR Breakout Board PCB patterns (PDF download) [24110222,3,5] (Free)
Items relevant to "Buck/Boost Battery Charging":
  • Complete kit for the High Power Buck-Boost LED Driver (Component, AUD $80.00)
Items relevant to "Multi-Stage Buck/Boost Charger":
  • Buck/Boost Charger Adaptor PCB [14108221] (AUD $5.00)
  • PIC16F1459-I/SO programmed for the Buck/Boost Battery Charger Adaptor (1410822A.HEX) (Programmed Microcontroller, AUD $15.00)
  • 1.3-inch blue OLED with 4-pin I²C interface (Component, AUD $15.00)
  • 1.3-inch white OLED with 4-pin I²C interface (Component, AUD $15.00)
  • Complete kit for the Buck/Boost Charger Adaptor (Component, AUD $40.00)
  • Complete kit for the High Power Buck-Boost LED Driver (Component, AUD $80.00)
  • Laser-cut clear acrylic front panel for Buck/Boost Charge Adaptor (PCB, AUD $2.50)
  • Buck/Boost Charger Adaptor software & laser cutting files (1410822A.HEX) (Free)
  • Buck/Boost Charger Adaptor PCB pattern (PDF download) (14108221) (Free)
Items relevant to "Automatic Train Controller":
  • Automatic Train Control PCB [09109221] (AUD $2.50)
  • Chuff Sound PCB [09109222] (AUD $2.50)
  • PIC16F1455-I/P programmed for the Automatic Train Controller (0910922A.HEX) (Programmed Microcontroller, AUD $10.00)
  • PIC12F675-I/P programmed for the Chuff Sound module (0910922C.HEX) (Programmed Microcontroller, AUD $10.00)
  • ISD1820-based voice recording and playback module (Component, AUD $7.50)
  • Firmware for the Automatic Train Controller (0910922A/C.HEX) (Software, Free)
  • Auto Train Control and Chuff Sound Generator PCB patterns (PDF download) [09109221/2] (Free)
Items relevant to "WiFi Programmable DC Load, Part 2":
  • WiFi-Controlled DC Electronic Load main PCB [04108221] (AUD $7.50)
  • WiFi-Controlled DC Electronic Load daughter PCB [04108222] (AUD $5.00)
  • WiFi-Controlled DC Electronic Load control PCB [18104212] (AUD $10.00)
  • 3.5-inch TFT Touchscreen LCD module with SD card socket (Component, AUD $35.00)
  • Laser-cut acrylic fan mounting-side panel for the WiFi DC Electronic Load (PCB, AUD $7.50)
  • WiFi-Controlled DC Electronic Load laser-cut front panel (2mm matte black acrylic) (PCB, AUD $10.00)
  • Software and laser-cutting files for the WiFi DC Electronic Load (Free)
  • WiFi-Controlled DC Electronic Load PCB patterns (PDF download) [04108221/2, 18104212] (Free)
  • Front panel decal and cutting diagrams for the WiFi DC Electronic Load (Panel Artwork, Free)
Articles in this series:
  • WiFi Programmable DC Load, Part 1 (September 2022)
  • WiFi Programmable DC Load, Part 1 (September 2022)
  • WiFi Programmable DC Load, Part 2 (October 2022)
  • WiFi Programmable DC Load, Part 2 (October 2022)

Purchase a printed copy of this issue for $11.50.

Multi-Stage By Tim Blythman Buck-Boost Battery Charger This simple, low-cost add-on turns our Buck-Boost Driver into a fully-featured multi-stage battery charger. It can be used with multiple battery chemistries but is especially useful for lead-acid types. Its features include adjustable absorption and float charge voltages, temperature compensation, a long-term ‘storage’ mode, charge status display and low quiescent current. W hen we presented the BuckBoost LED Driver project (June 2022; siliconchip.au/ Article/15340), we explained that you could also use it to charge batteries from a wide range of DC input voltages. However, in its original form, it only acted as a single-stage battery charger. For proper charging, especially with lead-acid batteries, you want a multi-stage charger and that’s what this simple add-on provides. One beneficial side-effect of its wide input voltage range is that you can use low-cost, high-power laptop chargers (typically delivering around 19V) as the power source. In the article starting on page 54 of this issue, we have quite a bit more information on how This Charger module (shown at actual size) is built from our Buck-Boost LED Driver and a new addon board. This combination turns it into a multistage charger, suitable for lead-acid batteries. 60 Silicon Chip Australia's electronics magazine to use the original Buck/Boost board by itself to charge batteries. But we expect anyone serious about using it in that way to build the add-on described here since it makes it so much more versatile and useful. The Charger Adaptor We call this add-on board the Charger Adaptor (Adaptor for short). Combined with the Buck/Boost Driver, we have a complete battery charging system. With the Adaptor, it can now perform bulk, absorption, float and storage charging. It does this while retaining the original Driver’s wide input voltage range, high efficiency and high current delivery. The Adaptor has a compact OLED screen to report the Charger’s current activity and monitor the battery and power supply status. Along with this screen, three buttons allow the Charger to be configured. The Charger has been conceived mainly for use with 12V and 24V lead-acid type batteries and their various equivalents and substitutes, such as AGM and even lithium types. But, with so many of the Driver and Adaptor parameters being adjustable, it could also be used with other battery types. That’s especially true of the LiFePO4 batteries that are designed to mimic lead-acid types. You can use the original Driver design if all you need is a float charger. siliconchip.com.au You would simply set its output voltage to the float voltage for the battery. For many 12V batteries, such as leadacid types, this is typically around 13.5-13.8V. The current limit can then be set at an appropriate level for the particular arrangement of battery, supply and wiring used. The Driver’s current limiting means that even if a deeply discharged battery is connected, it can be safely charged up to its float level without damaging the battery, overloading the supply or damaging the wiring. But float charging alone will not make the best use of a battery’s capacity, nor is it the quickest way to charge. Bulk charging applies a higher current (and higher voltage) to the battery to quickly raise the battery’s charge to near 80% of its capacity. Absorption charging follows. This involves applying a voltage above the float voltage to bring the battery up to around 95% of its capacity. After these stages, it will revert to float charging to maintain the charge level near its maximum. To enable bulk and absorption charging, we need to be able to increase the Driver’s output voltage. We should also monitor the battery current and voltage to know the battery condition. Ideally, a battery charger can monitor the battery temperature and adjust its output voltage to provide the optimum voltage levels for a given temperature. Cell voltages vary with temperature, so if you use a fixed charging voltage under varying ambient conditions, you can end up under-charging or over-charging the battery. The Charger solves this by monitoring the battery temperature with an NTC thermistor and calculating the appropriate charge voltage based on a user-specified temperature coefficient. The Charger is highly configurable. The default settings are functional, if not optimal, for 12V lead-acid type batteries, providing the current limit setting is appropriate. Note, though, that it is possible to program settings that may cause damage if you aren’t familiar with how multi-stage battery chargers work. And because the current limit on the Driver cannot be set any lower than around 1.8A, it is not practical to use with small batteries that cannot handle this rate of charge. Sealed lead-acid types of around 7Ah (such as the type commonly sold siliconchip.com.au The complete Charger assembly is a compact stack of modules. It’s intended to be fitted inside a cabinet, but the front acrylic cover panel could also be used as a mounting bezel to allow the display to be seen from outside, or it can be used as a standalone assembly. Features & Specifications ∎ Input: 11.3V to 35V DC at up to 10A ∎ Output: from 7V to 34V DC ∎ Charge current: up to 8A (extra heatsinking may be needed over 5A) ∎ Suitable for most 12V and 24V batteries ∎ Can perform bulk, absorption, float and storage charging ∎ Charging currents, voltages and times can be adjusted ∎ Compact OLED display for configuration and complete battery status ∎ Onboard pushbuttons for configuration and setting ∎ Battery voltage temperature compensation ∎ 10mA typical quiescent current, down to 1mA with power supply off as NBN backup batteries) are about the smallest we suggest charging with this device. These typically specify a maximum charge current of around 2A. The default bulk charge values (such as time and start voltage) also assume a battery no smaller than that. Charger Adaptor details The Charger Adaptor connects to the Buck/Boost LED Driver at four of its existing test points. While we didn’t originally envision this use, they’re the perfect place to interface another circuit. Fig.1 shows the circuit of the Adaptor and how it connects to the Driver. The Adaptor is based around IC3, a PIC16F1459 microcontroller. Australia's electronics magazine We’ve numbered the various components across the two boards as though they are one circuit, so there should be no confusion about which part is being discussed. Output terminal CON2 on the Driver board connects (by high-current wiring) to CON3 on the Adaptor, with the battery connected to the Adaptor’s CON4. This is so we can insert high-current schottky diode D6 in the charging path to prevent the battery from discharging into the Driver when the power supply is off. It also allows us to monitor the charger output voltage and battery voltage independently. The Driver’s CON1 input terminals October 2022  61 Fig.1: there isn’t much to the Adaptor circuit as it is mostly just components to connect the added microcontroller, IC3, to various points on the Driver board for monitoring and control. The microcontroller modifies the Driver’s output voltage by biasing its feedback pin via TP7. You can find the matching Driver circuit diagram on page 55. are used as the incoming supply connection, just as in any other Driver application. The four test points we connect to on the Buck/Boost board TP2, TP3, TP5 and TP7; they are numbered identically on both boards and connect directly through low-current pin headers. The input supply of the Buck/ Boost board is available at TP2, and this feeds into a 100kW/10kW divider to ground, allowing the analog-to-­ digital (ADC) peripheral of IC3 (via analog input AN6, pin 14) to monitor the input voltage. A similar divider monitors the output voltage at CON3 connected to the Driver output, while a 1MW/100kW divider is used to sense the battery voltage at CON4. 62 Silicon Chip The relatively high value of those two resistors reduces the current drawn from the battery while charging power is unavailable. A 10kW NTC (negative temperature coefficient) thermistor is connected across CON5, forming the top half of a voltage divider with a 10kW fixed resistor. The thermistor is placed in contact with the battery under charge to allow its temperature to be monitored. TP5 is connected to a similar 33kW/10kW divider so the micro can monitor the charging current. All five dividers include 100nF capacitors across their lower resistors to reduce noise and provide a low input impedance to the ADC. They connect to pins 7, 9, 12, 13 & 14 of IC3. With a 3.3V rail and reference, and Australia's electronics magazine 10:1 dividers, IC3 can measure voltages up to 36.3V with a resolution of around 0.03V. Current measurement is limited by the voltage output by the Driver and can thus be measured up to the full capacity of the Driver. The remaining connection from the Adaptor to the Driver is at TP7, which is connected to the feedback comparator inside IC1 on the Driver PCB and usually sits at 1.23V. If this rises, the Driver will decrease the output voltage. Conversely, a voltage reduction will cause the output voltage to rise. So we can modify the set output voltage by sourcing or sinking current via TP7. The pair of RCR networks attached to TP7 do just that. PWM (pulse width modulated) waveforms from pins 5 siliconchip.com.au and 8 of IC3 are smoothed by the first resistor of each pair and its associated 1μF capacitor. The second resistor in each network turns that smoothed voltage into a small control current which can raise or lower the Driver’s output voltage. The smoothing is necessary as any ripple will be translated into a corresponding ripple at the Driver’s output. The two RCR networks are used for different purposes. The network with the two 10kW resistors is used to apply the minor temperature compensation adjustments. The network with the two 4.7kW resistors can sink or source more current and thus make a larger adjustment. This is used to set the bulk and absorption voltages. With a 3.3V supply, a 37% duty cycle will result in around 1.23V and not cause any change in the Driver output. A fixed low signal or 0% duty cycle (which gives 0V at the input to the RCR network) will cause the Driver output voltage to rise about 15%. Note that the change is proportional to the output voltage because the fixed 1.23V comes from the variable divider on the Driver board (including VR1 etc). While we could have used one RCR network and PWM peripheral, the firmware is slightly simplified by keeping them separate. So microcontroller IC3 on the Adaptor board can monitor the various voltages on the Driver and adjust its output voltage to provide several different charge modes. One of the interesting quirks of the Driver design is that the actual current and voltage setpoints (as set by the trimpots on the Driver) are not known to the Adaptor board. This means that some parameters are set as proportions of other values. Monochrome I2C OLED module MOD1 is connected to pins 6 and 11 of IC3 as well as the 3.3V supply rail and ground. IC3 uses a bit-banged I2C interface to control MOD1. Tactile pushbuttons S1, S2 and S3 connect between ground and pins 2, 3 and 10 of IC3. The OLED, MOD1 and these three buttons provide the user interface for the Adaptor. supply current flows through common-­ cathode dual diode D7 and a 220W resistor to REG1, a 3.3V regulator which provides power to PIC16F1459 microcontroller IC3, which provides all the multi-stage charging functions. REG1 has been chosen for its wide input range and low quiescent current. The 220W resistor gives the regulator more headroom to operate at high input voltages by sharing some dissipation with REG1. A pair of 1μF ceramic capacitors provide input and output bypassing for REG1. D7 is fed at its second anode from the battery positive at CON4, so the Adaptor is still powered even if its primary power supply is absent. Thus, IC3 can remember the charging state even when the incoming supply is off. Microcontroller IC3 has a 100nF bypass capacitor between its 3.3V supply (pin 1) and ground (pin 20), while pin 4 (MCLR) is pulled up by a 10kW resistor to the 3.3V rail to prevent spurious resets. The usual in-circuit programming pins (1, 4, 15, 16 & 20) are brought out to optional ICSP programming header CON6, so IC3 can be programmed in-circuit if necessary. Powering the Charger For a couple of reasons, we recommend that the input voltage to the Charger via CON1 is higher than the typical battery voltage if possible. The first reason is that the Driver is more efficient when reducing the voltage in its ‘buck’ or step-down mode. The second is that the Adaptor PCB will draw power from whichever anode of D7 is at a higher voltage. If the output fuse F2 on the Driver blows and the supply is lower than the battery, the battery will slowly drain. Neither of these are critical, but we thought they would be worth mentioning so you can get the most out of the Charger. Firmware control The operation of the Adaptor and thus the Charger is controlled by microcontroller IC3. The default mode is equivalent to the float mode that is available with an unmodified Driver, as no adjustment is made to the output voltage. The three voltages (input, outage & battery), the output current and thermistor temperature are displayed on the screen. It’s assumed that the Driver output current is flowing out of CON2, into CON3 and then to the battery at CON4. Up to 10mA is actually used to power the Adaptor, but that is a small enough amount to be ignored. If you have anything else that can draw current from CON2 (or further downstream), you will have to take that into account, especially when setting the bulk charge current cutoff. Excess current drain may prevent the bulk stage from ending correctly. Single pin headers on the Driver PCB connect to the header sockets on the Adaptor PCB. The simplest way to do this is to slide the sockets onto the headers and then locate the Adaptor PCB using the mounting hardware. Adaptor power supply Power for the Adaptor is primarily taken from TP2 and TP3, which are connected to CON1 input via fuse F1 on the Driver. The Adaptor’s siliconchip.com.au Australia's electronics magazine 63 When the Adaptor detects that the supply is absent, it goes into a lower-­ power mode and blanks the OLED, reducing the current draw to around 1mA. This is necessary because the Adaptor will be running from the battery at these times. The supply could be absent for many reasons, depending on how the Charger is powered, and it is expected to be a relatively regular occurrence. The Adaptor may also display “PWR FAULT”, meaning that the supply has been detected, but there is no output from the Driver. This would typically indicate a problem with the Driver, such as a blown fuse. This situation requires attention, as the Charger will not be able to charge a battery until the Driver can provide an output. The temperature at the NTC thermistor is monitored by measuring the voltage at its divider junction and mapping that to temperature via a table. If the thermistor has an open-circuit or short-circuit fault, that is detected and displayed. If there is no fault, then the temperature compensation is applied in proportion to a coefficient set by the user. This is one of the parameters that is set as a proportion, and we’ll discuss the particulars of this during setup and testing. Multi-stage charging A typical multi-stage charger will have bulk, absorption and float modes. In bulk mode, current is supplied to the battery up to a set current limit and up to a set voltage (higher than the float voltage). When this voltage is reached and the current begins to fall off, such a charger will switch to a voltage-­limited absorption mode. The current tapers off until the Charger considers that the absorption mode is complete, after which the lower fixed float voltage is applied. The Charger works much like this, although the distinction between bulk and absorption is not that important. We call this the combined bulk/ absorption stage or just bulk for Parts List – Buck/Boost Charger Adaptor 1 assembled Buck-Boost LED Driver Module [June 2022; kit Cat SC6292] 1 double-sided PCB coded 14108221 measuring 75mm x 80mm 2 2-way barrier terminals, 8.25mm pitch (CON3, CON4) 1 lug-mount 10kW NTC thermistor on cable with two-pin 2.54mm XH plug 1 2-way JST XH 2.54mm header (CON5) 1 5-way right-angle male header (CON6; optional, for ICSP) 1 1.3-inch OLED with 4-pin I2C interface (MOD1) 1 4-way header socket (for MOD1) 4 single pin header sockets (TP2, TP3, TP5, TP7) 4 single header pins (TP2, TP3, TP5, TP7) 2 2-pin 6×3mm SMD tactile switches with black actuators (S1, S2) 1 2-pin 6×3mm SMD tactile switch with red actuator (S3) 4 5-6mm panhead M3 machine screws 4 15-16mm panhead M3 machine screws 4 10mm-long M3-tapped Nylon spacers 4 15mm-long M3-tapped Nylon spacers 1 75 × 80mm laser-cut clear acrylic cover plate [Cat SC6567] 1 8mm-long panhead M3 machine screw (for D6) 1 M3 shakeproof washer (for D6) SC6512 Kit ($40) 1 M3 hex nut (for D6) Includes everything except 2 5cm lengths of 10A wire (for CON2-CON3) the Driver Module Semiconductors 1 PIC16F1459-I/SO micro programmed with 1410822A.HEX, SOIC-20 (IC3) 1 AP7381-33V-A 3.3V linear regulator, TO-92 (REG1) 1 MBR20100CT 20A 100V dual schottky diode, TO220 (D6) 1 BAT54C dual common-cathode SMD schottky diode, SOT-23 (D7) Capacitors (all SMD M3216/1206-size multi-layer ceramic) 4 1μF 50V X7R 6 100nF 50V X7R Resistors (all SMD M3216/1206-size 1/8W 1%) 1 1MW 3 100kW 1 33kW 7 10kW 2 4.7kW 1 220W 64 Silicon Chip Australia's electronics magazine brevity. The Driver is set to supply the float voltage by default, but during the bulk/absorption stage, the Adaptor increases the output voltage by sinking a small current from TP7. The bulk/absorption stage is started when the battery voltage falls below a given setpoint. This setpoint is chosen with the assumption that, at this voltage, the battery is pretty flat and can take a substantial charge. You can also trigger the bulk/absorption stage manually. When the Driver’s current limiting dominates, this is the bulk phase. After a while, as the battery voltage rises, the current will begin to taper off, equivalent to the absorption stage. The Adaptor has a current setpoint, below which it assumes that the bulk and absorption stages have completed. Then, the float settings are reinstated and the output voltage drops. A timer also limits the maximum time in bulk/absorption stages (recommended by many battery manufacturers). There is also a ‘storage’ stage, intended for batteries that are left continuously on float charge. In storage mode, the Adaptor reduces the Driver’s output voltage below the float voltage. Periodically (once a week), it will start a bulk charge to ‘equalise’ the battery. That’s assuming there isn’t a load on the battery, which will trigger the Charger before then. This is the best strategy for getting a long life from a ‘standby’ lead-acid battery. Keeping a battery under float charge for extended periods can damage it. This state’s commencement and ending are simply controlled by timers and can also be disabled by setting the starting timer to zero. Although not as critical as bulk/absorption charging, the amount by which the voltage is decreased in storage mode is adjustable. The OLED and buttons allow various parameters to be set and configured. As you can see from the photos, holes in the Adaptor PCB give access to the current and voltage trimpots on the Driver PCB so that all settings can be changed in the assembled state. We’ll delve deeper into the configuration options after the assembly steps. The default software settings are pretty conservative and should be functional (if not optimal) for most common lead-acid battery types. They siliconchip.com.au Fig.2: the Adaptor has a mix of surface-mounting and through-hole parts and should be straightforward to assemble. If you take care to orientate IC3 correctly and don’t mix up the (unmarked) capacitors, you should have no trouble. The four test points are fitted with sockets on the underside to connect to pin headers on the Driver; see the photos for details. depend on appropriate Driver settings to work correctly. Construction The Adaptor is fairly self-contained, but won’t do anything useful without the Driver, so we’ll start by assuming that you have a Driver PCB assembled as described in the June 2022 issue (siliconchip.au/Article/15340). We can supply a complete kit for the Driver (Cat SC6292) and the Adaptor (SC6512), including the preprogrammed micro. If you haven’t assembled the Driver yet, we don’t have any changes to the original build instructions. However, you could substitute soldered wires for the barrier terminals between CON2 on the Driver and CON3 on the Adaptor. The Adaptor is built on a 75mm × 80mm double-sided PCB coded 14108221. The component locations are shown in Fig.2. Like the Driver, the Adaptor uses many surface-mounting components, so you will need flux paste, tweezers, solder-wicking braid, a fine-tipped iron, a magnifier and preferably a solder fume extractor. Fortunately, the parts are not as tightly packed as on the Driver, so the PCB assembly is straightforward. Start by soldering IC3, the PIC16F1459 microcontroller. Apply flux to the pads and rest the part on siliconchip.com.au the pads, being sure to align the pin 1 markings. Tack one pin in place and check that the pins remain aligned before soldering the rest of the pins. Use solder wick to remove any bridges and apply extra flux if needed. The SOT-23 diode, D7, is the other part with small pins, although once the pins are aligned, it’s easy to solder. Be sure to align the part with the PCB silkscreen and, like the IC, tack one lead and confirm the part is flat and square before soldering the remaining pins. Fit the M3216/1206-size ceramic capacitors next, working through each value in turn. There are two different values that you must not mix up. Follow with the various resistors. There are a few different values; they are marked with codes that indicate their values. Tactile switches S1-S3 are soldered similarly to the other surface-mounting parts. Clean the PCB of any excess flux now using an appropriate solvent. Allow the PCB to dry thoroughly before proceeding. The remaining parts are through-hole types and won’t require extra flux. REG1 is the TO-92 package regulator. Ensure its body lines up with the PCB silkscreen before soldering it. D6 is a TO-220 power diode that is mounted flat against the PCB. Bend the leads around 7mm from the body and slot them into the holes in the PCB. Secure the tab using the 8mm screw, nut and shakeproof washer, being sure The underside of the Adaptor board showing the sockets that connect to the test points. The added wire is because it is a prototype; this has been replaced by a PCB trace in the RevC version. Australia's electronics magazine October 2022  65 not to twist the leads. When you are happy with the location of the diode, solder its leads and trim them. This arrangement is suitable for a few watts of dissipation. If you plan to run the Charger above 5A, you might need to enhance the heatsinking. This could be as simple as clamping a steel or aluminium strip with a 3mm hole drilled in it between the diode and PCB. Take care that it can’t short against any other components. The four-way header for MOD1 is a female type to match the male header on the OLED. When soldering this, check that it is perpendicular to the PCB to allow the OLED to mount neatly. CON3 and CON4 can be fitted next. As noted, you could omit CON3 on the Adaptor PCB and CON2 on the Driver PCB and run heavy-duty wires directly. But we recommend keeping the barrier terminals to retain modularity. These two parts may require extra heat from the iron since they are physically larger and also sit on substantial copper areas of the PCB, so turn up the iron if possible while soldering them. CON5 is a two-way header for the thermistor. We’ve used a simple polarised header on our prototype, but we will supply JST-type headers to match the pre-wired thermistor leads in our kits. They are 2.54mm pitch headers, so they will fit the same pads. The thermistor is not polarised, so the orientation is not important. Finally, if you need to program your microcontroller (which won’t be necessary if you have bought our kit), fit a right-angled ICSP header at CON6. Programming If your microcontroller is already programmed, skip to the next section. You can use a PICkit 3, PICkit 4 or Snap programmer to program the PIC16F1459. You should set the PICkit to provide a 3.3V supply as this is what the circuit has been designed to use. Otherwise, apply 10-35V between TP2 (positive) and TP3 (negative) to power the micro via the regulator. Connect your programmer as indicated by the arrow marks and upload the 1410822A.HEX file using the MPLAB X IPE. Note that the grounds at CON3 and CON4 are not connected to the circuit ground at TP3 and the ICSP header, so you can’t use them for a programming ground connection. This arrangement prevents unexpected currents from flowing through the Adaptor’s digital ground circuit. Disconnect power before the next step. Testing Connect the thermistor and plug the OLED module into the header, then apply 10-35V DC via TP2 (positive) and TP3 (negative). The OLED screen should start after a second or so, showing a roughly correct supply voltage. The temperature reading should be sensible. If T_ERR is displayed, there may be a circuit problem, or an incorrect thermistor has been used. If the displayed supply voltage is way off (say, by more than 10%), you may have mixed component values in the dividers. Now is the time to fix any problems, before the Adaptor is let loose and connected to the Driver. Mechanical assembly This more clearly shows the connection arrangement between the Adaptor PCB and the Driver PCB. 66 Silicon Chip It’s best to temporarily detach the OLED while assembling the boards. They can be quite fragile as they are made of thin glass. To help align all the parts, start by fitting four 10mm spacers to the underside of the Driver in the extreme corners and attach them using short M3 screws. These will act as feet. Remove any other spacers under the Driver to allow the Adaptor to be fitted above. Use four 15mm machine screws to secure four 10mm tapped spacers facing up from the Driver PCB that correspond to the ‘corner’ mounting holes Australia's electronics magazine on the Adaptor. This will allow the Adaptor PCB to rest above the Driver. Now solder the four single header pins to TP2, TP3, TP5 and TP7 so they face out of the top of the Driver PCB. We’ll do these male headers first as they are much easier to install squarely. Slot the single pin sockets onto those newly soldered pins. It’s expected that they don’t push all the way down. Rest the Adaptor PCB over the screws and pins and ensure that the pins come out through the test points on the Adaptor PCB, then solder the sockets to the Adaptor PCB. If you need to separate the two PCBs, do so with care and also be sure to align the headers when reconnecting to avoid bending them. Now run two short lengths of 10A-rated wire between CON2 on the Driver PCB and CON3 on the Adaptor PCB, being sure to connect with the correct polarity according to the PCB silkscreen. You can see the colour coding in our photos. Reconnect the OLED module and thermistor and secure the Adaptor PCB with the four 15mm tapped spacers into the exposed upwards-facing threads. The acrylic cover piece is fitted after commissioning and setup. Commissioning & calibration Start by connecting your power supply to CON1, paying attention to the polarity. The OLED should spring to life and display FLOAT mode after a few seconds. To conserve power, it’s only updated about once per second unless one of the buttons is pressed. This is the main status page; you can access the remaining configuration pages by pressing S3 to cycle through. It’s a good idea to leave the main status page active as the other pages will not allow the display to blank when the supply is disconnected. Even though no battery is connected, the diode will cause a voltage to be present at CON4, where the battery voltage is measured. With no battery connected, the current should be close to zero, probably showing 0.01A due to the internal draw of the Adaptor PCB. Press and hold S1 for two seconds until the BULK/ABS mode starts. You should see the voltage increase above its FLOAT value. The BULK/ ABS mode should run for ten seconds until it detects that no current is siliconchip.com.au Table 1: Charger settings pages Title Function Notes BATTERY V Battery voltage (CON4) calibration constant SUPPLY V Supply voltage (CON1) calibration constant These pages also display the calculated voltage/current based on the calibration constant. These are best adjusted by using S1/S2 to adjust the constant while comparing the calculated value to a multimeter reading until the two match. OUTPUT V Output voltage (CON3) calibration constant OUTPUT I Driver current (from CON2 to CON3) calibration constant LOW V BAT Low battery voltage error threshold LOW V SUP Low supply voltage error threshold LOW V OUT Low output voltage error threshold 11.0V BULK START Voltage below which bulk charging is triggered These parameters determine the operation of the bulk and absorption modes. A timer also determines the maximum time that bulk charging will operate (see The current below which bulk below). charging stops 12.0V BULK BOOST The amount by which the output voltage is increased (above float voltage) in bulk mode 4% STORE DROP The amount by which the output voltage is decreased in storage mode The 4.5% value is based on a per-cell reduction from 2.3V to 2.2V. Higher values up to 10% may completely stop charging. 4.5% BULK TIME The maximum time that bulk charging runs for Assuming the bulk current limit has not been reached, bulk charging will run for this period (in hours and minutes). If bulk charging is interrupted by a low supply voltage, the remaining bulk time will slowly ramp back up to this limit until bulk charging recommences. 2:00 hours (HH:MM) STORE TIME The time for which storage charging occurs Apart from pressing S2 on the main page or a low voltage error, this timer expiring is the only condition that will end storage charging. 144:00 hours (<1 week) STORE DELAY The time between consecutive storage charges This timer is reset when float charging begins and counts down as long as no error or other state change occurs. If this is set to zero, no storage charging occurs. 0:00 hours (off) TEMP COEFF Battery voltage temperature coefficient It’s recommended that the battery float charge be modified at different temperatures. This parameter sets the change from nominal at 25°C. 0%/°C Use Edits Either load or discard the edited settings values Changes made to parameters do not affect charging until you press S1 on this screen. Pressing S2 instead discards the changes and reverts to the previous settings. Save Flash Save current setting to flash memory Pressing S1 will save the current values in use to flash memory so that they will be loaded at power-up. BULK END siliconchip.com.au Defaults Note that you will need a reasonable load (eg, a flat battery) to calibrate the current, and you should adjust for the Adaptor using around 10mA internally. If any voltage is measured below its LOW threshold, the Charger enters an alarm state and stops all bulk, absorption and storage charging. An error is displayed on the main page. Australia's electronics magazine 11.0V 11.0V 0.5A October 2022  67 Screen 1: when everything is operating normally, you should see this screen. The Adaptor is not modifying the output voltage and based on the current displayed, the battery is floating in a fully charged state. The dashes at lower right indicate that Storage mode is disabled. Screen 2: during Bulk charging, the Adaptor increases the output voltage. In this case, the Driver has current limiting active, which results in a lower output voltage than in Screen 1. The timer at lower right indicates the maximum remaining Bulk charging time. Screen 3: the output voltage is reduced below the Float voltage in Storage mode, and minimal current will flow into the battery, just enough to stop it from discharging. Either Bulk or Storage modes can be cancelled by pressing S2. flowing due to no battery being present. You can stop BULK/ABS charging anytime by pressing the S2 button on the main page; this will also end storage charging. The default temperature coefficient is zero, so you will need to change the value to test this feature. A negative value means that an increase in temperature will cause a decrease in voltage, and the change will be quite small. There are four calibration parameters that can be adjusted if necessary, although the defaults should be functional. Press S3 to cycle through the configuration pages. The first four are to set calibration constants, while the next 12 set various operating parameters. Two further pages are used to activate and save the various settings. Table 1 summarises the configuration pages. The four calibration constants are displayed alongside their calculated values. This means they can be calibrated using a multimeter to measure the actual value. The calibration constant is then adjusted until the multimeter value matches the displayed value. These constants are simple multipliers, so increasing the constant will increase the calculated value. If calibrating the current in this way, you will need to ensure there is a load on the Driver so that the proportions are meaningful. Adjust these as needed, then cycle through to the “Use Edits” page and press S1; the “Loaded” message should appear. Then press S3 once more and press S1 again to save the settings to flash memory; you should see the message “Saved”. is probably not a suitable setting for the Charger. Remember also that the current will creep higher at lower output voltages. Refer to the Driver article for details or run some tests with a deeply discharged battery to check this. You can also adjust this later. A good time will be when a flat battery is first connected to the Charger, as this is a typical maximum load condition. The other Adaptor settings will be fine for a typical lead-acid 12V battery but will need to be changed for a 24V battery. For example, change the low-voltage alarms if using a 24V battery. In general, the Low Battery, Low Output and Bulk Start voltages should be altered to suit a 24V battery by doubling them. The Wikipedia article on IUoU charging (which is the DIN designated name for this type of charging) has several suggested settings. See https://w. wiki/5SR9 Leave it to the Deutsches Institut für Normung to come up with such a catchy name for this charging scheme – Editor Table 2 also has some suggested Voltage and current settings Dial in your desired Float voltage using the voltage trimpot on the Driver. Diode D6 will drop some voltage, even at low currents, so you’ll want to tweak this later. Setting the voltage 0.3V higher is a safe starting point and can be adjusted later when a battery is connected. Adjust the current to your desired maximum using the trimpot on the Driver. Remember that the minimum is around 2A, and the maximum is around 8A, at the ¾ position of the trimpot. Anything above the ¾ position will disable current limiting and Table 2: suggested settings (check manufacturer’s recommendations) Battery Type SLA 12V AGM / Flooded lead-acid 12V LiFePO4 12V SLA 24V AGM / Flooded lead-acid 24V LiFePO4 24V Float voltage (Driver trimpot) 13.5V 13.8V 12.6V 27.0V 27.6V 25.2V LOW V BAT/ OUT 11.0V 11.0V 11.0V 22.0V 22.0V 22.0V BULK START 12.0V 12.0V 12.0V 24.0V 24.0V 24.0V BULK BOOST 4% 4% 10% 4% 4% 10% TEMP COEFF -0.17%/°C -0.14%/°C 0%/°C -0.17%/°C -0.14%/°C 0%/°C 68 Silicon Chip Australia's electronics magazine siliconchip.com.au Screen 4: you will see this screen if the power supply is off or disconnected. The output voltage is low and the displayed current is 0.00A. The counter at lower right counts down until the screen blanks; you can reactivate it by pressing any button. Screen 5: the calibration constants for the three voltages and the current value displayed on the main screen can be adjusted on these pages by simply using the S1 and S2 buttons. The newly calculated value is displayed and can be easily compared to a reading from a multimeter. Screen 6: several voltage thresholds can be set. There are three alarm thresholds and a Bulk charging start threshold. Each press of S1 or S2 changes the value by 0.1V, or you can hold the buttons to speed through the values. values for specific parameters related to the Charger. As we mentioned, we’ve picked some pretty conservative values to start with. You may need to switch to more aggressive values if your batteries will see heavy use. The storage mode is disabled by default but should be enabled for batteries that see infrequent use. The bulk/absorption time will depend on the current and battery capacity. Keep in mind that these phases can contribute up to 80-90% of the total charge delivered. This depends on the bulk/absorption start voltage; the 80% figure for bulk charging only applies to a very flat battery. The temperature coefficient does not need changing when switching between 12V and 24V batteries as it is a proportion of the charge voltage. The default value is zero, which means no correction occurs. That’s ideal for LiFePO4 batteries, but you should set it to the manufacturer’s suggested value for lead-acid batteries to ensure proper charge termination. Typical values around 0.15%/°C correspond to 3.6mV/°C per 2.4V cell, and you can also see suggested values in Table 2. In float, bulk/absorption and storage modes, a timer is shown in the bottom right-hand corner of the display. This will count down to the following timed state change, to the float state for bulk/ absorption and storage modes. In float mode, the timer counts down to storage mode if it is enabled. If storage mode is disabled, no timer will be seen on the float page. If there is a power-off error, the timer is the number of seconds until the screen blanks to save power. You can press any button to enable the screen again and reset this timer. manually trigger bulk/absorption cycles if necessary. This will allow you to tweak the Driver’s voltage setting trimpot to account for the drop across the diode. If possible, let the battery run down to permit bulk/absorption charging from a flat state. This will allow you to adjust the bulk/absorption boost percentage. Screen 7: the single current threshold is the trigger for ending Bulk charging and is adjusted on this page. This is changed with S1 and S2 in increments of 0.05A (50mA). Screen 8: none of the changes made on the preceding pages are used immediately but can be activated by pressing S1 on this screen. S2 reverts the edited values. The text on this screen will change to indicate when a button has been pressed. siliconchip.com.au Battery charging You can connect the battery now that the float charge settings have been configured. Depending on the settings, bulk charging may start. This is a good time to check that D6’s heatsinking is adequate, as bulk charging is typically the time of highest current draw. Ideally, you should let the battery charge fully. Recall that you can Australia's electronics magazine Conclusion Once the Charger has been set up, the acrylic cover piece can be placed over the spacers and secured with the last four screws. Note that there are holes in the cover piece to allow occasional access to the buttons. If you need to mount the Charger, you can either use the four tapped spacers at the rear, or the four at the front if you have a clear panel or bezel. The Driver is a versatile board that is handy for producing a wide range of voltages at handy current levels. The addition of the Adaptor PCB turns it into a versatile Battery Charger. The Charger is highly configurable and can be used to work with many different SC types of batteries. Screen 9: changes are not automatically saved to flash memory. Pressing S1 on the Save Flash screen stores the active settings to flash memory so that they will be loaded as the defaults on the next power-up. October 2022  69