Wiring diagrams in assistants. High temperature controller on a K-type thermocouple Algorithm for operating a thermometer program on ATmega and DS18B20

A series of articles about temperature measurement with Arduino controllers would be incomplete without a story about thermocouples. Moreover, there is nothing else to measure high temperatures with.

Thermocouples (thermoelectric converters).

All temperature sensors from previous lessons made it possible to measure temperature in a range no wider than – 55 ... + 150 °C. For measuring higher temperatures, the most common sensors are thermocouples. They:

  • have an extremely wide temperature measurement range -250 … +2500 °C;
  • can be calibrated for high measurement accuracy, up to an error of no more than 0.01 °C;
  • usually have a low price;
  • are considered reliable temperature sensors.

The main disadvantage of thermocouples is the need for a fairly complex precision meter, which must provide:

  • measurement of low values ​​of thermo-EMF with an upper value in the range of tens and sometimes even units of mV;
  • compensation of thermo-EMF of the cold junction;
  • linearization of thermocouple characteristics.

Operating principle of thermocouples.

The operating principle of this type of sensor is based on the thermoelectric effect (Seebeck effect). Therefore, another name for a thermocouple is a thermoelectric converter.

In a circuit, a potential difference is formed between connected dissimilar metals. Its value depends on temperature. Therefore it is called thermo-EMF. Different materials have different thermal emf values.

If in a circuit the joints (junctions) of dissimilar conductors are connected in a ring and have the same temperature, then the sum of the thermo-EMF is equal to zero. If the wire junctions are at different temperatures, then the total potential difference between them depends on the temperature difference. As a result, we come to the design of a thermocouple.

Two dissimilar metals 1 and 2 form a working junction at one point. The working junction is placed at the point whose temperature needs to be measured.

Cold junctions are the points where the metals of a thermocouple connect to another metal, usually copper. These may be the terminal blocks of the measuring instrument or the copper communication wires to the thermocouple. In any case, it is necessary to measure the temperature of the cold junction and take it into account in the calculation of the measured temperature.

Main types of thermocouples.

The most widely used thermocouples are XK (chromel - copel) and XA (chromel - alumel).

Name Designation NSKh Materials Measuring range, °C Sensitivity, µV/°C, (at temperature, °C) Thermo-EMF, mV, at 100 °C
THC (chromel-copel) L Chromel, copel - 200 … + 800 64 (0) 6,86
TCA (chromel-alumel) K Chromel, alumel - 270 … +1372 35 (0) 4,10
TPR (platinum-rhodium) B Platinorhodium, platinum 100 … 1820 8 (1000) 0, 03
TVR (tungsten-rhenium) A Tungsten-rhenium, tungsten-rhenium 0 … 2500 14 (1300) 1,34

How to practically measure temperature using a thermocouple. Measurement technique.

The nominal static characteristic (NSC) of the thermocouple is given in the form of a table with two columns: the temperature of the working junction and the thermo-emf. GOST R 8.585-2001 contains the NSCH of thermocouples of different types, specified for each degree. Can be downloaded in PDF format from this link.

To measure temperature using a thermocouple, follow these steps:

  • measure the thermo-EMF of the thermocouple (Etotal);
  • measure the temperature of the cold junction (T cold junction);
  • Using the thermocouple NSH table, determine the thermo-EMF of the cold junction using the temperature of the cold junction (E cold junction);
  • determine the thermo-EMF of the working junction, i.e. add the EMF of the cold junction to the total thermo-EMF (E working junction = E total + E cold junction);
  • Using the NSH table, determine the temperature of the working junction using the thermo-EMF of the working junction.

Here is an example of how I measured the temperature of a soldering iron tip using a TXA thermocouple.

  • I touched the working junction to the soldering iron tip and measured the voltage at the thermocouple terminals. The result was 10.6 mV.
  • Ambient temperature, i.e. cold junction temperature is approximately 25 °C. The cold junction EMF from the GOST R 8.585-2001 table for a K-type thermocouple at 25 °C is 1 mV.
  • The thermal EMF of the working junction is 10.6 + 1 = 11.6 mV.
  • The temperature from the same table for 11.6 mV is 285 °C. This is the measured value.

We need to implement this sequence of actions in the Arduino thermometer program.

Arduino thermometer for measuring high temperatures using a TXA-type thermocouple.

I found a TP-01A thermocouple. A typical, widely used TCA thermocouple from a tester. This is what I will use in the thermometer.

