Thermostat PCB Design: Sensors, Switching and Isolation
A thermostat is a small, unglamorous product that hides a surprising amount of design discipline. It combines a sensor with low-level analog signal conditioning, a switching output that may control mains voltage, and a user interface, all inside a housing that is often mounted on a wall with no airflow. Its board has to be accurate, safe and stable for years.
What a Thermostat Board Has to Do
The board reads a temperature sensor, compares the result with a setpoint and drives a relay or triac that controls the heating or cooling load. Around that core sits a microcontroller, a display or dial, a power supply derived from the mains or from batteries, and the interface circuitry that keeps the measurement clean.
Two requirements dominate the design. The measurement has to be stable and repeatable, because a thermostat that drifts a degree is a warranty claim. The switching side has to be safe and quiet, because it carries mains voltage and it must not inject noise into the sensor circuit.
Sensor Selection and Placement
Thermistor sensing remains the most common approach, because these elements are because they are cheap, accurate within a limited range and easy to interface. A negative temperature coefficient thermistor changes resistance predictably with temperature, and a series resistor converts that into a voltage the microcontroller can read.
The placement rule is simple and frequently ignored: the sensor must measure the air the user cares about, not the heat generated by the board. Mounting a sensor next to the relay, the regulator or the display backlight guarantees an offset that changes with operating state. Putting it at the edge of the board, with a slot and a thermal break in the copper around it, keeps the reading honest.

Analog Front End and Noise Control
The sensor signal is small and slow, which makes it vulnerable to interference from the switching side. Filtering begins with a capacitor across the sensor and continues with an RC network at the analog input. Averaging multiple readings in firmware removes random noise but cannot remove a systematic offset.
Layout matters as much as the filter. Keeping the analog section on one side of the board and the switching section on the other, with a single continuous ground plane beneath both, is more effective than adding components after the fact. Return currents from the relay coil must never share a path with the sensor ground.
Mains Isolation and Creepage
Where the board switches mains voltage, the layout must maintain the creepage and clearance distances required for the working voltage and the pollution degree of the environment. Slots cut into the board under the switching components increase the effective creepage path and are a common technique where space is tight.
Isolation between the mains side and the low-voltage side is maintained by the relay itself, by the spacing around the switching node and by the physical routing. The ground on the low-voltage side is not connected to the mains side anywhere on the board, and the isolation barrier must be respected by every trace that crosses it.
Relay Switching, Triac Switching or Solid State
Relay switching with an electromechanical device provides galvanic isolation and low on-state loss, at the cost of contact wear and audible switching. A triac switches silently with no moving parts but requires careful gate drive and snubbing, and it conducts leakage current even when off.
A solid state relay or a back-to-back MOSFET arrangement suits low-voltage loads and gives silent, long-life switching with fast response. Whichever is chosen, the switching device belongs on the far side of the isolation barrier, with its own return path and adequate thermal copper.

Power Supply Options
Mains-powered thermostats usually use a capacitive dropper or a small flyback converter. The capacitive dropper is cheap and compact, but it is not isolated from the mains, which constrains how the rest of the circuit can be referenced and touched. A flyback provides isolation at higher cost and complexity.
Battery-powered thermostats avoid the mains entirely and shift the design problem to energy consumption. Sleep modes, a low duty cycle on the sensor and a display with its own low-power driver become the deciding factors in battery life.
Display, Buttons and User Interface
The interface is a mechanical design as much as an electrical one. A segment LCD draws very little current and suits battery operation, while an LED display is brighter and consumes more. Capacitive touch buttons need a ground reference and attention to moisture, whereas mechanical buttons need debouncing and a robust bezel.
Whatever the choice, the interface components sit on the low-voltage side and their traces should be kept away from the switching node to avoid coupling user input into the load circuit.
Thermal and Environmental Design
A wall-mounted thermostat has no fan and little internal volume, so heat has to leave through the housing. A linear regulator dissipating several hundred milliwatts will warm the entire enclosure and bias the sensor. Switching to a small switching regulator often removes that bias at the same time as it reduces power.
The enclosure and the board also have to tolerate a wide humidity range. A conformal coating protects high-impedance sensor nodes from surface contamination, which is often the difference between stable operation and intermittent drift in a damp room.
Testing and Calibration
Every unit should be calibrated or at least verified against a reference at one or two temperatures, with the result recorded. A single point check catches a sensor that is out of tolerance, while two points also reveal gain errors in the analog front end.
Functional test should exercise the relay under load, confirm the switching thresholds and hysteresis, and verify that the measurement does not shift when the load switches. That last check is the one that catches a layout problem in the analog section, and it links directly to trace width and current calculations for the switching side.
Enclosure, Mounting and Field Behaviour
The housing is part of the thermal design. A wall-mounted unit sits against a surface that may be warm, and the rear of the enclosure often has no ventilation at all. Placing the sensor on the side of the board closest to the ventilation slots, and keeping the regulator and relay near the opposite face, is usually worth more than any firmware compensation.
Mounting also affects accuracy. A board secured at four corners with long unsupported spans can flex when a button is pressed or a terminal screw is tightened, and flexing shifts the reading of a board-mounted sensor. Adding a support post under the display or a stiffening rib in the housing removes the effect.
Finally, consider the terminal block. Line-voltage terminals carry the largest currents on the board, and their solder joints see mechanical load every time a wire is tightened. Generous pad area and a mechanical anchor for the terminal body are worth the space.
FAQ
Should hysteresis be built into the firmware? Yes. A thermostat without hysteresis will chatter around the setpoint, wearing the relay and disturbing the user. A hysteresis of a few tenths of a degree is usually enough, and the value should be part of the specification rather than a detail left to the programmer.
Why does my sensor read high when the heater runs? The most likely cause is thermal coupling through the board or the enclosure rather than electrical noise. Check the sensor placement and the copper around it before adding filtering components.
Can the same board run from mains or batteries? It can, but the two versions rarely share a layout. The mains version needs an isolation barrier and creepage, while the battery version is optimised for leakage current, and the compromises differ enough that separate boards are usually simpler, as discussed in the guidance on manufacturable design.



