Silicon ChipK-Type Thermostat - November 2023 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Computer keyboards need an update / Australia Post wants to put prices up again!
  4. Feature: The History of Electronics, Pt2 by Dr David Maddison
  5. Product Showcase
  6. Project: Pico Audio Analyser by Tim Blythman
  7. Feature: 16-bit precision 4-input ADC by Jim Rowe
  8. Project: K-Type Thermostat by John Clarke
  9. Review: Microchip's new PICkit 5 by Tim Blythman
  10. Project: Modem/Router Watchdog by Nicholas Vinen
  11. Project: 1kW+ Class-D Amplifier, Pt2 by Allan Linton-Smith
  12. Serviceman's Log: Charge of the light yardwork by Dave Thompson
  13. PartShop
  14. Subscriptions
  15. Vintage Radio: Recreating Sputnik-1, Part 1 by Dr Hugo Holden
  16. Market Centre
  17. Advertising Index
  18. Notes & Errata: Watering System Controller
  19. Outer Back Cover

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

You can view 47 of the 112 pages in the full issue, including the advertisments.

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

Articles in this series:
  • The History of Electronics, Pt1 (October 2023)
  • The History of Electronics, Pt1 (October 2023)
  • The History of Electronics, Pt2 (November 2023)
  • The History of Electronics, Pt2 (November 2023)
  • The History of Electronics, Pt3 (December 2023)
  • The History of Electronics, Pt3 (December 2023)
  • The History of Electronics, part one (January 2025)
  • The History of Electronics, part one (January 2025)
  • The History of Electronics, part two (February 2025)
  • The History of Electronics, part two (February 2025)
  • The History of Electronics, part three (March 2025)
  • The History of Electronics, part three (March 2025)
  • The History of Electronics, part four (April 2025)
  • The History of Electronics, part four (April 2025)
  • The History of Electronics, part five (May 2025)
  • The History of Electronics, part five (May 2025)
  • The History of Electronics, part six (June 2025)
  • The History of Electronics, part six (June 2025)
Items relevant to "Pico Audio Analyser":
  • Pico (2) Audio Analyser PCB [04107231] (AUD $5.00)
  • 1.3-inch blue OLED with 4-pin I²C interface (Component, AUD $15.00)
  • 1.3-inch white OLED with 4-pin I²C interface (Component, AUD $15.00)
  • Short-form kit for the Pico 2 Audio Analyser (Component, AUD $50.00)
  • Pico Audio Analyser PCB pattern (PDF download) [04107231] (Free)
  • Pico Audio Analyser firmware (0410723A) (Software, Free)
  • Pico Audio Analyser box cutting details (Panel Artwork, Free)
Articles in this series:
  • Pico Audio Analyser (November 2023)
  • Pico Audio Analyser (November 2023)
  • Pico 2 Audio Analyser (March 2025)
  • Pico 2 Audio Analyser (March 2025)
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 "K-Type Thermostat":
  • Thermocouple Thermometer/Thermostat main PCB [04108231] (AUD $7.50)
  • Thermocouple Thermometer/Thermostat front panel PCB [04108232] (AUD $2.50)
  • PIC16F1459-I/P programmed for the Thermocouple Thermometer/Thermostat (0410823A.HEX) (Programmed Microcontroller, AUD $10.00)
  • MCP1700 3.3V LDO (TO-92) (Component, AUD $2.00)
  • K-Type Thermocouple Thermometer/Thermostat short-form kit (Component, AUD $75.00)
  • K-Type Thermocouple Thermometer/Thermostat firmware (0410823A.HEX) (Software, Free)
  • K-Type Thermocouple Thermometer/Thermostat PCB pattern (PDF download) [04108231] (Free)
  • K-Type Thermostat panel artwork (PDF download) (Free)
Items relevant to "Modem/Router Watchdog":
  • Modem Watchdog PCB [10111231] (AUD $2.50)
  • Modem/Router Watchdog kit (Component, AUD $35.00)
  • Modem/Router Watchdog Software (Free)
  • Modem Watchdog PCB pattern (PDF download) [10111231] (Free)
Items relevant to "1kW+ Class-D Amplifier, Pt2":
  • 1kW+ Mono Class-D Amplifier cutting and drilling details (Panel Artwork, Free)
Articles in this series:
  • 1kW+ Class-D Amplifier, Pt1 (October 2023)
  • 1kW+ Class-D Amplifier, Pt1 (October 2023)
  • 1kW+ Class-D Amplifier, Pt2 (November 2023)
  • 1kW+ Class-D Amplifier, Pt2 (November 2023)