The parameters indicated on the packaging are:

  • type K;
  • measurement range – 60 … + 400 °C;
  • Accuracy ±2.5% up to 400°C.

The measuring range is based on fiberglass cable. There is a similar thermocouple TP-02, but with a 10 cm long probe.

TP-02 has an upper measurement limit of 700 °C. So, we will develop a thermometer:

  • for thermocouple type TXA;
  • with measuring range – 60 … + 700 °C.

Once you understand the program and circuit diagram of the device, you can create a meter for thermocouples of any type with any measurement range.

The remaining functionality of the thermometer is the same as the devices from the previous three lessons, including the function of recording temperature changes.

Category: . You can bookmark it.

Thermometer on the PIC16F628A and DS18B20 (DS18S20) microcontroller - an article with a detailed description of the memory thermometer circuit and, in addition, a logical continuation of the article I previously published on the Yandex site pichobbi.narod.ru. This thermometer has proven itself quite well, and it was decided to modernize it a little. In this article I will tell you what changes have been made to the scheme and the working program, I will describe the new functions. The article will be useful for beginners. Later I converted the current version of the thermometer into .

The thermometer on the PIC16F628A and DS18B20 (DS18S20) microcontroller can:

  • measure and display temperature in the range:
    -55...-10 and +100...+125 with an accuracy of 1 degree (ds18b20 and ds18s20)
    -in the range -9.9...+99.9 with an accuracy of 0.1 degrees (ds18b20)
    -in the range -9.5...+99.5 with an accuracy of 0.5 degrees (ds18s20);
  • Automatically detect DS18B20 or DS18S20 sensor;
  • Automatically check the sensor for failure;
  • Remember the maximum and minimum measured temperatures.

The thermometer also provides for easy replacement of the 7-segment indicator from OK to an indicator with OA. A gentle procedure for writing to the EEPROM memory of the microcontroller has been organized. A voltmeter that has proven itself well is described in this article -.

The circuit diagram of a digital thermometer on a microcontroller was developed for reliable and long-term use. All the parts used in the circuit are not in short supply. The pattern is easy to follow and perfect for beginners.

The schematic diagram of the thermometer is shown in Figure 1

Figure 1 - Schematic diagram of a thermometer on PIC16F628A + ds18b20/ds18s20

I will not describe the entire circuit diagram of the thermometer, since it is quite simple, I will only dwell on the features.

Used as a microcontroller PIC16F628A from Microchip. This is an inexpensive controller and also not in short supply.

Digital sensors are used to measure temperature DS18B20 or DS18S20 from Maxim. These sensors are inexpensive, small in size, and information about the measured temperature is transmitted digitally. This solution allows you not to worry about the cross-section of the wires, their length, etc. Sensors DS18B20,DS18S20 capable of operating in the temperature range from -55… +125 °C.

The temperature is displayed on a 7-segment 3-digit LED indicator with a common cathode (OK) or with (OA).

To display the maximum and minimum measured temperatures on the indicator, you need the SB1 button. To reset the memory you also need the SB1 button

Using the SA1 button you can quickly switch sensors (street, house).

A jumper is needed to switch the common wire for the LED indicator. IMPORTANT! If the indicator is OK, then we put the jamper in the lower position according to the diagram, and solder the transistors VT1-VT3 with p-n-p conductivity. If the LED indicator is OA, then we move the jamper to the upper position according to the diagram, and solder the transistors VT1-VT3 with n-p-n conductivity.

In Table 1 you can see the entire list of parts and their possible replacement with an analogue.

Table 1 – List of parts for assembling the thermometer
Position designation Name Analog/replacement
C1, C2 Ceramic capacitor - 0.1 μFx50V -
C3 Electrolytic capacitor - 220μFx10V
DD1 Microcontroller PIC16F628A PIC16F648A
DD2,DD3 Temperature sensor DS18B20 or DS18S20
GB1 Three 1.5V AA batteries
HG1 7-segment LED indicator KEM-5631-ASR (OK) Any other low-power for dynamic indication and suitable for connection.
R1,R3,R14,R15 Resistor 0.125W 5.1 Ohm SMD size 0805
R2,R16 Resistor 0.125W 5.1 kOhm SMD size 0805
R4,R13 Resistor 0.125W 4.7 kOhm SMD size 0805
R17-R19 Resistor 0.125W 4.3 kOhm SMD size 0805
R5-R12 Resistor 0.125W 330 Ohm SMD size 0805
SA1 Any suitable switch
SB1 Tact button
VT1-VT3 Transistor BC556B for indicator with OK/transistor BC546B for indicator with OA KT3107/KT3102
XT1 Terminal block for 3 contacts.

