Silicon ChipSwitch on or off anything with a Temperature Switch - June 2018 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: I, for one, welcome our new farm robot overlords
  4. Feature: AgBots – robots working on the farm of tomorrow! by Dr David Maddison
  5. Project: The USB Flexitimer: accurately timed switching by John Clarke and Nicholas Vinen
  6. Project: Wide-range digital LC Meter by Tim Blythman
  7. PartShop
  8. Project: Switch on or off anything with a Temperature Switch by John Clarke
  9. Subscriptions
  10. Serviceman's Log: Repairing ‘proper’ stereo gear is satisfying by Dave Thompson
  11. Project: 800W (+) Uninterruptible Power Supply (UPS) Part II by Duraid Madina and Tim Blythman
  12. Review: Degen’s wind-up or solar-powered AM/FM/SW radio by Ross Tester
  13. Feature: El Cheapo Modules 17: 4GHz digital attenuator by Jim Rowe
  14. PartShop
  15. Vintage Radio: 1952 Astor GP/PS Hybrid Portable by Associate Professor Graham Parslow
  16. Product Showcase
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: 6GHz+ Touchscreen Frequency Counter / 800W+ Uninterruptible Power Supply / Deluxe Frequency Switch / USB Port Protector
  20. Outer Back Cover

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

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

Articles in this series:
  • AgBots – robots working on the farm of tomorrow! (June 2018)
  • AgBots – robots working on the farm of tomorrow! (June 2018)
  • The farm of the future . . . Part II (July 2018)
  • The farm of the future . . . Part II (July 2018)
