Silicon ChipDeluxe eFuse, Part 3: using it! - October 2017 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Let’s be realistic about an Australian space industry
  4. Mailbag
  5. Feature: WRESAT: Australia’s first satellite – 50 years ago! by Dr David Maddison
  6. Feature: Three of our miniature satellites have gone missing... by Ross Tester
  7. Project: 0.01Hz - 6+GHz touchscreen frequency meter, Part 1 by Nicholas Vinen
  8. Feature: El Cheapo Modules Part 10: GPS receivers by Jim Rowe
  9. Project: One hour project: Kelvin – the very clever cricket by John Clarke
  10. Serviceman's Log: Old-fashioned appliance repairs are still worthwhile by Dave Thompson
  11. Project: 3-way Active Crossover for speakers, Part 2 by John Clarke
  12. Project: Deluxe eFuse, Part 3: using it! by Nicholas Vinen
  13. Feature: Adjust your hot-water thermostat and save $$$$ by Leo Simpson
  14. Subscriptions
  15. Vintage Radio: HMV 1955 Portable Model 12-11 by Associate Professor Graham Parslow
  16. PartShop
  17. Market Centre
  18. Notes & Errata: Automatic NBN/ADSL Router Rebooter / Power Supply for Battery-Operated Valve Radios / Vintage Radio (DKE38)
  19. Advertising Index
  20. Outer Back Cover: Microchip Low-power LCD

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

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

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

Items relevant to "0.01Hz - 6+GHz touchscreen frequency meter, Part 1":
  • 6GHz+ Touchscreen Frequency Counter PCB [04110171] (AUD $10.00)
  • Short Form Kit for the Micromite Plus Explore 100 (Component, AUD $75.00)
  • Case pieces for the 6GHz+ Frequency Counter (PCB, AUD $15.00)
  • Software for the 6GHz+ Touchscreen Frequency Counter (v1.01) (Free)
Articles in this series:
  • 0.01Hz - 6+GHz touchscreen frequency meter, Part 1 (October 2017)
  • 0.01Hz - 6+GHz touchscreen frequency meter, Part 1 (October 2017)
  • Touch-screen 6GHz+ Frequency Counter, part II (November 2017)
  • Touch-screen 6GHz+ Frequency Counter, part II (November 2017)
  • Part 3: Finishing our new 6GHz+ Digital Frequency Meter (December 2017)
  • Part 3: Finishing our new 6GHz+ Digital Frequency Meter (December 2017)
