Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

Multi-program timer-clock-thermometer. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Power regulators, thermometers, heat stabilizers

Comments on the article Comments on the article

The article describes a universal digital device based on a PIC controller that can perform the functions of a multi-program timer that can control four loads, a clock, an alarm clock, a wide-range thermometer and a temperature controller that provides both heating and cooling of the controlled object.

A universal digital device, the circuit of which is shown in Fig. 1, has the following specifications:

  • simultaneous or separate launch of up to nine software timers;
  • clock and alarm function;
  • sound and light signals when any of the timers or alarm clocks are triggered;
  • the possibility of issuing up to four signals that control external devices;
  • thermometer function (measured temperature - from -43 to +470 °С, average error - no more than ±2 °С);
  • thermostat function (maintained temperature - from -43 to +470 ° C) with the ability to select the operating mode (heating or cooling).

Multi-program timer-clock-thermometer
(click to enlarge)

Control the device using a 16-button keypad. It is possible to turn on and off the sounding of pressing buttons, setting the supply of sound, light and control signals, the possibility of individual adjustment of the device for a specific application by changing the control program MK. There is a backup power supply from the built-in rechargeable battery. All parameters set while working with the device are saved even when the backup power is turned off for more than 40 years.

As can be seen from the diagram, the basis of the device is the PIC controller DD1. Shift register DD2 and decoder DD3 are designed to organize dynamic indication, the principle of which is as follows. First, the code 3 is applied to the DD1111 decoder, as a result of which log levels are set at all its outputs. 1 and none of the digits of the HG1 indicator is lit. Next, the code of the required character is entered into the register DD2, after which the code corresponding to the desired bit of the indicator is sent to DD3.

Simultaneously with updating the data for the indicator, the keyboard is scanned, 16 buttons of which are divided into two groups - eight in each. The general conclusions of the buttons of these groups are connected to two inputs of the MK (RB0 and RB1). When a button is pressed, a log signal is sent to one of these inputs. 0 from the corresponding output of the decoder DD3, thereby determining its code.

Using the keyboard, you can start / stop any of the program timers or all at the same time, set the thermostat operation mode, current time, alarm time, etc. Most of the buttons have a dual purpose, depending on what information the user enters from the keyboard: numerical or control .

Consider the purpose of the keyboard buttons in more detail.

"0", "Clock" - digit 0 when entering numerical information or switching to clock mode, in which you can change the current time, set the time for the alarm to turn on, turn on the new hour alarm mode, edit the time correction coefficient (see below).

"1" - "9" - numbers 1 - 9 when entering numerical information or selecting the appropriate program timer.

"Term" - switching to the thermostat mode, where you can set the current temperature value, edit the value of the controlled temperature, the type of regulation (heating or cooling) and thermistor parameters.

"Del" - "minus" sign when entering the value of the controlled temperature, turning on / off the thermostat, thermometer, alarm clock or clock (when turned off, signs --- are displayed instead of the corresponding readings), zeroing when entering numerical data.

"Set" - transition/exit to the mode of changing the value of any parameter (software timer, current time, alarm clock, thermometer, thermostat, settings).

"Options" - switch to the mode of changing settings. Here you can turn on / off the sounding of buttons, welcome mode, select sources for issuing control signals, etc.

"Select" - start/stop the current software timer if its time delay value is different from 0.

"AH" - start/stop all software timers whose time delay value is different from 0.

The device is capable of issuing four control signals, each of which can be used at the discretion of the user. It is possible to set the source of these signals:

  • the signal will be active (have a log. 1 level) when one of the timers, the number of which is set by the user, is running;
  • the same, during operation of any number of timers, and inactive - after the expiration of all timers;
  • the signal will be active when the thermostat is triggered.

The device uses a two-color LED HL1, which flashes red if at least one control signal has become active when one or more timers are started, and green if there are no active signals.

At the end of the time delay of any of the running timers, the HG1 indicator starts flashing, and the HA1 piezo emitter with a built-in interrupter beeps. This continues until the user presses any button on the keyboard or a certain time passes, the value of which is stored in the MK's memory and can be changed during its programming. The sound signal emitted when the timer is triggered is determined by two parameters: the duration of the sound and the number of sound packs.

When the alarm goes off, sound signals are also given, but only the two leftmost symbols of the indicator - A and L (from the English. ALARM - alarm clock) start flashing. The sound signal of the alarm clock is also described by two parameters stored in the memory of the MK.

