MOSFET Heater Is Its Own Thermostat

While we might all be quick to grab a microcontroller and an appropriate sensor to solve some problem, gather data about a system, or control another piece of technology, there are some downsides with this method. Software has a lot of failure modes, and relying on it without any backups or redundancy can lead to problems. Often, a much more reliable way to solve a simple problem is with hardware. This heating circuit, for example, uses a MOSFET as a heating element and as its own temperature control.

The function of the circuit relies on a parasitic diode formed within the transistor itself, inherent in its construction. This diode is found in most power MOSFETs and conducts from the source to the drain. The key is that it conducts at a rate proportional to its temperature, so if the circuit is fed with AC, during the negative half of the voltage cycle this diode can be probed and used as a thermostat. In this build, it is controlled by a set of resistors attached to a voltage regulator, which turn the heater on if it hasn’t reached its threshold temperature yet.

In theory, these resistors could be replaced with potentiometers to allow for adjustable heat for certain applications, with plastic cutting and welding, temperature control for small biological systems, or heating other circuits as target applications for this type of analog circuitry. For more analog circuit design inspiration, though, you’ll want to take a look at some classic pieces of electronics literature.

A thermostat unit and a replacement PCB for it

Custom Thermostat PCB Connects Boiler To Home Assistant

Thanks to Home Assistant, automating the various systems that run your home is easier than ever. But you still need to make a connection between those systems and your Home Assistant setup, which can be tricky if the manufacturer didn’t have this use case in mind. When [Simon] wanted to automate his home heating system, he discovered that most Home Assistant-enabled thermostats that he could find didn’t support his two separate heating zones connected to a single boiler. The easiest solution turned out to be to design his own.

The original heating system consisted of two control boxes that each had a 230 V mains connection coming in and a “request heat” control line going to the boiler. [Simon] considered replacing these with a simple off-the-shelf ESP8266 relay board and a 12 V power supply, but figured this would look messy and take up quite a bit of space. So he bought a neat DIN-rail mounted enclosure instead, and designed a custom PCB to fit inside it.

A Home Assistant screen showing two thermostatsThe PCB holds a Wemos D1 Mini connected to two relays that switch the two heating circuits. The D1 runs ESPhome and needs just a few lines of configuration to connect it to [Simon]’s home network. There’s no separate power supply — the 230 V line is connected directly to a 12 V DC power module mounted on the PCB, so the new system is plug-and-play compatible with the old.

Complete PCB design files are available on [Simon]’s website and GitHub page. There are several other ways to make custom thermostats for your home, with an Arduino for example. If you’re interested in repairing your own heating system, or want to optimize it even further, there’s a whole community out there to help you.

Practical Sensors: The Many Ways We Measure Heat Electronically

Measuring temperature turns out to be a fundamental function for a huge number of devices. You furnace’s programmable thermostat and digital clocks are obvious examples. If you just needed to know if a certain temperature is exceeded, you could use a bimetalic coil and a microswitch (or a mercury switch as was the method with old thermostats). But these days we want precision over a range of readings, so there are thermocouples that generate a small voltage, RTDs that change resistance with temperature, thermistors that also change resistance with temperature, infrared sensors, and vibrating wire sensors. The bandgap voltage of a semiconductor junction varies with temperature and that’s predictable and measurable, too. There are probably other methods too, some of which are probably pretty creative.

Bimetalic coil by [Hustvede], CC-BY-SA 3.0.
You can often think of creative ways to do any measurement. There’s an old joke about the smart-alec student in physics class. The question was how do you find the height of a building using a barometer. One answer was to drop the barometer from the top of the building and time how long it takes to hit the ground. Another answer — doubtlessly an engineering student — wanted to find the building engineer and offer to give them the barometer in exchange for the height of the building. By the same token, you could find the temperature by monitoring a standard thermometer with a camera or even a level sensor which is a topic for another post.

The point is, there are plenty of ways to measure anything, but in every case, you are converting what you want to know (temperature) into something you know how to measure like voltage, current, or physical position. Let’s take a look at how some of the most interesting temperature sensors accomplish this.

Continue reading “Practical Sensors: The Many Ways We Measure Heat Electronically”

Open-Source Thermostat Won’t Anger Your Landlord

[Nathan Petersen] built a Hackable Open-Source Thermostat to smooth out temperature fluctuations caused by the large hysteresis of the bimetallic strip thermostat in his apartment. While it may be tempting to adjust the “anticipator” to take care of the problem or even replace the bimetallic thermostat with an electronic version, building your own thermostat from scratch is a good way to add to your project portfolio while making your way through college. Plus, he got to hone his hardware and software design chops.

