Designing a Portable Constant-Temperature Reflow Heater: Calculations and Derivations
Project page (schematics, BOM, firmware releases): DC12-20V (PD) Constant-Power Heating Platform — oshwhub.com
This is a build log for a portable constant-temperature heating platform intended for hand soldering and small-batch reflow work — pocketable, precise, fast to heat up, and cheap to build. The most interesting part of the project wasn't picking parts, it was the handful of calculations that tie the hardware to the firmware: the topology trade-off for the driver stage, the trace-resistance estimate for the heating plate, the calibration equations for three analog sensing channels, and the curve-fitting needed before any of that data can feed a PID loop. This post focuses only on those calculations — schematic-level detail and mechanical layout are left out.
1. Topology choice: why a single-MOSFET buck
The heating plate is a purely resistive load, but its resistance rises with temperature. To hold constant power as the plate heats up, the driver needs to output a variable voltage somewhere in the range 0–VBUS — which immediately rules out a relay: a relay is binary, its switching frequency is far too low for tight temperature control, overshoot and oscillation are hard to avoid, and the contacts degrade with repeated cycling.
That leaves two variable-voltage topologies to compare:
The 4-MOSFET buck-boost gives the widest output range and can both step up and down, but current always flows through two MOSFETs at once, which drags efficiency down, and the control algorithm has to manage complementary switching and dead-time — more silicon, more firmware complexity, more cost. Since the design never needs to boost above VBUS, that headroom is wasted. A single-MOSFET async buck gives up boost capability (not needed here) in exchange for one switch and a much shorter control chain.
This decision also fixed the gate-drive topology: low-side NMOS instead of high-side PMOS. A high-side PMOS would need a gate drive signal swinging Vgs between roughly 0 and −10V, i.e. sitting about 10V below VBUS (20V) — but there is no 10V rail anywhere in the system, so a dedicated regulator would have been needed just for that. A low-side NMOS only needs a level-shift stage plus a push-pull buffer to drive, which is a much shorter signal path.
2. Heating-plate trace resistance: a number you can verify by formula
The heating plate is a single-sided aluminum-substrate PCB using a 20 mil serpentine trace, 2600 mm total length, 1 oz copper (≈35 μm thick). The design specifies an equivalent trace resistance of 2.6 Ω. That number looks arbitrary at first glance, but it falls straight out of the standard conductor resistance formula:
Substituting copper resistivity , trace width , copper thickness , and total trace length :
That's close to the specified 2.6 Ω — the small gap is accounted for by copper's positive temperature coefficient at operating temperature and the extra resistance contributed by the serpentine's corner turns.
The direction of the calculation matters here: power requirement drives trace geometry, not the other way around. The system needs to deliver up to 65 W across 0–20V, which at full load implies roughly 3.25 A — for that voltage/current combination the load resistance has to land in the low single-digit ohm range. 2.6 Ω sits right in that window, and the serpentine's width and length were laid out specifically to hit that resistance target.
3. Calibration equations for the three analog sensing channels
The system measures three quantities: heating-plate current, heating-plate temperature (via thermocouple), and input voltage. Each goes through an analog front end before landing on the MCU's 10-bit ADC, and each has its own conversion equation.
3.1 Current sensing
The shunt resistor (1206, 50 mΩ) feeds an LM358-based differential amplifier. Its output satisfies:
provided the design meets and (the symmetry condition for a differential amplifier — break it and common-mode rejection collapses). (~0.7V, set by a diode clamp) is deliberately added because the LM358 isn't rail-to-rail: if the output sat near 0V it would enter its non-linear region, so the bias lifts the operating point and keeps the response linear even at very low or near-zero sampled current.
Rather than solving the shunt resistance analytically end-to-end, the conversion to a physical current value uses two-point calibration: a precision multimeter measures actual current at a few known points, the corresponding ADC readings are recorded, and a linear fit is derived:
This is more robust than computing everything from nominal component values — op-amp offset voltage and part-to-part variation across manufacturing batches get absorbed automatically by the fit, with no separate compensation needed in firmware.
3.2 Input voltage sensing
VBUS is divided by , before the ADC:
This one is a plain resistor divider with no bias term, because unlike current sensing, the divided voltage doesn't run into an op-amp dead-zone problem — the divided value already sits comfortably within a usable ADC range.
3.3 Back-solving MCU supply voltage
STC8H parts route an internal 0.9V bandgap reference to ADC channel 15, which can be used in reverse to calibrate the MCU's own supply voltage (which also happens to be the ADC reference voltage):
The logic: if the ADC reference equals the MCU supply, then knowing the bandgap's true voltage (0.9V) and its corresponding raw ADC reading lets you solve backward for the current supply voltage. This value gets reused downstream for the NTC divider calculation, since the NTC divider shares the same MCU-voltage reference — keeping both measurements tied to one common error source instead of two independent ones.
4. Temperature chain: thermocouple plus cold-junction compensation
Temperature is measured in two parts: a K-type thermocouple reads the hot junction (the plate itself), and an NTC thermistor measures the cold junction — needed because a thermocouple output represents a temperature difference, not an absolute value, so the cold-junction temperature has to be measured separately and added back in.
4.1 Thermocouple amplification
Using the same differential-amplifier structure as the current channel, with and :
Raw thermocouple EMF is only a few millivolts, so it needs amplification before it's usable at the ADC's effective resolution.
4.2 Cold-junction NTC: from voltage ratio to cubic fit
The NTC is divided against a fixed 10 kΩ resistor; the MCU reads the divider ratio and back-solves the NTC's resistance:
Once the NTC resistance is known, it has to be converted to a temperature via the thermistor's characteristic curve. Rather than storing and interpolating a lookup table on the MCU, the curve is fit to a cubic polynomial:
with fitted coefficients , , , .
A cubic fit (rather than a simple linear one) is used because an NTC's resistance-vs-temperature curve is only close to linear on a log-resistance axis — that's essentially what the Steinhart-Hart relation captures. On a linear axis the curve visibly bends, and a first-order fit would show noticeable error toward the ends of the working range. A cubic keeps residuals small across the relevant temperature band while avoiding logarithm or exponential evaluation on hardware — the STC8H has no hardware floating-point unit, so a cubic's multiply-adds are far cheaper than calling into a log/exp library.
5. PWM duty cycle: the last link before closing the loop
The MOSFET gate drive is generated by the STC8H's built-in advanced PWMA peripheral. Duty cycle is set by the reload register (PWMA_ARR) and the compare register (PWMA_CCR1):
This converts the two raw register values into a normalized 0–100% duty figure, giving the PID output a consistent, human-readable unit instead of forcing the control layer to reason about register values directly. The PID adjusts duty cycle as an abstract quantity; the driver layer maps that back to actual register writes. Decoupling the two makes tuning and debugging considerably easier.
6. Cross-checking against open-loop simulation
Before closing the loop with PID, the driver and sensing circuits were validated open-loop in Multisim. A few key numbers from that pass:
- At 20 kHz PWM, 50% duty cycle, load voltage settles to about 13V after roughly 1 ms.
- Input-loop current probe reads 2.36 A.
- The current-sense branch (ISMP minus offset) settles to 1.2V; dividing out the 10× amplifier gain gives a shunt drop of 0.12V, which back-calculates to about 2.4 A — closely matching the 2.36 A read directly from the current probe.
- Total system power comes out around 42.5 W.
The point of this cross-check: the value computed through the current-sensing chain has to agree with the value measured directly in simulation. A large mismatch would mean an error somewhere in the derived gain or bias assumptions. Here the two are within about 2%, which confirms the 10× differential-amp gain and the bias compensation are both correctly dialed in — enough confidence to wire this channel into the real PID loop.
Summary
Every derived number in this project follows the same pattern: start from a physical formula that gives a theoretical value or target range (trace resistance, divider ratio, power budget), then use multi-point calibration against real hardware to close the gap between theory and actual component tolerances. That's why nearly every sensing channel ends up expressed as a linear fit or a low-order polynomial — the formula provides the structure, calibration provides the accuracy, and neither one alone is enough.