ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING Universal timer on the RIS controller. Encyclopedia of radio electronics and electrical engineering Encyclopedia of radio electronics and electrical engineering / Clocks, timers, relays, load switches The versatility of the device described in the article is that it can not only turn on and off four loads at a given time, but also turn an outdated AT machine into an ATX computer and at the same time perform the function of an "anti-freeze" tool. When there is a need to switch several loads according to a given program, it is convenient to use an electronic watch with several alarm clocks equipped with electronic keys. However, if this requires control from a computer, then such a watch is no longer suitable. The proposed timer allows you to control four independent channels. For this, 16 events are provided, each of which can change the state of any channel (turn it on or off) at the appointed time, taking into account the day of the week. Channels can be controlled directly from the computer to which the device is connected, from which the current time is set and events are configured in the timer. The device allows in a regular AT computer to implement advanced power management functions similar to ATX standard machines (programmatically turn off and on at the appointed time), as well as manage the power of peripheral devices (printer, scanner, external modem). To use the timer as an "anti-freeze" tool, you need a program that automatically regularly resets the time to turn off and then turn on after a few minutes. When the computer freezes, the timer, turning off the power for a while, will perform a "cold" reboot of the system. The schematic diagram of the device is shown in fig. 1. Its basis is PIC-controller PIC16F84A-04 (DD2). The clock frequency (4 MHz) sets the quartz resonator ZQ2. On the element DD1.1, a pulse generator with a repetition rate of 32768 Hz is made for timing. The pulses of this generator are fed through the buffer element DD1.2 to the external input of the RTCC counter of the microcontroller. The required frequency and, consequently, the accuracy of the clock is set by the subscript capacitor C2. (click to enlarge) Transistors 1VT1-4VT1 are loaded with relays 1K1-4K1, the contacts of which are included in the power supply circuits of loads connected to sockets XS1-XS4. LEDs 1HL1-4HL1 - load status indicators. The computer controls the device via the RS-232 interface. Since the PIC16F84A microcontroller does not have a built-in serial interface, the latter is implemented in software. COM port signals are not used as standard. The transmitted data is synchronized via the DTR line, the computer transmits information via the RTS line, and receives it from the controller via the CTS line. The data is transmitted in duplex mode and is padded with control bytes to check the correctness of the information. The interface used is described in more detail in the author's article "Interface of a PIC controller with a PC" ("Radio", 2003, No. 7, pp. 20-22). R4R7VD4 and R5R8VD5 circuits convert RS-232 levels to TTL levels for microcontroller inputs. The TTL level from the microcontroller output is enough to directly control the RS-232 line, which made it possible to simplify the matching circuit. After power is applied, the DD2 microcontroller is set to its initial state, in which all channels are turned off, the clock is reset, and load control is blocked to prevent them from being turned on by mistake. When setting up the device, the computer transmits the current time, day of the week, and parameters for events. All information about the latter is stored in the non-volatile EEPROM memory of the microcontroller. Each event contains the number of the load that it manages, information about the action performed (turning on or off), the time of operation (including the day of the week) and can be in the "off" state (does not perform an action) and in the "daily" mode (occurs at the specified time, regardless of the day of the week). After setting the time and setting the channels, the device can be used both independently (with the communication cable disconnected from the XS5 connector) and under computer control. Since the RS-232 interface allows you to connect and disconnect a cable while devices are turned on (hot plug), you can do this at any time. For direct channel control, use the SB1-SB4 buttons. Holding any of them in the pressed position for more than 0,5 s leads to a change in the state of the corresponding channel. The time delay is implemented in software and prevents loads from being switched by accidental clicks. Port B of the microcontroller is configured so that its input lines RB0-RB3 and RB5 are connected through internal resistors to the power rail. The power supply of the timer is made according to the traditional scheme and has no special features. The use of a step-down transformer T1 is due to the need for galvanic isolation of the supply network and the computer. The GB1 battery is a backup power source for the clock in case of power outages. Microcontroller "firmware" codes are given in Table. 1. When programming, you need to set the following bit values in the configuration word: generator type (OSC) - HS, watchdog timer (WDT) - disabled, delay after power on (FWRTE) - enabled. (click to enlarge) The connection of the computer with the timer is carried out through the dynamically loaded library timercom.dll. The TIMER program is used to set events and manually control loads. Its main window (Fig. 2) has three tabs. The first of them ("Loads") displays the state of the loads, which can be changed by unchecking or checking the corresponding box, the second one ("Events") contains the conditions of the 16th event, the number of the load channel, the required action, the time and day of the week when it should happen. In the "Options" tab, you can select the COM port to which the device is connected and check the box that allows the program to receive data from the device immediately after launch. After changing the parameters of events or the state of loads, you must click the "Record" button to transfer the new information to the timer (in this case, the current time is automatically set). Pressing the "Read" button causes the current device data to be loaded. The device is assembled on a printed circuit board and placed in the "Pilot" line filter housing. Buttons, LEDs and socket XS1 are installed on its side wall. Transformer T1 - any small-sized one with a secondary winding of 12 V. As 1K1-4K1, imported relays TRU-12VDC-SB-CL with an operating voltage of 12 V and 5 A contacts (winding resistance - 400 ... 500 Ohm) are used. Backup power supply GB1 - a battery of batteries or galvanic cells with a voltage of 3,6 ... 4,5 V. The current consumed from it does not exceed 8 mA. You can connect the timer to the computer's COM port with both a modem and a null modem cable. The assignment of the connector pins for each case is given in Table. 2. Author: S.Kuleshov, Kurgan See other articles Section Clocks, timers, relays, load switches. Read and write useful comments on this article. Latest news of science and technology, new electronics: Air trap for insects
01.05.2024 The threat of space debris to the Earth's magnetic field
01.05.2024 Solidification of bulk substances
30.04.2024
Other interesting news: ▪ Gene therapy will build muscle without exercise ▪ Anker Soundcore Space Q45 and Space A40 Wireless Headphones ▪ ARMADA PXA8 1936-core LTE chip from Marvell ▪ Hydrofoil Electric Taxi Candela P-12 News feed of science and technology, new electronics
Interesting materials of the Free Technical Library: ▪ section of the site Tools and mechanisms for agriculture. Article selection ▪ article Monday is a hard day. Popular expression ▪ article by Mamei Sapota. Legends, cultivation, methods of application ▪ article Quartz oscillator. Encyclopedia of radio electronics and electrical engineering ▪ article Chairs. Focus Secret
Leave your comment on this article: All languages of this page Home page | Library | Articles | Website map | Site Reviews www.diagram.com.ua |