Hello friends, I hope you all are doing great. Today, I am going to share the Sensorless Peltier Cooler Controller with ESP32 - Proteus Simulation, the eighty-ninth project of our IoT Projects series. If you have searched for a Peltier module with an ESP32, TEC1-12706 temperature control, the Seebeck effect, or how to control a thermoelectric cooler without a temperature sensor, here is a complete one in a Proteus simulation. A Peltier cooler normally needs a thermistor or a DS18B20 glued to its cold plate. This one needs none, because the Peltier module itself is the thermometer.
A Peltier module pumps heat when current flows through it, and it works the other way round too: when the two sides are at different temperatures, it makes a voltage. That is the Seebeck effect, and for the TEC1-12706 it is 0.0517 V for every kelvin between the plates. So this ESP32 switches the module off for 40 ms every half second, measures that voltage with two cheap 0-25 V sensor modules, works out the temperature difference and holds it at a target with a PI loop through an IRLZ44N MOSFET. In this tutorial, we will go through the circuit, how a Peltier module pumps heat, the Seebeck voltage and why it can only be read with the current off, the measurement window, the PI loop with its anti-windup, the power, and a fault check. Then we watch the module cool in the simulation, hold 15 K and 25 K, run at full power and warm back when it is switched off, and compare every reading of the ESP32 with the module's own pop-up. 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 sensorless Peltier cooler controller with ESP32 in Proteus simulation:
What Does This Sensorless Peltier Cooler Do?
- Drives a Peltier module: a TEC1-12706 on 12 V, switched by an IRLZ44N MOSFET with a 500 Hz PWM.
- Measures without a sensor: every 500 ms the PWM stops for 40 ms and the module's own Seebeck voltage gives the temperature difference.
- Holds a target: a PI loop sets the duty for 10, 15, 20 or 25 K, or MAX for full power.
- Watches itself: STEADY when the difference stays within 0.3 K, FAULT when current flows while the MOSFET should be off.
- Reports: dT, the Seebeck voltage, the duty, the current and the power on the OLED, a dashboard and the serial monitor.
It is a great project for learning thermoelectric cooling, closed-loop control and a clever measurement trick in one go. In the simulation, the module's pop-up shows both plate temperatures, the heat pumped and the COP, so we can check the ESP32's sensorless reading against the real temperatures at every step.
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_Peltier_Seebeck.hex, Wi-Fi 192.168.1.101 |
| TEC1-12706 Peltier module | TEC12706TEP | TEC1-12706 Peltier Module Library for Proteus | U4: red wire on +12V, black wire = TECN |
| IRLZ44N MOSFET | IRLZ44NTEP | N-MOSFET Library for Proteus | Q1 on the low side, gate from D25, small heatsink |
| 0-25 V voltage sensor (x2) | VSENSOR25VTEP | Voltage Sensor 0-25V Library for Proteus | U2 on +12V to D34, U3 on TECN to D35 |
| Resistors 220 ohm, 10k | RESISTOR4BANDTEP | Resistor Library for Proteus | R1 gate resistor, R2 gate pull-down |
| 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 Peltier Cooler: the Circuit
| Signal | ESP32 | Goes to |
|---|---|---|
| PWM | D25 | R1 220 ohm to Q1's gate; R2 10k to ground keeps the MOSFET off while the ESP32 starts |
| V12_S | D34 | U2's output: the 12 V supply divided by 5 |
| VN_S | D35 | U3's output: the module's black wire (TECN) divided by 5 |
| TECN | - | U4's black wire, Q1's drain and U3's input |
| +12V | - | U4's red wire and U2's input |
| SDA / SCL | D21 / D22 | OLED1 |
The MOSFET sits on the low side: its source on ground, its drain on the module's black wire. When it conducts, the black wire is pulled to almost 0 V and the module gets the full 12 V. When it is off, no current flows and the black wire floats up to 12 V minus whatever voltage the module itself makes. Each 0-25 V sensor module is just a 30k / 7.5k divider, so 12 V becomes 2.4 V, safely inside the ESP32's 3.3 V input range.
How the Sensorless Peltier Cooler Works
The Peltier Module as a Heat Pump
A TEC1-12706 is 127 pairs of small bismuth telluride blocks between two ceramic plates. Current from the red wire to the black one carries heat from the plain side to the printed side. The module's datasheet values (S = 0.0517 V/K, R = 1.87 ohm, K = 0.58 W/K) give the heat taken from the cold side: Qc = S x I x Tc - I² x R / 2 - K x dT. The first term is the pumping, the second is half of the module's own resistive heat leaking back to the cold side, and the third is heat conducted back through the blocks. Everything it takes from the cold side plus all the electrical power goes out of the hot side, which is why a Peltier module needs a good heatsink with a fan. The more temperature difference it holds, the less heat it can pump, and at 66 K (dTmax) it pumps none at all.
The Seebeck Effect: the Module Is Its Own Thermometer
The same blocks work as a thermocouple. With no current, a temperature difference between the plates makes a voltage: Vs = S x dT. For the TEC1-12706, 0.0517 V per kelvin, so 15 K makes 0.776 V and 25 K makes 1.29 V. That is far larger than a single thermocouple (about 40 microvolts per kelvin), because 127 pairs are in series. So if we can read the module's voltage, we know the difference between its plates without any sensor at all.
Why the Current Must Be Off to Measure
While current flows, the module's voltage is I x R + Vs. At 6 A the resistive part is 6 x 1.87 = 11.2 V, and the 0.78 V we want is buried in it. Worse, R changes with temperature. So the ESP32 stops the PWM for 40 ms every 500 ms. With the MOSFET off, no current flows, the I x R part vanishes, and the voltage across the module is the Seebeck voltage alone. The ESP32 waits 20 ms for everything to settle and averages the readings of the last 20 ms. The plates have thermal mass, so their temperatures hardly change in 40 ms. The price: the module can be on at most 92 % of the time, so even MAX is 460 ms on and 40 ms off.
Measuring the Difference With Two Voltage Sensors
The module's voltage is the difference between its red wire (+12 V) and its black wire (TECN), so the circuit measures both: U2 the supply on D34, U3 the black wire on D35, and Vs = V(+12V) - V(TECN). Measuring the supply as well means a 12 V supply that is really 11.8 V or 12.3 V does not spoil the reading. Worked example: the ESP32 averages 2.243 V on D34 and 2.088 V on D35. Multiplied by the divider's 5, that is 11.215 V and 10.440 V, so Vs = 0.775 V and dT = 0.775 / 0.0517 = 15.0 K. One ADC count is 3.3 / 4095 x 5 = 4 mV at the input, 0.08 K; averaging many readings in the window smooths that out.
The PI Loop and Its Anti-Windup
Every 500 ms the ESP32 compares the measured dT with the target. The error drives the duty: duty = 0.25 x error + 0.06 x the integral of the error. So 4 K short gives 100 % at once, and the integral slowly finds the duty that holds the target exactly, where the proportional part alone would always stay a little short. While the duty is pinned at 0 % or 100 %, the integral is frozen (anti-windup): otherwise it would keep growing during the long full-power cool-down and the module would overshoot far past the target.
The Low-Side MOSFET and Its Heat
The IRLZ44N is a logic-level MOSFET: fully on at 4 to 5 V on its gate and still well on at the ESP32's 3.3 V. The simulation shows the cost of 3.3 V: about 32 mohm instead of 22, so at 6 A it drops 0.2 V and turns 1.2 W into heat. That is too much for a bare TO-220 for long, so the project gives it a small heatsink. R1 (220 ohm) limits the gate's charging current; R2 (10k) holds the gate low while the ESP32 boots, so the module never starts by itself. The PWM runs at 500 Hz, so the MOSFET is either fully on or fully off: half on, it would carry amps with volts across it and burn.
Power, STEADY and FAULT
The ESP32 also estimates the power from the module's constants: while the MOSFET conducts, the current is (V - Vs) / 1.87 ohm, and the average power is the duty times V times that current. STEADY is reported when dT has stayed within 0.3 K of the target for 3 s. And there is a safety check: the module cannot make more than 66 K x 0.0517 = 3.4 V on its own. If the off window ever shows more, current is still flowing while the MOSFET should be off, most likely a shorted MOSFET. The ESP32 then reports FAULT and does not trust the reading.
The Arduino Code Explained
The sketch is ESP32_Peltier_Seebeck.ino, built for our ESP32 DevKit V1 with the WiFi, WebServer, Wire and Adafruit SSD1306 libraries. The module's constants and the timing:
const float SEEBECK = 0.0517, R_TEC = 1.87; // V/K, ohm - the TEC1-12706's constants
const unsigned long PERIOD_MS = 500, WINDOW_MS = 40, SETTLE_MS = 20;
The PWM at 500 Hz with 10 bits, and the duty as a number from 0 to 1:
ledcAttach(PWM, 500, 10); // 500 Hz, 10 bits: the MOSFET fully on or fully off
void setDuty(float d) { ledcWrite(PWM, (int)(d * 1023 + 0.5)); }
The off window: 40 ms before the end of each period the PWM stops; after 20 ms of settling, both voltages are added up:
setDuty(0); phase = 1; sum12 = sumN = 0; nSum = 0;
if (now - cycleAt >= PERIOD_MS - WINDOW_MS + SETTLE_MS) { sum12 += analogRead(V12_PIN); sumN += analogRead(VN_PIN); nSum++; }
At the end of the window, the averages become volts, the difference is the Seebeck voltage, and the Seebeck voltage is the temperature difference:
v12 = sum12 * VREF / 4095.0 * DIV / nSum;
vs = v12 - vn; // no current: the module's voltage is the Seebeck voltage
dT = vs / SEEBECK;
The fault check comes first:
if (vs > SEEBECK * 66) { // more than its dTmax (66 K) can make: current still flows
The PI loop: the integral grows only while the duty is not pinned, or while the error would pull it back:
const float u = KP * e + KI * integ;
if ((u > 0 && u < 1) || (u >= 1 && e < 0) || (u <= 0 && e > 0)) integ += e * PERIOD_MS / 1000.0; // anti-windup
duty = constrain(KP * e + KI * integ, 0.0f, 1.0f);
And the current while the MOSFET conducts, from the module's resistance:
current = (v12 - vs) / R_TEC; // while the MOSFET conducts
The OLED is redrawn only while the module is driven, never inside the measurement window. The dashboard's links are Refresh, OFF, 10 K, 15 K, 20 K, 25 K and MAX; /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-Sensorless-Peltier.pdsprj from the Proteus Simulation folder. Keep the HEX and the DLL files next to it.
- Press Play. The sketch starts at a target of 15 K: full power first, then the PI settles. The module on the sheet prints both plate temperatures.
- Open the Laptop WiFi Monitor (press Go): 10 K to 25 K set the target, MAX gives full power, OFF stops the current.
- Click U4 for the module's pop-up and compare its dT with the ESP32's on the OLED.
Simulation Results: the Peltier Cooler in Proteus
We pressed Play and let the sketch start at its 15 K target. Then we set 25 K on the dashboard, gave the module full power with MAX, and switched it off. At every step we compared the ESP32's sensorless dT with the module's pop-up, which knows the real temperatures of both plates. The times are the simulation's clock; the whole run took 60.6 simulated seconds.
Cooling at Full Power
At 2.3 s the sketch set the target to 15 K. With the plates still equal, the error was 15 K, so the PI asked for far more than 100 % and the duty was pinned at full power: 6.28 A at the start. Around 7 s the module's pop-up showed 11.85 V and 6.13 A, the cold plate at 19.1 C and the heatsink side at 26.9 C, with 53 W pumped out of the cold side and 126 W into the heatsink. The OLED read 7.6 K from a Seebeck voltage of 391 mV; the pop-up's own dT was 7.8 K, and the plates kept parting in the moment between the measurement and the picture.
Holding 15 K
As the difference approached 15 K, the proportional part let go and the integral found the duty that holds it. At 20.8 s the ESP32 reported STEADY: dT 15.19 K (Vs 785 mV) at a duty of 19 % - 13.9 W into the module. The module's pop-up agreed: cold plate 13.7 C, hot side 28.8 C, a real difference of 15.1 K. Without any temperature sensor, the reading was within 0.1 K. Keeping 15 K takes only a fifth of the power that the cool-down took, because now only the heat leaking back from the room and through the module has to be pumped.
The IRLZ44N's pop-up shows it switching 500 times a second, about 20 % on, its junction at 29 C on the small heatsink. U3, the sensor on the black wire, caught the module between pulses: 8.98 V in, 1.795 V to the ESP32's pin, exactly one fifth.
25 K From the Dashboard
The dashboard showed HOLD 15 K - STEADY. We clicked 25 K: the duty went back to 100 % until the difference neared the new target, then settled. At 42.3 s the ESP32 reported STEADY: dT 25.17 K (Vs 1301 mV) at a duty of 36 % - 25.0 W into the module, and the pop-up showed the cold plate at 6.4 C and the hot side at 31.5 C, 25.1 K. Ten kelvin more needed almost twice the power, 24.8 W against 14.2 W in the module's pop-up, because both the heat leaking in from the room and the heat flowing back through the module grow with the difference.
Full Power
Then MAX: the PI stepped aside and the duty stayed at 100 %, still with the 40 ms off window in every half second. In about 7 s the difference grew to 31.2 K: the cold plate at 1.9 C, close to freezing, the hot side at 33.1 C. The module's pop-up averages over 0.1 s, so it shows the measurement window as a dip in the PWM it reports; the MOSFET's pop-up shows the truth, about 93 % on, its junction at 32 C. The IRLZ44N with only 3.3 V on its gate dropped about 0.2 V at 6 A, 1.2 W, easily handled by its small heatsink.
Switched Off: Still Measuring
Last, OFF: no more current. This is where a sensorless design shows its charm: the Seebeck voltage does not need the current, so the ESP32 kept measuring as the plates drifted back towards the room. 31.95 K at 52.3 s, 27.82 K at 57.3 s; the pop-up showed 27.2 K with 15.8 W leaking back through the module into the cold side. The current on the OLED is the one the module would draw if switched on now. The phone shows the same dashboard, and the serial monitor holds every event of the run.
At every step the sensorless reading agreed with the module's real temperatures within about 0.1 K at steady state, from a voltage the module makes by itself.
Download the Project Files
Click the button below to download Sensorless-Peltier-Cooler-ESP32-Proteus-Simulation-v1.0.zip (about 4.4 MB, without the source code of the models):
Sensorless Peltier Cooler Controller with ESP32 - Proteus Simulation V1.0- Proteus Simulation: ESP32-Sensorless-Peltier.pdsprj, ESP32_Peltier_Seebeck.hex and copies of the models.
- Arduino Code: ESP32_Peltier_Seebeck.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 module's constants, the gains, the period and the window are near the top.
Ideas to Extend the Project
- Add an H-bridge to reverse the current and hold a plate temperature both below and above the room.
- Add one temperature sensor on the heatsink: with the hot side known, dT gives the cold plate's real temperature.
- Measure R in the first milliseconds after switching on, and correct S for the module's temperature.
- Replace the PWM with a buck converter: a smooth DC current is more efficient for a Peltier module than switching it.
- Log dT and the power to find the best COP for a given cooling load.
- Control the heatsink fan from the duty, so it runs only when the module works hard.
From Simulation to Real Hardware
- The heatsink is everything: without a good heatsink and fan the hot side overheats in seconds and the module can be destroyed.
- Calibrate S: measure Vs and the real difference once with a thermometer on each plate; modules differ by several percent.
- Wires and contacts: keep the module's leads short and use the sensors at the module, so no lead resistance adds to the reading.
- Supply: a TEC1-12706 draws about 6 A at 12 V; use a supply rated for at least 8 A.
- Condensation: a cold plate below the dew point collects water; seal it or stay above the dew point.
Troubleshooting
- dT reads near 0 while the module works: U3 must be on the module's black wire and U2 on +12V; both GND pins on ground.
- FAULT with a large voltage: current flows in the off window; the MOSFET is shorted or its gate never goes low.
- The reading jumps with the duty: the window is too short for your module's leads; raise SETTLE_MS.
- The difference never reaches 25 K: the heatsink is too warm, or the cold plate carries too much heat.
- The OLED stays dark: SDA and SCL on D21 and D22, VCC on 3.3 V.
Limitations of the Simulation
- The module is our library's model: its datasheet constants, a heatsink and a cold plate with their thermal masses, not every detail of a real module.
- The model reports its temperatures every 0.1 s; a real module's voltage also has a short electrical tail after switching off.
- S, R and K are taken as constants; in a real module they change a little with temperature.
- ESP32 is a product of Espressif Systems and the IRLZ44N of Infineon; this project is not made or endorsed by them or by Labcenter.
So, that was all about the Sensorless Peltier Cooler Controller with ESP32 - Proteus Simulation. I hope it helps you understand how a Peltier module pumps heat, how its own Seebeck voltage measures the temperature difference, why that voltage can only be read with the current off, and how a PI loop with anti-windup holds the target, all tested in a simulation before you power a real module. 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!