Items relevant to "The USB Flexitimer: accurately timed switching":
  • USB Flexitimer PCB [19106181] (AUD $7.50)
  • PIC16F1455-I/P programmed for the USB Flexitimer [1910618A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (C and HEX) files for the USB Flexitimer [1910618A.HEX] (Software, Free)
  • USB Flexitimer PCB pattern (PDF download) [19106181] (Free)
Items relevant to "Wide-range digital LC Meter":
  • Wide-range digital LC Meter PCB with stackable headers [04106181] (AUD $7.50)
  • Wide-range digital LC Meter PCB [04106181] (AUD $5.00)
  • Pair of PCB-mounting right-angle banana sockets (red/black) (Component, AUD $6.00)
  • 1nF ±1% polypropylene (MKP) or C0G/NP0 ceramic capacitor (Component, AUD $2.50)
  • 20x4 Alphanumeric serial (I²C) LCD module with blue backlight (Component, AUD $15.00)
  • Case pieces for the Wide-range Digital LC Meter (PCB, AUD $7.50)
  • Arduino Sketch (.ino) and libraries for the Wide-Range Digital LC Meter (Software, Free)
  • Wide-range digital LC Meter PCB pattern (PDF download) [04106181] (Free)
Items relevant to "Switch on or off anything with a Temperature Switch":
  • Temperature Switch Mk2 PCB [05105181] (AUD $7.50)
  • PIC12F617-I/P programmed for the Temperature Switch Mk2 [0510518A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (ASM and HEX) files for the Temperature Switch Mk2 [0510518A.HEX] (Software, Free)
  • Temperature Switch Mk2 PCB pattern (PDF download) [05105181] (Free)
Items relevant to "800W (+) Uninterruptible Power Supply (UPS) Part II":
  • 800W+ Uninterruptible Power Supply control shield PCB [11106181] (AUD $5.00)
  • Arduino Sketches (.ino) and library for the 800W+ Uninterruptable Power Supply (Software, Free)
  • 800W+ Uninterruptible Power Supply control shield PCB pattern (PDF download) [11106181] (Free)
  • 800W+ Uninterruptible Power Supply front panel artwork (PDF download) (Free)
Articles in this series:
  • 800W (+) Uninterruptible Power Supply (UPS) (May 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) (May 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part II (June 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part II (June 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part III (July 2018)
  • 800W (+) Uninterruptible Power Supply (UPS) Part III (July 2018)
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)

Purchase a printed copy of this issue for $10.00.

Switch on or off when it’s TOO HOT or TOO COLD • Monitors from -10°C to +125°C • Resolution: 1°C up to 100°C; 2°C for 100-125°C • Adjustable hysteresis • Accuracy: typically ±2°C • Two sets of relay contacts to control two individual devices By John Clarke Temperature Switch Mk2 Turn on a pump or fan if something is too hot... or turn on a heater if it's too cold. Two sets of changeover contacts allow a flexible switching arrangement. All you need to set it up is a multimeter. T here are many instances where you may want to switch something on or off at a certain temperature. You could be switching a fan, pump, light, alarm, heater, cooler or something else. Our new Temperature Switch Mk2 can do any of these tasks. You can use it in automotive, household and industrial applications. If switching the load directly, the Temperature Switch can be used for devices that have a supply voltage up to 30V DC or AC and draw up to 5A (or 8A if the specified Altronics relay is used). If you want to switch mains-powered devices you will need a separate 250VAC-rated relay, contactor or solid state relay. The Temperature Switch's relay can be energised when the temperature goes above (or below) a particular threshold, which is set using a trimpot (VR1). Then you can set a lower (or higher) threshold temperature with another trimpot (VR2). Why do you need two temperature settings? In practice, if you have just one temperature setting, the relay may switch rapidly on and off (chatter) as the temperature changes by very small amounts near your preset temperature. The difference between the two temperature settings can be as little ⁤ Switches a relay if the temperature goes above (or below) a preset value and keeps it on until the temperature drops below (or goes above) a second preset value ⁤ Relay contact rating of up to 30VAC/DC at 5A or 8A (see parts list) ⁤ Adjustable hysteresis is set with an upper and lower threshold ⁤ Switching temperature can be anywhere from -10°C to +125°C ⁤ Power supply: 12-15V DC at up to 60mA; quiescent current 20mA ⁤ Indicators: power on LED1, relay energised LED2 ⁤ Thermistor temperature reading between TP4 and TPref, 10mV/°C 44 Silicon Chip Celebrating 30 Years as 1°C but in practice you would go for a larger difference to stop the relay from switching too frequently. In effect, these two temperature thresholds provide hysteresis for the circuit. For example, you could set the unit to energise the relay if the sensed temperature goes above 60°C but once it has been energised, it can be set to remain energised until the temperature drops below 55°C. If the relay is connected to a fan, that will ensure that it runs for a minimum period before switching off, ie, the time taken to reduce the temperature by 5°C. Sensing the temperature We use a low-cost negative temperature coefficient (NTC) thermistor to measure temperature. This is a twolead device with a resistance that varies with temperature. As it gets hotter, its resistance drops. It can be attached to an object to sense its temperature (eg, a heatsink). You can get waterproof thermistors which can be immersed in liquid, or you could waterproof a standard NTC thermistor. You can also get lug-mount siliconchip.com.au Fig.1: the circuit uses a PIC microcontroller (IC1) to monitor the temperature via an NTC thermistor (TH1). IC1 compares the measured temperature to the thresholds set by trimpots VR1 & VR2 to decide when to energise RLY1. NTC thermistors which can easily be attached to a flat surface using a screw or bolt. Circuit description The full circuit of the Temperature Switch is shown in Fig.1. It’s based on IC1, an 8-pin PIC12F617 microcontroller that includes an internal analog-to-digital (ADC) converter with four multiplexed inputs and a PWM (pulse-width modulation) generator. The NTC thermistor TH1 is connected across CON2 and it forms a voltage divider in combination with the 3.9kW resistor from the +5V rail. Therefore the voltage across TH1 will drops as the temperature rises. This voltage is stabilised by a 100nF capacitor connected across the pins of CON2 and it has more filtering provided by another RC low-pass filter comprising a 10kW resistor and second 100nF capacitor, before being fed to input pin 7 of IC1. Pin 7 is set up as the AN0 analog input and IC1 can read the voltage at this pin using its internal 10-bit ADC, with a resolution of approximately 5mV (5V ÷ 210). It then uses a look-up table to convert the voltage reading into a temperature. This is necessary since the relationship between temperature and resistance of TH1 is non-linear. siliconchip.com.au The two threshold temperatures are set using trimpots VR1 and VR2 which are connected across the 5V supply rail. Their wipers go to analog input pins 6 (AN1) and 3 (AN3) and the setting of each potentiometer determines the voltage at these pins, ie, 0-5V. See the section below for an explanation of how these voltages correspond to temperatures. The 100nF capacitors connected from each analog input to ground provide a low source impedance for the ADC. IC1 converts the voltages at pins 3 and 6 to digital values and then into temperatures. It then compares the sensor temperature to the upper and lower switching thresholds, to decide whether relay RLY1 should be energised. It drives digital output pin 2 (GP5) high to energise the relay or low to de-energise it. When pin 2 is high, NPN transistor Q1 is turned on to energise the coil of relay RLY1, pulling in its armature and connecting the COM and NO contact pairs on CON3. The 1kW base resistor sets the base current for Q1 to 4mA. LED2, connected across the coil of RLY1 via its 10kW series resistor, lights to show when the relay is energised. When transistor Q1 is turned off to switch off the relay, diode D2 absorbs Celebrating 30 Years the voltage generated by the collapsing magnetic field in its coil. This protects Q1 from any back-EMF spike voltages. The DC power source is connected to CON1 and can be in the range of 12-15V DC. Diode D1 provides supply reverse polarity protection. The voltage at D1's cathode is (nominally) around 11.4V and this is used to drive the coil of RLY1. The 100µF electrolytic capacitor filters the supply, and voltage transients are safely clamped using a 16V zener diode (ZD1). Current through ZD1 is limited by the series 47W resistor. The 3-terminal regulator REG1 provides a regulated 5V supply rail for IC1 and TH1. LED1 is connected across the 5V supply with a 3.3kW currentlimiting resistor and lights whenever the unit is powered up. IC1's MCLR reset input is tied to the 5V supply via a 10kW resistor to provide a power on reset for the microcontroller. Relationship between temperature and voltage We mentioned earlier that trimpots VR1 and VR2 can be adjusted to provide a voltage of 0-5V to IC1, corresponding to temperature thresholds that can be set in the range of -10°C to +125°C. So how do you adjust the trimpots for each temperature? June 2018  45 lution of IC1's ADC, giving better accuracy. The equivalent scaling is done in the software so that the temperature thresholds match the readings at TP1 and TP2. Monitoring temperatures Fig.2: compare this component layout for the Temperature Switch Mk2 with the completed prototype PCB shown below when building the project. If you need to use the Temperature Switch Mk2 to switch on/off mains-powered devices, you have to substitute RLY1 with a 250VAC-rated DPDT relay, which must be mounted off the PCB. So that you can monitor the current sensor temperature easily, the PWM output at pin 5 is driven with a 3.9kHz square wave with a duty cycle that is proportional to temperature. When you connect a DMM between this pin and TPref, it will internally average out the PWM signal to give a DC voltage reading. This also has a scaling factor of 10mV/°C. So if you get a reading of say 275mV between TP4 and TPref, that corresponds to a temperature of 27.5°C (275mV ÷ 10mV). If you want to measure the voltage across the thermistor itself, you can do so between TP3 and GND. Selecting a thermistor The short answer is that you connect the negative lead of your digital multimeter to the test point marked TPref. (It is biased to around 100mV above ground using a 10kW/200W resistive divider across the 5V supply rail). The positive lead of your DMM then goes to TP1 (for setting trimpot VR1) or TP2 (for setting VR2). By connecting the negative lead of your DMM to TPref, you will get a negative reading at test points TP1 and TP2 when trimpots VR1 and VR2 are set close to their fully anti-clockwise positions. This allows you to set temperature thresholds below 0°C. The 24kW/10kW resistive dividers between AN1/AN3 and TP1/TP2 cause the voltages that you read with your multimeter at TP1 and TP2 to change by 10mV for each 1°C adjustment. So you can simply read the voltage (in mV) between TP1 and TPref or TP2 and TPref and then divide by ten to convert from the voltage reading to a 46 Silicon Chip temperature. For example, 300mV = 30.0°C, 472mV = 47.2°C etc. So the 100mV value at TPref allows for up to a -10°C adjustment where a reading at TP1/2 will be -100mV. The maximum setting of VR1/VR2 gives a reading at the relevant test point of 1.37V (5V ÷ [24kW ÷ 10kW + 1] 100mV) or 1370mV, corresponding to +137.0°C. This confirms that we can set the thresholds up to the +125°C maximum that the unit can handle. We considered using a scaling factor of 1mV = 1°C but were concerned that some DMMs may be inaccurate when reading small voltages. We were also concerned that this could result in increased inaccuracy due to noise and EMI that could be picked up by the meter. Note that we feed the voltage at the wipers of VR1 and VR2 directly to IC1, rather than sensing the divideddown voltages at TP1 and TP2. This allows us to use the full 10-bit resoCelebrating 30 Years The thermistor we used has a reference resistance of 10kW at 25°C and a beta value of 4100. 10kW NTC thermistors are very common so you shouldn't have trouble finding a suitable sensor. The beta value determines the shape of the temperature/resistance curve. While beta values vary from device to device, it is very common to find NTC thermistors with a beta close to 4000. As long as yours is in the range of 39004200 then it should give similar results to the one used in our prototype. We generated the temperature lookup table for our firmware using this online calculator: siliconchip.com. au/link/aaj1 If you want higher accuracy Although general-purpose NTC thermistors are typically accurate to within a few degrees Celsius, if you want higher accuracy, use a thermistor with tight tolerances such as the AVX NJ28NA0103FCC. This has a 1% tolerance at 25°C and a beta value of 4100, also with a 1% tolerance. It is available from RS: siliconchip.com. au/link/aaf7 This thermistor is not encapsulated. For remote temperature measurement, you can extend the leads. Use insulation sleeving (eg, heatshrink tubing) over the wire connections. For attachment to a solid object, the thermistor can be epoxy glued to the object or clamped against it. For outdoor use siliconchip.com.au or immersion in liquid, insulate the thermistor assembly using neutralcure silicone sealant. Note that if extending the leads over long distances, even if the wires add a resistance of more than 10W, this is still only a 0.1% error at 25°C; although the error will increase at higher temperatures. So check the total (“round-trip”) resistance before wiring the thermistor to a very long cable. Construction The Temperature Switch Mk2 is built on a double-sided PCB coded 05105181 measuring 104 x 58.5mm. It can be housed in a UB3 129 x 68 x 43mm Jiffy box, mounted on short spacers. Use the overlay diagram, Fig.2, as a guide during construction. Fit the resistors first. These have colour-coded bands, as shown in Table.1 but we suggest that you use a DMM set to measure ohms to check the values, as the colour bands can be easily misinterpreted. Diodes D1, D2 and ZD1 are installed next and these need to be inserted with the correct polarity, ie, with the striped end (cathode, “k”) oriented as shown in Fig.2. Both diodes are 1N4004 types while the zener diode (ZD1) is a 1N4745 or equivalent. We recommend using an IC socket for IC1. Take care with orientation when installing the socket and when inserting the IC. Note that IC1 needs to be programmed with the software for the Temperature Switch before use. A programmed IC can be obtained from the Silicon Chip Online Shop (search for it by code or month). Alternatively, you can program a blank chip yourself using the HEX file which is available from the Silicon Chip website (free for subscribers). For the test points, we used five PC stakes. One for TPgnd and the others for TPref, TP1, TP2, TP3 and TP4. If left as bare pads, they can be probed directly using standard DMM leads. The capacitors are mounted next. The electrolytic types must be inserted with the polarity shown (longer lead is positive, with a stripe on the can indicating the negative lead). Install transistor Q1 and regulator REG1 now and take care not to mix them up as they have the same package. Now fit trimpots VR1 and VR2. They may be marked with code 103. Orient these with the adjusting screw as shown in Fig.2, toward IC1. Install terminal blocks CON1, CON2 siliconchip.com.au Parts List 1 double-sided PCB, coded 05105181, 104 x 58.5mm 1 DPDT 12V DC coil relay (RLY1) [Jaycar SY4052 (5A) or Altronics S4270A (8A)] 1 10kW NTC thermistor with beta ~4100; see text (TH1) [Jaycar RN3440] 2 2-way screw terminals with 5.08mm pin spacing (CON1,CON2) 2 3-way screw terminals with 5.08mm pin spacing (CON3) 1 DIL 8-pin IC socket for IC1 7 PC stakes (optional) (TPgnd,TP1,TP2,TP3,TP4 & TPref) 1 UB3 jiffy box, spacers and mounting screws (optional) Semiconductors 1 PIC12F617-I/P programmed with 0510518A.HEX (IC1) 1 LP2950ACZ-5.0 regulator (REG1) 1 BC337 NPN transistor (Q1) 1 16V 1W (1N4745) zener diode (ZD1) 2 1N4004 1A diodes (D1,D3) 2 3mm LEDs (LED1,LED2) Capacitors 1 100µF 25V PC electrolytic 3 10µF 16V PC electrolytic 8 100nF 63/100V MKT polyester Resistors (all 1%, 0.25W) 2 24kW 6 10kW 1 3.9kW 1 3.3kW 1 1kW 1 200W 1 47W 2 10kW multi-turn vertical trimpots (3296W style) (VR1,VR2) Table.1: Resistor Colour Codes o o o o o o o No. 2 6 1 1 1 1 1 Value 24kΩ 10kΩ 3.9kΩ 3.3kΩ 1kΩ 200Ω 47Ω 4-Band Code (1%) red yellow orange brown brown black orange brown orange white red brown orange orange red brown brown black red brown red black brown brown yellow violet black brown and CON3 now. CON1 and CON2 are 2-way types which are mounted separately while CON3 comprises two 3-way screw connectors dovetailed together. Fit all three connectors with the wire entry to the outside edge of the PCB. Finally, the LEDs and RLY1 can be mounted. We placed the LEDs close to the PCB but they can be mounted higher or even off the PCB, for example, chassis-mounted to the case. If mounting them off-board, wire them to the LED pads with flying leads. The LEDs must be oriented correctly with the anode (longer lead) of the LED Celebrating 30 Years 5-Band Code (1%) red yellow black red brown brown black black red brown orange white black brown brown orange orange black brown brown brown black black brown brown red black black black brown yellow violet black gold brown to the pad marked “A” on the PCB. Although presented as a bare PCB, the Temperature Switch can be installed within a UB3 box. Mark out and drill the 3mm holes in the box, corresponding to the corner mounting holes on the PCB, then attach it to the box using short spacers and screws. Holes will be required at each end of the box (or on the lid) for cable glands, which the power supply, thermistor and relay wiring will pass through. Testing You will need a 12-15V DC supply at up to 60mA. Connect the power supply June 2018  47 The PCB fits neatly into a UB3 Jiffy box with M3 x 15mm spacers to support it. The connectors and thermistor can then have holes drilled for them through the top of the lid or out the side of the box. Note that the PCB is slightly less wide than the typical UB3 box to account for variations and contraction of the material under strain. to CON1 and the thermistor to CON2. Leave IC1 out of its socket before switching the power supply on. LED1 should light. Now measure the voltage between TP+5V and TPgnd. The reading should be between 4.975V and 5.025V. Next, check the voltage between TPref and TPgnd. It should be between 96.5mV and 99.5mV, ideally close to 98mV. If these voltages are correct, then switch the supply off and insert IC1, taking care to orient it correctly. Switch the power back on and measure the voltage between TP4 and TPref. Check that this corresponds to room temperature, keeping in mind the 10mV/°C scaling factor. To test the switching operation, connect your DMM between TP2 and TPref, then adjust VR2 for a reading that is a few tens of millivolts above the reading at TP4. For example, if you read 220mV at TP4 (corresponding to 22°C), adjust VR2 for 260mV at TP2 (corresponding to 26°C). Now connect your DMM between TP1 and TPref and adjust VR1 for an intermediate reading, eg, 240mV corresponding to 24°C. At this point, RLY1 should not be energised. Heat up the thermistor and the relay should be energised; you should hear it click and LED2 will light up. 48 Silicon Chip Then cool the thermistor down and it should click again as it’s de-energised. Depending on the ambient temperature, you may be able to heat up the thermistor by simply holding it between two fingers. Or you could use a cigarette lighter, with the flame briefly held below the thermistor body Setting the thresholds Now determine the temperatures at which you want the relay to be energised and de-energised. If you want the relay energised when the temperature rises above a particular threshold then this temperature becomes your upper threshold. Subtract your desired hysteresis value (in °C) from the upper threshold to determine the lower threshold. In this case, use the same procedure as described under Testing above so that the voltage reading between TP1 and TPref equals the lower threshold and the reading between TP2 and TPref equals the desired upper threshold. Conversely, if you want the relay to be energised when the temperature falls below a particular threshold then this will be your lower threshold and you should add the desired amount of hysteresis to it, to determine the upper threshold value. In this case, adjust VR1 to give a reading between TP1 and TPref equal to your upper threshold and adjust VR2 to give a reading between TP2 and TPref that corresponds to your lower threshold. Do not set both thresholds to the same temperature as this will cause relay chatter. Installation Wire your power supply leads to CON1. For use in a motor vehicle, use automotive-rated wire with the +12V terminal connected to the switched side of the ignition. That way, your battery won’t be drained when the ignition switch is off. The 0V terminal on CON1 should be connected to the vehicle chassis (assuming you have a negative chassis, like all modern vehicles) using a crimp eyelet secured to a convenient screw terminal. You may need to drill a separate hole for this connection if you can’t utilise an existing earth connection. Note that while the test points can show readings with a resolution greater than 1°C (252mV for 25.2°C) the Temperature Switch will only switch RLY1 on and off at the temperature settings and readings rounded up to the nearest degree. Previous temperature control projects published in Silicon Chip • Infrared-Sensing Heater Controller for convection and bar radiators up to 10A, 50/60Hz and 230VAC, with temperature control from 15°C to 31°C.You can even add a thermopile for added precision (April 2018; siliconchip.com.au/Article/11027) [PCB 10104181 – $10]. • Need to convert a freezer into a fridge, or even a fridge into a wine cooler? Try the TempMaster Thermostat Mk3 (August 2014; siliconchip.com.au/Article/7959) [PCB: 21108141 – $15 | Jaycar KC5529]. • High-temperature applications like ovens or kilns (below 1200°C) or even freezing cold (above -50°C)? Try the High-temperature Thermometer/Thermostat (May 2012; siliconchip.com.au/Article/674) [PCB 21105121 – $20]. SC Celebrating 30 Years siliconchip.com.au