Peltierelemente und MicroPython - Teil 3: Der Flaschenkühler oder Minustemperaturen aus dem PC-Netzteil

In the first episode of this series we had built an adjustable power supply for 8A current load. Some readers will have wondered what such current loads are needed for in the context of microcontroller circuits. The current guzzlers are also not the controllers, but the parts we will use today for our bottle cooler, the Peltier elements. At 12V supply voltage, a current of 4A already flows through a single element. So our power supply can supply two of them in parallel. The bigger brother of the DC-DC buck converter can even supply three units with 12A load capacity. How this works in detail and what you have to consider, I will tell you in today's article. Welcome to part 3 of the Peltier series.

Figure 1: RTD

Figure 1: Thermobox

Today we will deal with the following important points concerning cooling:

  1. How does a thermoelectric converter work as a heat shoveler?
  2. How to build an efficient heat lock?
  3. How to build an inexpensive and stable cooling box?
  4. How can the ESP32 control and regulate voltages and currents up to 12A?

The material list contains only a few larger parts, the thermocouple, the DC-DC converter, as well as an ESP32 and beyond that some small parts.

1

TEC1-12706 12V Thermoelectric Cooler

1

DC-DC Step Dwon Buck Converter 8A or
DC-DC Step Down Buck Converter 12A

1

ESP32 Lolin LOLIN32

1

LED white 5mm

1

LDR 5mm

1

20-25mm brass tube 6mmØ and 0.5mm wall thickness


Sealing compound


Shrink Tubing Assortment

1

Resistor 1kΩ

1

Resistor 10kΩ

1

NPN standard transistor for example BC550

2

Two pin header

1

LED red

1

Resistor 560Ω

1

two-pole female connector

1

Breadboard


various jumper cables


For the thermal head

2

Fin heat sink

2

matching PC fans

4

Plastic angle 10 x 10 x 30mm


Thermal compound

Possibly

some aluminum plates sections (see text)


waterproof glued multilayer board

1

piece polystyrene plate 126 x 126 x 10


various screws, nuts,


Supply cable for the Peltier element with 1mm²


For the cooling tank

1

Polystyrene board 30mm


Parcel tape


It will be best if you read through chapters 2 and 3 of these instructions first before you get the material for the box and the thermal head. The possibilities for implementation are so varied that I can not possibly address them all. There your imagination and the fundus of your tinkering cellar are in demand. Therefore, understand the following description only as a suggestion for your own approaches.

1. Some theory to warm up

In episode 2, we used the thermoelectric effect (aka Seebeck effect) for the heat flow meter. This consists of a migration of electrons at the contact points of two different metals. When the contact points are heated or cooled, the difference in the speed of the electrons at the contact points results in an electrical voltage at the point where one of the two conductors is separated. Because the element itself acts as a voltage source, the technical direction of current within the element is from the negative to the positive pole.

Figure 2: Seebeck effect

Figure 2: Seebeck effect

If cause and effect are reversed, this results in the Peltier effect. This means that a current flow through the element results in a temperature difference at the contact points. With the same current direction, the contact point that would have to be heated in the Seebeck effect cools down.

Figure 3: Peltier effect

Figure 3: Peltier effect

Basically, this also works with iron and copper. However, similar to the Seebeck effect, the effect is considerably increased if semiconductor material is used instead of the metals. In our Peltier elements, this is positively and negatively doped bismuth telluride. 127 small cuboids of this material are connected in series and arranged between two ceramic plates. The PN junctions are thus in parallel at one plate (top), the NP junctions at the other. This adds up the effects of the Peltier effect, one side cools down while the other is heated. This leads us to point 2 of the preliminary considerations.

Figure 4: Peltier element schematically

Figure 4: Peltier element schematic

2. How to build an effective heat lock?

