Silicon ChipLow voltage DC Motor and Pump Controller (Part 2) - December 2018 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Love or hate Google, the massive EU fine is a joke
  4. Feature: "The Grand Tour": the incredible Voyager missions by Dr David Maddison
  5. Project: An incredibly sensitive Magnetometer to build by Rev. Thomas Scarborough
  6. Project: Amazing light display from our LED Christmas tree... by Tim Blythman
  7. Feature: The Arduino Uno’s cousins: the Nano and Mega by Jim Rowe
  8. Subscriptions
  9. Serviceman's Log: Travelling makes me go cuckoo by Dave Thompson
  10. Christmas Showcase
  11. Project: A Useless Box by Les Kerr & Ross Tester
  12. Feature: El cheapo modules, part 21: stamp-sized audio player by Jim Rowe
  13. PartShop
  14. Project: Low voltage DC Motor and Pump Controller (Part 2) by Nicholas Vinen
  15. Vintage Radio: 1948 AWA compact portable Model 450P by Associate Professor Graham Parslow
  16. Market Centre
  17. Advertising Index
  18. Notes & Errata: Tinnitus & Insomnia Killer, November 2018; LED Tachometer, October-November 2006
  19. Outer Back Cover: Hare & Forbes Machineryhouse

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

You can view 37 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 "An incredibly sensitive Magnetometer to build":
  • Extremely Sensitive Magnetometer PCB [04101011] (AUD $12.50)
  • Extremely Sensitive Magnetometer PCB pattern (PDF download) [04101011] (Free)
  • Drilling template for the High-Sensitivity Magnetometer (PDF download) (Panel Artwork, Free)
Items relevant to "Amazing light display from our LED Christmas tree...":
  • Software for Amazing Light Patterns for the LED Christmas Tree (Free)
Articles in this series:
  • Oh Christmas tree, oh Christmas tree... (November 2018)
  • Oh Christmas tree, oh Christmas tree... (November 2018)
  • Amazing light display from our LED Christmas tree... (December 2018)
  • Amazing light display from our LED Christmas tree... (December 2018)
Items relevant to "A Useless Box":
  • Useless Box PCB [08111181] (AUD $7.50)
  • Pair of programmed micros for the Useless Box [0811118A/B.HEX] (Programmed Microcontroller, AUD $20.00)
  • Software for the Useless Box (Free)
  • Useless Box PCB pattern (PDF download) [08111181] (Free)
  • Useless Box panel label (Panel Artwork, Free)
Items relevant to "El cheapo modules, part 21: stamp-sized audio player":
  • DFPlayer Mini audio player module (Component, AUD $6.00)
  • Sample BASIC source code for interfacing a Micromite with the DFPlayer Mini module (Software, Free)
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)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (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)
  • Low-cost electronic modules: 8×16 LED Matrix module (July 2025)
  • Low-cost electronic modules: 8×16 LED Matrix module (July 2025)
Items relevant to "Low voltage DC Motor and Pump Controller (Part 2)":
  • Four-channel High-current DC Fan and Pump Controller PCB [05108181] (AUD $5.00)
  • PIC16F1459-I/SO programmed for the Four-channel High-current DC Fan & Pump Controller (0510818A.HEX) (Programmed Microcontroller, AUD $10.00)
  • Firmware for the Four-channel High-current DC Fan & Pump Controller (0510818A.HEX) (Software, Free)
  • Four-channel High-current DC Fan and Pump Controller PCB pattern (PDF download) [05108181] (Free)
Articles in this series:
  • Low-voltage, high-current DC Motor Speed Controller (October 2018)
  • Low-voltage, high-current DC Motor Speed Controller (October 2018)
  • Low voltage DC Motor and Pump Controller (Part 2) (December 2018)
  • Low voltage DC Motor and Pump Controller (Part 2) (December 2018)

Purchase a printed copy of this issue for $10.00.

