When you need to measure temperature with laboratory-grade precision—better than ±0.1°C across a wide range—thermistors and digital sensors like the DS18B20 fall short. The solution is a Platinum Resistance Temperature Detector (PT100) paired with a dedicated analog front-end. Designing robust sensor circuitry for a PT100 requires more than just wiring it to an Arduino or ESP32 analog pin; it demands a precision current source, high-resolution ADC, and careful attention to lead-wire resistance.
The Sensing Principle and Output Signal
A PT100 sensor is a passive resistive device made of pure platinum wire or film. Its resistance scales predictably with temperature: it measures exactly 100.00 Ω at 0°C and increases by approximately 0.385 Ω per degree Celsius (the standard DIN 43760 temperature coefficient). Because it is purely resistive, the PT100 itself outputs no voltage or current. It merely acts as a variable resistor. To extract a readable signal, your sensor circuitry must inject a highly stable, known excitation current through the platinum element and measure the resulting voltage drop.
However, feeding that tiny analog voltage drop directly into an ESP32’s 12-bit ADC will yield noisy, inaccurate results due to the microcontroller's poor analog front-end and fluctuating reference voltages. Instead, robust sensor circuitry uses a dedicated RTD-to-Digital converter like the Maxim Integrated MAX31865. The MAX31865 handles the precision current excitation, amplifies the microvolt-level signal, and outputs a 15-bit digital value via SPI. Therefore, the physical output of the PT100 is analog resistance, but the output of your complete sensor circuitry to the microcontroller is a digital SPI data stream representing that resistance.
| Temperature (°C) | PT100 Resistance (Ω) | Voltage Drop (mV) @ 1mA | MAX31865 Raw ADC Code (Decimal) | MAX31865 Raw ADC Code (Hex) |
|---|---|---|---|---|
| -50°C | 80.31 | 80.31 | 6,136 | 0x17F8 |
| 0°C | 100.00 | 100.00 | 7,640 | 0x1DD8 |
| 25°C (Room) | 109.73 | 109.73 | 8,383 | 0x20BF |
| 100°C (Boiling) | 138.51 | 138.51 | 10,583 | 0x2957 |
| 250°C | 195.47 | 195.47 | 14,935 | 0x3A57 |
Wiring the Sensor Circuitry: Pinouts and Topologies
The physical wiring topology you choose dictates the complexity of your sensor circuitry and the mathematical compensation required in firmware. While 2-wire setups are common in cheap hobby kits, they introduce massive errors due to the copper lead resistance. For any ESP32 project requiring real accuracy, you must use 3-wire or 4-wire configurations.
| MAX31865 Pin | ESP32 Pin (Example) | Function & Notes |
|---|---|---|
| VIN / VDD | 3V3 | Supply Range: 3.0V to 3.6V. Do not use 5V on ESP32 GPIO-tolerant breakouts unless it has an onboard LDO. |
| GND | GND | Common ground. Keep digital ground currents away from the RTD return path. |
| SCK | GPIO 18 | SPI Clock. MAX31865 supports up to 5MHz. |
| SDO (MISO) | GPIO 19 | SPI Data Out (RTD data to ESP32). |
| SDI (MOSI) | GPIO 23 | SPI Data In (Used only for writing configuration registers). |
| CS | GPIO 5 | Chip Select. Active LOW. Pull high when not communicating. |
| RDY | GPIO 4 | Data Ready / Fault Interrupt. Active LOW when conversion completes or fault occurs. |
Choosing Your Wire Topology
| Topology | Wires Used | Accuracy | Firmware Compensation Needed? | Best Use Case |
|---|---|---|---|---|
| 2-Wire | 2 | Poor (±1°C to ±5°C error) | Yes (manual offset subtraction) | Short runs (<1m), non-critical hobby projects. |
| 3-Wire | 3 | Excellent (±0.2°C) | Yes (MAX31865 hardware + CVD math) | Industrial standard, long cable runs up to 10m. |
| 4-Wire | 4 | Laboratory (±0.05°C) | No (Kelvin sensing eliminates lead R) | Calibration labs, extremely precise scientific logging. |
Raw-to-Unit Math and Calibration Scaling
Once the ESP32 reads the 15-bit raw ADC value from the MAX31865 via SPI, you must convert it to resistance, and then to temperature. Never conflate the raw ADC integer with a voltage; it is a direct ratio of the RTD resistance to the reference resistor.
Step 1: ADC to Resistance
The MAX31865 outputs a 15-bit unsigned integer (the 16th bit is a fault flag). The formula to extract the actual PT100 resistance is:
R_RTD = (ADC_Code / 32768) * R_REF
If your raw ADC reads 8383 and your reference resistor is 430 Ω:
R_RTD = (8383 / 32768) * 430 = 109.73 Ω
Step 2: Resistance to Temperature (Scaling)
For a quick approximation above 0°C, you can use the linear Temperature Coefficient of Resistance (TCR):
T = (R_RTD - 100.0) / 0.385
However, platinum RTDs are not perfectly linear. If you are measuring below 0°C, or need accuracy better than ±0.5°C across a wide span, you must use the Callendar-Van Dusen (CVD) equation. According to Omega Engineering's RTD standards, the CVD equation for temperatures below 0°C incorporates a quadratic and cubic term to account for the platinum curve's slight droop. Most modern RTD libraries, such as the Adafruit MAX31865 library, handle the CVD iteration internally, but understanding the math is critical when you need to port the code to a bare-metal ESP-IDF environment without Arduino wrappers.
Common Interference Sources and Mitigation
Because the MAX31865 is measuring voltage drops in the millivolt range across high-impedance nodes, your sensor circuitry is a magnet for environmental noise. Here are the three most common failure modes and how to engineer them out of your design.
1. 50/60Hz Mains EMI Coupling
Running unshielded RTD wires parallel to AC mains cables will induce a 50Hz or 60Hz AC voltage onto the measurement lines. The MAX31865 includes an internal digital notch filter specifically designed to reject this. You must configure the MAX31865's Configuration Register (Address 0x00) to match your local grid frequency. Set bit D1 to 1 for 50Hz rejection (Europe/UK/AU) or 0 for 60Hz rejection (US/Canada). Failing to set this register correctly will result in a fluctuating temperature reading that dances by ±1.5°C.
2. Thermal EMF (Seebeck Effect) at Solder Joints
When you solder copper wire to the platinum pads of the RTD, or when you transition from the RTD cable to the copper traces on your PCB, you inadvertently create a thermocouple. If one side of your terminal block is near a hot voltage regulator and the other is in ambient air, a Thermal Electromotive Force (EMF) in the microvolt range is generated. In high-precision sensor circuitry, this mimics a temperature shift. Mitigation: Keep the MAX31865 input terminals thermally isolated from heat-generating components (like the ESP32's onboard LDO or WiFi antenna trace) and ensure both input wires experience the exact same ambient temperature at the PCB junction.
3. Fault Register False Positives
Beginners often write an SPI read loop that crashes when the MAX31865 throws a fault. The chip monitors for FAULT_HIGH (RTD resistance > RREF) and FAULT_LOW (RTD resistance shorted to ground). If your PT100 cable is unplugged, the inputs float, triggering a FAULT_HIGH. If a wire pinches and shorts, it triggers FAULT_LOW. Always read the Fault Status Register (Address 0x07) before trusting the RTD data registers. As detailed in the Adafruit MAX31865 hardware guide, you must write a 1 to bit D1 in the configuration register to clear the fault latch before the chip will resume taking valid conversions.






