Hello friends, I hope you all are doing great. Today, I am going to share the PT100 Cold Chain Logger with MAX31865 and ESP32 - Proteus Simulation, the eighty-third project of our IoT Projects series. If you have searched for a MAX31865 with an ESP32, how to read a PT100 RTD accurately, a vaccine fridge temperature monitor, or what mean kinetic temperature is, here is a complete one in a Proteus simulation. Vaccines, insulin and many medicines must be kept between 2 and 8 C from the factory to the patient: the cold chain. Too warm and they slowly lose their strength; frozen and many vaccines are destroyed at once, often with no visible sign.
So every fridge in the chain needs a logger that measures accurately, records everything, and raises the alarm early. This ESP32 reads a PT100 platinum resistance thermometer through a MAX31865 RTD converter, logs a sample every minute, and keeps what a cold chain record needs: the minimum and the maximum, the time spent above 8 C and below 2 C, and the mean kinetic temperature, the single figure that tells how much the medicine has aged. It sounds TOO WARM, TOO COLD and PROBE FAULT alarms that stay on until someone acknowledges them, shows a two-hour trend on an OLED, and serves the record on a dashboard and as a CSV file. In this tutorial, we will go through the circuit, the cold chain, how a PT100 works, the MAX31865 and its registers, fault detection, mean kinetic temperature and the alarm logic. Then we put the fridge through a power cut, a freezing mistake and a broken probe in the simulation. At the end, you can download the project with the sketch and every library file.
NOTICE: Our team has put a lot of effort into this project: the circuit, the code and every part in the simulation are our own work, and you get them all free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below. And if our free projects help you, you can buy us a coffee. So, let's get started with the PT100 cold chain logger with MAX31865 and ESP32 in Proteus simulation:
What Does This Cold Chain Logger Do?
- Measures accurately: a 3-wire PT100 through a MAX31865, 15-bit, about 0.03 C a step.
- Logs every minute: the temperature, the minimum and maximum, the minutes above 8 C and below 2 C, and the excursions.
- Works out the MKT: the mean kinetic temperature of everything logged.
- Raises the alarm: TOO WARM after 3 minutes above 8 C, TOO COLD after 1 minute below 2 C, PROBE FAULT at once; each stays on until ACK.
- Shows and serves the record: an OLED with a two-hour trend, a dashboard, and the log as a CSV file.
It is a great project for learning precision temperature measurement, SPI, fault handling and a bit of pharmaceutical science in one go. In the simulation, the MAX31865's pop-up holds the probe in a scene, the fridge, the room, ice water, an oven, and can open or short the probe, so we can try every alarm in minutes.
Components Used in the Proteus Simulation
All the parts come from our Proteus libraries, each with its own tutorial. The project zip at the end includes every LIB and DLL file.
| Part | Proteus device | Library post | Connection |
|---|---|---|---|
| ESP32 DevKit V1 | ESP32 DEVKIT V1 | ESP32 DevKit V1 Library for Proteus | U1, ESP32_Cold_Chain.hex, Wi-Fi 192.168.1.101 |
| MAX31865 with a PT100 | MAX31865TEP | MAX31865 RTD Sensor Library for Proteus | U2 on SPI (D18, D19, D23, CS D5), RDY on D4 |
| Passive buzzer | BUZZERPASSIVETEP | Passive Buzzer Library for Proteus | BZ1 on D33 through R1 |
| Resistor 100 ohm | RESISTOR4BANDTEP | Resistor Library for Proteus | R1, the buzzer's |
| OLED SSD1306 128x64 | OLED12864WHITEADVTEP | OLED SSD1306 Library for Proteus | OLED1 on I2C, 0x3C |
| Laptop WiFi Monitor | LAPTOP WIFI MONITOR | Laptop WiFi Monitor | PC1 |
| Mobile WiFi Monitor | MOBILE WIFI MONITOR | Mobile WiFi Monitor | MOB1 |
Proteus Simulation of the Cold Chain Logger: the Circuit
| MAX31865 pin | ESP32 | Signal |
|---|---|---|
| CLK | D18 | SPI clock (SCK) |
| SDO | D19 | data from the MAX31865 (MISO) |
| SDI | D23 | data to the MAX31865 (MOSI) |
| CS | D5 | chip select, low during a transfer |
| RDY | D4 | DRDY: low when a conversion is ready |
| VIN / GND | VIN (5 V) / GND | the module's regulator makes 3.3 V |
The PT100 itself connects to the module's screw terminal with three wires; on the sheet the probe and its cable are part of the module's drawing. The buzzer sits on D33 through 100 ohm and the OLED on the I2C pins D21 and D22.
How the Cold Chain Logger Works
The Cold Chain: 2 to 8 C
Most vaccines and many biological medicines are stored between 2 and 8 C. Above 8 C they lose potency, slowly at first and faster as the temperature rises: the damage adds up over time, so a short excursion matters less than a long one, but it all counts. Below 0 C many vaccines freeze, and freezing can destroy them in minutes, often without anything to see. So a fridge logger must catch both, record how long each lasted, and never hide an excursion: a medicine that has been out of range is set apart until someone checks the maker's stability data.
The PT100 Platinum Resistance Thermometer
A PT100 is a platinum wire or film whose resistance is exactly 100 ohm at 0 C and rises by about 0.385 ohm per degree. Platinum is chosen because its resistance is stable for years and follows a standard curve, IEC 60751, the Callendar-Van Dusen equation: above 0 C, R = 100 (1 + A T + B T^2) with A = 3.9083e-3 and B = -5.775e-7. Solving the quadratic for T gives the temperature from the resistance. Worked example: at 5 C, R = 100 (1 + 0.019542 - 0.0000144) = 101.953 ohm. Because 1 C is only 0.39 ohm, the resistance of the leads matters: two 0.4 ohm leads add 0.8 ohm, about 2 C. A 3-wire probe has a third lead so the converter can measure the lead resistance and cancel it.
The MAX31865 RTD Converter
The MAX31865 drives a small current through the PT100 and a precise reference resistor in series, and its 15-bit ADC measures the ratio: code = R(PT100) / RREF x 32768. Because it is a ratio, the current does not need to be exact. With RREF = 430 ohm, the 5 C probe gives 101.953 / 430 x 32768 = 7,769, and one step is 430 / 32768 = 0.013 ohm, about 0.034 C. The ESP32 talks to it over SPI mode 1: an address byte (bit 7 set for a write) and then the data. CONFIG = 0xD3 turns on the bias, starts automatic conversions every 20 ms (with the 50 Hz filter), selects 3-wire mode and clears any fault. Each time a result is ready, the DRDY pin goes low; reading the two RTD registers takes it high again.
Catching a Broken Probe
The lowest bit of the RTD result is a fault flag. When it is set, the FAULT STATUS register (07h) says why: above the high threshold, below the low one, or a broken connection. An open probe also reads a code of 7FFFh, full scale, and a shorted one reads 0000h. The sketch treats any of these as PROBE FAULT, sounds the alarm at once, and counts the minutes the fridge went unwatched: a logger that silently logs nonsense would be worse than none.
Mean Kinetic Temperature
Medicines age by chemical reactions, and reactions speed up exponentially with temperature (the Arrhenius law). So the average temperature underestimates the damage of a warm spell: a day at 2 C plus a day at 14 C average 8 C, but the warm day ages the medicine far more than the cold day spares it. The mean kinetic temperature fixes this. MKT = (dH / R) / -ln(the mean of exp(-dH / (R T))), with T in kelvin and dH / R = 10,000 K (an activation energy of 83.144 kJ/mol, the usual value). Worked example: that day at 2 C (275.15 K) and day at 14 C (287.15 K) give exp(-36.344) and exp(-34.825); their mean is about 4.58e-16, whose natural logarithm is -35.320, and 10000 / 35.320 = 283.13 K = 9.97 C. The MKT is almost 10 C, not 8: well over the limit, though the plain average sits right on it.
Alarms with Sensible Delays
A fridge warms for a minute every time the door opens, so an alarm on the first reading above 8 C would cry wolf all day. The HIGH alarm waits until the temperature has been above 8 C for 3 minutes in a row. Freezing does its damage quickly, so the LOW alarm waits only 1 minute below 2 C. A probe fault alarms at once. Every alarm latches: the buzzer keeps sounding until someone clicks ACK on the dashboard, and even then the record keeps the excursion. The dashboard's verdict is in range (fine to use) or EXCURSION (set the stock apart and check the stability data).
What the Record Is For
An alarm is only half of a logger's job; the other half is the evidence afterwards. When an excursion happens, the usual procedure is not to throw the stock away or to carry on as if nothing happened, but to mark it do not use, keep it cold, and send the record to whoever decides: how high or how low, for how long, and the mean kinetic temperature over the period. The maker's stability data says how much exposure each product can take; many products can take a few hours above 8 C, very few can take freezing. That is why this logger counts the minutes above 8 C and below 2 C separately, keeps them after an ACK, and serves the minute-by-minute CSV. A record that can be silently reset, or an alarm that erases itself when acknowledged, would make the decision a guess.
A Day in Minutes
A real excursion takes minutes to hours. The sketch has TIME_SCALE = 60: in the simulation each simulated second counts as a minute of the log, so a power cut of an hour takes a minute to watch. On a real logger TIME_SCALE is 1 and a sample is taken every real minute.
The Arduino Code Explained
The sketch is ESP32_Cold_Chain.ino, built for our ESP32 DevKit V1 with the WiFi, WebServer, SPI, Wire and Adafruit SSD1306 libraries. The limits and the alarm delays:
const float T_LOW = 2.0, T_HIGH = 8.0; // the cold chain's range, C
const int HIGH_DELAY = 3, LOW_DELAY = 1; // minutes out of range before an alarm
The SPI settings and a register write:
const SPISettings MAX_SPI(1000000, MSBFIRST, SPI_MODE1);
SPI.transfer(reg | 0x80); SPI.transfer(v);
Reading a result when DRDY is low, and the fault flag:
if (digitalRead(DRDY)) return; // DRDY low: a new conversion is ready
faultStatus = rd(0x07);
From the code to the temperature:
ohms = code * RREF / 32768.0;
if (r >= 100.0) return (-A + sqrt(A * A - 4 * B * (1 - r / 100.0))) / (2 * B);
The mean kinetic temperature, sample by sample:
mktSum += exp(-DH_R / (tempC + 273.15));
mkt = DH_R / -log(mktSum / samples) - 273.15;
The OLED shows the temperature large, the time, the state, the minimum and maximum, the MKT and the minutes above 8 C, and a two-hour trend with dotted lines at 2 and 8 C. The dashboard's links are ACK, NEW LOG and LOG.CSV; /data gives everything as JSON.
How to Run the Proteus Simulation
- Download the project zip below and install the library files (the steps are under the download button).
- Open ESP32-Cold-Chain.pdsprj from the Proteus Simulation folder. Keep the HEX and the DLL files next to it.
- Press Play. The fridge is at 5 C; each simulated second is a minute of the log.
- Click U2 for the sensor's pop-up and change the scene: Room for a power cut, Ice water, Probe open.
- Open the Laptop WiFi Monitor (press Go): ACK silences an alarm, LOG.CSV shows the record.
Simulation Results: the Fridge in Proteus
We put the fridge through three accidents in 47 minutes of the log (60 simulated seconds): a power cut, a cooler packed with too much ice, and a broken probe. The times below are the log's clock, which starts at 08:00.
The Fridge in Range
At start the ESP32 wrote CONFIG 0xD3 and read back 0xD1 (the fault-clear bit clears itself): the MAX31865 was found. The fridge read 4.96 to 5.02 C, a PT100 resistance of 101.94 ohm, the noise of the readings a few hundredths of a degree. After 15 minutes: minimum 4.9 C, maximum 5.2 C, MKT 5.03 C, in range, and the dashboard's verdict: fine to use.
A Power Cut: TOO WARM
At about 08:16 the power failed: the probe found itself in room air. The temperature crossed 8 C within a minute, but the alarm waited, as designed, for 3 minutes above 8 C: at 08:20, ALARM: TOO WARM at 19.0 C, the buzzer sounding. The MKT climbed fast: 7.92 C at 08:20, 12.77 C at 08:25, 16.50 C at 08:35 with the fridge at 22 C. Twenty minutes at room temperature had pushed the mean kinetic temperature of the whole log far above 8 C, though most of the log was spent at 5 C: that is the Arrhenius weighting at work. The dashboard's verdict changed to EXCURSION. At 08:35 we clicked ACK: the buzzer stopped, and the record kept the excursion.
Too Much Ice: TOO COLD
Then someone packed the cooler with ice. The temperature fell straight through the range: 2.67 C at 08:40, and at 08:41, after a minute below 2 C, ALARM: TOO COLD - freezing risk at 1.5 C. At 08:45 the probe read 0.05 C. The log now held 21 minutes above 8 C and 5 below 2 C: two excursions in opposite directions, both of which could have ruined the stock.
A Broken Probe: PROBE FAULT
Last, the probe broke open. The next result carried the fault flag: the fault status read 0x84 (the high threshold and the open input) and the code was 7FFFh, full scale. At 08:47 the sketch printed PROBE FAULT: status 0x84 - open and raised the alarm at once: a fridge that is not being watched. The OLED showed FAULT instead of a number, and the minutes with a faulty probe started to count in the record.
Every alarm came at the right moment, with its delay, and the record kept every excursion after it was acknowledged.
Download the Project Files
Click the button below to download PT100-Cold-Chain-Logger-MAX31865-ESP32-Proteus-Simulation-v1.0.zip (about 4.1 MB, without the source code of the models):
PT100 Cold Chain Logger with MAX31865 and ESP32 - Proteus Simulation V1.0- Proteus Simulation: ESP32-Cold-Chain.pdsprj, ESP32_Cold_Chain.hex and copies of the models.
- Arduino Code: ESP32_Cold_Chain.ino, the sketch.
- Proteus Library Files: the LIB files of every part.
- Proteus Model Files: the DLL models.
- README.txt: the installation steps, the properties, the test results and the links to every library post.
No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.
How to Install the Project Files
- Close Proteus and extract the whole zip file, for example to your Desktop.
- Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
- Copy the files from Proteus Model Files into the MODELS folder.
- Start Proteus and open the project from the Proteus Simulation folder.
Changing the Code
Open the sketch in the Arduino IDE with the TEP Boards for Proteus installed, select ESP32 Dev Module (TEP Proteus), and use Sketch > Export Compiled Binary. Put the new HEX next to the project. The limits, the alarm delays, the MKT constant, the log length and TIME_SCALE are near the top.
Ideas to Extend the Project
- Keep the record safe: write each sample to an SD card or to flash, so a power cut of the logger itself loses nothing.
- Take the time from NTP and stamp every sample with the real date and time.
- Send the alarms out: an e-mail, a push message or an SMS through a GSM module when nobody is at the fridge.
- Log a second probe, in a bottle of glycol, which follows the medicine's temperature rather than the air's.
- Add a door switch, so the record tells a door left open from a failed compressor.
- Run on a battery with the Wi-Fi asleep between reports, for a cold box in transport.
From Simulation to Real Hardware
- Set TIME_SCALE to 1: one sample a real minute.
- Match the jumpers: the MAX31865 board has 2/3/4-wire jumpers that must match the probe and the CONFIG bit.
- Check RREF: PT100 boards use 430 ohm, PT1000 boards 4300 ohm; the code formula needs the right value.
- Calibrate: compare with a reference thermometer in ice water and at room temperature, and keep the certificate with the logger.
- Place the probe well: in the middle of the stock, away from the walls and the cold plate, ideally in a buffer bottle.
Troubleshooting
- "CONFIG 0x0 - not found?": SCK, MISO, MOSI and CS on D18, D19, D23 and D5; the MAX31865 needs SPI mode 1 or 3.
- PROBE FAULT: the probe is open or shorted, or a wire is loose.
- The temperature reads about 2 C high: a 2-wire probe adds its leads; use 3 or 4 wires.
- Alarms on every door opening: raise HIGH_DELAY, or log a buffered probe.
- The OLED stays dark: SDA and SCL on D21 and D22, VCC on 3.3 V.
Limitations of the Simulation
- The probe is our library's model: a scene with a 1.5 s lag and a little noise, not a fridge with its own thermal mass and compressor cycles.
- The limits, the alarm delays and the MKT constant are typical values for learning; a real cold chain follows its own procedures and validated equipment.
- The network to the laptop and the phone is simulated inside Proteus.
- ESP32 is a product of Espressif Systems and the MAX31865 of Analog Devices (Maxim Integrated); this project is not made or endorsed by them or by Labcenter.
So, that was all about the PT100 Cold Chain Logger with MAX31865 and ESP32 - Proteus Simulation. I hope it helps you understand how a PT100 and a MAX31865 measure temperature so precisely, why a cold chain record needs the mean kinetic temperature and not just the average, and how a logger with honest alarms protects medicines from heat, frost and a broken probe, all tested in a simulation before you put one in a real fridge. More projects with the ESP32 and the Raspberry Pi 5 are coming. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!