For initial debugging of the digital thermometer, a virtual model built in Proteus was used. In Figure 2 you can see a simplified model in Proteus

Figure 2 – Model of a thermometer on the PIC16F628A microcontroller in Proteus

Figure 3-4 shows the circuit board of the digital thermometer

Figure 3 – Printed circuit board of a thermometer on a PIC16F628A microcontroller (bottom) not to scale.

Figure 4 – Printed circuit board of a thermometer on a PIC16F628A microcontroller (top) not to scale.

The thermometer, assembled working parts, starts working immediately and does not need debugging.

The result of the work is Figures 5-7.

Figure 5 - Appearance of the thermometer

Figure 6 - Appearance of the thermometer

Figure 7 - Appearance of the thermometer

IMPORTANT! In the thermometer firmware not sewn in advertising can be used for your pleasure.

Amendments made to the work program:

1 automatic detection of DS18B20 or DS18S20 sensor;

2. The rewriting time in EEPROM has been reduced (if the condition for rewriting is met) from 5 minutes to 1 minute.

3. The blinking frequency of the dot has been increased;

A more detailed description of the operation of the thermometer can be found in the document, which can be downloaded at the end of this article. If you don’t want to download, then on the website www.pichobbi.narod.ru The operation of the device is also perfectly described.

The finished board fit perfectly into a Chinese alarm clock (Figures 8, 9).

Figure 8 – All the stuffing in a Chinese alarm clock

Figure 9 - All the filling in the Chinese alarm clock

Video - Thermometer operation on PIC16F628A

The device (see figure) can be used for automatic control of temperature measurements in greenhouses and vegetable stores, drying cabinets and electric ovens, as well as for biomedical purposes. It provides high sensitivity and noise immunity, convenient control of operating modes. The presence of galvanic isolation in the power and control circuits makes it reliable and safe to operate. The optocoupler system synchronizes with the network frequency to avoid switching interference.

The device consists of two main functional units: an electronic thermostat and a digital meter. Control signals in the thermostat are generated based on comparison of the voltage received from the thermocouple (TC) with the reference voltage.

Main technical characteristics of the device: controlled temperature range from 0 to 200 or up to 1200 °C, depending on the sensor used. The thermometer error is no more than 1.5% of the upper measurement limit; maximum accuracy of maintaining temperature up to 0.05°C. It should be taken into account that the system using TP is differential, i.e. the voltage at its output is proportional to the temperature difference between the connected and free ends of the thermocouple. Therefore, if at high controlled temperatures the influence of ambient temperature fluctuations on the output voltage of the TP is insignificant, and it can be ignored, then for controlled temperatures less than 200 ° C it is necessary to apply additional compensation measures changes in the temperature of the free ends of the thermocouple. Maximum load switching frequency 12.5 Hz, load current up to 0.1A, and when using an additional triac switch up to 80 A at a voltage of ~220 V, overall dimensions 120x75x160 mm.

An alternating voltage of 24 V with the mains frequency (f), removed from the secondary winding of transformer T1, is supplied through the limiting resistor R21 to the transistor optocoupler U1, at pin 5 of which synchronizing pulses are formed, the front of which in time practically coincides with the moments when the mains voltage passes through zero. Next, these pulses arrive at the digital part of the device, which, based on the signals coming from the analog part, generates the corresponding control signals.

The analog part of the device is implemented on four op-amps of the K1401UD2 microcircuit. The voltage removed from the TC is amplified by op amp DA1.1 and supplied to the inputs of op amp DA1.2...DA1.4, which act as comparators. The reference voltages that determine their switching thresholds are set by resistors R8, R9, R11, R12, R14-R16. Due to the absence of feedback in the op-amp (DA 1.2-DA 1.4) and their high gain, a very high sensitivity of the device is achieved. Resistor R12 is used to set the upper temperature threshold at which the load is turned off, and resistor R9 is intended to set the temperature difference (Dt) between the upper and lower switching thresholds of the thermostat. When Dt adjustment is not required, to ensure maximum accuracy of temperature maintenance, it is recommended to install a jumper instead of resistor R9; in this case, resistor R8 can be excluded from the circuit. The circuits on the elements VD1-VD3, C1-SZ, R10 R13, R17 serve to prevent the passage of negative voltage to the inputs of digital microcircuits and eliminate interference. Synchronization of triggers DD1.2, DD2.1, DD2.2 is carried out by pulses generated by counter DD3. The table explains the logic for generating control signals in the device.