The purpose of our application should be cooling. Cooling simply means that internal energy must be extracted from a body. This energy, together with the not inconsiderable amount of electrical work to be applied, is delivered to the hot side of the element. To prevent our transducer from reaching too high temperatures - the solder of the contact points melts at 125°C - we need effective heat dissipation, which we ensure by using a PC heat sink with a fan. For it further applies a simple principle. The lower the temperature of the heat exchanger, the lower the temperatures we achieve in the cold room, or in other words, the less electrical energy we have to use for the same cold room temperature. Figure 5 shows a possible setup where the hot-side fan is still missing. The thermocouple is placed between two 4 and 6 mm thick aluminum plates. Please make sure that the surfaces are as flat as possible, so that a good thermal contact between the Peltier element and the metal can be established, especially on the hot side. The use of thermal paste is also a very good idea in this context.

Figure 5: layout of the parts

Figure 5: Arrangement of the parts

How and what you build the unit from depends largely on what you find in your craft box or at the scrap dealer. One thing is important, though. The ceramic plates of the Peltier element must be at least covered, and better slightly covered, by the metal bodies. That was the reason why I screwed an aluminum plate on top of the heat sink. The surface of the heat sink was a good 3mm too narrow.

To prevent the Peltier element from slipping during assembly, it is held in position by the four plastic angles. Aluminum brackets are unsuitable because they represent thermal bridges. This is exactly where we have the biggest temperature differences in our setup. Oh, and the difference between the hot and cold sides must not exceed 65°C, regardless of the maximum temperature of 125°C, according to the element's data sheet.

What applies to the hot side is also important for the cold side. So that the thermal energy can be collected as effectively as possible in the cooling tank, a heat sink with a fan is also provided here.

Figure 6: thermal head completely (no fan)

Figure 6: Thermal head complete (without fan)

The complete thermal head, still without fan, is shown in Figure 6. The individual layers are shown schematically in Figure 7. Because of the multitude of heat sinks and fans, your result will most likely look different. In all cases, only three things are important:

  • Good thermal conductivity transitions between the layers in the heat flow
  • At least 1cm thick insulation between the heat exchangers of the hot and cold  side
  • Sufficiently dimensioned cooling on the hot side

Figure 7: Fan cold side

Figure 7: Fan cold side

Here you can download the archive of all working drawings of the thermal head. Included are 6 pages DIN A4, which show the development on a scale of 1:1.

For the installation of the Peltier element the direction of the heat transport is important. If you put the red cable to the positive pole for a few seconds and the black one to the negative pole of a 5V source that can supply at least 2 A, you will notice that the printed side gets cold. The other ceramic surface will get progressively warmer. Don't stretch the experiment too long, you know, too high temperatures will harm the element. The experiment has told you which surface is the warm side. This side belongs to the large heat sink.

3. How can we build a cheap and stable icebox?

So that the box is easy as well, and build affordable and easy ... we take a 30-Styrofoam plate and cut or saw these four cm in 17 wide strips. Each of the strips we provided with recesses, as can be seen in the figure. 8 At the upper end of one stage is cut out so that the thermal head can be lowered to the support plate in the finished container. From the rest of Styrofoam plate we cut a square of 11 cm length. Match between the sides and fixes them if we zusammenzurren firmly with the package tape. If possible, nowhere gaps remain between the plates. The outer bottom plate with 17 x 17 cm is repeatedly fixed with adhesive strips on the side surfaces, and then we are also ready. The interior of 11 x 11 x 47 cm can therefore absorb 2L plastic bottle to 11 cm in diameter.

Figure 8: thermo pattern

Figure 8: thermo pattern

4. How can the ESP32 voltages and currents to 12A control and regulate?

The cooling performance depends largely on two factors. One is the temperature of the heat exchanger on the warm side and the second the current through the Peltier element. The latter in turn depends on the applied voltage from, because the internal resistance of the Peltier element is roughly a constant. Thus, the resistance is considered to formula I = U / R

If we want to keep the interior temperature at a certain level, we just need to just suck out the amount of heat that penetrates through the wall. If we want to remove also the amount of heat in another case, which is in the drink and in the bottle, it naturally needs a significantly higher use of electricity.

A control can now be simply to turn the current through the Peltier element at certain time intervals and off. But you can also the amperage (leave) so there is a constant temperature that results in, or set in the second, first on full power and return temperature set after reaching the. I have chosen the second solution interesting.