Items relevant to "Recreating Sputnik-1, Part 1":
  • Sputnik design documents and Manipulator sound recording (Software, Free)
Articles in this series:
  • Recreating Sputnik-1, Part 1 (November 2023)
  • Recreating Sputnik-1, Part 1 (November 2023)
  • Recreating Sputnik-1, Part 2 (December 2023)
  • Recreating Sputnik-1, Part 2 (December 2023)

Purchase a printed copy of this issue for $12.50.

John Clarke’s K–Type Thermocouple THERMOSTAT With this Thermometer, you can easily measure temperature over a very wide range and control a device in response. It utilises a K-type thermocouple as its sensor and can drive a relay for thermostat control of either heating or cooling operation. T he K-type Thermocouple Thermometer/ Thermostat (known as the Thermometer or Thermostat from now on) can measure a very wide range of temperatures. It incorporates a relay that can control the power to a heating element or refrigerator compressor. While some digital multimeters can measure temperatures using a thermocouple, they almost universally cannot automatically control the temperature for heating or cooling. For heating, power can be switched on when the temperature is below a preset temperature and switched off when it reaches the preset. Alternatively, power is switched on for cooling when the temperature is above the preset and off when it goes below the threshold. Fig.1: a K-type thermocouple is often thought of as having a simple 41.276µV/°C sensitivity (the Seebeck coefficient), but it actually varies like this. We must account for this variation to get accurate readings, especially at lower temperatures. 50 Silicon Chip Australia's electronics magazine It has adjustable hysteresis to prevent rapid on/off switching of the relay near the threshold. This introduces a difference between the temperatures at which the relay will switch on and off. The hysteresis is adjustable from 0 to 60°C, although it usually would only be around 1-2°C. The temperature reading is shown on a two-line, 16-character LCD. While the unit can display a temperature from -270°C to +1800°C, the actual range depends on the probe used. Some K-type probes operate from -50°C to +250°C, some from -50°C to +900°C, some from -40°C to +1200°C, while others only operate above 0°C. Thermocouple probes can also be insulated or uninsulated. Insulated probes do not have an electrical connection to the thermocouple, so the probe can touch a material that is grounded or at some fixed voltage without producing erroneous readings. Uninsulated probes shouldn’t be used where there will be a potential difference between the thermometer ground and the probe. For our Thermometer, if that happens, it will show a fault (short to ground or short to supply). The Thermometer is housed in a small instrument case with controls on the front for power on/off, selecting the display view and adjusting settings. siliconchip.com.au Features » » » » » » » » » » » » » » Wide temperature measurement range (typically -50°C to +1200°C) Fine resolution of 0.25°C for all measurements and settings Accuracy of up to ±2°C from -200°C to +700°C; ±4°C up to +1350°C Compact unit powered from 12V DC Low current consumption – 75mA with full display brightness and relay on Linearised thermocouple readings Thermostat relay Adjustable thermostat switching temperature and hysteresis Heating or cooling thermostat operation Adjustable display backlighting brightness Thermometer reading averaging options Thermocouple connection fault indication Relay switches up to 30V at 10A External relay can be used for switching mains or higher currents (see text) Specifications » Measurement range: thermocouple dependent; up to -270°C to +1800°C » Ambient (cold junction) measurement range: -40°C to +125°C » Cold junction accuracy: ±2°C from -20°C to +85°C; » » » » » » » » » ±3°C from -40°C to +125°C Thermostat threshold: from below -270°C to above 1800°C Thermostat hysteresis: 0°C to 60°C Offset trim: -7°C to +7°C (compensating for offset & cold junction errors) Linearisation: corrected in 0.5°C steps with 0.25°C resolution from -161°C to 1311°C (cold junction at 0°C), -136°C to 1336°C (cold junction at 25°C) Reading averaging: over 1, 2, 4, 8, 16, 32, 64 or 128 readings Thermostat indication: animated up or down flowing bargraph during heating or cooling Display brightness control: 10 brightness steps plus off Automatic menu return to thermometer reading option Thermocouple error indication: open circuit, short to ground or short to supply Lead image: www.pexels.com/photo/frozen-river-near-mountainous-area-6685417 Background image: unsplash.com/photos/ynwGXMkpYcY At the rear of the case are the sockets for 12V DC power input and the K-type thermocouple. There is also a cable gland for wires to enter the box and connect to the Thermostat relay contacts via screw terminals. The common (C), normally open (NO) and normally closed (NC) contacts are available. K-type thermocouple principles A K-type thermocouple comprises a junction of two dissimilar wires. The K-type uses an alloy of chrome and nickel (called Chromel) for one wire and an alloy of aluminium, manganese, silicon and nickel (called Alumel) for the second. These two wires only make contact with each other at the temperature probe end. The other ends of the wires connect to a two-pin plug at the Thermometer. A thermocouple works because the junction of two dissimilar metals siliconchip.com.au produces a voltage that is dependent on temperature. A K-type thermocouple has a nominal sensitivity of 41.276µV/°C. However, using this one value has limitations; the sensitivity is not fixed but actually varies with temperature. For example, the K-Type thermocouple has a sensitivity of 35.54µV/°C at -100°C and 41.61µV/°C at +750°C. This variation will introduce temperature reading errors if a fixed value is assumed. The sensitivity of a K-type thermocouple over temperature is shown in Fig.1. The change in output per °C is called the Seebeck coefficient. It refers to the voltage change due to the temperature difference between the probe and the plug end of the thermocouple. A typical graph shows the Seebeck coefficient with the plug end of the thermocouple at 0°C. The coefficient is reasonably consistent over the 75°C to 1000°C range but Australia's electronics magazine drops off rapidly for temperatures in the negative region. If the 41.276µV/°C sensitivity figure were used in our Thermometer, the readings would only be truly accurate at 0°C, 500°C and 1000°C. It is not that convenient to maintain the plug end of the thermocouple at 0°C. Instead, the plug end is allowed to vary with the ambient temperature. The thermocouple driver measures its temperature and uses that reading to compensate readings at the probe end. This is called ‘cold junction compensation’ (the plug end is defined as the cold junction). Despite the name, this plug end isn’t necessarily colder than the probe; it could be hotter. In Fig.1, we added an extra curve for when the cold junction is at 25°C. That gives you an idea of the shift in the graph with varying cold junction temperatures. If the cold junction temperature is 25°C and the thermocouple probe end is measuring 0°C, the thermocouple is actually measuring -25°C. This is where the Seebeck coefficient rapidly reduces in value as the temperature measured by the thermocouple falls. That makes getting accurate readings in that part of the curve challenging. Our Thermometer uses a Maxim MAX31855 integrated circuit (IC). It provides a digital data output of the thermocouple reading, adjusted to account for the cold junction compensation. The IC itself measures the cold junction temperature. This gives a reading within ±2°C from -200°C to +700°C (not including errors due to the thermocouple itself). However, this accuracy figure does not include the variation in readings due to the Seebeck coefficient changes with temperature. It assumes a consistent 41.276µV/°C Seebeck coefficient over that temperature range. Temperature correction Fig.2 shows the temperature correction required. Again, the ambient cold junction temperature shifts the curve from 0°C. We show the 25°C cold junction curve as an example. The graph shows what value must be added to or subtracted from the reading to account for the Seebeck variation with temperature. For example, when the probe is measuring an actual 0°C with a cold junction temperature at 25°C, -1.55°C November 2023  51 Fig.2: this shows the error in temperature readings if they are made with the assumption of a fixed sensitivity. We can subtract these errors from the regular readings for more accurate results. needs to be added to the reading (ie, 1.55°C subtracted) to obtain a correct 0°C result. We have incorporated these linearisation corrections within the workings of the Thermometer software, covering the range from -161°C to +1311°C when the cold junction is at 0°C. Typically, the cold junction will be somewhat more than 0°C. When the cold junction is at 25°C, the range becomes -136°C to +1336°C. This linearisation is based on standard K-type thermocouple thermoelectric voltage versus temperature tables; see siliconchip.au/link/abmo Various methods can be used to make corrections. One is to describe the thermoelectric voltage versus temperature as mathematical polynomials and then calculate the required correction for the reading. That can involve many calculations. For a description of that and other techniques, see the Texas Instruments reference design document “TIDA00468 - Optimized Sensor Linearization for Thermocouple”; go to siliconchip.au/link/abmp and select the TIDA-00468 reference design. Another method is to have a table that lists corrections against Thermocouple output, which is our approach. Since the MAX31855 provides the Thermocouple output with the cold junction compensation included, the cold junction value needs to be 52 Silicon Chip removed from the value before the compensation table for the thermocouple is applied. After the correction is made by adding or subtracting the appropriate value, the cold junction value is added back to give the overall temperature reading. Linearisation is done in 0.5°C steps. After linearisation, temperature accuracy will be limited mainly by the errors and offsets of the MAX31855 IC and the thermocouple itself. Circuit details The circuit for the Thermometer is shown in Fig.3. It is based around the MAX31855KASA+T cold-junction compensated thermocouple-to-digital converter for K-type thermocouples (IC1) and a PIC16F1459 8-bit microcontroller (IC2). The microcontroller also drives a two-line by 16-character LCD to show the readings. The thermocouple socket (CON1) is designed specifically for the K-type thermocouple so that extra voltage is not produced due to dissimilar metal junctions. The voltage passes through ferrite beads (FB1 & FB2) with 100nF bypass capacitors shunting noise to ground. In conjunction with the capacitors, the ferrite beads act as high-­frequency suppression filtering for the thermocouple voltage entering IC1. Transient suppression devices TVS1 and TVS2 Australia's electronics magazine also clamp excessive input voltages to IC1. IC1 is powered from a 3.3V supply, while IC2 is powered from 5V. These are derived from the 12V supply input at CON2 with reverse polarity protection by diode D1. The result is that 11.4V is applied to the input of REG1 via a 100W resistor, and any over-­ voltage from the 12V input is limited to 12V by zener diode ZD1. These components provide some protection should a much higher voltage be applied to CON2. The 100W resistor also shares any heat dissipation with REG1 to spread heat more evenly inside the Thermometer enclosure. This helps to maintain a more consistent cold junction temperature. REG2 provides the 3.3V supply for IC1. IC1 draws a maximum of 1.5mA, so there is very little dissipation within REG2, around 2.6mW. That’s calculated as (5V – 3.3V) × 1.5mA. IC1’s dissipation is 5mW (3.3V × 1.5mA). Given its 170°C/W junction-to-­ ambient temperature coefficient, this amounts to a temperature rise of 0.84°C, so we can expect the cold junction measurement to be higher than the actual ambient temperature by this amount, plus whatever heat is provided by the 100W resistor, REG1, REG2 and IC2. The MAX31855 provides a digital version of the thermocouple reading, with cold junction compensation applied. The data is sent via a serial interface with pin 5 for the clock, pin 6 for the chip select and pin 7 for the serial data output. The serial data is monitored at the RA5 input of IC2 (pin 2), while IC2 controls the clock and chip select lines from its RC4 and RC5 outputs (pins 6 & 8). These use 1.1kW/2.2kW resistive dividers to reduce the 5V outputs from IC2 to 3.3V levels suitable for IC1. IC2 reads the temperature data provided by IC1 by clocking the data through one bit at a time. The available data includes the thermocouple temperature with cold junction compensation as a signed 14-bit binary value, the cold junction temperature as a signed 12-bit binary value and any thermocouple fault conditions. The fault conditions detected are an open circuit connection, a short to ground and a short to a positive voltage. Apart from reading the data from IC1, IC2 drives the LCD module and siliconchip.com.au backlighting, monitors the Menu, Up and Down switches (S1-S3) and drives the thermostat relay, RLY1. The LCD module is driven using a 4-bit parallel interface to its D4-D7 data inputs. These are connected to the RB4-RB7 digital outputs of IC2. The Enable (EN) and Register Select (RS) inputs of the LCD are driven from the RC2 and RC1 outputs of IC2, respectively. The data is sent as two sets of four bits to make up the full 8-bit data to produce characters on the LCD. The unused D0-D3 inputs of the LCD are connected to ground. The LCD could be driven with an 8-bit parallel interface if all D0-D7 inputs were connected to IC2. However, that would require more pins from IC2 than are available. LCD backlighting Backlighting for the LCD module is provided by driving LEDs behind the LCD screen. The LED anode connects to the BLA terminal at pin 16. We connect BLK (‘backlight kathode’) at pin 16 to the drain of Mosfet Q2 via a 68W current limiting resistor. The LEDs are on when Q2 is activated by a highlevel voltage at its gate from the RC5 output of IC2. When the gate is driven high, its drain voltage goes low. The RC5 output is switched on and off rapidly to dim the display. The duty cycle (on time to full period ratio) determines the brightness. When the duty cycle is 50%, the LEDs are driven at an average of half the maximum current. Higher duty cycles provide more brightness. The RC5 (pin 5) delivers a pulsewidth modulated (PWM) signal at 976Hz; that’s fast enough so that the on-and-off switching of the LEDs is not noticeable. Switches S1 to S3 are momentary Fig.3: the circuit is straightforward as the MAX31855 (IC1) measures the temperature and passes it digitally to microcontroller IC2, which then updates the LCD screen over a four-bit bus. The remainder of the circuit comprises the three control pushbuttons, the thermostat relay (RLY1) and a linear DC power supply. siliconchip.com.au Australia's electronics magazine November 2023  53 pushbuttons. They connect to the RC0, RA1 and RA0 inputs of IC2, which are pulled high to 5V using 10kW resistors. When a switch is pressed, the closure is detected as a low level at that pin (near 0V) and IC2’s software responds by selecting a menu or changing a menu value. Relay RLY1 is driven via transistor Q1, which is, in turn, driven from the RA4 digital output of IC2 (pin 3). When this output is high (5V), the transistor is switched on via base current through the 1kW resistor. The collector then goes low and the relay coil is powered, connecting the common (C) and normally open (NO) contacts. When RA4 goes low, Q1 switches off; the relay is not powered and the C and NC contacts are joined instead. Diode D2 quenches the high-voltage back-EMF the relay coil generates when it switches off, avoiding damage to Q1. Adjustments The Thermometer incorporates several display and adjustment settings that are stored in non-volatile memory. These values remain after the power is switched off. Settings are selected using the Menu button to cycle through each menu while the Up and Down buttons adjust settings. For temperature settings that can be changed, the Up button increases the value while the Down button decreases it in 0.25°C steps when pressed briefly. Holding a button changes values at a progressively faster rate over time. That allows large values to be reached in a reasonable time while allowing for smaller 0.25°C steps. Where the particular menu provides two choices, either The rear of the case with a K-type thermocouple attached. 54 Silicon Chip Fig.4: note how the two right-angle headers (CON4 and CON5) are mounted differently. The only components on the underside are the two TVS diodes, which are not polarised; their positions are shown on the PCB silkscreening. The two large ferrite beads have multiple turns of enamelled copper wire passing through them (see the instructions in the text). the Up or Down button can be used to select the other option. Details of each menu are in the separate panel named “Menu Summary”. Animations Thermostat operation during cooling or heating is indicated using an animated bar within a rectangle that progresses downward for cooling and upward for heating in the lower righthand corner of the display. The animation is shown for the Thermometer, Thermostat Set and Hysteresis menus. The rectangle indication is shown without the bar animation when the Thermostat is off. Construction The Thermometer is built using two double-sided plated-through PCBs, with the main 98 × 70mm PCB coded 04108231 while the 19 × 22mm front panel PCB is coded 04108232. These are housed in a Ritec ABS translucent black instrument case measuring 105 × 80 × 40mm. Relay RLY1 provides switched outputs at CON3. This can handle up to 10A at up to 30V. An external relay will be required if you need to switch mains voltages; we will provide details on wiring up an external relay later. Start building the main PCB by soldering IC1 in place. It is an SOIC 8-pin IC, one of the simplest surface-mount devices to solder. Start by orientating the IC correctly over the PCB pads (referring to Fig.4) and solder pin 1. Check the IC alignment with the remaining pads; remelt the solder and readjust the IC if the registration to the other pads needs to be corrected. Solder the remaining pins once The on/off switch is mounted to a cutout on the vertical pushbutton PCB (see Fig.5). siliconchip.com.au Fig.5: three tactile pushbuttons are the only components on this small front-panel PCB. It connects to the main PCB via rightangle header CON5. are going to use it. See the section on using this project for mains switching if that is what you require. Front panel PCB assembly This photo from the rear of the PCB shows the multiple windings for FB1 & FB2 and the LCD mounting arrangement. this is correct. You can remove any solder bridges that form with a dab of flux paste and the application of solder wick. The next components to install are the resistors, diodes and transient suppressors TVS1 and TVS2. Ensure D1, D2 and ZD1 are installed with the orientations shown on the overlay diagram and PCB screen-printing and don’t get them mixed up. TVS1 and TVS2 can be mounted either way around. Fit the socket for IC2, ensuring it is orientated correctly. Ferrite beads FB1 and FB2 are wound using five turns of 0.8mm diameter enamelled copper wire each. Strip the ends of insulation using a sharp knife or similar before mounting them on the PCB. The right-angle header strips, CON4 and CON5, can be installed now. These are 4-way and 16-way headers. If you have a longer strip, you can snap it into 4-way and 16-way strips. Note that CON4 and CON5 are installed differently. CON4 (for the LCD) is installed with the straight pin side into the PCB, while CON5 (for the front panel PCB) is installed with the right-angle pins into the PCB. This allows for the required positioning of the LCD module and switches at the front panel. Fit two PC stakes at the S4 power connection points, ready for wiring to the switch later. Now mount VR1, the capacitors, transistors Q1 and Q2, plus regulators siliconchip.com.au REG1 and REG2. The electrolytic capacitors must be orientated with the correct polarity; the longer leads are positive, while the stripe on the can indicates negative. Ensure that Q1, Q2 and REG2 are not mixed up, as they are different types that all come in similar TO-92 packages. The DC socket, CON2 and the K-type socket (CON1) can be fitted next. Finally, install the relay if you Assembly for the front switch PCB (see Fig.5) is straightforward and mainly involves installing the three switches: S1, S2 & S3. Switch S4 is installed later once it is attached to the front panel. The LCD module and front switch PCB can now be attached and soldered to the right-angle headers on the main PCB – see Fig.7. Panel cutouts Drill and cut the front and rear panels as shown in Fig.6. You can also download that diagram (siliconchip. com.au/Shop/11/294), print it out at actual size and use it as a template. The rectangular cutouts can be made using a series of small drill holes around the inside perimeter, removing the centre and carefully filing to shape. Fig.6: make the front and rear panel holes and cutouts as shown here. You can also download this diagram as a PDF from the Silicon Chip website, print it out at actual size, cut out the templates and stick them to the panels. Australia's electronics magazine November 2023  55 The completed PCB mounted in the case, ready for operation. Switch S4 is glued and attached by a soldered crimp lug to the small vertical PCB. Once the panels are complete, attach switch S4 to the front panel with one nut behind the panel and the other in front. Then place the front panel over the LCD and with S1-S3 switches protruding and install the assembly comprising the panel, switch PCB and main PCB into the enclosure. Secure the main PCB to the enclosure base with the screws supplied with the enclosure. Switch S4 can now be secured using epoxy resin to the switch PCB. Wait until the glue is cured before removing the assembly. As an alternative to gluing, the switch can be secured using a 6.3mm chassis-mount double-ended spade connector (Jaycar PT4916 or Altronics H2261) or a single-ended connector soldered to the front of the front panel PCB. The hole in the connector will need to be drilled out for the switch, and the spade connector lugs will need to be cut to size and bent. When installed correctly, the rectangular section of the switch body will be 2mm proud of the front panel PCB face. The wires from the switch’s top two terminals should now be connected to the switch contact PC stakes on the main PCB. Making panel labels Fig.7: this shows how the LCD and front panel PCB attach to the main PCB and how switch S4 is wired up. The LCD and front panel PCB are shown ‘folded’ down for clarity but they should actually be at right angles to the main PCB. Switches S1-S3 are located on the underside of the PCB. Fig.8 shows the front panel labels that can be downloaded, printed and affixed to the front and rear panels. The artwork can be printed onto an A4-sized Avery “Heavy Duty White Polyester – Inkjet” sticky label suitable for inkjet printers or a “Datapol” sticky label for laser printers. Cut out the holes and display opening with a sharp craft knife. Labels are available from: • www.blanklabels.com.au • www.averyproducts.com.au The first of those also has instructions and interesting information. For Avery labels: siliconchip.com.au/l/ ably For Datapol labels: siliconchip. com.au/l/aabx We have more information on making panel labels on our website: siliconchip.au/Help/FrontPanels The Thermometer can now be fully assembled without the lid and without IC2 installed. Apply power and check that there is about 5V between pins 1 and 20 of IC2’s socket. If so, disconnect power and insert IC2, ensuring the orientation is correct. VR1 will need to be adjusted so the Australia's electronics magazine siliconchip.com.au 56 Silicon Chip display does not just show blocks of ‘on’ pixels. Apply power, rotate VR1 anticlockwise to show the blocks and then rotate it clockwise until they just disappear. That gives the best display contrast. External relay and mains switching The internal relay for thermostat switching is recommended for up to 10A and 30V maximum. While the PCB tracks for the relay and CON3 are well separated from the rest of the circuitry, the enclosure is not strong enough to ensure that the mains wiring can be securely held in position. So, for mains switching, we recommend using an external relay securely mounted in an enclosure or within the appliance to be controlled. Using an external relay also enables higher-­ rated contacts better suited for switching a refrigerator compressor. Figs.9-11 show various ways to add an external relay. The three diagrams show how to connect the external relay when there is a 12V supply available, when there is no 12V available and for connections to the Thermostat using either a direct relay connection or via a mains plug and socket that is switched via the relay. If the external relay is mounted in a metal enclosure, this enclosure must be Earthed. The relay mounting screws must be made of Nylon for a plastic enclosure. If the mains plug and socket are required, and the enclosure is metal, there must be a mains Earth connection to the chassis. Otherwise, connect the mains input Earth directly to the mains Earth on the general purpose outlet (GPO). No chassis Earth is required for a plastic enclosure, but there must not be any unearthed exposed metal screws on the outside of the enclosure. Use Nylon screws to ensure safety. Suitable relays include the 12V DC SPST 30A 240V AC relays sold by Jaycar (SY4040) and Altronics (S4211). Solid-state relays rated for switching mains AC voltage could also be used. You will also need extra parts to finish it, such as cable ties, P-clamps, cable glands, screws, nuts, spade connectors, 10A mains wire etc. Setting it up The “Menu Summary” section (shown opposite) lists the available siliconchip.com.au Menu Summary The initial settings shown in brackets at the end of each menu description below are the defaults before being changed via the menus. Any changes to the values or settings will subsequently replace those. Thermometer This shows the temperature reading of the probe after cold-junction compensation. While it can display between -270°C and +1800°C, the probe may have a narrower operating range. This screen is shown on power-up. Offset Adjust (0.00°C) This applies a temperature offset adjustment to the Thermometer readings. It can compensate for any initial offsets in the thermocouple reading, cold-junction reading error and self-heating effects of the IC. The offset can be adjusted in 0.25°C steps above and below zero, from -7°C to +7°C. It does not affect the Thermostat setting value or cold-junction temperature reading. Thermostat Set (0.00°C) This is the temperature threshold for the Thermostat to switch off. It can be adjusted beyond the ranges of -270°C and +1800°C in 0.25°C steps. During operation, the thermostat relay will switch on or off only after three temperature readings are at or beyond the threshold. This prevents false readings from causing the relay to switch due to noise. Note that the thermostat switching will be delayed more with higher averaging values selected (see below). Hysteresis (4.00°C) Adding hysteresis prevents the Thermostat from switching rapidly when the temperature is near the threshold. For heating, once the Thermostat switches off, the temperature must drop by the hysteresis amount before the Thermostat switches on again to resume heating. For cooling, once the Thermostat switches off, the temperature needs to increase by the hysteresis amount before the Thermostat switches on again to begin cooling. It can be set between 0°C and 60°C in 0.25°C steps. Brightness (50%) The display backlight brightness can be set off to one of ten brightness steps, from low to full brightness. A bargraph shows the setting, while the brightness also changes as you modify the setting. Averaging (1) Higher averaging values slow the Thermometer reading update but allow a more constant temperature reading when the temperature probe is subject to mains hum and noise. The options are averaging over 1, 2, 4, 8, 16, 32, 64 or 128 measurements. When averaging is set to eight measurements and above, a backslash before the word “Thermometer” on the main menu shifts from one position to the other (upper or lower) to indicate when the temperature value is updated. If set to 128 samples, updating the new averaged value can take up to 10 seconds. This update is progressively faster for lower averaging values (around five seconds for 64, 2.5s for 32 etc). Thermostat (cooling) The Thermostat can be set up for either heating or cooling. For heating, the Thermostat is switched on when the temperature is below the preset temperature and switched off when it reaches the preset. Alternatively, for cooling, the Thermostat is switched on when the temperature is above the preset and off when it goes below the threshold. Auto Return (off) Enabling this causes it to return to the main Thermometer display if no buttons are pressed for four seconds. This saves having to cycle through all the menus to reach the main Thermometer menu. Linearisation (on) This determines whether the thermocouple readings are linearised (corrected) for the change in the Seebeck coefficient against temperature. You can select this to be on or off. When on, if the reading goes beyond the temperature range where linearisation is performed, the display will show “Linearisation Range Error”. Also, when set on, the non-­linearised reading can be shown on the main temperature display by pressing the down button. Cold Junction Shows the cold junction temperature as measured by the MAX31855 IC. It can range from -40°C to +125°C in 0.25°C steps. Typically, this shows ambient temperature, but it will include reading errors due to self-heating and measurement accuracy. Australia's electronics magazine November 2023  57 Parts List – K-Type Thermometer / Thermostat 1 double-sided, plated-through PCB coded 04108231, 98 × 70mm 1 double-sided, plated-through PCB coded 04108232, 19 × 22mm 1 Ritec 105 × 80 × 40mm ABS black translucent instrument case [Altronics H0192] 1 2×16 character alphanumeric LCD [Altronics Z7013] 1 K-type thermocouple probe [Jaycar QM1283 (-50°C to +250°C), QM1282 (-50°C to +900°C), element14 2947102 (0°C to +800°C)] 1 cable gland for 3-6mm diameter cable 3 SPST micro tactile PCB-mount switches with 6mm actuators (S1-S3) [Jaycar SP0603, Altronics S1124] 1 SPDT sub-miniature toggle switch (S4) [Jaycar ST0300] 1 12V DC 100mA+ plugpack with 2.1mm or 2.5mm ID barrel plug 1 12V SPDT 10A relay (RLY1) [Jaycar SY4050, Altronics S4197] 1 K-type thermocouple socket (CON1) [element14 3810628] 1 PCB-mount DC socket, 2.1mm or 2.5mm ID (to suit power supply; CON2) [Jaycar PS0520, Altronics P0621A] 1 3-way screw terminal, 5.08mm pitch (CON3) 1 16-way right-angle header, 2.54mm pitch (CON4) 1 4-way right-angle header, 2.54mm pitch (CON5) 1 20-pin DIL IC socket (for IC2) 2 large ferrite suppression beads (FB1, FB2) [Jaycar LF1256 (pack of 6), Altronics L4710A] 1 250mm length of 0.8mm diameter enamelled copper wire (for FB1 & FB2) 2 50mm lengths of light-duty hookup wire (for S4) 2 PC stakes 1 10kW single-turn trimpot (VR1) [Jaycar RT4600, Altronics R2597] 1 small amount of epoxy resin or 6.3mm chassis mount spade connector (for mounting S4) [Jaycar PT4916, Altronics H2261] Semiconductors 1 MAX31855KASA+T cold-junction compensated thermocouple-to-digital converter IC for K-type thermocouples (IC1) [element14 2515622] 1 PIC16F1459-I/P 8-bit microcontroller programmed with 0410823A.hex, DIP-20 (IC2) 1 7805 1A 5V regulator, TO-220 (REG1) 1 MCP1700-3302-E/TO or AMS1117-3.3 3.3V low-dropout linear regulator, TO-92 (REG2) [Silicon Chip SC2782, element14 1296588] 1 BC337 45V 500mA NPN transistor, TO-92 (Q1) 1 2N7000 60V 200mA N-channel Mosfet, TO-92 (Q2) 2 (P)4KE15CA or (P)4KE16CA 400W 12.8-13.6V standoff transient suppression diodes (TVS1, TVS2) [Jaycar ZR1162] 1 12V 1W zener diode (ZD1) [1N4742] 2 1N4004 400V 1A diodes (D1, D2) Capacitors 2 100μF 16V PC radial electrolytic 2 1μF 50V X5R or X7R radial ceramic 6 100nF 50V X5R or X7R radial ceramic Resistors (all ¼W, 1% unless noted) 4 10kW 1 1kW 2 2.2kW 1 100W 1W 2 1.1kW 1 68W ½W or 0.6W menus and their functions. These will need to be set according to your application. Typically, the averaging value will need to be more than one so that the temperature does not jump about, especially if you introduce hum and noise when touching the thermocouple probe. The thermostat settings require selecting heating or cooling plus adjusting the threshold temperature and the hysteresis. Hysteresis is to prevent the Thermostat from switching rapidly at the threshold, so set it high enough to prevent that from occurring. Calibration The Thermometer requires calibration to obtain the correct temperature reading due to offset values within the MAX31855 and the fact that the temperature within the enclosure is higher than ambient. The Offset menu allows adjustment to correct for these initial errors. This is best done by calibrating the Thermometer using a 0°C reference solution. This can be made using a jar of pure fresh water that has sufficient crushed ice stirred in so that the temperature reaches 0°C. You should be able to adjust the Thermometer reading using the Offset adjustment so that the display shows 0°C. You will need to check that linearisation is on (see how to check that under the Menu summary). It’s best to leave the Thermometer switched on for a while (eg, half an hour or more) before performing calibration to ensure it has thermally stabilised. If you wish to check the calibration at a higher temperature, a 100°C reference can be made by continuously boiling water at sea level. The boiling point of water drops with height above sea level by close to 0.325°C/100m. So water boils at 96.7°C at 1000m elevaSC tion and 93.5°C at 2000m. ► Fig.8: the front and rear panel label artwork. They can be printed onto adhesive-backed paper or photo paper as described under “Making panel labels”. 58 Silicon Chip Australia's electronics magazine siliconchip.com.au Fig.9: note the wire links on the main board in place of RLY1 so that 12V is fed to the relay output terminal to control the external relay coil. Fig.10: the extra wiring to control a mains appliance using the Thermostat. It needs to be in its own suitable enclosure with properly insulated wiring. This assumes you have an external source of 12V DC; otherwise use Fig.9. Fig.11: if using an external mains relay, you can wire it to an IEC mains input socket and GPO output mounted on the box that contains the mains relay, like this. Use the correct wire colours, and don’t leave off the cable ties. siliconchip.com.au Australia's electronics magazine K-Type Thermostat Kit SC6809 ($75 + postage): includes most components except the case, LCD, thermocouple proble, cable gland and switches S4 & S5. November 2023  59