The hardware is designed around the STM32, using a cheap, minimal variant since the device just needs to sense temperature and control the furnace in on-off mode. The TMP117 high-accuracy, low-power, temperature sensor was selected for temperature measurement since accuracy was an essential feature of the project. Dry-contact output for the furnace is via a normally-open solid state relay (opto-isolator). For the user interface, instead of going the easy-route and using an I2C/SPI OLED or LCD display, [Nathan] used three 7-segment LED displays, each driven by an 8-channel constant current driver. The advantage is that the display can be viewed from across the room, and it’s brightness adjusted via PWM. Temperature set-point adjustment is via a simple slide potentiometer, whose analog voltage is read by the micro-controller ADC. To remind about battery replacement, a second ADC channel on the micro-controller monitors the battery voltage via a voltage divider. The PCB components are mostly surface mount, but the packages selected are easy enough to hand solder.

[Nathan]’s Github repo provides the hardware and firmware source files. The board is designed in Altium, but folks using KiCad can use either the awesome Altium2KiCad converter or the online service for conversion. (The results, with some minor errors that can be easily fixed, are quite usable.) Serendipitously, his PCB layout worked like a charm the first time around, without requiring any rework or bodge wires.

The firmware is a few hundred lines of custom bare-metal C code, consisting of drivers to interface with the hardware peripherals, a UI section to handle the user interface, and the control section with the algorithm for running the furnace. [Nathan] walks us through his code, digging into some control theory and filtering basics. After making a few code tweaks and running the thermostat for some time, [Nathan] concludes that it is able to achieve +0.1°F / -0.5°F temperature regulation with furnace cycles lasting about 10-15 minutes (i.e. 4-6 cycles per hour). Obviously, his well insulated apartment and a decent furnace are also major contributing factors. Moving on, for the next version, [Nathan] wants to add data collection capabilities by adding some memory and SD card storage, and use an RTC to allow seasonal adjustments or time-based set-points.

This is his first attempt at a “functional’ useful project, but he does love to build the occasional toy, such as this POV Top.

Old Thermostat Gets Smarts

A smart thermostat is nothing new. But making one built a decade or more ago takes a few tricks. If you want to upgrade your thermostat without replacing it, [geektechniquestudios] shares their solution using a Raspberry Pi Zero to smarten up that dumb controller.

The hardware is decidedly simple: just a Pi Zero and a pair of relays. The relays act as button presses to the old thermostat. The software, though, is decidedly complex. There’s a React server and a Redis database along with some other bits and pieces.

Continue reading “Old Thermostat Gets Smarts”

Fail Of The Week: Thermostat Almost Causes A House Fire

Fair warning: any homeowners who have thermostats similar to the one that nearly burned down [Kerry Wong]’s house might be in store for a sleepless night or two, at least until they inspect and perhaps replace any units that are even remotely as sketchy as what he found when he did the postmortem analysis in the brief video below.

The story begins back in the 1980s, when the Southern New England area where [Kerry] lives enjoyed a housing boom. Contractors rushed to turn rural farmland into subdivisions, and new suburbs crawled across the landscape. Corners were inevitably cut during construction, and one common place to save money was the home’s heating system. Rather than engage an HVAC subcontractor to install a complicated heating system, many builders opted instead to have the electricians install electric baseboards. They were already on the job anyway, and at the time, both copper and electricity were cheap.

Fast forward 40 years or so, and [Kerry] finds himself living in one such house. The other night, upon catching the acrid scent of burning insulation, he followed his nose to the source: a wall-mounted thermostat for his electric baseboard. His teardown revealed burned insulation, bare conductors, and scorched plastic on the not-so-old unit; bearing a 2008 date code, the thermostat must have replaced one of the originals. [Kerry] poked at the nearly combusted unit and found the root cause: the spot welds holding the wires to the thermostat terminal had become loose, increasing the resistance of the connection. As [Kerry] points out, even a tenth of an ohm increase in resistance in a 15 amp circuit would dissipate 20 watts of heat, and from the toasty look of the thermostat it had been a lot more than that.

The corner-cutting of the 1980s was nothing new, of course – remember the aluminum wiring debacle? Electrical fires are no joke, and we’re glad [Kerry] was quick to locate the problem and prevent it from spreading.

Continue reading “Fail Of The Week: Thermostat Almost Causes A House Fire”

Running Linux On A Thermostat

When your thermostat comes with Linux running on it, that’s not a hack. When it doesn’t, and you get Linux on there yourself, it most definitely is. This is exactly what [cz7asm] has done. In a recent video, he shows the Honeywell thermostat booting Linux and running a wide range of software.

While the hardware inside the thermostat doesn’t afford all the luxuries of a typical modern embedded Linux, it’s got enough room for the basics. The system runs from a 1 MB rootfs in RAM, and has a 2.5 MB kernel image, leaving a spare 12 MB for everything else. With just these meager resources, [cz7asm] shows how the system can use a USB network adapter, connecting to telehack.com for some command-line retro fun, and host a web server, although no browser runs yet. There’s also framebuffer support for displaying graphics and animations, and the usual Linux terminal goodness.

All we’ve seen so far is the video, so we hope [cz7asm] posts the code somewhere, because we’re tired of using our thermostat just to run the AC.

You might remember [cz7asm] from his previous thermostatic triumph: running Doom. Check out the video of the latest thermostat adventure after the break.

Thanks to [Piecutter] for the tip!

Continue reading “Running Linux On A Thermostat”