But how can a ESP32 voltages up to 16 V and currents up to 12 A master? One aid is a DC-DC step-down converter (aka buck converter), which can very well control voltages that can be specified by means of a trimming potentiometer. - Oh, of course - and the ESP32 then turns the potentiometer or what? No, he does not have to, yes. However, it can control the brightness of a LED on PWM pulses, ... which in turn illuminates a light-sensitive resistor (LDR Light Dependent Resistor), ... which is connected in parallel to trim potentiometer on the controller board.

Figure 9: buck converter circuit diagram

Figure 9: buck converter circuit diagram

We provide the potentiometer at the right stop and then turn back to the point that the voltage at full darkened LDR is just beginning to sink up (Vmax), or reaches the maximum allowable value of 16V. Then we can use the ratio of pulse length to period duration of the PWM signal (aka duty cycle or duty cycle) the voltage at the output of the regulator between about 3V and control Umax - not linear. In the next episode we are the ESP32 also teach you to measure currents and then we are able to regulate currents through the voltage control. The controller is characterized a real-rounder. How do you get the problem with the linearity in the handle, I'll tell in the next episode.

LDR and the white LED together form an optocoupler of homegrown. In order to shield external light, the two components are used in a piece of 6mm brass tube. By the wall thickness of 0.5 mm results in an inside diameter of 5mm. From the LED we file from the thicker edge so that they all fit into the tube, the LDR can be from the start without any problems sink. To the terminals of both components we solder short pieces of cable and push for insulating heat shrink tubing pieces about it. Then we close the openings with putty and equip the cable ends with a two-pin connector.

Figure 10: Special optocoupler

Figure 10: Special optocoupler

The LDR has some features that are very useful for us. The response time is 1 to 3 ms. "Smeared" the pulses of the PWM signal into a smooth resistance value when the frequency is greater than 1000 Hz. The light resistance is 200 ohms, the dark resistance than 2 milliohms. Unfortunately, the range may be between them but not fully utilized for the following reasons.

Figure 11: LDR resistance to PWM duty cycle

Figure 11: LDR resistance to PWM duty cycle

Although the resistance of the LDR increases linearly with the light intensity, but the latter does not depend linearly with the duty cycle of the PWM signal. This is confirmed by a series of tests, the results can be seen in Figure. 11 To slow the rapid drop of the curve at low duty cycles, I have increased the series resistor of the LED of 560 ohms to 10 k. Thus, the illuminance at low percentages increases not so fast, the curve is flatter. but less illuminance leads at the end of the scale, even at a higher residual resistance at LDR, because now comes less light.

The calculation of the resistance of the parallel connection of R2 and the LDR does not make things less complex. Thus is the equation of the exponential function, which the trend line follows, also in the relationship between output voltage and duty cycle a. And at 100% duty cycle a minimum voltage of approximately 3V is given by the higher LDR value. For this application we can use it but live well.

Figure 12: output voltage to duty cycle

Figure 12: output voltage to duty cycle

The equation of the trend line for the output voltage is a rational power function. We will incorporate this knowledge in the next episode in the control program for the ESP32 with.

Figure 13: equation of the trendline

Figure 13: equation of the trendline

Of course, the parameters, factor and exponent depend on the structure of the optocoupler in the equation of the individual circumstances. We will therefore equal yet to develop a program by which we can take the appropriate characteristic. But first must the circuit built on the breadboard, otherwise there is nothing to measure. The points at which pieces of wire for LDR must be soldered to the circuit board are indicated in yellow in the image.

Figure 14: controller 8A - circuit

Figure 14: controller 8A - circuit

Now we are ready to capture the data for the characteristic. We do that at idle, which means that we still do not connect the Peltier element in the thermal head.