Depending on the applied quartz resonator, the accuracy of the clock turns out to be different, therefore, software time correction is implemented in this device. The correction factor is set by the user from the keyboard and is also stored in the memory of the MK. In fact, it represents the number of microseconds that is added to the oscillation periods generated by the internal timer of the MK - in our case 1,92 ms. With the help of a correction factor, this time is achieved to become equal to 2 ms (a time period of 1 s is recorded after every 500 such periods).

The temperature is measured by measuring the voltage drop across the thermistor RK1. Its resistance as a function of temperature is determined by the following formula:

where R0 is a constant having the dimension of resistance; B is a constant having the dimension of temperature; T is the absolute temperature. Thus, this dependence must be reduced to a linear one. There is a known method of linearization using a thermistor bridge, but this approach is inconvenient because when replacing the thermistor, you have to change the parameters of the bridge itself, which is not so simple.

It would be more convenient to get the temperature value without any linearization, but for this you need to calculate the value of the following expression:

where Rd is the resistance of the additional resistor; N - 10-bit binary code obtained after analog-to-digital conversion; Un - supply voltage.

In the device being described, this expression is calculated by the MK control program, and the result is displayed on the indicator. It should be noted that the above range of measured and controlled temperatures (-43 ... +470 °C) can be stretched, compressed or shifted in any way. The indicated interval was chosen because the temperature measurement error in it does not exceed ±2 °С. In this case, the resistance of the additional resistor R17 is 300 ohms. To reduce the error, it can be increased, however, as a result, the boundaries of the temperature interval will change. For ease of calculation, you can use document term (10 bit).mcd for the MathCAD 2001 system, which calculates the range of measured temperatures based on the specified parameters of the thermistor RK1, resistor R17 and the required error.

In order to ensure that the real-time clock does not go astray when the main power is turned off, the instrument has a backup power unit MK. It consists of a 1 V battery GB3,6, a resistor R16 and diodes VD2, VD3. When the main power is turned on, the VD3 diode closes, and the GB1 battery is charged through the R16 resistor. When the main power is turned off, the battery voltage is supplied through the VD3 diode only to the MK (the VD2 diode prevents the supply of voltage to the remaining elements of the device). The MK determines the fact of a power outage, as it constantly monitors the voltage level at the RB2 pin. And when it becomes equal to log. 0, the MK stops regenerating the indicator and polling the keyboard, stops all running software timers, stops measuring and regulating the temperature and switches to clock mode. In addition, if the settings were changed while working with the device, then after turning off the power, the red LED will blink briefly, if the settings have not changed - green. If the device is not supposed to be used for a long time (a week or more), then to prevent complete discharge of the battery, you can turn off the backup power using jumper S1.

The MK constantly monitors the status of the contacts of the buttons on the keyboard, and if there was not a single press during the specified time, and not a single program timer was launched, it automatically switches to clock mode.

The MK control program is written in C, so it can easily use any data types, including real ones. The program was developed in the HT-PIC C programming system (it can be "downloaded" from the site ). For debugging, we used the simplest in-circuit emulator, which is a set of contacts connecting the lines of the parallel port of the computer to the socket under the MK on the main board. Correspondence of the conclusions of the parallel port of the computer to the sockets of the MK socket on the timer board is given in Table. 1. To control the emulator, the MK control program was compiled with minor changes in the Borland C++ 3.1 programming environment.

Multi-program timer-clock-thermometer

Unfortunately, the work of such an emulator takes place on a time scale different from the real one, but nevertheless, without such a device, it would be almost impossible to debug such a complex program. Without the use of an emulator, only analog-to-digital conversion was implemented, the description of which in relation to this MK can be found on the website (document DS30292C - "10-bit ADC module in PIC16F87x microcontrollers").

Let us briefly consider the main points of the MC control program. It is written using the structured programming methodology, as a result of which it has a large number of subroutines. After turning on the power, the MCU sets up the I / O ports, the ADC and the internal timer. Then the main loop starts running, which is infinite. In it, as already mentioned, the presence of the main supply voltage is constantly checked, and if it is turned off, the MK ceases to perform all functions except for timing. When the main power is turned on, it displays the splash screen and returns to the operating mode.

