Silicon ChipArduino-based LC & ESR Meter - August 2023 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: High inflation and price changes
  4. Feature: High-Altitude Aerial Platforms by Dr David Maddison
  5. Subscriptions
  6. Project: The WebMite by Geoff Graham
  7. Project: Watering System Controller by Geoff Graham
  8. Feature: The Electrical Grid by Brandon Speedie
  9. Project: Arduino-based LC & ESR Meter by Steve Matthysen
  10. Feature: RadioFest 2023 by Kevin Poulter
  11. Project: Calibrated Measurement Mic by Phil Prosser
  12. Feature: An interview with DigiKey by Silicon Chip / Tony Ng
  13. Serviceman's Log: Servicing in the Wild West of Central Europe by Dave Thompson
  14. Vintage Radio: Replacing Vibrators, Pt3 by Dr Hugo Holden
  15. PartShop
  16. Market Centre
  17. Advertising Index
  18. Outer Back Cover

This is only a preview of the August 2023 issue of Silicon Chip.

You can view 39 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.

Items relevant to "The WebMite":
  • WebMite firmware, user manual, fonts etc (Software, Free)
Articles in this series:
  • The WebMite (August 2023)
  • Watering System Controller (August 2023)
  • The WebMite (August 2023)
  • Watering System Controller (August 2023)
Items relevant to "Watering System Controller":
  • WebMite firmware, user manual, fonts etc (Software, Free)
  • Watering System Controller PCB [15110231] (AUD $12.50)
  • Watering System Controller firmware and web server files (Software, Free)
  • Watering System Controller PCB pattern (PDF download) [15110231] (Free)
Articles in this series:
  • The WebMite (August 2023)
  • Watering System Controller (August 2023)
  • The WebMite (August 2023)
  • Watering System Controller (August 2023)
Items relevant to "Arduino-based LC & ESR Meter":
  • ESR Meter add-on PCB for Digital LC Meter [04106183] (AUD $5.00)
  • Combined LC/ESR Meter PCB [04106182] (AUD $7.50)
  • 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)
  • Firmware for the Arduino-based LC and ESR Meter (Software, Free)
  • Arduino LC/ESR Meter PCB patterns (PDF download) [04106181/2] (Free)
  • Arduino ESR Meter table and baseplate template (Panel Artwork, Free)
Items relevant to "Calibrated Measurement Mic":
  • Calibrated Measurement Microphone PCB (SMD version) [01108231] (AUD $2.50)
  • Calibrated Measurement Microphone PCB (TH version) [01108232] (AUD $2.50)
  • Short-form kit for the Calibrated Microphone (SMD version) (Component, AUD $22.50)
  • Short-form kit for the Calibrated Microphone (TH version) (Component, AUD $25.00)
  • Simulation and calculation files for the Calibrated Measurement Microphone (Software, Free)
  • Calibrated Measurement Microphone PCB patterns (PDF download) [01108231/2] (Free)
  • Calibrated mic capsule set - Panasonic WM61A lot 4A14 (Component, AUD $12.50)
  • Calibrated mic capsule set - JLI61A lot 3 (Component, AUD $12.50)
  • Calibrated mic capsule set - JLI60A V02 (Component, AUD $12.50)
  • Calibrated mic capsule set - CMC6027 (Component, AUD $12.50)
  • Calibrated mic capsule set - CMC2742 (Component, AUD $12.50)
Articles in this series:
  • Calibrated Measurement Mic (August 2023)
  • Calibrated Measurement Mic (August 2023)
  • Reference MEMS Microphones (April 2024)
  • Reference MEMS Microphones (April 2024)
Articles in this series:
  • Servicing Vibrators, Pt1 (June 2023)
  • Servicing Vibrators, Pt1 (June 2023)
  • Replacing Vibrators, Pt2 (July 2023)
  • Replacing Vibrators, Pt2 (July 2023)
  • Replacing Vibrators, Pt3 (August 2023)
  • Replacing Vibrators, Pt3 (August 2023)

Purchase a printed copy of this issue for $11.50.