In a steady state of operation, when the temperature at the facility corresponds to the set one, the HL2 indicator should be constantly on, and the HL1, HL3 indicators should be off. Temperature deviations are indicated by the inclusion of indicators HL1, HL3. To improve visibility, they operate in flashing mode. The pulses necessary to control these indicators are generated at outputs 5 and 12 of the dD3 counter. From pin 9 of trigger DD1.2 through the emitter follower on transistor VT1, the signal goes to the indication and load control circuits. Forced disconnection of the load is carried out by switch SA1, which opens these circuits. To control the load, a dinistor optocoupler U2 is used, included in the diagonal of the bridge VD2. The maximum switching current in this version is 0.1 A. By installing an additional seven-stor VS1 and accordingly changing the load switching circuit, this current can be increased to 80 A.

The functions of measuring temperature, as well as displaying its value, are implemented on the basis of the K572PV2 microcircuit (analogous to ILC7107). The choice of this ADC is due to the possibility of directly connecting LED sign-synthesizing indicators to it. When using LCD, you can use K572PV5. When the SB1 button is pressed, the ADC receives voltage from the output of op-amp DA1.1, providing a temperature measurement mode. When you press the SB1 button, the voltage across the variable resistor R12 is measured, corresponding to the temperature of the set control threshold.

Details. The device uses constant resistors of the MLT type, tuned SP5-2 (R9, R15), variable SPZ-45 (R12), capacitors of the K73-17 (C11-C13), KT1 (C10), K53-1 (C4-C7) type . Optocoupler AOUYU3V can be replaced by AOU115V. Indicators HG1-HG4 type SA08-11HWA can be replaced with domestic KLTs402.

The setting consists of setting resistor R3 to the correct thermometer readings at the minimum temperature, and resistor R4 at the maximum. To eliminate the mutual influence of the resistor resistances, this adjustment should be repeated several times. A correctly assembled device does not require further adjustment; you only need to set the required Dt value with resistor R9, and with resistor R15 the permissible temperature excess limit before turning on the alarm.

A semiconductor diode can be used as a temperature sensor. The main advantages of the latter are low cost and much lower inertia compared to an integrated sensor; measurement accuracy reaches 0.2°C in the temperature range from -50 to +125°C. The low-voltage part of the device is powered from a bipolar stabilizer with a voltage of ±5 V, assembled on elements DA2-DA3, C4-C9. To control optocoupler U1, a voltage of +12 V is used. It is prohibited to turn on the device without grounding. The device has high noise immunity, allowing a significant length of the line connecting it to the sensor. However, to ensure reliable operation of the device, it should not be laid near power wires carrying high-frequency and pulse currents.

Literature:

1. Anufriev L. Multimeter on BIS // Radio. - 1986. No. 4. - P. 34-38.

2. Suetin. V. Household digital thermometer // Radio. - 1991. No. 10. P.28-31.

3. Gutnikov V.S. Integrated electronics in measuring devices. - 2nd ed. reworked and additional - L.: Energoato-mizdat, 1988.

Thermometer on ATmega8 and temperature sensor DS18B20

Thermometer circuit for ATmega8 and DS18B20

Digital thermometer DS18B20
Seven segment LED indicator
Thermometer program algorithm
Digital thermometer program for DS18B20

The circuit and program are very simple digital thermometer using a microcontroller ATmega8 and temperature sensor DS18B20. The thermometer allows you to measure temperature from 0 to 99 degrees with an accuracy of 0.5 degrees with a resolution of 0.1 degrees

The thermometer is very simple in its characteristics, and it can only be used as a thermometer to measure “room” temperature. Using a microcontroller with 8 kilobytes of memory in this design is of course wasteful; you can use a simpler microcontroller. But the point is that this design is the basis for further development of the project using the DS18B20 digital temperature sensor. In the next article, the design of another thermometer will be published - on two DS18B20 sensors, which will allow you to measure the temperature not only in the room, but also “overboard”. Naturally, the ability to measure negative temperatures will be added. In the future, a thermostat function, a clock, and the ability to work with various loads will be added to the design, which will make it possible to assemble a simple structure - the basis of a “smart home.” Well, today is the first article in this series.

Thermometer circuit based on ATmega8 and DS18B20 temperature sensor

Let's look at the thermometer diagram:

As you can see, the circuit is very simple; only the necessary minimum of parts is used.
The circuit uses a seven-segment three-digit LED indicator to indicate readings.

Design supply voltage - 5 volts. If you use a microcontroller with low voltage power supply, then you can lower the supply voltage of the structure, but in this case, you may have to reduce the value of the damping resistances in the indicator segments. Approximate resistance values ​​can be taken:
- with a power supply of 5 volts - 200-300 Ohms
- with a power supply of 2.7 - 3 volts - 100-150 Ohms


Transistors- any low-power NPN structures.
temperature sensor - DS18B20
Seven segment indicator - any three-digit with a common cathode. If you want to use others, with a common anode, then you will have to replace the transistors with PNP ones and make changes to the program (replace the array of binary codes for displaying numbers on the indicator). I used a red glow indicator, and at the same time, for the next scheme, I prepared the same one, but with a blue glow color.

Parts of the thermometer on the microcontroller ATmega and DS18B20



ATmega8 microcontroller pinout:

Three-digit seven-segment indicator FYT-5631AUR-21:

Temperature sensor DS18B20:

Transistors BC547C:

Algorithm of the thermometer program on ATmega and DS18B20

All microcontroller settings are factory settings; the FUSE bits do not need to be touched.

To operate the program, two microcontroller timers/counters are used:
eight-bit T0
sixteen-bit T1
By using eight-bit timer T0 configured to call an overflow interrupt, with an internal frequency CK/8 (period 2 milliseconds) is organized:
— calculation of current temperature
— dynamic output of temperature measurement results with the DS18B20 sensor
By using sixteen-bit timer T1 configured to call an overflow interrupt, with an internal frequency of CK/64 (period 4 seconds) in an organized manner:
— sending a command to the DS18B20 sensor to measure temperature
— reading the measured temperature from the sensor
In principle, you can use one eight-bit timer/counter, also configured to trigger an overflow interrupt, with an internal frequency of CK/8, and organize the entire operation of the circuit while processing the interrupt. But the fact is that there is no point in this - the DS18B20 sensor needs a little less than 1 second (with 12-bit resolution) to convert (determine) the temperature, i.e., we will not be able to update the temperature data more than once per second . In addition, such frequent temperature updates will lead to heating of the sensor and, accordingly, to distortion of real data. Using a second counter allows you to separately set the time intervals for temperature measurement.

This is what the main part of the program looks like in Algorithm Builder:

Where:

SP— setting the starting address of the stack

Timer 0— setting timer T0:

Timer 1— setting timer T1:

TIMSK— setting interrupts from timers:

Init_Display— subroutine for setting the bits of ports involved in the dynamic indication of data output to a three-digit seven-segment indicator

1 —> I- global interrupt enablement

If you have any questions, if something is not clear, or if you have questions about the program, write and I will answer.

(2.4 KiB, 7,012 hits)

I decided to insert a thermometer into my laminator, a K-type thermocouple thermometer. To make it more informative for me, I believe that a hobby radio amateur cannot be content when only two LEDs “POWER” and “READY” are lit on such a device. I arrange the scarf for my details. Just in case, with the ability to cut it in half (this is some versatility). Right away with a place for the power part on the thyristor, but for now I’m not using this part, this will be my circuit for a soldering iron (when I figure out how to attach a thermocouple to the tip)

There is not enough space in the laminator (the mechanisms are located very tightly, you know in China), I use a small seven-segment indicator, but that’s not all, the whole board doesn’t fit either, this is where the versatility of the board comes in handy, I cut it in half (if you use a connector, the upper part fits many developments on little tidbits from ur5kby.)

I set it up, first I do as stated in the forum, I don’t solder in the thermocouple, I set 400 (although if this parameter is in memory, this item will disappear), I set the variables to approximately room temperature and exactly to boiling point,

Such a controller theoretically operates up to 999°C, but at home such a temperature is unlikely to be found, at most it is an open fire, but this heat source has strong nonlinearity and sensitivity to external conditions.

here is a sample table.

and also for clarity

So there is little choice in choosing a source for adjusting the controller readings.

There is no more playing with buttons, everything can be collected,
I used a thermocouple from a Chinese tester. And a post in the forum advised me that this thermocouple can be multiplied, its length is almost half a meter, I cut off 2 cm.

I make a transformer by twisting it with charcoal, it turns out to be a ball, and to the two ends it’s exactly the same way, along a copper wire, for good soldering to my wires

If you find an error, please select a piece of text and press Ctrl+Enter.