Four-channel High-current DC Fan and Pump Motor Controller – Part II by Nicholas Vinen In the October 2018 issue, we revealed our new high-current fan and pump controller, able to switch up to 40A total with a 12V nominal supply, controlling up to four loads using the readings from between one and four temperature sensors. And it’s programmed over USB, to make the many different settings easy to control. In this second part, we cover PCB assembly, wiring it all up and adjusting those settings to suit your installation. O ne of the main goals with this new DC Fan Controller was to provide many different options to suit different situations, without making it a nightmare to configure. We certainly couldn’t use jumpers and trimpots because there would be just too many and it would be too hard to make any changes once the unit was mounted in a vehicle. So instead, we have made the unit configurable and controllable over a USB text interface. Unfortunately, the low-power micro we’ve chosen doesn’t have a great deal of memory but we’ve come up with a way to provide a friendly user interface that allows you to see the exact settings and make changes via a laptop or desktop PC. Basically, you view and change your settings via a web page which then produces a “magic string” of text which, when pasted into the Fan Controller’s terminal, changes its behaviour to match up what you have entered on the web page. So if you aren’t happy with the way your fans and/or pumps are being operated, it’s a simple matter to reach 84 Silicon Chip the accessible USB plug or socket you’ve fitted, connect it to your PC and upload a new configuration. You can even test it without having to take the vehicle out on the road, simulating battery voltage and changes and temperature sensor changes to see what happens. The PCB itself has been made reasonably compact to make fitting it inside the vehicle easier, by using mostly SMD parts. Despite this, it’s a bit larger than our last solo Fan Controller (January 2018), so you’ll need a bigger box and it’s a bit trickier to find somewhere to fit. But we did find a good location in the packed engine bay of our test vehicle and the wiring is pretty easy, once you’ve purchased appropriate connectors and gotten the hang of soldering them. And anyway, it’s heaps more capable and configurable, so the small penalty in size is well worth it. PCB construction The Fan Controller is built on a PCB coded 05108181, Australia’s electronics magazine siliconchip.com.au FAN1 FAN2 FAN CONTROLLER MK2 MODULE 1 OUTPUT 4 D3 FAN3 FAN4 221 D6 PTC1 10 F 1 1 F CON3 22 F 10kΩ CON5 - TS2 10kΩ THERMISTORS CON6 - TS3 18B20 CON7 - TS4 18B20 CON12 DISABLE ON OFF TEMP SENSORS SC 20 1 9 Fig.4: this diagram shows where each part is fitted to the PCB and also gives an example of how to wire the unit up. Most installations will not use all of the connections shown. Be sure to get the supply and output polarities right – the positive leads go to the pads closest to the board edge. You can mix and match the temperature sensor types; those shown here are just one possibility. which measures 68 x 34.5mm. All the components are mounted on the top side. Use the PCB overlay diagram, Fig.4, as a guide during assembly. If you are fitting onboard USB socket CON1, start with that. Spread a thin smear of flux paste on its four mounting pads and five signal pins, then drop the socket on the board and move it around until the two plastic posts on the underside drop into the alignment holes. You should find its five pins are then positioned over the pads. Nudge it a little if necessary, to get the alignment perfect. Then apply solder to one of the four large pads which attach its “feet”. You will need to apply a fair bit of heat and some extra solder to get a good, solid joint. Re-check the signal pin positions and if necessary, reheat that solder joint and carefully nudge the part without lifting it up. It may be hot, so use caution. Once you’re happy with the position of the signal pins, solder the other three mounting feet, then apply a small amount of solder to those pins. If you load some solder onto the tip of your iron and touch it to the end of the pin (which is partially hidden under the body), the flux paste you applied earlier should help to ‘suck’ the solder off the iron and onto the pin and pad. Repeat this for the other four signal pins and carefully examine them under a magnifier with good light, to ensure a good joint has formed and there are no bridges between pins. If there are bridges, apply a little extra flux paste and then use solder wick and heat from the iron to remove them. Next, move onto microcontroller IC1. It is in a wide SOIC package with relatively large pin spacings, so it is not difficult to solder. First, find its pin 1 dot and make sure that it is orientated as shown in Fig.4. Also, check that it is sitting flat on the board, then tack solder one of its corner pins. It’s easier to solder if you spread a small amount of flux paste on all its pads first. Make sure all the pins are correctly aligned on their pads. If not, heat that initial solder joint and gently nudge it into position. Repeat until you are happy that they are all lined up, then solder the remaining pins and finally, add a little extra solder to the first pin to refresh the joint. Inspect the joints and as before, if you find any bridges, clean them up with flux paste and solder wick. Now you can proceed to solder IC2, IC3 and REG1 similarly, as they are all in smaller SOIC packages. Note though that their pin 1 dot is orientated differently to IC1. Check the orientation carefully against what is shown in Fig.4 siliconchip.com.au 220Ω REG2 100nF CON4 - TS1 1S 1A FUSE 10kΩ 4.7kΩ 4.7kΩ 4.7kΩ 4.7kΩ OUTPUT 3 1 CON2 ICSP D4 Q2 GND D+ D- VCC 100kΩ 220Ω POWER TVS1 10-40A BLADE FUSE 1nF 12V BATTERY 1kΩ – D1 100nF IC3 + 470nF 1 1kΩ 100nF 1kΩ D5 CON1 220Ω 1 39kΩ Q4 OUTPUT 2 IC1 PIC 16F1459 IC2 Q1 CON13 - LED D7 Q3 REG1 100nF OUTPUT 1 10kΩ LED1 100kΩ D2 The completed motor/pump controller is shown here slightly oversize for clarity (actual PCB size is 68mm wide – as seen above). Yes, it is all SMD components so a good eye, a steady hand and a fine-tipped iron are all required. before soldering each chip. Mosfets Q1 and Q2 should be fitted next. These are in a similar package to IC2, IC3 and REG1 except that the pairs of pins on one side are joined together. So we have provided larger pads to solder those pairs of pins to the board. Again, check that the pin 1 dot is orientated correctly – the same as IC2 and IC3 – before soldering them in place. These are seven small three-pin SOT-23 package pards on the board: Q3, Q4, D5-D7 and REG2. They look similar so don’t get them mixed up. Their pins are widely spaced, so they are pretty easy to solder. Use the same technique as with the ICs; it’s generally easier to tack the pin that’s all by itself on one side first, then solder the other two pins and refresh the first solder joint last. Now fit the smaller (3216/1206-size) resistors and capacitors. The required values and positions are shown in Fig.4. They are not polarised, so orientation is not important. The resistors will be printed with a 3-digit or 4-digit code on the top to indicate their value, while the ceramic capacitors will be unmarked so be careful not to mix them up. It’s the same basic method – tack one end, check the positioning and then solder the opposite side and go back and refresh the first joint. Besides making sure the parts are flat on the board and that the solder joints are made properly, the main trick is to be patient and wait several seconds between soldering one side of the part and the other. This gives the joint time to solidify. Otherwise, the part will tend to move out of position when you touch it with the iron. Australia’s electronics magazine December 2018  85 You can now fit PTC1 and the large 220 resistor next to it, using the same basic technique. Keep in mind that these larger parts will require a bit more heat and solder to form good joints. Neither of these components are polarised. The diodes are also two-terminal devices and can be soldered in the same manner as the passives but are larger again so they will also need a bit more heat. Fit diodes D1D4 now, ensuring that their cathode stripe faces towards the right side, ie, into the middle of the board. You can also fit TVS1 now; it’s larger again but otherwise is similar to the other diodes. The last remaining SMD component is the 22µF tantalum capacitor next to REG1. It is also polarised and must be soldered with its positive end (generally marked with a stripe) towards the bottom edge of the board. You can now move on to fit the headers that you require for your application. You will need at least one of the four temperature sensor headers (CON4-CON7); we recommend that you fit all four, even if you aren’t planning to use them, in case you want to add more sensors later. You can also fit CON12 and/or CON13 now, for the enable/disable control and indicator LED. Again, you may want to fit them even if you aren’t planning to use them, Parts list – Fan/Pump Controller for sample installation with one fan and three temperature sensors (change to suit yours) 1 DC Fan/Pump Controller PCB Mk2, fully assembled 1 IP65-rated sealed high-temperature ABS box, 15x65x40mm [Jaycar Cat HB6122] 1 USB mini-B to type-A cable 2 30A waterproof blade fuse holders with LED [Jaycar Cat SZ2042] 1 1A blade fuse [Jaycar Cat SF2126] 1 20A blade fuse [Jaycar Cat SF2138] 2 6mm non-insulated eye terminals [Jaycar Cat PT4934] 1 4-way Deutsch waterproof plug/socket set [Jaycar Cat PP2149] 1 2-way Narva-style waterproof plug/socket set [Jaycar Cat PP2110] 1 4-way Narva-style waterproof plug/socket set [Jaycar Cat PP2114] 1 2-way 250-series automotive socket (to suit radiator fan) Jaycar Cat PP2062] 1 1m length 2-core 7.5A automotive cable [Jaycat Cat WH3057] 1 1m length 2-core 15A automotive cable [Jaycar Cat WH3079] 1 1m length 2-core 25A tinned automotive cable [Jaycar Cat WH3087] 1 1m length 25A black tinned automotive cable [Jaycar Cat WH3082] 1 1.2m length 10mm diameter clear heatshrink tubing [Jaycar Cat WH5555] 2 DS18B20 digital temperature sensors in waterproof housings [SILICON CHIP cat SC3359] 1 10k lug-mount NTC thermistor [Altronics Cat R4112] 3 2-pin polarised headers, 2.54mm pitch, with pins [Jaycar Cat HM3402] 2 M6 copper crinkle washers 2 M6 hex nuts 86 Silicon Chip in case you change your mind later. Planning the wiring As mentioned in the first article (October 2018), rather than use connectors for the high-current wiring, we have simply provided large pads on the board, to which fairly thick wires can be soldered directly. While it is possible to use fixed cables, we suggest that you use in-line connectors on most or all of the wires. This has a few advantages: it makes testing easier, it makes it easier to replace a sensor or fan later if you have to, it makes it easier to remove the unit in case you need to repair or reprogram the unit, and so on. There are various suitable types of inline automotive connectors, many of which are waterproof. While waterproof connectors are not critical for the 12V supply wiring or connections to fans/pumps, we recommend that you use them for the sensors, enable/disable line and external LED wiring (if used) as water may conduct enough current to affect the function of those devices. See the panel below for more details on suitable connectors that are available. Having decided where you will have connectors and what type to use, you will then need to find a suitable location for the case that will house your PCB. We strongly suggest that you use an IP65 (or better) rated waterproof box. You could use an ordinary plastic box and waterproof it with silicone but it will be hard to get it apart later if you need to. We used a sealed ABS plastic box from Jaycar – see the additional parts list (at left) for details. Figure out where your box will fit in the vehicle and also how you will attach it. We used a screw through one of the box’s two integral mounting holes, through a support member in the vehicle (which already had a hole in it) and into a piece of foam, capped off by a washer and a nut. We also placed a thin piece of foam (with a hole in it) between the box and the cross member. This provides some vibration reduction compared to rigidly mounting it to the vehicle. Now that you have a location for the box, you can measure the lengths of all the required cables. The easiest way to measure how long a cable needs to be is to thread a spare piece of wire through the vehicle between the two points to be connected, loosely, then pinch the end in one hand, pull it out and measure its length. Remember that some parts of the car may flex or move, so don’t make it too tight. You will also need to calculate the minimum current rating for each. This will typically be 10-20A for fan cables and 10-40A for the battery cables. Just about any wire can be used for the sensor wiring, enable/disable switch, LED and battery voltage sense wiring, as these all carry mere milliamps. When cutting the cables to length, remember to account for the length lost stripping both the inner and (where present) outer layers of insulation, plus a bit extra in case you damage the wire while stripping it and have to cut it off. Having cut and stripped the insulation off the ends of all the various cables required, crimp and/or solder the connectors on. Leave the connectors that will plug into the PCB off for the moment. Don’t forget to make provision for some heatshrink tub- Australia’s electronics magazine siliconchip.com.au There’s not a huge amount of space under the hood of many cars, especially a big V8! Choose a location that doesn’t interfere with the operation of any other controls and, preferably, is easy to get to! Ensure all wiring is adequately secured. ing for any multi-wire or multi-cable bundles, to keep everything neat when you run them later. Configuration and testing It’s a good idea to test the unit before making the final connections since if you find any problems later, it will be harder to fix them if the unit is already captive in its case due to wires soldered directly to the board. You will need to load it with its initial configuration. All you need to do this is a computer with a USB port and a serial terminal program such as Tera Term Pro (a free download from https://ttssh2.osdn.jp/index.html.en). You also need an internet connection, although it doesn’t necessarily need to be available at the same time that the computer is hooked up to the unit; you can prepare the configuration beforehand. Start by plugging the finished board into your computer using either a Type-A to mini Type-B USB cable (if you fitted CON1) or a chassis-mounting Type-B socket wired into CON3, plus a suitable cable. Check that your computer has detected a new USB serial device. That verifies that the microcontroller is working correctly. In Windows 10, you can do this by right-clicking on the Start button, choosing “Settings” from the menu that appears, then clicking on the Devices icon. You should see a device listed with a name like “USB Serial Port (COM5)”. The COM number will vary. Open this serial port using your chosen terminal emulator and then type “status” and press Enter. You should get a status display similar to that shown in Fig.6. If you siliconchip.com.au don’t, check your port settings (the baud rate setting and so on are not important). If you can’t get any response, you may have a wiring or hardware fault, so check that your USB socket is soldered and wired correctly, that the PIC chip (IC1) is properly programmed and soldered and that all associated components have been fitted correctly. Once you’ve established communications with the chip, open a web browser and go to http://siliconchip.com.au/ apps/DCFanMk2 This page will help you set up a basic configuration for the unit, for further testing. See the panel on Settings for help on how to set the unit up initially. The web page referred to above translates your desired settings into an encoded string which you can send to the Fan/Pump controller, setting its configuration to the desired state. Read up on the basic settings now – you can ignore the more advanced settings for now. You can read about them later, once you’ve established that everything is working. Loading the configuration Once you have selected all the options you want, click the “Copy to clipboard” button at the bottom of the window, then switch to your terminal program and paste the configuration string (which is now in the system clipboard) into the terminal. You can do this in Tera Term Pro by right-clicking in the terminal window, then pressing Enter. You should get a response that says “OK”. If it says “Error”, then the clipboard string has somehow become corrupted. Australia’s electronics magazine December 2018  87 Explanation of Settings Basic Settings The settings user interface (available at http://siliconchip.com.au/apps/DCFanMk2) is shown in Fig.5. Note that this has been revised slightly since the October article, to remove some unnecessary features and add some other useful ones. Start by using the top four drop-downs to select the type of temperature sensors you have hooked up to CON4-CON7. The following three voltage thresholds control how the unit responds to changing battery voltages. The defaults are sensible, so you don’t necessarily need to change them. The first determines the voltage the battery needs to rise above before the unit will become active. The second determines the voltage it must fall below when active to terminate normal operation and enter cool-down mode, an optional time during which the fans and/ or pumps will continue to run, possibly with reduced duty cycles. The third voltage threshold prevents cooldown mode from flattening the battery. If the battery voltage falls below this during cool-down mode, the unit will immediately go into sleep mode and wait for the battery voltage to rise above the switch-on threshold before becoming active again. The cool-down delay is designed so that vehicles which charge the batteries sporadically will not enter cool-down straight away when the battery is no longer being charged. The battery voltage must be below the “Enter cool-down” threshold for this long before it will go into cool-down mode. For vehicles which continuously charge the battery, set this to a short time (eg, 1s). The minimum cool-down on-time sets the minimum time that the unit must be in full operation before it goes into cool-down mode. If the battery voltage is above the threshold for a shorter time than this, the unit will immediately shut down instead. The cool-down time is the maximum number of seconds that the unit will spend in cool-down mode before shutting down. Cool-down compensation allows you to reduce the fan/pump duty cycles in cooldown mode, compared to what they would be during normal operation given the sensor temperatures. Upon entering cool-down mode, the duty cycles are immediately multiplied by the maximum value of this setting. So if that is 75%, they will drop by 25%. The minimum duty cycle setting for each output will still be in effect. As the battery voltage drops towards the 88 Silicon Chip shut-down threshold, the duty cycle multiply value approaches the lower value of the setting. So with the default values, duty cycles will reduce from 75% of nominal to 25% of nominal before the unit shuts off completely. Per-output settings Each output has a similar configuration entry in the table beneath the global settings. You can enable or disable each output individually using the drop-downs at left. You can also set output #2 to be a slave to #1 so that the two outputs can be paralleled to give a single 20A output. The same comment applies for outputs #3 and #4. The PWM frequency must be the same for outputs #1 and #2 and the range of possible frequencies is shown on-screen, along with the closest frequency to the one you have selected, which will be the actual frequency used. Note that the real frequency will also vary slightly depending on the micro’s oscillator calibration. The frequencies for outputs #3 and #4 can be set independently but only if one of them is 10Hz or less. The maximum frequency setting for these two inputs is 2kHz. Typically, you would only use two different frequencies if one of these outputs is controlling a pump and you want it to be driven with long pulses. In this case, you can choose a frequency as low as 1/10Hz (100mHz). The duty cycle for the output is determined by three main parameters: the duty cycle range, the temperature range and the way the sensor data is combined. The lowest duty cycle in the range given will occur when the sensor reading is at the lowest temperature specified, and the highest duty cycle will occur when the sensor reading is at the highest temperature specified. In other words, if you set the duty cycle range to 40-60% and the temperature range to 20-30°C, you will get a duty cycle of 40% at 20°C, 42% at 21°C, ... 58% at 29°C and 60% at 30°C. In the simplest case, this temperature is derived from a single sensor. This is the default; you will find that initially, the duty cycle of output 1 is derived from TS1, of output 2 from TS2 and so on. But you can change this mapping. Multiple outputs can use the same sensor if desired. The final setting we’ll describe here is the ramp rate, which specifies the minimum number of milliseconds that it takes for the output duty cycle to change by 1%. So if you set this to, say, 100ms then a change from 0% to 100% duty cycle will take 10 seconds. Advanced Settings The Curve setting for each output allows you Australia’s electronics magazine to compensate for loads where the speed/ power is not directly proportional to voltage, linearising their speed to temperature relationship. For example, if you have a fan where speed is proportional to the cube of the average voltage across it, use the Cube Root setting to provide a more linear speed with temperature. SVC stands for Supply Voltage Compensation and allows the duty cycle to be automatically dialled back as the battery voltage increases, providing a constant voltage/ speed for a given input temperature. Simply specify the voltage at which you want this to take effect (eg, 12V). If the supply voltage is, say, 13V then the duty cycle will be reduced to 12/13 of nominal to give the same average voltage across the load. Advanced temperature formulas To the right of the sensor name, you will see a minus sign and then a drop-down box containing zero. You can select a different number to offset the sensor reading or, more usefully, you can select a second temperature sensor to make a differential reading. The temperature settings you enter for “Temperature range” then refer to the difference between the two sensors. Rather than using a single sensor on either side of the minus sign, you can instead change the blank dropdown in front of it to read “min” or “max” and this will let you select a second sensor. The temperature used in the calculation will then be the lowest (min) or highest (max) of the two readings. Or you can make one of the values a constant; the temperature sensor reading will then be clamped when it goes below (min) or above (max) that value. That feature is most useful in the differential sensing mode. So effectively, you can build a simple formula to derive the temperature reading from up to four sensors, rather than just using the temperature from one sensor directly. There is one additional option; you can actually have TWO such formulas, using the same structure (but they can be different). The unit will calculate both values and then the result will be either the lowest (min), highest (max) or average (avg) of the result. That gives you a further way to combine multiple temperature readings. To enable that option, click on the first black drop-down in the temperature measurement box and change it to one of the three other options. The second formula will then appear, and you can fill it in. siliconchip.com.au Immediately after pressing Enter, the new configuration takes effect. Type “show status” and press Enter and you may see some changes already. Initial testing You can now use the “override” command to perform some basic checks on your settings. The override command lets you ask the unit to pretend that the supply voltage or temperature sensor readings are a particular value, so you can see what happens without actually having to vary the supply voltage or heat up or cool down the sensors. This is useful both when the unit is installed in the vehicle (since you can’t always get the sensors to read what you want while idling) but also at this early stage, to avoid the need for variable voltage sources and variable resistors. First, run the “status” command (type “status” and press Enter). Since the unit has no 12V supply, it should give a supply reading close to 0V and it should indicate that it is in sleep mode as a result. Now issue the command “override supply 14.4V” (or similar). Re-run the status command. You should see that the supposed supply voltage has increased and that the unit is now in run mode. However, since it knows there is no 12V supply, it will not drive the Mosfets, to protect the driving circuitry (which runs off the currently non-existent 12V supply). Still, you can see what PWM duty cycle the unit will drive each output to for the current temperature sensor inputs. You can then issue a command like “override TS1 47.5C” to make it pretend that temperature sensor #1 is actually at 47.5°C, rather than its actual current temperature. Re-run the status command and observe how the output duty cycle(s) change. You can then override other sensor temperatures, or change the existing one, to see what happens. If it isn’t working as expected, review your configuration and repeat the procedure above to load the new configuration into the unit, then continue testing in this manner. See Fig.6 for an example where the override feature is used. Once you have finished testing, issue the “override clear” command and the unit will go back to working as usual. You can then proceed to connect actual loads if you want – they don’t have to be fans, a 12V LED would work and would give you an easy way to see how the duty cycle changes. Having said that, since your fan(s) will already have the right connectors, it may be easiest to use them for testing. Just make sure you have them in a safe location so that when they are powered up, they don’t fall over and the Fig.5: a screen grab of the latest version of the web-based configuration interface. The upper section allows you to configure the temperature sensor types, supply voltage thresholds, timing parameters and cool-down mode settings. The lower section controls the relationship between sensor temperature and duty cycle for the four outputs. In this example, outputs #1 & #2 are combined to control a single 20A fan, based on the temperature of three sensors. siliconchip.com.au Australia’s electronics magazine December 2018  89 Common automotive connectors Deutsch connectors We have used two different types of waterproof connector on our prototype. For the two DS18B20 sensors, we used a single 4-pin Deutsch plug and socket set (Jaycar Cat PP2149). This was cheaper than two 2-pin plugs and sockets (Jaycar Cat PP2150). A 6-pin version is also available (Cat PP2148). Deutsch connectors are used widely on vehicles and are known to be reliable, with a typical current rating of 13A/pin. They are relatively easy to put together, although there are a few steps, and ideally, you should use a specialised crimping tool (but you can get away without it). Jaycar sells an appropriate tool, Cat TH2000, which also requires a Deutch die set (Cat TH2011). First, if the wires you will be attaching to the connectors are part of a multi-core cable, you will need to strip back about 20mm of the outer insulation to expose enough wire to feed into the connectors. You need to strip about 3mm of insulation away from the end of each wire to crimp into the pins later. Both the plug and socket have a thick gasket inserted into the rear, with a small hole for each wire. The first step is to carefully prise this out of each shell and then push wires through these holes. If your wire is particularly thin (as is the case with the waterproof DS18B20 sensors), use heatshrink tubing to make the wire diameter larger so it will seal properly when pushed through. The next step is to crimp the wires onto the pins. One set has pointed ends and the other set have cups in the end, which accept the pointed ends of the other pins. The cupped pins are larger so you can figure out which shell they go into by checking for the one with the slightly larger holes. Once you’ve figured out which pins will go on which wires, fold the larger metal leaves around the wire insulation, crimping them to hold the wire in place. Next, fold the smaller leaves around the exposed copper. A Deutsch crimping tool will do all this in one step but if you don’t have one, you can use small pliers (ideally with angled ends) to carefully fold the leaves around the wire and clamp it down hard. It isn’t ideal but it works. The trick to doing this is to make sure that you don’t just squish the leaves flat, as they will tend to spread out and make the pin too wide. You also need to compress them horizontally, so that the final crimp is compact. We also like to add a little flux and then solder to the top of the exposed wires to ensure good electrical contact, but that technically shouldn’t be necessary if the wires have been properly crimped (but that’s quite tricky to get right if the wire is very thin). Once all the pins are soldered, push them into the rear of each housing until you hear them click into place. For the cupped pins, you will know they have been pushed home because their ends will be flush with the front of the connector. For the pointy pins, it can be quite hard to push them in (especially with the gasket in the way), so you may find it easier to push them in part way and then grab them from inside the front of the shell using pliers, and pull them forward until they lock in place. Now all you need to do is push both gaskets back into the rear of each shell, making sure that they sit flush with the rear of the connector all around the edge, then push the flat orange plastic piece into the end of the socket (ie, the shell with the cupped pins) until it locks into place. This stops the sealing gasket from being pulled off when you withdraw it from the plug later. The green plastic wedge pushes into the end of the plug and locks in place in a similar manner. Narva connectors This is another type of multi-pin waterproof automotive connector, rated at 20A/pin. They are a bit more expensive than a Deutsch connector but have a higher current rating. Jaycar sells these in 2-pin (Cat PP2110), 3-pin (Cat PP2112), 4-pin (Cat PP2114) and 6-pin (Cat PP2116) versions. We have used two in our set-up; one 2-pin version for the NTC thermistor on the intercooler radiator, mainly because we already had a suitable plug wired to the existing thermistor in the vehicle, and a 4-pin version to connect the unit to the battery. Its 20A rating is sufficient for our installation as only one fan is being driven, and the four pins mean we can connect both pairs of battery wires in a single plug/socket. One of the disadvantages of this type of connector is that the socket pins are a bit sloppy and so plugging the two pieces together can be a bit of a chore. But once the pins find the cups, they all lock into place. Assembling these is similar to the Deutsch connectors but there are some differences. Rather than one large rubber gasket at the rear, there are individual gaskets for each wire, so you need to remember to push these over the wires before crimping the pins (although they can be pushed over the pins if you’ve forgotten). Both the plug and the socket have a section at the rear which unclips and swings out, to allow you to insert the pins, which click into place. You then push the gaskets in, leaving the small central section sticking out, then swing the rear back into place and latch it using the plastic clips. This prevents the gaskets from falling out. You can tell which is the plug and which is the socket since the socket (which takes the cupped pins) has larger entry holes and is overall deeper. Note that the gaskets will fit wire rated at around 15-20A. Thinner Both the Deutsch (left) and Narva (right) connectors are waterproof and are available with various numbers of pins, from 2 to 47(!). 90 Silicon Chip Australia’s electronics magazine siliconchip.com.au gauge wire will need to have heatshrink added to form a proper seal while larger gauge wire (~25A) cannot fit through the gaskets (and will only just fit in the connector). You will need to use silicone sealant if you need connectors with heavy duty wiring to be waterproof. Overall, we suggest that you stick with Deutsch connectors unless your application exceeds their 13A/pin current rating as they are easier to use. Non-waterproof options Chances are your fans/pumps will already have a plug and it will be easier if you can find a matching plug rather than cut off the existing one and attach a new one or hard-wire it (although that’s certainly feasible). Our fan already had a “250-series” two-pin connector and these are available from Jaycar too; they sell 2-pin (Cat PP2062), 3-pin (Cat PP2064), 4-pin (Cat PP2066), 6-pin (Cat PP2068) and 8-pin (Cat PP2069) versions. Make sure you use wire with a high enough current rating to suit your fan. Keep in mind the fan’s specified nominal current may be for a 12V supply, and it could draw around 30% more current at 14.4V when the battery is being charged. Another option for high-current connections, especially to the battery, is Andersen connectors, which are also available from Jaycar. These are available in a range of current ratings including 35A, 50A, 75A, 120A, and175A. These are dual “genderless” connectors (ie, two identical connectors will plug into each other). Individual Anderson connectors are also available, with lower current ratings. The 50A connectors are quite large but are probably the best choice for battery connections requiring 30-40A. The lower rated connectors will not accept thick wire and are challenging to assemble, whereas the 50A and up versions feature a “solder cup” which you can fill with liquid solder and then push the wire into, making them relatively straightforward to put together. We used the 250-series (right) plug because that’s what our radiator had fitted. The two-way Narva connector (below) was used because it had a higher current rating (20A). There are several other types available. siliconchip.com.au spinning blades won’t hit anything. You will also need to connect the sensors (if not already connected) and a 12V power supply with sufficient current capability for further testing. This could be your car battery. You can also use the override command in live testing. It’s also a good idea to check that the sensors are actually working, rather than just relying on the override command. Test each sensor by heating it up or cooling it down slightly, then re-run the status command and check that the temperature reading from that sensor has changed as expected. You can use a hot air gun, some ice, a cigarette lighter etc. Just make sure if you are heating the sensor that you don’t overheat it or anything nearby. For example, if using a lighter, keep the flame some distance below the sensor and don’t heat it for more than a few seconds. You may also be able to observe the fans/pumps being driven, depending on whether you’re pushing the sensor temperatures into the ranges where those loads are activated. Preparing the case Now you need to figure out where each wire is going to enter the case. Try to keep in mind the layout of the pads and connectors on the PCB, ie, avoid wires crossing all over the place inside the box, if possible. Mark and drill the holes required to get those wires into the case. Don’t make the holes any larger than necessary. Solder the fan/pump and power supply wires onto the pads, in the locations shown on Fig.4. It helps to pull these as far into the box as necessary, so you can do the soldering outside the box, then pull the wires back out when you have finished. The other connections are made with polarised plugs. Depending on the sizes of the holes you’ve made, you may be able to crimp/solder these onto the wires and then feed them through the holes, then push them into the plastic plug blocks. If they don’t fit through the holes, you will have to feed the wires through first and then crimp/solder the pins afterwards. Note that the LED and any DS18B20 temperature sensor wires are polarity sensitive, so make sure you refer to Fig.4, so you get them on the right side of each plug. The enable/ disable and any NTC thermistor wiring is not polarity sensitive so the pins can go into the plugs either way around. While it isn’t necessary to bring the USB connector outside the case – you could just open up the case and plug in a cable if you need to change the way the unit operates – it’s certainly more convenient to have it available from the outside. This is especially true if the unit is going to be buried behind panels or under other bits of the vehicle. We’ve provided the option to fit a waterproof USB socket on the outside of the case and connect it via pin header CON3. Simply wire up the USB socket pins as per Fig.4 – the standard USB wire colour codes are shown there too. But in many cases, it will be easier to feed a micro-B to Type A USB cable through a hole in the box and plug it into CON1 on the board, then seal up the hole with silicone sealant. Tuck the USB plug away somewhere that it won’t get splashed with too much water and tie it up with a twist tie or two so that you can easily remove it and plug it into Australia’s electronics magazine December 2018  91 List of USB serial terminal commands status - shows the unit’s current status, including sensed battery voltage, sleep/cool-down/active state, sensor temperatures, PWM output duty cycles and override status. Fig.6: this shows how you can use the override command in the USB serial terminal to test the unit. You can set pretend supply voltages and sensor temperatures and observe how this changes the output duty cycles. If you have fans and a power supply connected, their speeds will change as if the sensor temperatures have changed to the values given. a laptop later if you need to reconfigure the unit. dump - displays the unit’s configuration string (including restore command) on the console. This can be pasted into the web app to retrieve the current configuration. restore - when followed by a base64-encoded string of the appropriate length, updates the unit’s configuration in RAM with the new settings (get this from the web app). save - saves the current configuration in RAM to flash, so it is retained the next time power is cycled. Usually used after a restore command. That’s the approach we took in our installation revert - loads the configuration from flash into RAM, overwriting any changes which have been made but Once you have fed all the wires in through the holes not saved since power-up. you’ve made in the box, solder and/or plug them into the ILICON HIPoutputs to get board where required. If you’re paralleling Gives instant calculation of a short wire link beoverride supply xx.xxV - pretend that the supply voltthe 20Ayou current rating, you can run age- isFrequency the specified value until cleared. Inductance - Reactance Capacitance tween the negative pads for the master and-slave outputs. There’s no need to link the positive pads since they all join override TSn xx.xxC - predent that temperature sensor to the 12V supply anyway. n is at theas specified It’s thenfind time forwall a final testasbefore PCB You’ll this chart handylocating as yourthe multimeter – and just useful!temperature until cleared. neatly inyou’re the case and securing with neutral Whether a raw beginner or a PhD it rocket scientist . . . ifcure you’resilibuilding, repairing, checking or designing override clearthis - clear all current overrides. cone sealant. Use this theissame sealant inwaiting generous quantities electronics circuits, what you’ve been for! Why try to remember formulas when chart will youup the all answers you seek in seconds . . easily! Read the feature in the Januar y 2016 issue of SILICON CHIP togive seal the gaps around the .wires where they enter (you can view it online to see just how much simpler makeuse yourcable life! ties to tidy up the wiring, but again, leave the case, on both sides. Even if it) looks like a tight fit, hitit willand HUGvehiAll you dogoop, is followjust the in linescase! for the known values . . . and read the unknown value off the intersecting it with the a little slack to allow axis. for movement. After all, most E 42especially 0 It really is that easy –are andtoo fasttaut (much faster you than reaching yourflex calculator! x5 Make sure none of the wires either; want forcles quite a bit when going over big bumps, on heavy 94mm photo pa per Printedslack on heavy (200gsm) phototopaper flat (rolled in tube) Limited quantityengine. available a little inside the case allowMailed for a small amount ofor folded around the heavy Mailed Folded: Mailed Rolled: movement. Leave it for a few hours to set. Tie the USB cable (if using a captive one) somewhere con$20.00 inc P&P & GST ORDER NOW AT www.siliconchi p.com.au/shop $10.00 inc P&P & GST You can then locate it in your vehicle, in the place de- venient, out of the way but where you can easily reach it termined earlier, and tie it down using screws, cable ties once any panels are back in place that you have removed, or any other method you see fit. in case you need to adjust the settings later. As we said, it’s a good idea to place some springy foam Now all that’s left is to go for a drive and make sure that or rubber between the case and the vehicle to provide some everything is working as expected! If you want to leave a vibration isolation. We used one of the case’s two water- laptop plugged in while driving (eg, via a USB extension proof screw mounting holes to attach it to a cross member cable), that’s OK, just make sure it’s routed in a safe manin the vehicle. ner (ie, don’t leave the bonnet open while driving) and get After another quick check to make sure everything is a passenger to monitor the sensors and fans via the “staworking, screw the lid on (including the waterproof gasket) tus” command. SC The S C READY RECKONER It’s ESSENTIAL For ANYONE in ELECTRONICS The SILICON CHIP READY RECKONER Gives you instant calculation of Inductance - Reactance - Capacitance - Frequency It’s ESSENTIAL For ANYONE in ELECTRONICS You’ll find this wall chart as handy as your multimeter – and just as useful! Whether you’re a raw beginner or a PhD rocket scientist . . . if you’re building, repairing, checking or designing electronics circuits, this is what you’ve been waiting for! Why try to remember formulas when this chart will give you the answers you seek in seconds . . . easily! Read the feature in the Januar y 2016 issue of SILICON CHIP (you can view it online) to see just how much simpler it will make your life! All you do is follow the lines for the known values . . . and read the unknown value off the intersecting axis. It really is that easy – and fast (much faster than reaching for your calculator! Printed on heavy (200gsm) photo paper Mailed flat (rolled in tube) or folded Limited quantity available Mailed Folded: Mailed Rolled: $20.00 inc P&P & GST ORDER NOW AT www.siliconchi p.com.au/shop $10.00 inc P&P & GST 92 Silicon Chip Australia’s electronics magazine HU 420x59G4Em on heavy photo pa m per siliconchip.com.au