The program reglertest.pywe need is very easy to know. We import a few classes, create a PIN object for the Flash button and an output spin for an LED. The function defined below blink() Easily allows us to program flash signals for status messages. When the LED is located on the plus rail and pulled from the pin against mass to light up, the parameter must inverted on True be set. The default value False Sys ahead that the LED lies on GND level and is turned on by a high level on the PIN.

 # thermobox.py
 # Author: J. Grzesina
 # Rev: 1.0
 # Booth: 2021-08-01
 # *********************************************************
 from machine import Pin code, I2c, ADC, timer,PWM
 from time import sleep
 import OS,SYS
 
 button=Pin code(0,Pin code.IN,Pin code.Pull_up)
 blinkled=Pin code(2,Pin code.OUT)
 
 # Pintranslator for ESP8266 boards
 # Lua-Pins D0 D1 D2 D3 D4 D5 D6 D7 D8
 # ESP8266 Pins 16 5 4 0 2 14 12 13 15
 # SC SD
 
 pwmpin=15              # PWM pin for voltage control
 PWM=PWM(Pin code(pwmpin))
 PWM.freq(10000)        # PWM frequency
 PWM.duty(1023)         # full pipe for minimal voltage
 
 # ********************************************************
 # Functions
 # ********************************************************
 
 
 def setduty(D):
     PWM.duty(D)
 
 
 def blink(pulse,wait,inverted=False):
     IF inverted:
         blinkled.off()
         sleep(pulse)
         blinkled.on()
         sleep(wait)
     Else:
         blinkled.on()
         sleep(pulse)
         blinkled.off()
         sleep(wait)
         
 
 whiler True:
     r=input("DutyCycle%:")
     r=int(float(r)/100*1023)
     setduty(r)
     print(r)
     IF button.value()==0:
         print("Canceled with Flash Button")
         SYS.exit()
     blink(0.1,0.9, inverted=True)
     #Sleep (1)

One of the key points of this example program is the definition and setup of the PWM pins. At ESP32 all starting pins are also PWM-suitable. The PWM frequency can be up to 40MHz. The duty cycle is given by a value between 0 and 1023, so not in percent.


 pwmpin=15 # PWM pin for voltage control
 PWM=PWM(Pin code(pwmpin))
 PWM.freq(10000) # PWM frequency
 PWM.duty(1023) # full pipe for minimal voltage


The XL4016 on the controller board always adjusts the output voltage, among other things, such that the voltage from the voltage divider of R2 and R1 at the feedback input FB is 1.25 V. The minimum voltage results when the parallel connection of LDR and R2 reaches the lowest value. Because R2 is no longer changed, this is the case with maximum brightness of the LED and thus at 100% duty cycle. However, because the parameter value is to be selected from the range 0 to 1023, the percentages must be converted after the input. This happens in the endless loop, which can be left when pressed the Flash key after an input.


 r=input("DutyCycle%:")
 r=int(float(r)/100*1023)
 setduty(r)


Now we can measure the resulting output voltage with a digital multimeter after entering different percentages and enter together in a table. The graphical evaluation with LibreOffice Calc finally delivers the desired formula with the parameters.

Of course we can test our thermal head with the same program. So that the Peltier element does not overheat, we also take the fan on the warm side at the same time. It is connected directly to 12V so that it can always start properly, no matter which voltage at the Peltier element.

Figure 15: controller 8A - circuit with fan

Figure 15: Controller 8A circuit with fan

With my construction, I was able to determine a temperature of -6 ° C in about 5 to 6 minutes on the heat sink of the cold side, while the hot-sided heat sink reached and held hand heat.

In the next episode, we will develop a Micropython program for the ESP32, which can take over the supply of up to three of the cooling units presented today. For three units, however, we need a more powerful Buck Converter, which can deliver up to 12 A.

Until then, I wish a lot of pleasure in the construction and test of the cool box.

Figure 16: thermal head completely

Figure 16: Thermal head complete

Esp-32Projects for advanced

1 comment

Ulrich Kafka

Ulrich Kafka

Beschreibung SEEEHHR GUT
Sehr geehrter Herr Grzesina,
hiermit möchte ich Ihnen mein grosses Lob und Glückwunsch für die Beschreibung aussprechen!!!
Ich finde sie sehr gut!!
Allerdings hätte ich das mit einem OP und KTY10-62 gelöst. Maximal mit einem ATMEGA (und BASCOM)
Bitte weiter so.
73 DC8SE

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN