Silicon ChipProgrammable Hybrid Lab Supply with WiFi – Part 2 - June 2021 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Semiconductor shortages are becoming serious / The right to repair
  4. Feature: The Right to Repair (and Modify) by Dr David Maddison
  5. Project: Advanced GPS Computer - Part 1 by Tim Blythman
  6. Feature: The History of USB by Jim Rowe
  7. Project: Recreating Arcade Pong by Dr Hugo Holden
  8. Feature: The History of Videotape – Camcorders and Digital Video by Ian Batty, Andre Switzer & Rod Humphris
  9. Project: PIC Programming Helper by Tim Blythman
  10. Review: The New Arduino IDE 2.0 by Tim Blythman
  11. Project: Programmable Hybrid Lab Supply with WiFi – Part 2 by Richard Palmer
  12. Review: Weller T0053298599 Soldering Station by Tim Blythman
  13. Product Showcase
  14. Serviceman's Log: Trying to fix unbranded, generic equipment is frustrating by Dave Thompson
  15. PartShop
  16. Vintage Radio: 1940 RME Model 69 communications receiver by Fred Lever
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: Programmable Hybrid Lab Supply with WiFi, May 2021; Arduino-based Power Supply, February 2021; DIY Reflow Oven Controller, April-May 2020; Deluxe Touchscreen eFuse, July 2017
  20. Outer Back Cover

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

You can view 37 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 "Advanced GPS Computer - Part 1":
  • Advanced GPS Computer PCB [05102211] (AUD $7.50)
  • PIC32MX170F256B-50I/SP programmed for the Advanced GPS Computer [0510221A.hex] (Programmed Microcontroller, AUD $15.00)
  • DS3231 real-time clock IC (SOIC-16) (Component, AUD $7.50)
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • MCP4251-502E/P dual 5kΩ digital potentiometer (Component, AUD $3.00)
  • Micromite LCD BackPack V3 complete kit (Component, AUD $75.00)
  • Matte/Gloss Black UB3 Lid for Advanced GPS Computer (BackPack V3) or Pico BackPack (PCB, AUD $5.00)
  • Firmware for the Advanced GPS Computer [0510221A.HEX] (Software, Free)
  • Advanced GPS Computer PCB pattern (PDF download) [05102211] (Free)
  • Advanced GPS Computer box cutting diagram and lid dimensions (Panel Artwork, Free)
Articles in this series:
  • Advanced GPS Computer - Part 1 (June 2021)
  • Advanced GPS Computer - Part 1 (June 2021)
  • Advanced GPS Computer – Part 2 (July 2021)
  • Advanced GPS Computer – Part 2 (July 2021)
Articles in this series:
  • The History of USB (June 2021)
  • The History of USB (June 2021)
  • How USB Power Delivery (USB-PD) works (July 2021)
  • How USB Power Delivery (USB-PD) works (July 2021)
Items relevant to "Recreating Arcade Pong":
  • Mini Arcade Pong PCB [08105211] (AUD $27.50)
  • Pair of Signetics NE555Ns (Component, AUD $12.50)
Articles in this series:
  • The History of Videotape – Quadruplex (March 2021)
  • The History of Videotape – Quadruplex (March 2021)
  • The History of Videotape - Helical Scan (April 2021)
  • The History of Videotape - Helical Scan (April 2021)
  • The History of Videotape – Cassette Systems (May 2021)
  • The History of Videotape – Cassette Systems (May 2021)
  • The History of Videotape – Camcorders and Digital Video (June 2021)
  • The History of Videotape – Camcorders and Digital Video (June 2021)
Items relevant to "PIC Programming Helper":
  • 8-pin PIC Programming Helper PCB [24106211] (AUD $5.00)
  • 8/14/20-pin PIC Programming Helper PCB [24106212] (AUD $7.50)
  • Relay - 1A DPDT 5V DC coil (EA2-5NU) (Component, AUD $3.00)
  • PIC Programming Helper PCB patterns (PDF download) [24106211-2] (Free)
Items relevant to "Programmable Hybrid Lab Supply with WiFi – Part 2":
  • WiFi-Controlled DC Electronic Load control PCB [18104212] (AUD $10.00)
  • Programmable Hybrid Lab Supply Control Panel PCB [18104211] (AUD $10.00)
  • Programmable Hybrid Lab Supply Regulator Module PCB [18104212] (AUD $7.50)
  • 2.8-inch TFT Touchscreen LCD module with SD card socket (Component, AUD $25.00)
  • ESP32 DevKitC microcontroller module with WiFi and Bluetooth (Component, AUD $25.00)
  • Software, manuals and laser templates for the Programmable Hybrid Lab Supply (Free)
  • Programmable Hybrid Lab Supply Control Panel PCB pattern (PDF download) [18104211] (Free)
  • Programmable Hybrid Lab Supply Regulator PCB pattern (PDF download) [18104212] (Free)
  • Drilling/cutting diagrams and front panel artwork for the Programmable Hybrid Lab Supply (Free)
Articles in this series:
  • Programmable Hybrid Lab Supply with WiFi – Part 1 (May 2021)
  • Programmable Hybrid Lab Supply with WiFi – Part 1 (May 2021)
  • Programmable Hybrid Lab Supply with WiFi – Part 2 (June 2021)
  • Programmable Hybrid Lab Supply with WiFi – Part 2 (June 2021)

Purchase a printed copy of this issue for $10.00.

Programmable Hybrid Lab Power Supply with Part II – by Richard Palmer Our new Lab Power Supply delivers 0-27V at up to 5A <at> 16V, and can be controlled remotely via WiFi. You can even set up multiple units to track automatically and connect them in series or parallel. After describing the configuration and circuitry last month, this follow-up article shows how to build the two PCBs and wire up everything neatly into a modestly-sized plastic instrument case. A s previously explained, this supply uses a three-stage hybrid arrangement, with two switch-mode supplies followed by a final linear stage. This gives excellent efficiency and keeps the whole thing compact and light, while still delivering very good performance. It has quite a few useful features, such as soft-starting and a fast settling time with minimal overshoot. With these features, plus its programmability, it can produce controlled pulses of power or voltage steps for testing how devices handle transients. The AC-DC switch-mode supply is a prebuilt module, but the other two modules in the device must be assembled before the whole thing can be fitted into its case and wired up. So let’s get onto building those two boards. Construction The first step is to assemble the boards. Fig.6 is the PCB overlay diagram for the Regulator board, while Fig.7 is the diagram for the Control board. All the parts on the Regulator board mount on one side, 72 Silicon Chip and most are surface-mount types. The Control board has components on both sides, but just a few SMDs, and they are all on the same side. It’s best to solder the SMDs first, then move on to the through-hole components. If you have a solder reflow oven, (or make your own! See Control board features & specs • Dual core ESP-32 240MHz, 32-bit processor • Onboard 2.8in or 3.5in colour LCD touchscreen display • 520kB RAM, 4MB flash memory • Full-size and micro SD card sockets • Touch interface plus detachable switches, LED and rotary encoder • 20-pin expansion header with I2C x 2, SPI, DAC x 2, ADC x 2, serial communications and GPIOs • Maximum of 17 GPIO/PWM pins can be used • WiFi (802.11 b/g/n) with 150Mbps throughput • Bluetooth & BLE support • USB-serial port • Web server and web client functions • Over-the-air (OTA) or USB reprogramming Australia’s electronics magazine siliconchip.com.au Fig.6: all components mount on the top side of the Regulator board in these locations. It’s generally easiest to fit all the SMDs before moving onto the through-hole parts, and leave the devices along the top that attach to the heatsink until after testing the basic functions. Note that SMD diode D3 has two anode terminals and three cathode terminals, two of the latter being on the sides. Errata: REG4 was incorrectly listed in the parts list last month as a VXO7803, when it should be the 5V version labelled VXO7805. If you purchased it, the “7803” suffix part will still work. Also, IC4 should be an MCP4725A0T-E/CH. Q3 & Q4’s base and emitter pins are swapped, and therefore should be soldered upside down relative to the overlay. how in our feature April/May 2020 issues – siliconchip. com.au/series/343) you can solder all the SMDs at once by manually adding solder paste to all the SMDs pads, then carefully placing the parts on top, and finally running both boards through a reflow cycle. Once they have cooled down, inspect all the ICs carefully to ensure there are no bridges between pins or unsoldered pins. Unsoldered pins can be fixed by adding a little flux paste, then a little solder. Bridged pins can be fixed by adding a little flux paste, then applying solder wick and removing it as soon as the excess solder is drawn away. The parts used can certainly be hand-soldered, and the only ones which are a little tricky are IC1, IC2 & IC6 on the Regulator board. The rest should all be straightforward, but be careful with the polarised parts. They are the ICs and diodes, including the LED. Verify that all the pin 1 markers are in the correct positions before soldering the parts. With the SMDs all loaded, move on to the through-hole parts. It’s best to start with the two box headers; make sure they are orientated as shown. On the control board, we recommend that you fit the Construction options Both side panels of the Control board are detachable, providing layout flexibility. The 2.8in LCD can be upgraded to a 3.5in type as long as there is room (you would need a larger case than the one specified). If doing that, make sure you program the chip with the alternative binary file, as the 3.5in LCD has a different controller to the 2.8in type. siliconchip.com.au pushbuttons next, then the LED, with the top of its lens about 2-3mm below the top of the switch caps, and the flat side orientated as shown. Solder the two 19-pin female headers for the ESP-32 module next. They can be cut from one 40-pin header strip, but make sure you cut beyond the 19th pin location in both cases, to avoid damaging it. The DC socket and micro SD card socket are not needed for this project, although you might want to install the DC socket to assist with testing. That leaves REG1 on this side of the board, which is only needed if you already fitted the DC socket. Its metal tab faces towards CON2. After fitting the rotary encoder on the other side of the board, that just leaves the LCD. None of the solder links need to be bridged, and the solder stakes shown at the two test points (EXT_PWR and EXT_GND) are also optional. Aligning the height of the display with the switches is essential for a neat panel layout. Refer to the bottom of Fig.7 to see what the final arrangement should look like. Set the top of the display 2-3 mm lower than the tops of the switch buttons for a good result. This should mean that the touchscreen will be 0-1mm proud of the panel face, and the buttons should protrude A more compact 75W switching supply could be used (eg, MeanWell LRS-75-24), which would reduce the overall heat generation, although it would also limit the maximum output current. While you can build two separate Supplies and gang them together as a tracking supply, it would also be possible to connect two Supply boards to a single Control board to make an all-in-one tracking supply which could also be configured to provide twice Australia’s electronics magazine the current (with the outputs in parallel) or twice the voltage (outputs in series). That would require an added isolator so that the two Supply boards could float relative to each other, as well as two separate AC-DC supplies. This two-channel design will require a larger case, such as Jaycar Cat HB5556. It will also require revised software. We hope to present the required changes for that possibility in a future article. June 2021  73 Fig.7: the Control board is sparsely populated, with all the SMDs on the front side along with the touchscreen, rotary encoder, switches and LED. The only required components on the back side are the ESP-32 module (which plugs in via header sockets) and box header CON2. CON3, CON4 and the wires shown going to their corresponding headers are only required if the board is cut along the slots when using a different front panel arrangement. by about 1.5mm. The length of pins provided on displays differs, so you might have to remove any existing pins and add longer ones if they are too short. The dashed lines shown in Fig.7 indicate where wires would be connected if you cut the board apart along the slots, but we don’t recommend that you do that unless you have specific plans to mount the control panel in a different case than the one specified. Finishing the Regulator board On the Regulator board, mount the fan header next, followed by the vertical axial resistors and electrolytic capacitors, observing the latter’s polarity markings. Follow with REG3 & REG4, ensuring that you don’t get the two different 74 Silicon Chip types mixed up as they have different pinouts. You can then mount the relay and toroidal inductor. The PC stakes shown for VIN, GND and VOUT are optional. There are advantages in soldering wires to stakes (it can be easier to make a good joint and there is less chance of strain-related failures), but it is certainly possible to solder wires directly to the board. That just leaves the components which mount on the heatsink: REG1, REG2, Q1, Q2 and the NTC thermistor. Don’t forget to insulate the device tabs and mounting screws from the heatsink using washers and bushes. Commissioning the Control board The bare ESP32 module and a USB cable are all that are Australia’s electronics magazine siliconchip.com.au The prototype used a support panel to mount to the front panel to avoid additional mounting holes. When building it as described in the article, standoffs will need to be used to mount the Controller board directly to the fascia. required for the first stage. Mounting the module on the Control board will come later. We’re assuming that you’re already somewhat familiar with the Arduino development environment. If you don’t already have the Arduino IDE (integrated development environment) install, you can download it from www.arduino. cc/en/software You will need to add ESP32 board support to the IDE if you haven’t already. To do this, go to File → Preferences and add “https://dl.espressif.com/dl/package_esp32_index. json” to the Additional Boards Manager URLs. Next, open the Boards Manager (Tools → Board → Board Manager), search for ESP32 and click “Install”. This will set up the development environment and add an extensive list of example programs to the list. Set the Board to “ESP32 Dev Module” via the menu (see Screen1). The rest of the settings may be left as the defaults. Plug in the ESP32 module and select the new communication port that appears from the menu. To check that it is working correctly, open the Communication → ASCII Table example and upload it (CTRL+U in Windows). Open the Serial Monitor, set the baud rate to 9600, and the screen should fill with the ASCII output from the test sketch. Loading software over-the-air To demonstrate other possible applications for the Control board, we’ve created a version of the WiFi weather app used as a demonstrator program for the D1 Mini BackPack (October 2020; siliconchip.com.au/Article/14599). This also happens to be a good way to test the Control board independently. We have made a ZIP file available for download from the SILICON CHIP website which includes two display options: a 2.8in or 3.5in touchscreen (you can also download it from siliconchip.com.au/link/ab72). The 2.8in version ends in -28. BIN while the other version ends in -35.BIN. Load it using the OTA update process described below. The Weather app has a built-in OTA function to simplify loading of the power-supply controller code. Over-the-air programming of the ESP32 is a two-stage process. First, we load a simple sketch with the over-the-air (OTA) updater via USB. Load up the ArduinoOTA example (File → Examples → ArduinoOTA → OTAWebUpdater). Fill in your WiFi credentials (SSID and password) at the top of the program (see Fig.8). Open the Serial Monitor and change the baud rate to 115,200. Save the Arduino sketch, as we’ll be using it again. Compile and upload the sketch, and note the IP address displayed in the Serial Monitor. Now you can disconnect the ESP-32 module and plug it into the Control board, making sure that it is aligned as in the photo below. Plugging it in the wrong way around could be catastrophic! Do not connect the Control board and Regulator board together just yet, but do make sure that the TFT touchscreen is mounted on the Control board. Power this combination up, using a USB cable or (if you fitted CON1 and REG1) a DC supply of 9-12V. The To provide a better layout for the front panel, the Controller board was split into three parts and linked with rainbow cable. The mounting arrangements shown here use a piece of clear perspex, which is not required to complete the project. siliconchip.com.au Australia’s electronics magazine June 2021  75 Screen2: if your module has been assembled and programmed correctly, once it has connected to your WiFi network, it should give local weather data as shown here. The assigned IP address is at the bottom right. Screen1: once you have selected the correct Board in the Arduino IDE Tools menu, the settings should look like this. Fig.8: to upload code to the ESP-32 via WiFi (OTA update), you need to add your network credentials towards the top of the program, as shown here. The hostname can be left as-is or changed to suit your requirements. Fig.9: when presented with the ESP-32 login page, use the default credentials of “admin” & “admin”. There’s no need to change these as they are only used once. Fig.10: once logged into the OTA page, you can select a file and then upload it into the ESP-32’s flash memory remotely using the “Choose file” and “Update” buttons respectively. 76 Silicon Chip USB cable doesn’t have to be plugged into your computer, although it could be. Open a web browser on your computer and type in the ESP32’s IP address. You should be presented with a login screen (Fig.9) The username and password are both “admin”. There’s no point in changing these to something more secure, as we’ll only be using this sketch once. After logging in, select the software file you’ve downloaded with the “Choose file” button (Fig.10), then “Update”. The web page will track the upload progress; then, after a short delay, the ESP32 will reboot, running the weather app (see Screen2). Once you have verified that the Control board is working correctly, you can load the power supply program. It is part of the same ZIP package that contained the weather app. There is only a single binary for the power supply program as this project is designed around a 2.8in display (ergo, use file -28.BIN). Once you’ve loaded that program using the same OTA update procedure (or uploaded directly via USB), disconnect the DC supply (if present) and connect the USB cable to your computer (for both power & communications). Open the Arduino serial monitor at 115,200 baud, and you should see some start-up commands, ending with the “SCPI Command?” prompt. If you type “*IDN?” into the command field and click Send, the software should respond with something like “SiliconChip,PSU01,PS01-01,1.0,NONE”. We will discuss setting up WiFi and other configuration options for the power supply a bit later. Screen rotation & calibration Some TFT screens come with the origin of the touchscreen rotated 180° from that of the display. If your touchscreen appears to not be working, that could be why. Try tapping the screen near the SET legend at upper right. If this takes you to the calibration screen, simply tap the ROT button in the centre of the screen (see Screen4 at upper right). The number below it should change from 3 to 1. Wait for the yellow [E] indicator to go out (after around 60 seconds), and the new value will be stored permanently in the ESP32’s EEPROM. Australia’s electronics magazine siliconchip.com.au Screen3: a mockup of the main screen that appears at switch-on. The present voltage, current and power are shown at left, with the input voltage and heatsink temperature above. The voltage and current setting are at right, with the buttons to enable/disable current limiting and tracking below. The device’s status is shown in the top right-hand corner of the screen. Screen4: the calibration screen shows the unit’s voltage and current readings at upper left, with the adjustable calibration offsets to their right. The save and cancel buttons are at lower right, with the screen rotation button in the middle and the touch calibration menu button at lower left. (All menus are accessed by pressing the buttons which appear along the bottom when appropriate). To align the touchscreen accurately with the display, tap the TCH button at the calibration screen’s bottom-left corner. Follow the prompts, touching each of the two + symbols six times. As above, it will permanently store the values after 60 seconds. The PSU software download also contains PDF manuals for the two boards, with information beyond that contained in these two articles. immediately. At this point, the green box should disappear, leaving the main menu displayed. A small green “W” near the top right corner indicates that WiFi is operating. The On button should light the LED, and the Off button should turn it off again. Touching any of the menu buttons along the right-hand side of the display should highlight the setting value next to it, or change the mode of a function. As described last month, when a setting is selected on the touchscreen, the encoder should change the selected digit’s value, and the SW_L and SW_R buttons should shift the highlighted digit left or right on the screen. Setting up the WiFi network Now that the Control board has been programmed, when you power it up, the control menu (Screen3) should appear with a green box overlaid. The program will try to connect to a local WiFi LAN, and time out after 10 seconds, as we have not yet provided it with credentials. Then another 10-second delay should occur, while it seeks for an existing ESPINST network. Finally, it should become the Access Point for the ESPINST network almost Screen5: the WiFi settings screen allows you to set the device’s hostname, network SSID and password, and also shows the unit’s current IP address and hostname. The “AC” setting stands for auto connect. siliconchip.com.au Further testing Now it’s time to power off the Control board and connect it to the Regulator board using a 20-wire ribbon cable about 10cm long, with IDC plugs at either end. If you haven’t made this cable up yet, do so now, making Screen6: the tracking screen lets you assign the Supply to a tracking group (GRP) and then set whether it tracks the voltage, current or both of other units in the group. Australia’s electronics magazine June 2021  77 sure that the pin 1 indicator on each IDC plug (usually a triangle moulded into the plastic at one end) points to the same wire in the cable. Grey ribbon cable typically has one red wire to indicate pin 1. If you’re using rainbow cable, use the black wire (black = 0 in the resistor colour code scheme). Ensure that the IDC headers are crimped firmly enough for all the blades to pierce the ribbon cable insulation fully. You can usually tell that this is the case because the two (or three) pieces of each IDC plug will be completely flush and parallel. Partially crimped IDC plugs will usually have a gap at one or both ends, visible upon close inspection. This is the most common cause of ribbon cable failures. Connect the two boards together. It should be impossible to misconnect them due to the keyed headers. Still, just to be sure, it is a good idea to verify that the GND, 5V and 3.3V rails are correctly connected at either end using an ohmmeter or continuity tester. Also check that none of these rails are shorted to each other. Now plug the USB cable back to the ESP32. As there is currently no other source of power, this is quite safe. A USB port can also provide sufficient current to test the PSU’s basic functions, other than the fan. Now check that the 5V and 3.3V rail voltages are correct on the Regulator board. The cathode (striped end) of diode D7 is a convenient point to measure the 5V supply, while the thermistor connector pin closest to the power transistors should register 3.3V. On the Arduino serial monitor screen, the power-on selftest (POST) should report that three I2C devices have been detected. If any do not show up, a solder bridge on one of the ICs is the most likely culprit. The LED on the power supply board should follow the one on the control board as the output on/off switches are operated. Failure here is most likely due to the LED being soldered in backwards, or a solder bridge on IC6. On the control panel screen, the output current should be showing 0A a few seconds after turn-on, once the autozero function has completed. The input and output voltages should read less than a volt, as there are some current paths from the 3.3V and 5V supplies to these rails. The temperature reading will be out of range until the thermistor is soldered in. Set the output voltage to 2.0V, as this will be needed for calibration. Next, disconnect the control panel from the power supply board and connect a 7-12V DC supply between the Vin terminal and GND on the Regulator PCB. Check the output voltages on the +5V and -5V regulators. The nominally +5V rail should read approximately 4.5V, as the reverse bias protection diode (D1) is in series with this supply. Low-current testing of the supply itself can safely proceed without the heat sink. Using the same 7-12V DC supply to Vin as before, and with the Control board disconnected, test the output voltage of REG1, which appears across ZD1. It should read somewhere between 3.6V and Vin, with a value approximately 3.6V higher than the voltage at the output of REG2 (the middle pin). Turn off the power, reconnect the Control board and switch back on. The relay should now switch on and off with the LED when the control panel switches are operated. Set the output voltage to 2V, switch the output on, and check the voltages at Vout (2V) and Vpre (about 5.6V). Adjust the output voltage and check that Vpre is tracking at around Vout + 3.6V. Next, attach a 47Ω (or slightly higher value) 1W resistor across the output. Set the voltage to 5V and make sure the output current reads approximately 100mA. Before turning off the control panel, set the output voltage to 2V and wait for that value to be saved to flash memory, after approximately 60 seconds, when the [E] indicator at the top right corner of the screen has gone out. Then unplug the USB cable. This sets us up for initial testing when we’ve assembled the entire supply. Panel preparation Drill and cut holes in the plastic instrument case’s front panel as shown in Fig.11. The holes should line up with the parts on the Control board (refer also to the bottom of Fig.7 for the mounting details). Hole “B” at left is for the output on LED, while the 12 holes marked “A” correspond with the mounting screws for the display and Control board to the rear of the front panel. The three “C” holes at lower-right are for the panel-mounted output and Earth binding posts. Fig.12 shows the cutting and drilling required for the rear panel, which is relatively straightforward. When finished, Remote control via SCPI The Standard Commands for Programmable Instruments (SCPI) protocol used in this project was developed in the early 1990s to provide a standard syntax and command structure for programmable instruments from power supplies to oscilloscopes and beyond. It was designed as a master-slave protocol, with the controlling computer always being master. While it was initially implemented on the GPIB bus (IEEE 488), other communication channels such as serial (including USB serial) and TCP are now commonly employed. SCPI commands consist of casesensitive keywords separated by colons. Commands ending in a question mark are 78 Silicon Chip queries, and the instrument returns a value, or set of values, to any query. Each keyword may have parameters associated with it, ergo: “:SET:VOLTage 350 mV” or “:MEASure:VOLTage?” Parameters may be integers, floating-point numbers or strings, depending on the command. Numeric commands may be followed by a unit, such as V, mV, A or mA. Full SCPI understands all the multipliers from yotta (1024) to yocto (10-24). This instrument only accepts ‘bare’ units or milli-units, avoiding the problems associated with setting megaamps when you intended milliamps! Each command, such as “MEASure” can Australia’s electronics magazine be issued using the full form or an abbreviation, which is always the part in upper case, and almost always four characters long. Thus “:MEAS:VOLT?” is equivalent to “:MEASure:VOLTage?” The IVI Foundation, which is the successor to the non-profit SCPI Consortium, has a website with exhaustive documentation on SCPI and more recently developed, and more flexible instrument communication protocols such as VISA and VXI at www.ivifoundation.org/specifications/ default.aspx The SCPI commands used for this programmable supply are fully detailed in the manual included with the downloads for this project. siliconchip.com.au Fig.11: the front panel drilling and cutting template scaled by 75%. The rectangular hole for the touchscreen can be made by copying this diagram, attaching it to the panel temporarily and then drilling a series of small (2-3mm) holes just inside the outline. Use a cutting tool like a rotary tool or, in a pinch, a pair of sidecutters to join all the holes together until the panel falls out, then file the edges smooth and until the touchscreen fits. Fig.12: the rear panel drilling and cutting is relatively simple, as you just need holes to mount the IEC mains input connector and cooling fan. While we’ve shown slots for the fan exhaust, it would be much easier just to drill a series of 5mm diameter holes in the area shown. Don’t make them larger than that so that small fingers can’t be inserted. Fig.13: the heatsink drilling details, plus the plan for the DIY version made from sheet aluminium at right. All holes are drilled to 2.5mm for tapping to 3mm on the commercial heat sink; drill to 3.5mm for folded version. Do not drill the mounting holes in the heatsink base until the components are attached to the heatsink. The holes can then be positioned by drilling through the bottom of the case. The DIY heatsink uses two pieces of 1.6mm aluminium sheet, 145 x 95mm and 145 x 85mm. The bottom edge of the heatsink is 3mm below the bottom of the PCB. siliconchip.com.au 79  S ilicon Chip Australia’s Australia’s electronics electronics magazine magazine siliconchip.com.au June 2021  79 5,5 44,5 31,0 21,0 11,0 16,0 20,0 9 26,0 2,5 12,5 9,0 4,0 2,0 20 9 14 9 27,0 181,0 4,5 4,5 8,5 8,5 18,0 16,0 189,0 16,0 64,5 26,0 2,5 16,0 9,0 12,5 4,0 248,0 24,0 25,0 27,0 48,0 48,0 27,0 26,0 24,0 Fig.14: this shows how to prepare the bottom of the case. The mounting holes are marked green and should be drilled through (3.5mm) and countersunk from the bottom. File the top of these posts down to the height of the lower posts. Only two of the green holes need to be drilled, depending on whether the commercial or DIY heatsink is used. The orange lugs also need to be filed down, but not drilled. The PCB mounts directly onto the two blue lugs with 9mm x 4G round head self-tappers, as does the MeanWell AC-DC converter. A second mounting hole is required for the MeanWell supply. It is 51mm forward of the blue mounting hole and 73.5mm inwards. Fig.15: the front panel artwork for the instrument is reproduced here at 75% of life size – in other words, you will need to enlarge it by 133% before photocopying. Alternatively, it can be downloaded at full size from our website so you can print a high-quality version to attach to the instrument. 80 Silicon Chip Australia’s electronics magazine siliconchip.com.au The completed prototype regulator module attached to the heatsink, which was reused from another project (hence the extra holes). Note the insulating washers under the device tabs and plastic bushes under the mounting screws. If using mica washers, add thermal paste on both sides. Check for full insulation between each tab and exposed metal on the heatsink before powering it up. mount the fan and IEC mains socket on the inside (with the mains socket inserted from the outside). The same-size front panel label artwork can be downloaded from the SILICON CHIP website, printed, laminated and glued to the front of the panel. (Note that Fig.15 is undersize – if photocopying, enlarge to 133%). Cut out the holes with a sharp hobby knife, and then the Control board can be attached and the knobs fitted. Making/attaching the heatsink All the basic functions have now been validated, so you can mount the heatsink. Fig.13 shows where to drill holes on the specific commercial heatsink, plus details on how to make your own. The bottom edge of both heatsink types protrudes 3mm below the bottom of the PCB as shown. The end of the heatsink closest to the back panel also protrudes 3mm past the end of the PCB, to allow the mounting hole to be set in from the end. Once you’ve finished that, mount the fan and power supply connector on the back panel of the case, and wire up the AC side of the AC-DC converter. The AC cables need only be about 7cm long, as the converter will be mounted quite close to the power socket. The Earth wire will need to extend to the front panel terminals. Insulate the ends of the mains cables at the power socket with heatshrink tubing. Several mounting lugs on the bottom of the instrument enclosure need to be trimmed, and three mounting holes drilled – see Fig.14. Depending on the heatsink option chosen, either the middle (CINCON) or front (DIY) lugs are drilled through. This is because the CINCON heatsink is slightly too short to reach the front mounting lug. siliconchip.com.au Drill a 3.5mm hole at the red dot, to secure the AC-DC converter. It is directly in line with one of the existing (unmodified) pillars, but 31mm closer towards the centreline of the case. Mount the AC-DC converter in the case with a 4G x 9mm round head, self-tapper through the hole next to the terminals, and a countersunk 3mm machine screw cut to length, with a spacer, through the hole that was drilled. Fold up a plastic cover for the AC terminals and power socket, and secure it under the converter’s edge. I made mine from a red polypropylene cutting mat. Now connect the AC-DC converter to Vin and ground and solder in the Earth and negative terminal wires for the front panel binding posts. Wind 4-5 turns of hookup wire around the toroidal core for the output filter inductor, then solder one end to the Vout terminal on the PCB, and mount the PCB/heatsink in the case. Connect all three wires to the front panel. I used crimp eyelet lugs to enable easy removal from the binding posts; however, you can also solder wires directly to them. The toroidal choke tucks into the corner of the case between the heatsink and the front panel. Finishing it up At this point, the Lab Supply assembly is substantially complete, and we move on to further testing. If you didn’t remember to set the output voltage on the control panel to 2V before switching it off, disconnect the mains, reconnect the USB cable and follow the instructions above. Disconnect the USB cable. Set the AC-DC converter’s output voltage to its lowest setting using its trimpot (fully anticlockwise) and then switch on the power. Vin should read within a few volts of 20V (the Australia’s electronics magazine June 2021  81 Table 1: CON2 pin mapping Expansion possibilities 20-pin header CON2, along with the two optional headers associated with the rotary encoder and pushbutton switches, offers a broad range of inputs and outputs for expansion, or when the Control board is used for other purposes. A total of 17 ESP32 pins are connected to these headers, besides the SPI bus, which is shared with the SD card and touchscreen (see Table 1). Several general-purpose I/O (GPIO) pins and the I2C bus are used in this Power Supply project; however, the SPI bus, serial port, USB port, DAC and ADC channels are unused and so are available. The I2C bus supports all modes up to 5MHz with 7-bit or 10-bit addressing. It is best to stick with 400kHz/7-bit operation, though, as many older I2C chips do not support the more advanced modes. I2C pull-up resistors are provided onboard. A second I2C bus is available as one of the configuration options for pins 13 and 14 of CON2, as alternates to GPIO0 and the second DAC channel. The SPI bus has been extended to the 20-pin expansion connector; one GPIO pin will need to be allocated as a chip select (CS) line for each additional SPI device used. As the SPI signals traverse the ribbon cable, it’s best to stick to 10MHz bus frequencies or lower. SD card file storage is supported. As with the ESP8266-based Mini D1 LCD backpack, an onboard micro SD card socket has been provided in addition to the full-size one on the LCD module. Either may be used, but not together, as a single chip select line is shared between them. Optionally, the card detect (CD) switch in the socket can be jumpered to GPIO3. It is grounded when a card is inserted, and will require a pull-up current to be configured in software for that pin. The two-channel ADC is capable of 12-bit resolution, and the maximum sample rate is around 27kHz under software control. Pads are provided between these pins and GND to reduce input noise when GPIO pins 34 or 35 are used as ADC inputs. The specified 100nF capacitors provide substantial filtering at even moderate frequencies, as the input draws just 50nA. Two 8-bit DAC channels are provided, with a practical throughput of around 200k samples per second. A logic-level serial interface is available, able to transmit and receive at up to 5Mbps. USB-serial is also supported. As noted in the text, unisolated USB power or communications are not recommended for the Power Supply project. Other than the I2C and SPI signals, the remainder of the pins are multi-function. Any GPIO pin can be configured as an interrupt input or PWM output. Most of the specialised pins (ADC, DAC and serial) can also be used for digital I/O, bringing the total number of GPIO-capable pins to 8, or 17 if the rotary encoder and pushbutton switches are not required. If there are insufficient GPIO pins for a specific project, an I2C I/O expander such as the MCP23008 can be added. CON2 pin # ESP-32 function ESP-32 pin PSU function 1 GND GND 2 GND GND 3 SPI:MISO GPIO19 – 4 SPI:SCK GPIO18 – 5 I2C1:SDA/GPIO GPIO21 I2C control for IC1,IC2,IC4 6 SPI:MOSI GPIO23 – 7 I2C1:SCL/GPIO GPIO0 I2C control for IC1,IC2,IC4 8 I2C2:SDA/GPIO GPIO22 – 9 COM2:TX/GPIO GPIO17 Sense DRDY signal from IC1 10 COM2:RX GPIO16 – 11 GPIO GPIO2 – 12 GPIO GPIO4 Sense SW_ON press 13 DAC1/GPIO GPIO25 – GPIO26 Control fan on/ off 14 DAC2/I2C2:SCL/ GPIO 15 ADC1-7/GPIO GPIO35 – 16 GPIO GPIO12 Sense SW_OFF press 17 ADC1-6/GPIO GPIO35 – 18 +5V +5V 19 +5V +5V 20 +3.3V +3.3V BLE modes, they have not been used in the power supply project. Also, a second serial port is available on the 20-pin expansion connector. It too is unused in the Power Supply project. USB-serial communication is available, via a micro USB socket on the ESP-32 module, providing a ready means of programming the device and debugging code using one of the available integrated development platforms, such as Arduino. The USB port also provides one of the SCPI control interfaces for this power supply project. It is highly recommended that a USB isolator is used with the Power Supply project to avoid ground loops that might destroy the ESP-32 or your computer’s USB port. These isolators are available in eBay or AliExpress for around $15 that work in either full-speed (11Mbps) or high-speed (480Mbps) modes. I have successfully used the variety illustrated in the photo below. Communication The ESP32 offers a broad range of WiFi options; it can connect to an existing 2.4GHz WiFi LAN or create a local network in ‘soft-AP’ mode. Both modes are enabled for the Power Supply project. First, the controller attempts to connect to an existing LAN, with credentials entered on the COMMS submenu. If that fails, it attempts to join an existing network with an SSID of ESPINST. If that fails, it creates the ESPINST network for other instruments to join. While the Control board supports both traditional Bluetooth and 82 Silicon Chip Australia’s electronics magazine siliconchip.com.au Your completed Hybrid Lab Power Supply should look not too dissimilar to this photo of the prototype. converter’s minimum setting). Note the voltages at Vout and Vpre (approximately 3.6v higher). If all is in order, it is safe to turn the trimpot to its highest setting, which will raise Vin to around 30V. Basic testing is now complete, and you can start using the instrument to provide power for projects on your bench. Calibration Calibrating the supply is optional, as current and voltage measurements will be accurate within a few percent, depending mainly on the resistors’ tolerances. To calibrate the voltage measurements, set the output voltage to 25V (or any other setting a few volts below the maximum value) and select the CAL menu on the screen (lower left of Screen3). With no load connected, turn the supply’s output on and measure the voltage with your multimeter. Using the numeric value controls, enter the difference between the multimeter reading and the value displayed on the screen at left. If the multimeter reading is higher, input a positive value. In the example shown in Screen4, the Power Supply is reading 25.00V but the reference multimeter is reading 25.12V, so 0.12V is set as the offset at upper right. Touch the SAVE button to save the result. This will also exit the Calibration menu. Wait for the [E] indicator to extinguish before turning the instrument off, so that the siliconchip.com.au new calibration value is permanently stored in flash memory (EEPROM). Repeat the same calibration process for current, with the output on, using a load resistor that draws 1A or more at any output voltage. A 1Ω 1W or higher power resistor will work fine. There is no need for zero current calibration, as this value recalibrates automatically after a short period whenever the output is off. If you want to use a WiFi network connection to the instrument, enter the COMMS sub-menu (Screen5). Fill in your WiFi credentials and tap the auto-connect (AC) button, if it is not already green. This will initiate the WiFi connection protocol. A green rectangle will appear showing connection progress. Once complete, “W” indicator at the top of the screen should be green and the IP address displayed at the bottom of the COMMS screen. Conclusion The Lab Supply, as presented here, is a very useful instrument indeed. Still, it could be expanded to have even more features due to the power of the ESP-32 WiFi & microcontroller module. Also keep in mind that the BackPack-style Control board is powerful and versatile in itself, and could be used to power various other designs. SC Australia’s electronics magazine June 2021  83