Steve Matthysen’s Arduino-Based T LC and ESR METER This enhancement to our Wide-Range Digital LC Meter (June 2018; siliconchip.au/Article/11099) allows it also to measure capacitor ESR. That is extremely useful for diagnosing faulty equipment because increasing ESR over time is one of the most common ways electrolytic capacitors fail. im Blythman presented an LC Meter with excellent performance, range and accuracy in the June 2018 issue. The meter is based on a custom Arduino shield and is easy to build. Its accuracy is optimised by auto-calibration features and compensation for the inherent capacitance of the leads and even the Arduino pins. While it’s undoubtedly useful for checking suspect components, for electrolytic capacitors, it is important to know whether it has a low impedance to alternating currents. That requires it to have a low equivalent series resistance (ESR). The last full ESR meter published in Silicon Chip was the Mk.2 Meter by Bob Parker (March-April 2004 issues; siliconchip.au/Series/99), who created its original design some 27 years ago! The project articles include additional information expanding on the design of capacitors and the importance of measuring their ESR values. I thought it would be worthwhile to incorporate both the LC and ESR functions in a single device. Why is ESR so important? Electrolytic capacitors are used where high charge storage is required. In many applications, current must flow efficiently into and out of the capacitor to charge or discharge it. ESR acts like a resistor in series with the capacitor, losing energy each time current flows in or out. That ESR also prevents the capacitor from doing its job properly, which is usually stabilising voltage. Say the capacitor is being charged at 1A and then starts discharging at 1A. If it has an ESR of 1W, the voltage seen by the rest of the circuit will suddenly shift by 2V ([1A + 1A] × 1W). For example, that would add to the ripple on a power supply storage capacitor. High ESR values also lead to heating within the electrolytic capacitor, possibly changing the capacitance and reducing the integrity of its electrolyte. One of the most common indications of failed or failing electrolytic capacitors is a sudden or gradual increase in their ESR values. Increased ESR values can introduce a wide range of mysterious circuit failures that are sometimes difficult to pin down. For a switch-mode power supply, these include decreased voltage regulation, filter failures, elevated noise levels, signal losses, or failure to start. 54 Silicon Chip Australia's electronics magazine siliconchip.com.au Therefore, it makes sense when testing electrolytic capacitors to confirm that their capacitance and ESR values are in the appropriate ranges. Revised design The March 2004 Mk.2 ESR Meter is based on a Z86E0412 microcontroller driving two seven-segment displays. It (and its predecessor) were extremely popular. In this version, rather than redesign the wheel, we adopted the same frontend circuitry used in the Mk.2 meter, but we feed the signals into an Arduino Uno driving an LCD. The benefit of doing this is that the ESR front end can be built on a relatively small circuit board and integrated with the LC meter presented in the June 2018 issue (siliconchip.au/Article/11099). That makes it a great general-­ purpose instrument that can not only check the ESR of capacitors but also their values (up to a certain limit), plus it can be used to measure inductors and more. Alternatively, you could simply attach the front end to an Arduino Uno (or clone) with a 4-line I2C alphanumeric LCD to produce a standalone ESR meter. The code for both the LC-integrated and standalone versions is available from siliconchip.com.au/ Shop/6/234 Electrolytic capacitor construction In their most basic form, capacitors have two conductive plates (the anode and cathode) separated by an insulating material called the dielectric. There are three main types of electrolytic capacitors based on the material used for the anode and the associated dielectric used in their design: aluminium, niobium oxide and tantalum. Capacitance is directly proportional to the total surface area of the plates but inversely proportional to the distance between the plates. Hence, the thinner the dielectric, the more efficient capacitors become. Dielectrics have a high resistance; for low-value capacitors, examples include various polymers, mica, ceramics and even some liquids and gases, including air. In all three types of electrolytics, the anode consists of the primary material (aluminium, niobium oxide or tantalum) and the dielectric is a very thin layer of the respective oxide (pentoxide for niobium) deposited on the face of the anode. This very thin dielectric must be in close contact with the cathode, which is the electrolyte’s purpose. In essence, the electrolyte is the actual cathode, except that we also require a physical connection that allows the device to be soldered into a circuit. To ensure a high-quality coupling with low resistance, the electrolyte is a highly conductive liquid, gel or solid. In aluminium electrolytic capacitors, an efficient way to ensure a high-quality coupling between the two is to sandwich a thin electrolyte-soaked sheet of paper between the dielectric and the cathode. Manganese dioxide is a solid electrolyte typically used in niobium and tantalum capacitors to connect the cathode to the dielectric. For more details, see our article “All About Capacitors” in the March 2021 issue (siliconchip.au/ Article/14786). If you have already built the LC meter and want to attach the ESR module, you could do that, although starting from scratch is possibly easier. Measuring ESR Fig.1 shows a simplified diagram representing the theory of operation. S1 and S2 are electronic switches Fig.1: S1 repeatedly discharges and then briefly applies current to the DUT. The pulses are too short to charge the capacitor, so the resulting voltage is proportional to the ESR. The pulse amplifier then feeds an amplified version to the comparator, along with a linear ramp, and by counting the number of output pulses, we can accurately determine the ESR. siliconchip.com.au Australia's electronics magazine controlled by the Arduino. When no measurement is underway, both S1 and S2 are in the discharge position to ensure the capacitor being tested and the C-Ramp capacitor are maintained in discharged states. At the start of a measurement cycle, the Arduino code places S2 into the Charge position and charges C-Ramp with a constant current of 9.4mA. The resulting voltage at the inverting input of the comparator increases at a steady rate of 20mV/ms (ie, 20V/s). After 480µs, S1 is switched to the charge position for 20µs, connecting a constant current source to the capacitor being tested. Depending on the range, the applied current is either 0.5mA, 5mA or 50mA. The test current pulse is kept very short to minimise charge build-up on the capacitor plates; we only want to measure the momentary pulse that develops across the capacitor’s equivalent series resistance. Per Ohm’s law, the magnitude of the resulting voltage pulse is directly proportional to the ESR of the capacitor. The test pulse voltage is amplified by a factor of 20 and fed into the non-­inverting input of the comparator. It compares the magnitude of the test pulse to the reference ramp voltage, and if the magnitude of the test pulse is greater than the latter, the comparator produces a 5V pulse at its output. The Arduino code increments a counter August 2023  55 and then waits another 480µs before closing S1 again for 20µs to produce another test pulse. Since the ramp voltage increases at a constant rate, it will eventually exceed the magnitude of the test pulses. The Arduino code detects the missing pulse and stops the measurement process, placing both S1 and S2 in the discharge position. The Arduino uses the total number of pulses and the test current to calculate the ESR figure and displays it on the LCD screen. Circuit details Fig.2 shows the circuit diagram of the original LC meter (on the left) with the ESR add-on on the right. However, note that some extra components are shown on the left, such as mode switch 56 Silicon Chip S1 and ESR input protection diodes D5 & D6. While only one connection is shown passing between them – the added ESR+ terminal connection – there are 10 further connections between the corresponding pins of CON5 and CON6. GND is shared between both sides via pin 8 of those connectors. There are two versions of the PCB. The smaller version that is an add-on to the existing LC Meter design only has the added circuitry on the right (with a few components mounted offboard, such as D5 & D6). The larger version incorporates everything shown in Fig.2 and simplifies the wiring, especially as CON5 & CON6 are not required. The ESR circuit on the right has Australia's electronics magazine three sections: a set of current sources used to pulse the capacitor being tested (upper left), the pulse amplifier (lower left) and the reference voltage ramp generator (upper right). Pulse current sources Transistors Q1, Q2 and Q3 are driven by Arduino Uno digital outputs D12, D11 and D10 when the respective output is pulled low. The Arduino Uno will switch on one of the transistors depending on the measurement range. The 10kW, 1kW & 100W collector resistors set the current pulse to 0.5mA, 5mA or 50mA. There is no current regulation; we rely on the fact that the 5V supply is regulated, and the DUT is initially discharged when the current is applied. siliconchip.com.au Fig.2: the original LC Meter circuit is on the left (with a few additions), while the added ESR-sensing circuitry is on the right. Headers CON5 and CON6 are not present on the combined PCB we’ve designed; instead, the ten connections are run via PCB tracks. Otherwise, a ribbon cable joins all pins between the two connectors. Therefore, close to 5V appears across the selected resistor and the current is determined by Ohm’s law. The current pulse is applied to the capacitor being tested via the parallel 100nF and 47µF capacitors which block any DC components. The ESR of this combination of capacitors is inconsequential, given the relatively high values of the current source resistors. Critically, the measurement is taken directly from the DUT terminal, so the circuit is not measuring the ESR of those two capacitors as well. The 100nF capacitor keeps the impedance low at high frequencies, as required by the nature of the short current pulses. Whenever Q1, Q2 and Q3 are turned off, the Arduino Uno digital output siliconchip.com.au D13 switches Q4 on by supplying current to its base. This ensures that the two AC-coupling capacitors are maintained in a discharged state, ready for the next current pulse. Inverse parallel diodes D1 & D4 protect Q4 from potentially high currents should a charged capacitor be connected to the test leads. The maximum pulse voltage for an ESR value of 100W is typically under 500mV, so D1 and D4 have minimal effect on the pulse voltage. Pulse amplifier The pulse voltage developed across the capacitor being tested is fed to the pulse amplifier via a 33nF capacitor and a 1kW series capacitor. The pulse is amplified by a two-stage transistor Australia's electronics magazine amplifier formed by Q5 and Q6. The ratio of the 6.8kW feedback capacitor to the 150W fixed resistor and VR1 (adjusted for about 200W) sets the gain to 20 (1 + 6.8kW ÷ [150W + 200W]). Diodes D2 and D3 protect Q5 if a charged capacitor is connected to the test leads. The amplified pulse voltage goes to the non-inverting input of the Arduino Uno’s comparator via a 270nF capacitor, which blocks the DC voltage across the 680W resistor at Q6’s collector. This resistor keeps the 270nF capacitor discharged in the absence of a pulse. Voltage ramp generator PNP transistors Q7 and Q9 operate as a current mirror circuit to charge the 470nF ramp capacitor at a constant August 2023  57 rate. When the Arduino pulls pin 4 of CON6 low, Q9 switches on, causing about 9.4µA to flow through the 470kW resistor. At the same time, Q8 switches off, allowing the ramp capacitor to charge. Q7 mirrors the current through Q9, so the capacitor begins to charge from 0V at 9.4µA. The rising voltage across the 470nF capacitor is connected to the Arduino Uno’s internal comparator (inverting input) via pin 1 of CON6. The Arduino Uno disables the ramp generator by setting pin 4 of CON6 high, turning off the charging via C9 while switching on Q8 to discharge the ramp capacitor. Integration with the LC meter The LC meter used the Arduino’s analog comparator inputs (D6 and D7) as digital outputs to drive the coils of relays RLY1 and RLY2. It was necessary to move those functions to D3 and D4 (by modifying the LC Meter code) to allow the ESR function to use the comparator. The larger, combined PCB design includes this rerouting. At the same time, D3 and D4 are shared with the ESR meter as digital I/Os via the selector switch, S1, that chooses between the LC and ESR modes. This was necessary since there were insufficient spare I/Os available on the Uno. As the original LC Meter shield lacks CON5, the wires from CON6 go to the Arduino/switch pins on my prototype. Additional input protection If the ESR meter were accidentally What is a normal ESR value? Electrolytic capacitors include reactive elements, so the ESR value will change depending on the frequency of the applied voltage (there is also an equivalent series inductance or ESL). Temperature changes also affect the reading, as do different manufacturing processes. Manufacturer data sheets typically give the expected ESR values at 20°C and 100Hz, 120Hz or 100kHz, although many do not include such information (or give it differently, eg as a dissipation factor). Thus, providing definitive expected ESR values for all electrolytic capacitors is impossible. Still, we do not expect to see the values exceeding several ohms, and higher-value capacitors should generally have lower ESR values. Capacitors designed for use in switch-mode supplies (often labelled “Low ESR”) should have values of a fraction of an ohm or less. For example, the data sheet for the Panasonic FM-A series of aluminium capacitors gives values from 0.012W to 0.34W ohms varying with the voltage rating (6.3V to 50V) and capacitance (22μF to 6800μF). The data sheet for the RubyCon YXF series for similar capacitance and voltage ranges lists the maximum expected ESR values to be between 0.025W and 1.3W. Table 1 shows the tabulated typical ESR values from the Mk.2 ESR Meter. These are generalised expected readings, so manufacturer data sheets should be used as a reference. However, it should be apparent that a capacitor is faulty if the measured ESR value exceeds tens or even hundreds of ohms! Table 1: typical ESR readings for good capacitors 10V 16V 1μF 35V 63V 160V 250V 5 4 6 10 20 2.2μF 2.5 3 4 9 14 4.7μF 6 3 2 6 5 1.6 1.5 1.7 2 3 6 10μF 58 25V 22μF 3 0.8 2 1 0.8 1.6 3 47μF 1 2 1 1 0.6 1 2 100μF 0.6 0.9 0.5 0.5 0.3 0.5 1 220μF 0.3 0.4 0.4 0.2 0.15 0.25 0.5 470μF 0.15 0.2 0.25 0.1 0.1 0.2 0.3 0.15 1000μF 0.1 0.1 0.1 0.04 0.04 4700μF 0.06 0.05 0.05 0.05 0.05 10mF 0.04 0.03 0.03 0.03 Silicon Chip A version of Table 1 that can be downloaded as a PDF will be available from: siliconchip. com.au/ Shop/11/238 Australia's electronics magazine connected to a charged capacitor, the energy dumped into this circuit could still damage it despite the protections mentioned above. As with the original project published in 2004, we have included two high-current diodes (1N5404s) connected back-to-back directly across the input sockets: D5 and D6. Despite this, remember to discharge capacitors before testing them! Software The ESR measurement code is based on Bob Parker’s algorithm published in the March 2004 issue, with minor changes to the pulse timings to better suit the Arduino Uno. The original design uses a pulse width of 8µs with an off-time of 492µs. Such settings resulted in a slight fluctuation in the readings. For example, a 0.6W resistance would show a reading fluctuating between 0.59 and 0.61. A pulse width of about 20µs improved the stability with no impact on accuracy, so a 480µs off-time was adopted to maintain the overall 500µs period. The program starts in the high range by setting D12 low and D13 high. This sets the pulse current to 0.5mA. At the same time, the reference voltage generator is initiated by setting D3 low. If the pulse at the Arduino’s non-­ inverting input exceeds the reference voltage, the comparator’s interrupt-onchange feature sets a flag indicating a pulse was detected. Consequently, a counter is incremented, the interrupt flag is reset, and another pulse is applied to the capacitor being tested. This process repeats until the code detects that the flag was not set after applying a current pulse. This signifies that the reference ramp voltage has reached a level greater than the pulse voltage, and counting is complete. After each count cycle, if the total number of pulses is below 10, the next lower range is selected, and the measurement is repeated until the count produced is between 10 and 100. In the low range, a count between 10 and 100 equates to an ESR reading of between 0.1W and 1W; in the medium range, it represents 1W to 10W; or 10W to 100W in the high range. If the count exceeds 100, the program automatically tries the next higher range until the count is between 10 and 100. If the count remains above 100 on the highest range, the display shows “Over range!”. siliconchip.com.au The prototype Meter was made using a specialised case to suit the display module. While you can use multiple PCBs as shown above, a single board design using the PCB shown in the lead photo requires much less wiring. Test lead resistance Since we aim to measure ESR values well below 1W, the resistance of the test leads and banana socket connections can introduce errors. Therefore, if the Zero button (S2) is pressed, the Arduino notices its D4 input pulled low and shows the message “Short test leads and press zero…”. Once the leads are shorted, the Arduino repeatedly measures and displays the lead resistance in ohms on the fourth line of the LCD. The code waits for the zero button to be pressed again and saves the lead resistance in the Arduino’s EEPROM. The result is then subtracted from the subsequent capacitor ESR measurements. In addition to displaying ESR measurements on the LCD, the Arduino also produces a serial stream of the measurement data via its USB port. The incremental count is displayed for each current pulse, followed by the final count, the final range selected and the number of range changes made during a measurement. The accumulated count includes the effects of test lead resistances. Combined LC / ESR Meter When the LC Meter and ESR Meter siliconchip.com.au are combined, a contact on the LC/ ESR selector switch, S1, signals which mode has been selected to the Uno via its digital input D2. With D2 low, it is in ESR mode. Switching from one mode to the other happens after the program completes the current procedure being processed by the Arduino. As previously mentioned, Arduino pins D3 and D4 are shared between the LC and ESR modules. D3 serves as a digital output in both modes; however, D4 is a digital input for the ESR module (for the Zero switch) but an output for the LC meter (driving RLY1). When switching modes, D4 is reconfigured by the code as required. could be removed), the Arduino and control board stack should fit, as should mode switch S1, but it will be a bit of a squeeze. Alternatively, you could use just about any rectangular case. It would need to be at least 175mm tall internally for a 20×4 LCD module to fit at the top with the combined control PCB and Arduino below it. The LCD Case selection The case used for the prototype is available from Mouser Electronics (563-HH-3421) or Digi-Key (HH-3421-ND), although stocks are limited. An optional tilt stand is available separately from Digi-Key (3771171-ND). Because the combined board is considerably narrower than the ESR-only board, it should fit in that case. With an internal depth of 37mm (excluding things like mounting bushes, which Australia's electronics magazine If you decide to build the ESR meter as separate PCBs, you might also need a mounting arrangement for the banana sockets as shown here and in Fig.8. In this case diodes D5 & D6 are located inside the white heatshrink. August 2023  59 will be around 87mm wide, defining the minimum internal width, while a depth of at least 30mm is required to fit the Arduino Uno, the shield on top of it, and the body of switch S1. The Altronics H0401 sloped case specified in the parts list should have plenty of room. Because of the sloping lid, you will need to mount the LCD and other PCBs to the inside of the lid. The screws and spacers in the parts list are intended to allow you to do this; the nut for switch S1 can also be used to hold the board in place. Remember to position the board so that the banana sockets will be accessible (or mount the chassis socket off-board). Construction First, you need to decide if you will build the original LC Meter design and wiring in the add-on ESR module or the combined PCB. We reckon the latter is a lot simpler. Fig.3 shows the wiring required with separate boards, while Fig.4 shows the combined PCB. For the combined version, the only part you need to add externally to Fig.4 is the LCD screen, via CON4. If you want to build the add-on board, it is shown in Fig.5, while the LC Meter board, without the sockets (as we’re using off-board sockets), is shown in Fig.6. We’ll describe the assembly process for the combined board; the two smaller boards are similar, you just need to skip the parts that are not onboard. The combined PCB measures 64.5 × 115.5mm and is coded 04106182. It’s essentially a larger-­ than-normal Arduino shield. Fit the resistors first, checking their values with a multimeter as you install each one. Follow with the smaller diodes (1N4148 & 1N4004), taking care to check their orientations; face the cathode stripes as shown in Fig.4. Next, mount IC1 (which can be soldered to the board or socketed, but watch its orientation), followed by trimpot VR1 (ideally a multi-turn type, although universal pads are provided) and pushbutton switch S2. ► Fig.3: this is the wiring needed to add the ESR feature to the existing LC Meter design by simply adding another small board (at the bottom). We think most constructors will prefer the much easier method of building the single combined PCB! 60 Silicon Chip Australia's electronics magazine siliconchip.com.au Follow with the transistors. There are nine, of four different types, so make sure to get the right types in each position and orientate them as shown. Bend their leads with small pliers if necessary to fit the pads. The next job is to install the capacitors, starting with the non-polarised MKTs/ceramics (the values should be printed on them, possibly as codes like 102 = 1nF, 104 = 100nF etc) and then the electrolytics. The latter are polarised, so insert the longer positive leads into the pads marked + (the striped side is negative). Remember that the 47µF non-polarised type goes at lower left. If you’re unsure about the values, check each component with a multimeter. Now is a good time to fit the bulkier components like the reed relays (watch their orientation), diodes D5 & D6 (ditto), the banana sockets and inductor L1. That just leaves the headers and the 3PDT mode switch. The CON4 header needs to be fitted as we’ll use it to connect to the LCD later, unless you plan to solder the LCD wires directly to its pads. CON1 is only needed if you plan to mount the banana sockets off-board and will not solder the wires directly (although you will need to do so for CON7 regardless). The remaining headers mount on the underside of the board. Use standard pin headers for the four SIL connections to the Arduino Uno (or similar) since we will not stack anything on top of this board. However, they need to be fitted using a particular method due to the height of the USB Fig.4: the combined PCB is basically the LC Meter shield (top section) with the ESR circuitry added below. Toggle switch S1 selects between the two functions. Some extra mounting holes have been added to increase mounting flexibility, although they unfortunately are not in a rectangle. connector on the Arduino Uno board that will fit below. First, apply some insulation to the top of the USB socket on the Uno, such as electrical tape or Kapton tape. Next, insert the Arduino headers into the shield board from the underside. Place a scrap of perfboard, protoboard or similar on top of the header pins that stick out the top of the board, then use a flat object to push the headers down so the tops of the pins are flush with the perfboard. Carefully remove the perfboard without moving the headers, then solder the pins at either end. This Figs.5 & 6: if you want to build the separate ESR board (left), either to use it as a standalone ESR meter or to add to an existing LC Meter (right), here is where all the components go. Besides the 10-way ribbon cable from CON6 (which could be left off & the ribbon cable soldered to the PCB), you also need to wire up the COM− and ESR+ test terminals. siliconchip.com.au Australia's electronics magazine August 2023  61 will mean there is a gap between the underside of the PCB and the plastic spacer on the headers. That’s so the pins project out further to reach the Arduino sockets despite the USB socket not allowing the shield to be pushed fully down. Finally, the 3PDT toggle switch mounts on the top side of the board into slotted holes designed to suit its rectangular solder lugs. This avoids the need to run nine flying leads, although you could do so if you want to mount that switch elsewhere. If doing so, use a short length of ribbon cable. Testing Make a final inspection of the soldering to ensure there are no solder bridges between tracks and that all the components are in their correct position and correctly orientated. If you have built the separate ESR board, you can do some testing before you wire it up. Connect pin 5 of CON6 to a +5V supply with pin 8 at 0V. Measure the current draw, which should be about 1mA. If the current is significantly higher (or zero), disconnect the supply and look for assembly errors. When plugging the shield into the Arduino, we recommend using 12mm tapped spacers and short machine screws to hold the two boards together due to the fact the headers won’t plug fully into the sockets. Attach the four spacers to the mounting holes on the Arduno, but only one needs to be screwed in through the shield to hold it down. The rest just set it at the correct height. If there is a solder joint touching the top of the USB socket that prevents you from tightening the screws, trim it flush to the extent possible. Wiring When the Meter is switched to ESR mode, a splash screen is briefly displayed showing the ‘Zero value’, which is effectively the offset due to the resistance of the leads and anything else that might be in the measuring circuit. 62 Silicon Chip Australia's electronics magazine If you are building the combined PCB, there isn’t much to the wiring. You just need to make up a 4-way cable to go from CON4 to the I2C LCD header. Make sure the connections are made per the labelling on the two PCBs, ie, GND to GND, SDA to SDA etc. If in doubt, refer to Fig.3; using a 4-way ribbon cable will keep it tidy. If you haven’t already soldered the I2C adaptor to the LCD screen, do that now, as the 4-way cable from the main board connects to that. If you’re adding the ESR board to an existing LC Meter, or building the boards separately for some other reason, wire them up as per Fig.3. The ten wires from CON6 are shown separately for clarity but again, it’s best to use a 10-way ribbon cable and only split out the individual wires as much as necessary to reach the appropriate pads. Note how, in Fig.3, the LC Meter shield no longer plugs directly into the Arduino as many pins are rerouted. Also note that diodes D5 & D6 are mounted off-board in this case. Loading the software To upload the firmware for the Uno board, you need to have the Arduino IDE (Integrated Development Environment) software installed on your computer. If you don’t have it, get it from www.arduino.cc/en/main/software The program that runs on the Uno requires an external library to interface with the I2C LCD. Open the IDE and select Sketch → Include Library → Manage Libraries... , then search for “liquidcrystal_pcf8574” and install the version by Matthias Hertel. siliconchip.com.au Now open the sketch file: “ESR. ino” for the standalone version or “LC_ESR_Meter.ino” for the combined version. Select the board type as Arduino Uno (Tools → Board Type → Arduino AVR Boards), then use the Tools → Port menu to select the serial port that the Arduino is plugged into. Most versions of the Uno will display as COMx: (Arduino Uno or similar) in the dropdown menu. If you’re using a 16×4 LCD rather than the 20×4 LCD recommended, change the line “lcd.begin(20, 4)” to “lcd.begin(16, 4)”. Compile and upload the sketch by pressing Ctrl-U. If you see the message “Done Uploading” at the bottom of the window, then all is well. If you get an error message, check that the LCD I2C library is installed correctly and that the correct serial port is selected. LCD adjustment If the LCD backlight is not lit, check that the backlight jumper is fitted on the I2C adapter board. If the backlight is working, but there is no text, adjust the contrast pot on the back of the I2C adapter board. Zeroing the test leads The program first checks to see if the resistance of the test leads has been saved in the EEPROM; if not, you will be prompted to perform the Zero process. Follow the instructions requesting the test leads to be shorted, and once the displayed resistance is stable, press the zero switch (S2). The display should briefly indicate that the zeroing process is complete before changing to the regular measurement display. The code expects the total resistance of the leads to be less than 1W or it won’t accept the result and briefly display the message “Invalid reading or bad leads” before aborting the zeroing process. In normal measurement mode and with the test leads separated, the display should indicate “Over range”. Calibration Calibration is straightforward, using a known resistance of about 68W or 82W. Verify the resistor’s actual value beforehand with a multimeter (deducting the multimeter lead resistances measured when shorting the leads together). Switch S1 (if present) to ESR mode. With this resistor connected via the probes, the screen should display a siliconchip.com.au Parts List – Arduino ESR Meter 1 suitable case [Altronics H0401] 1 Arduino Uno or equivalent microcontroller module 1 20×4 blue backlit alphanumeric LCD with I2C interface [SC4203] 1 double-sided PCB coded 04106182, 68.5 × 115.5mm 1 100μH bobbin-style or high-current axial RF inductor (L1) 4 5V DC coil DIL reed relays (RLY1-RLY4) [Altronics S4100, Jaycar SY4030] 1 200W top-adjust multi-turn trimpot (VR1) 1 3PDT solder tag toggle switch (S1) [Jaycar ST0505] 1 vertical tactile pushbutton switch (S2) 3 PCB-mount right-angle banana sockets; one black, two red (CON2, CON3, CON7) [Silicon Chip SC4983] OR 3 panel-mount banana sockets; two black, one red (CON2, CON3, CON7) 1 4-pin right-angle polarised header with matching plug and pins (CON4) 1 set of Arduino-style regular headers (1×10-pin, 2×8-pin, 1×6-pin) 1 100mm length of 4-way ribbon cable terminated with DuPont sockets at one end 8 M3-tapped 12mm spacers 9 M3 × 6mm panhead machine screws 4 M3 × 6mm countersunk head blackened machine screws Semiconductors 1 LM311 high-speed comparator, DIP-8 (IC1) [Altronics Z2516, Jaycar ZL3311] 3 BC327 or BC328 500mA PNP transistors (Q1-Q3) 2 BC337 or BC338 500mA NPN transistors (Q4, Q8) 1 BC548 or BC547 100mA NPN transistor (Q5) 3 BC558 or BC557 100mA PNP transistors (Q6, Q7, Q9) 2 1N4004 400V 1A diodes (D1, D4) 2 1N4148 75V 200mA diodes (D2, D3) 2 1N5404 400V 3A diodes (D5, D6) Capacitors 1 220μF 16V electrolytic 1 100μF 16V electrolytic 1 47μF 16V non-polarised electrolytic 1 22μF 16V electrolytic 2 10μF 6.3V tantalum or ceramic 1 470nF 63V MKT 1 270nF 63V MKT 3 100nF 50V multi-layer ceramic or MKT 1 33nF 63V MKT 2 1nF 1% NP0/C0G ceramic, MKP or polystyrene [Silicon Chip SC4273] Resistors (all 1/4W 1% axial) 1 470kW 1 220kW 5 100kW 2 47kW 7 10kW 2 6.8kW 1 4.7kW 4 2.2kW 1 1.3kW 3 1kW 1 680W 1 220W 1 150W 1 130W 1 100W Extra parts if building the ESR Meter with separate PCBs 1 double-sided PCB coded 04106181, 68.5 × 53mm 1 3PDT solder tag slide switch (S1) [Mouser 502-50209LX] 1 2x5 IDC header with matching socket (CON6) Ribbon cable and heatshrink tubing value close to the resistor value. Adjust VR1 until the reading matches the resistor value. Now try a resistor in the medium range (1-9.9W) across the leads and verify that the reading is close to expected. Similarly, a 0.1-0.9W resistor should give a very close measured result. With calibration complete, you can Australia's electronics magazine test a selection of electrolytic capacitors to get a feel for the meter’s operation. The screen shows the measured ESR on the first line, the range (High, Medium or Low) on the third line, and the saved lead resistance on the fourth line. There is no need to subtract the lead resistance from the displayed ESR August 2023  63 value, as that has already been done. If you’ve built the combined LC/ ESR Meter (as we think most people will), now would also be a good time to switch over to LC mode and verify that the unit changes modes when you flick the switch and that inductor and capacitor measurements are correct. Final assembly If you are building the unit as a standalone ESR meter, all that remains is to place the Arduino and ESR shield into an appropriate enclosure, with the LCD visible and the test lead terminals (and possibly S2) accessible. We have not shown the wiring to achieve this but it is similar to what is shown in Fig.3 without the LC Meter shield. The main differences are that the two connections from pins D3 & D4 on the Arduino to the ESR PCB via S1 should be run directly, while pin D2 should be tied to GND. The 5V and GND supply connections also connect from the Arduino to the ESR board rather than via the LC Meter Shield. If you have built the combined PCB, fitting it into an enclosure is a bit more straightforward. Again you will need a cut-out to view the LCD screen (unless your case has a clear lid) and possibly a way to access S2 (eg, a small hole in the case). The toggle switch will fit through a hole in the lid of your enclosure, but the board should be mounted against the left edge so that the banana sockets will fit through holes in the side (unless you’ve decided to mount them elsewhere and connect them to the socket pads via flying leads). You could use panel-mount banana sockets mounted just off the left edge of the board and attached via short wires. As in the prototype, you would typically mount the LCD screen near the top of the case with the main PCB below. Power for the prototype was fed in via the Uno’s power connector, with the plug going through a cut-out in the left-hand side of the case. You could use a similar arrangement, or use a chassis-mounting DC barrel socket mounted elsewhere and wired to the VIN and GND pins of the Uno. If your enclosure doesn’t have a ► Fig.7: while not recommended for the combined PCB, here is how the separate PCBs were mounted on an acrylic baseplate for the prototype. 64 Silicon Chip Australia's electronics magazine siliconchip.com.au clear lid, cut a piece of clear acrylic or other plastic for the display window. You can either glue this onto the underside of the enclosure cover or mount it on top of the LCD. Prototype mounting details Some constructors may wish to use a similar mounting arrangement to the prototype. However, this is not suitable if you are using the combined PCB; it’s only relevant if you have separate PCBs. The boards, mounting brackets and display were mounted on a 4mm-thick acrylic base plate, as shown in Fig.7. Fig.8 shows the reinforcement bracket used for mounting the banana sockets to the case. Depending on your case, you may not need this; you can mount the sockets directly to it, or use the onboard ones. If you are chassis-mounting mode switch S1, you might want to make a similar bracket for it if mounting it directly to the case isn’t suitable. Consider that you should drill a hole about 3mm in diameter in the case for accessing Zero switch S2 later should you need to recalibrate the lead resistance. Having to open up the case to do that could be a nuisance. Table 1 can be printed onto adhesive paper or printed, laminated and glued onto the case as a guide. That is what I did for the prototype. Keep in mind that if you’re using the Combined PCB, the mode switch toggle will be in the middle of where I attached it on my prototype. Depending on where you’ve put the banana sockets, you may be able to attach it higher up to clear that switch. Here is another view of the combined PCB we designed, plugged into an Arduino Uno, at actual size. Note how as well as the banana sockets projecting off the left-hand side, the USB and DC power inputs of the Uno do too. This allows you to make holes in the side of the case for all of those connectors. Conclusion Don’t forget to discharge the capacSC itors before testing them! Fig.8: while also not necessary for the version built with the combined PCB as described, this shows the mounting bracket used to hold the banana sockets in the prototype. siliconchip.com.au Screen 1: This screen is seen when no component is connected, or when a resistance over 100W is detected. The bottom line continues to display the lead resistance. If you see this when a capacitor is connected, it's probably not good anymore! Screen 2: Pressing and holding the ZERO button brings up this screen. You should short the ESR measurement terminals using the leads you would use for measurement and confirm that a low value as seen is displayed before pressing the ZERO button again. Australia's electronics magazine August 2023  65