The information that should be displayed on the indicator at the current moment is stored in the array d. In the process of indicator regeneration, the MC rewrites its contents into an intermediate array, and from it it sequentially reads the codes of the output characters and displays them on the indicator. An additional array is introduced in order to eliminate the flickering of the indicator resulting from writing new information to array d before the old one is not yet fully displayed. For example, let's say that the array d initially contained the string "ABCDEFHLP", and when the fourth character ("D") is displayed, the string "FDA 2002" is entered in the array. Then the user of the device, due to the inertia of human vision, at some point in time will see the line "ABC 2002". In addition, if such processes are repeated constantly (and this will be the case in real work), the person will get the impression that the information on the indicator is flickering.

As noted, the keyboard is scanned simultaneously with the indicator update. When any button is pressed, the contact bounce suppression subroutine is called, which delays a few milliseconds (the value of this time is stored in the MK memory), during which the device does not respond to further button presses.

It should also be noted that the exposure time of software timers, clocks and alarms is set in seconds (the hour counter is reset when the value 24 x 60 x 60 = 86400 is reached), and before being displayed on the indicator it is converted to the H : MM : SS format for timers or to the format HH : MM for clock and alarm. This is done using the following formulas:

C = time mod 60.

Here the operation ][ means discarding the fractional part, i.e. the division is integer.

The obtained values ​​of hours, minutes and seconds are not yet suitable for direct display on the indicator, as they are presented in binary code. To select the most significant and least significant decimal places, it is necessary to perform two more operations on each value:

LSB = value mod 10.

Let's consider an example. Let it be necessary to display the value 8673 s on the indicator in the format H : MM : SS. We get

C = 8673 mod 60 = 33.

Thus, the indicator will display 2 : 24 : 33

From the examples given, it can be seen how many operations need to be performed just to organize the output to the indicator. It would be almost impossible to implement such mathematics in assembly language. In the C language, this is implemented in just a few lines, while, thanks to a high level of optimization, the program code is quite compact and fast. But the most important thing is that the programmer can focus his main attention on the program algorithm, abstracting from the specific features of the architecture of the applied microcontroller. All this contributes to the easy transfer of the program from one MK to another.

The source text of the MK program and the "firmware" codes in Intel HEX format are located at the above address on the Internet.

To program the MK, the author used a programmer assembled according to the scheme shown in Fig. 2, and the PonyProg2000 software, the latest version of which can be "downloaded" from the website . The main difference between the programmer and that described in [1] is the addition of another transistor (VT3) to the synchronization signal generation circuit, which increases the programming reliability by completely eliminating the negative voltage at the MK pins.

Multi-program timer-clock-thermometer

The described device allows MK programming on the board, that is, it supports ICSP technology (In-Circuit Serial Programming - in-circuit serial programming). To do this, it is connected by five wires to the programmer through connector X1 as follows: 7 - common; 5,6 - 5 V; 2 - SDA; 3 - SCL; 1 - Upprog.

It is possible to use other programmers, including those supporting low-voltage programming. In the latter case, you must additionally connect the corresponding contact of the programmer with pin 4 of connector X1.

A drawing of the printed circuit board of the device is shown in fig. 3, keyboards - in fig. four.

Multi-program timer-clock-thermometer
(click to enlarge)

There are seven holes on the timer board, into which, before mounting the parts, pieces of tinned wire are inserted and soldered to the printed conductors on both sides of the board. The function of jumpers is also performed by the conclusions of some parts. The holes through which such connections of printed conductors are made are highlighted in fig. 3 with four crosswise dots.

Multi-program timer-clock-thermometer

The source files of the project and the library of used components for CAD Accel EDA 15.0 are located at the above site.

The device uses fixed resistors and capacitors for surface mounting. The exception is oxide capacitors C6, C7 (K50-35). MK PIC16F876 can have any maximum operating frequency and temperature range, the main thing is that it be in a DIP package (had an SP suffix). The HRM14AX piezoelectric emitter can be replaced by a unit made on three elements of the KR1533LAZ microcircuit and a ZP-18 piezoelectric emitter [2]. Thermistor RK1 - MMT-4 with a nominal resistance of 15 kOhm (R0 = 0,294 Ohm, V = 3176 K).

As connectors X1 - XZ, split blocks with straight pins are used, which are used in computer technology: for X1, a block with a two-row arrangement of pins is used, and for X2 and XZ - with a single row. The eighth contact of the XP1 plug and the third XP2 plug were removed, and plugs were inserted into the corresponding sockets of the mating parts of the connectors - pieces of thick fishing line. This measure will prevent the connectors from mating incorrectly. The X2 connector socket is made of a 20-slot panel for a microcircuit in a DIP package (one part of it is used, which has 10 pins). Buttons SB1-SB16 - TS-A3PS-130.

The contents of the MK EEPROM, which can be changed in order to set other operation parameters, are presented in Table. 2.

Multi-program timer-clock-thermometer
(click to enlarge)

The column "Parameter" contains the name of the parameter, which is displayed on the indicator. If there is a dash in this column, then this parameter can only be changed when programming the MK.

Literature

  1. Dolgiy A. Development and debugging of devices on the MK. - Radio, 2001. No. 6, pp. 24-26; No. 7, p. 19-21
  2. Zelepukin S. MPT-1 microcontroller temperature controller. - Radio, 2001, No. 9, p. 21, 22.

Author: D.Frolov, Ryazan

See other articles Section Power regulators, thermometers, heat stabilizers.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Machine for thinning flowers in gardens 02.05.2024

In modern agriculture, technological progress is developing aimed at increasing the efficiency of plant care processes. The innovative Florix flower thinning machine was presented in Italy, designed to optimize the harvesting stage. This tool is equipped with mobile arms, allowing it to be easily adapted to the needs of the garden. The operator can adjust the speed of the thin wires by controlling them from the tractor cab using a joystick. This approach significantly increases the efficiency of the flower thinning process, providing the possibility of individual adjustment to the specific conditions of the garden, as well as the variety and type of fruit grown in it. After testing the Florix machine for two years on various types of fruit, the results were very encouraging. Farmers such as Filiberto Montanari, who has used a Florix machine for several years, have reported a significant reduction in the time and labor required to thin flowers. ... >>

Advanced Infrared Microscope 02.05.2024

Microscopes play an important role in scientific research, allowing scientists to delve into structures and processes invisible to the eye. However, various microscopy methods have their limitations, and among them was the limitation of resolution when using the infrared range. But the latest achievements of Japanese researchers from the University of Tokyo open up new prospects for studying the microworld. Scientists from the University of Tokyo have unveiled a new microscope that will revolutionize the capabilities of infrared microscopy. This advanced instrument allows you to see the internal structures of living bacteria with amazing clarity on the nanometer scale. Typically, mid-infrared microscopes are limited by low resolution, but the latest development from Japanese researchers overcomes these limitations. According to scientists, the developed microscope allows creating images with a resolution of up to 120 nanometers, which is 30 times higher than the resolution of traditional microscopes. ... >>

Air trap for insects 01.05.2024

Agriculture is one of the key sectors of the economy, and pest control is an integral part of this process. A team of scientists from the Indian Council of Agricultural Research-Central Potato Research Institute (ICAR-CPRI), Shimla, has come up with an innovative solution to this problem - a wind-powered insect air trap. This device addresses the shortcomings of traditional pest control methods by providing real-time insect population data. The trap is powered entirely by wind energy, making it an environmentally friendly solution that requires no power. Its unique design allows monitoring of both harmful and beneficial insects, providing a complete overview of the population in any agricultural area. “By assessing target pests at the right time, we can take necessary measures to control both pests and diseases,” says Kapil ... >>

Random news from the Archive

Pets should not be allowed in bed 28.03.2023

Many people like to sleep with their pets, but do not suspect that this can negatively affect their health. American scientists have found that cats and dogs can cause various sleep disorders in their owners.

The researchers analyzed data from people who participated in the 2005-2006 National Health and Nutrition Survey. In their work, scientists took into account such factors as sleep quality, such as fatigue, drowsiness, prolonged falling asleep or insufficient sleep. They found that dog owners were more likely to suffer from sleep disorders, and cat owners were more likely to suffer from spontaneous leg twitches.

Scientists cannot say exactly why pets affect the sleep of their owners. Perhaps this is due to the fact that cats and dogs are more active at night and can interfere with a peaceful rest. However, they do not recommend that people get rid of their pupils because of this: simply denying them access to the bedroom is enough.

Scientists also warn people with chronic sleep disorders that having a pet can only exacerbate their problem.

Other interesting news:

▪ Antiquarks and proton rotation

▪ Opaque transparency

▪ Bionic organ of vision

▪ Solar panels on aircraft wings

▪ Thecus N2810 Pro NAS

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site Wonders of nature. Article selection

▪ article Kapitsa Sergey Petrovich. Famous aphorisms

▪ article When and where were pigeons used for aerial photography? Detailed answer

▪ video camera article. Repair Secrets

▪ article Refinement of the guard. Encyclopedia of radio electronics and electrical engineering

▪ article Spectacular tricks and their clues. Encyclopedia

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024