Items relevant to "El Cheapo Modules Part 10: GPS receivers":
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "One hour project: Kelvin – the very clever cricket":
  • Kelvin the Cricket PCB [08109171] (AUD $7.50)
  • PIC12F675-I/P programmed for Kelvin the Cricket [0810917B.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (HEX and ASM) file for Kelvin, the Very Clever Cricket [0810917B.HEX] (Software, Free)
  • Kelvin the Clever Cricket PCB pattern (PDF download) [08109171] (Free)
Items relevant to "3-way Active Crossover for speakers, Part 2":
  • 3-Way Adjustable Stereo Active Crossover PCB [01108171 RevD] (AUD $12.50)
  • 3-Way Adjustable Stereo Active Crossover prototype PCB [01108171 RevC] (AUD $5.00)
  • 3-Way Adjustable Stereo Active Crossover PCB [01108171 RevE] (AUD $20.00)
  • Set of four 8-gang potentiometers with knobs for the 2/3-Way Active Crossover (Component, AUD $55.00)
  • SMD parts for the 3-way Adjustable Active Stereo Crossover (Component, AUD $30.00)
  • 3-Way Adjustable Stereo Active Crossover simulation file (Software, Free)
  • 3-Way Adjustable Stereo Active Crossover PCB pattern (PDF download) [01108171] (Free)
  • 3-Way Adjustable Stereo Active Crossover front & rear panel artwork (PDF download) (Free)
Articles in this series:
  • Fully adjustable, 3-way active loudspeaker crossover Pt.1 (September 2017)
  • Fully adjustable, 3-way active loudspeaker crossover Pt.1 (September 2017)
  • 3-way Active Crossover for speakers, Part 2 (October 2017)
  • 3-way Active Crossover for speakers, Part 2 (October 2017)
Items relevant to "Deluxe eFuse, Part 3: using it!":
  • Deluxe Touchscreen eFuse PCB [18106171] (AUD $12.50)
  • PIC32MX170F256B-50I/SP programmed for the Deluxe Touchscreen eFuse [1810617A.HEX] (Programmed Microcontroller, AUD $15.00)
  • 2.8-inch TFT Touchscreen LCD module with SD card socket (Component, AUD $25.00)
  • IPP80P03P4L-07 high-current P-channel Mosfet (Component, AUD $2.50)
  • LT1490ACN8 dual "Over-the-Top" rail-to-rail op amp (Component, AUD $10.00)
  • IPP80N06S4L-07 high-current N-channel Mosfet (TO-220) (Component, AUD $2.00)
  • Matte Black UB1 Lid for the Deluxe Touchscreen eFuse (PCB, AUD $7.50)
  • Software for the Deluxe Touchscreen eFuse (Free)
  • Deluxe Touchscreen eFuse PCB pattern (PDF download) [18106171] (Free)
Articles in this series:
  • Deluxe Touchscreen eFuse, Part 1 (July 2017)
  • Deluxe Touchscreen eFuse, Part 1 (July 2017)
  • Deluxe Touchscreen eFuse, Part 2 (August 2017)
  • Deluxe Touchscreen eFuse, Part 2 (August 2017)
  • Deluxe eFuse, Part 3: using it! (October 2017)
  • Deluxe eFuse, Part 3: using it! (October 2017)

Purchase a printed copy of this issue for $10.00.

Higher power, loads more features . . . Deluxe Deluxe Touchscreen e Fu Fuse se by Nicholas Vinen Part 3: final assembly and operation Having built the PCB assembly for our Deluxe Touchscreen eFuse and performed some basic tests, we’re going to conclude the story by attaching the six chunky binding posts, attaching the classy matte black laser-cut lid and fitting it into its case. We’ll also show some screen grabs and explain how to use the unit and operate its touchscreen interface. A t the end of part two in the August issue, we left off with a fully assembled and tested unit needing only to be put into its case. The photo below shows how the finished assembly is mounted to the lid. This shows the terminals attached to a bare PCB so that you can clearly see the mounting arrangement. Start by removing the washers, nuts and lower half of the plastic shell from each binding post. Feed each binding post through from the top of the lid, with the four red posts in the corners and two black posts in between. Place the other half of the plastic shell on the underside of the lid and rotate the top and bottom halves until they slip into the locking slots in the lid. Now slide an M8 spring washer onto the screw shaft, followed by a flat washer, and then screw on one of the nuts that you took off the binding post to hold it in place. Once you’ve attached all six binding posts in this way, remove the four screws holding the touchscreen onto the The basic mounting arrangement showing how the PCB (in this case without components) attaches to the display PCB via four threaded stand-offs. The six heavy-duty binding post terminals attach to both the front panel and then directly to the PCB, as shown here. It is imperative that the terminals make intimate contact with the PCB tracks and pads. 76 Silicon Chip Celebrating 30 Years siliconchip.com.au Fig.1: touching the fuse trip current value brings up this keypad which allows you to enter a new trip current value. It can be specified in amps or milliamps and the “X” button cancels the entry, retaining the pre-existing value. Fig.2: this settings screen is brought up by touching the main screen at left centre and allows you to adjust the LCD backlight brightness, auto-off timeout (which can be disabled) and output start-up state. eFuse PCB but leave the screen in place. Feed each screw (8-10mm long) through the screen mounting holes in the top of the lid, then place the 1mm thick Nylon spacers carefully on top of the four corresponding holes on the touchscreen module PCB. Then slide the six binding post screws through the corresponding holes on the eFuse PCB and carefully lower the lid down into place. Be careful not to bump the Nylon washers out of place, then loosely attach the four screws to the tapped spacers below. Next, check that the unit is sitting flush on the lid and the nuts holding the binding posts are just resting on top of the PCB surface in each case. Tighten or loosen these nuts as necessary, then do up the four screen mounting screws properly. Ensure that none of the large nuts short out any adjacent components (the board is designed with sufficient clearance – just – but it’s best to check). Finally, fit the remaining binding post nuts onto the shafts and tighten them up to make good electrical contact with the PCB pads, as well as holding the PCB assembly firmly in place. You can now apply power and check that everything is working before screwing the whole assembly into the bottom of the case using four black self-tapping screws. being physically close to the actual inputs themselves. If there is no voltage applied to the V- input, its reading should be close to zero, as it is here. Immediately to the right of these voltage readings, the instantaneous (short-term averaged) current readings are shown for both the positive and negative outputs. If those outputs are off (as they are by default at power-up), then the word “off” appears instead. The outputs can be switched on and off by simply touching the upper and lower right-hand corners of the screen. If they are linked (shown by an unbroken line between them, along the right edge of the screen) then they will be switched together and they will also trip off simultaneously if either exceeds the programmed current limit. They can be linked or unlinked by touching the centre right edge of the display. The trip current and speed are shown at centre right. The speed is either “Slow”, “Medium” or “Fast” and can be changed simply by touching it; it will cycle through the three possible settings. The trip current is shown above this and you can change it by touching it. This will bring up a keypad, allowing you to enter a new value in amps or milliamps (see Fig.1). It takes effect immediately after you have finished setting it. If you change your mind, you can cancel and the old setting will be retained. Note that while making these changes, if the output(s) are still switched on, the unit will continue to operate as normal and protect the load(s). It uses the pre-existing setting as the trip threshold until you have finished setting a new one. Using the unit The operation of the software has been changed slightly since our last article, so what we describe below is slightly different from what we stated in the last article. The photo opposite (top) shows the eFuse with its main screen, which appears immediately after power up. This is the default screen and shows all the relevant parameters which are constantly updated. The input voltages are shown in the upper left and lower left An end-on close-up of the heavy-duty terminals attached to the PCB. Don’t forget the spring washers and flat washers on corners, with their positions the terminal shafts – they help prevent them working loose. siliconchip.com.au Celebrating 30 Years Fuse trip bars Because a normal fuse or circuit breaker will not trip instantly when the current flow exceeds the set threshold, the current readings shown are a useful guide October 2017  77 Fig.3: both voltage and both current readings can be calibrated using this screen. It allows you to change the scale factor and add or subtract a fixed value (offset) and see the effects of the changes before saving them to flash. Fig.4: if, at start-up or during operation, the V+, V+H or V-L supply rails are not within their expected ranges, the unit will automatically switch off its outputs and display a screen like this until the fault clears. but don’t necessarily indicate how close the unit is to tripping. Also, they can only update a few times per second or they will become too difficult to read. So to give you a better idea of what’s going on, a bar graph is shown along the top and bottom edges of the display. When either bar reaches the right edge of the screen, the corresponding fuse (top = V+, bottom = V-) will trip off. This is akin to fitting a standard fuse with a temperature read-out and calibrating the scale so that the bottom end is at ambient temperature and the top is at the temperature where the fuse material will melt. So you can quickly see how close it is to tripping and these are constantly updated. We’re also showing temperature readings above and below the voltage readings. These are not the simulated fuse temperatures, they are the estimated temperatures of Mosfets Q1 and Q3. As stated in the earlier articles, the continuous current rating of this unit is limited by the (unavoidable) heating of those transistors. We don’t want them to be damaged so the unit will switch the outputs off to protect them. These estimated temperatures are used for that protection measure. The data sheet gives a maximum operating junction temperature for the BUK7909 of 175°C (a pretty typical figure for a Mosfet) but since we’re estimating these, to be safe, we switch the output off above an estimated 150°C. We take into account the increase in on-resistance with elevated temperature and also factor in the estimated thermal resistance of the Mosfet packages and heatsinks, along with an estimated maximum ambient temperature of 45°C, accounting for elevated temperatures inside the unit’s case during operation. We also monitor the Mosfet gate voltages, since if they drop, this will increase the onresistance and thus heating. of the outputs tripping off. You can turn this feature off (in the settings screen) if you don’t need it. Reducing the backlight brightness will also reduce the quiescent current and an estimate of the burden current is shown at centre left (although you can’t really see it when the display backlight is off). The settings screen also lets you select the state of the outputs when the unit is powered up. By default, they are both off. You can instead set them to retain the last state or to be on by default. Retaining the last state would make sense in a semi-permanent installation where the source power could be lost but you want the load to come back on automatically if it was on when power was lost. Backlight control and start-up state Because the unit draws more power from the positive voltage source when the screen is lit and because you may be using it in a situation where it’s left connected longterm, the screen will by default switch off after a period of inactivity. The backlight brightness and time-out settings are shown at centre left and can be changed by touching in this area. This brings up the setting screen (see Fig.2). Touching anywhere on the screen, including areas which do not have any effect, will reset this timer, as will either 78 Silicon Chip Calibration Trimpots VR1 and VR2 on the eFuse PCB allow the common mode rejection of the differential current-sensing amplifiers to be optimised but these do not allow other errors to be adjusted out such as scale errors due to resistor tolerances, offset errors due to bias currents and offset voltages or errors in the voltage dividers which allow the unit to measure the input voltages. These are instead performed digitally, using the touchscreen. All you need to do is set up the unit with a known voltage or current and then hold your finger on the reading which needs to be adjusted (ie, in one of the four corners of the screen) for a couple of seconds. The display will then change to the calibration display; see Fig.3. This shows you the raw reading for that input, along with two adjustments and the adjusted reading. You can increase or decrease the scale and offset factors so that the adjusted reading shown matches the actual reading. Note that readings above 9.99V/9.99A are shown in the calibration screen with an extra digit of resolution for easier adjustment. For example, say you feed exactly 12.00V into the V+ input and you get a reading of 11.70V. Then if you feed 15.00V into V+, you might get a reading of 14.60V. This is an error of -0.3V at 12V and -0.4V at 15V. Since the difference in error is 0.1V with a difference in reading of 2.9V, you can calculate the scale error as being 0.1V / 2.9V = 0.034 and so you can then increase the scale factor to 1.034 and make the measurements again. Celebrating 30 Years siliconchip.com.au This time you should find that the readings you get are something like 12.1V for a 12V input and 15.1V for a 15V input. Since the error is now the same in both cases, that means we have set the scale value correctly (otherwise, nudge it slightly up or down and try again). It’s then just a matter of setting an offset of -0.1V and the readings should be correct. Press “Save” to save the calibration to flash memory. You can then repeat this procedure so that both input voltage and both current readings are as close as possible to being correct. Note that calibrating the current readings can be a little tricky due to noise. The software is designed so that with VR1 and VR2 adjusted correctly and the other calibration settings made correctly, you should get a 0A reading for both outputs with no load. We have to take noise in the measurement system into account when making the calculations since this is overlaid on the current measurements. But you may find you get a non-zero reading with no load and this is a good thing to check once you have finished calibration. If that happens, the easiest solution is to slightly reduce the offset setting for the relevant output(s) to bring the reading closer to zero. This may lead to a small error at higher currents but you shouldn’t need a very large offset (hopefully well under 100mA) to get a zero reading. If you do need a larger adjustment, that suggests that some other aspect of the calibration is off, so go back and check it again. It is important to get the CMRR adjustment correct; if you get a zero reading with no load with an input voltage of say 12V but a non-zero reading at say 30V (or vice versa), that strongly suggests that the CMRR is not good and you need to tweak VR1/VR2 to fix this, then re-check the software calibration. How the software works Start-up self-checks Fuse trip logic While not shown on the main screen, the unit constantly monitors the V+H and V-L voltage rails to make sure that they come up to an appropriate voltage before it begins operation and that they do not drop to the point where the unit will not work correctly. If the V+ supply voltage is not high enough for the unit to operate properly, it will not start up and will display a message indicating this (see Fig.4). Should V+ drop too far during operation, the outputs will automatically be switched off and a similar message displayed. This is to protect the unit itself, since, with a low V+, the Mosfets could go into partial conduction, causing excessive heating. Likewise, if a construction error prevents the V+H or V-L voltages from coming up correctly, at power-up the unit will refuse to operate and will display a message indicating this and showing the voltages. In this case, you will need to switch off and check your construction. If for some reason these voltages drop too much during operation (eg, due to a dud component), the outputs will again switch off and a similar message will be displayed. Conclusion The software for this project can be downloaded from the SILICON CHIP website and a programmed PIC32 microcontroller will be available from the SILICON CHIP on-line shop. siliconchip.com.au We won’t go into too many details about the BASIC code which drives the display, handles touch and basically provides the “user interface” for the eFuse. It’s all pretty standard MMBasic code and if you’re interested, you can download the source code and have a look at it. What made the software a bit tricky for this project was the fairly complex CFUNCTION that we had to build. That’s because we need the unit to be checking the current flow at both outputs several thousand times per second in order to switch the output off if it exceeds the programmed limits. We can’t really rely on BASIC code to do that as it wouldn’t be fast enough and the timing may not be precise. So what we do is call a CFUNCTION at the start of the BASIC code which sets up the analog-to-digital converter (ADC) in the PIC32 to automatically scan the relevant inputs (four to monitor voltages and two for currents) and convert the voltages at those inputs to digital values. We have also set up the main hardware timer, timer 1, to generate periodic interrupts and we check whether the ADC has finished scanning and converting the programmed inputs. If it has, we extract the values from special registers and add them into a set of accumulation registers, as well as keeping track of how many times this has been done. We’ve had to use the timer because MMBasic doesn’t give CFUNCTIONs access to most interrupts and that includes the ADC conversion completed interrupt. As long as the timer interrupts are frequent enough that it won’t miss an ADC conversion complete event, this isn’t an issue. The BASIC code can then call the CFUNCTION with a different set of parameters to retrieve these values and it can then divide the accumulated values by the number of times they have been accumulated to get average readings for each input. It simultaneously resets these accumulators, ready for the next conversion. We’ve built the fuse trip logic into the timer interrupt routine, so that no matter what the BASIC code is doing, if the current flow goes too high or the simulated fuse temperature reaches its limit, the output(s) will be switched off. The BASIC code periodically checks if this has happened and has the ability to then “reset” the fuse later, through another CFUNCTION call. This also has the advantage that the mathematics required to simulate the action of a fuse can be handled efficiently with C code, which is important since the calculations are updated thousands of times per second. There’s one final trick to the CFUNCTION and that is that the pin we have used to control the LCD backlight, pin 18 (RB9) is not one of the Micromite’s PWM outputs. But we want to use PWM to control the backlight brightness. The reason we didn’t use a PWM pin for the backlight is that all PWM pins are also analog inputs on the LCD BackPack, and we needed every single analog capable input for measuring voltages. Incidentally, the PIC32 chip used for the Micromite has a limited capability to re-assign pin functions, meaning that it would theoretically be possible to use other pins for PWM but the Micromite firmware does not currently support this. Anyway, our solution is simply to use the timer 1 interrupt, which we have already had to set up to monitor the ADC state anyway, to pulse this pin with a programmable duty cycle and that allows us to control the backlight brightness while only using up a small number of extra CPU cycles. SC Celebrating 30 Years October 2017  79