METHODS, ALGORITHMS AND ELEMENTS OF RELAY CONTROL FOR EMBEDDED SYSTEMS

МЕТОДЫ, АЛГОРИТМЫ И ЭЛЕМЕНТЫ РЕЛЕЙНОГО УПРАВЛЕНИЯ ДЛЯ ВСТРАИВАЕМЫХ СИСТЕМ
Safir P.
Цитировать:
Safir P. METHODS, ALGORITHMS AND ELEMENTS OF RELAY CONTROL FOR EMBEDDED SYSTEMS // Universum: технические науки : электрон. научн. журн. 2023. 7(112). URL: https://7universum.com/ru/tech/archive/item/15784 (дата обращения: 01.11.2024).
Прочитать статью:
DOI - 10.32743/UniTech.2023.112.7.15784

 

ABSTRACT

This paper investigates the algorithms and elements of relay control for embedded systems. The paper will consider systems based on an electromechanical relay and a transistor connected to an embedded system. MOSFET as the best solution for soft control of objects (PWM). Optocoupler as a safe solution for controlling high voltage devices. Some software algorithms for better control of the system will be discussed.

АННОТАЦИЯ

В данной статье исследуются алгоритмы и элементы релейного управления для встраиваемых систем. Будет проанализирован оптимальный  вариант для контроля различных систем. Будут рассмотрены системы на основе электромеханического реле и транзистора подключенные к встраиваемым системам. MOSFET как наилучшее решение для плавного контроля за объектами (PWM). Оптопара как безопасное решение для контроля устройств с высоким напряжением. Будут рассмотрены некоторые программные алгоритмы для наилучшего контроля за системой.

 

Keywords: relay system, embedded system, MOSFET, optocoupler, hysteresis, the change prediction method.

Ключевые слова: релейное управление, встраиваемые системы, MOSFET.

 

Introduction

Developing an efficient algorithm for relay control system based on various embedded systems is not an easy task. Relay[1] is a type of logic controller. Relay has only two states, on or off. There are many methods and program algorithms of relay control in order to obtain optimal real-time speed control for different controlled systems. Relay control is the most economical control method in operation. But there are also other control methods, such as MOSFETs[1] or optocouplers. These allow more accurate and flexible control of the load as well as reduction of electromagnetic noise.

 

A diagram of a relay

Description automatically generated with medium confidence

Picture 1. Relay control system

 

Relay control system

On/Off

A diagram of a set of data

Description automatically generated

Picture 2. On/Off relay control system

 

The simplest algorithm for relay operation is to turn the relay on or off when the set reference point is crossed. For example: we measure the temperature in a liquid, and when it reaches 80 degrees, we must stop heating. 80 degrees is the set point. We can use this kind of code for Arduino:

If (temperature < set_point)

  digitalWrite(relay, HIGHT)

else

 digitalWrite(relay, LOW)

But as we know any mechanical switching, whether it is a push button or an electronic mechanical relay during switching occurs bounce contacts, which creates noise throughout the control system, and in this case, every time we switch we must add a time delay to our code to wait for the mechanical bounce to calm down[2].

Delay(500)

In any case, this is not the best algorithm for relay control, because the relay will be triggered all the time and very often when crossing the set point.

Hysteresis

A diagram with red line and green lines

Description automatically generated

Picture 3. Hysteresis ana Relay status

 

Hysteresis[3] is an algorithm that sets the parameters of relay triggering, more or less around the set point, by the size of the hysteresis window. This allows us to reduce relay triggering[3], increase noise tolerance of the system and in this case we will not use delay, which will free up some resources of the embedded system. But the accuracy of the system is a little bit reduced because we turn the relay on and off above or below the set point. Implementation of the code on Arduino:

If (temperature < low_set_point)

  digitalWrite(relay, HIGHT)

else if (temperature > hight_set_point)

 digitalWrite(relay, LOW)

The change prediction method

Possibilities of modern programmable logic controllers[3] allow to realize differential equations of control method, where it is possible to include program-logic solutions. The change prediction method is built so that it can analyze[4] the rate of change of the parameter that we control and based on the obtained data can turn on or off the relay in advance setting. This algorithm uses feedback control on the rate of change of the controlled parameter. The most important thing in this algorithm is the gain coefficient, which is calibrated for each system separately. Then this coefficient is multiplied by the rate of change is entered into the algorithm as a derivative - the change in value divided by the time for which the change occurred.

Picture 4. The change prediction method

 

Disadvantages of using an electromechanical relay:

  • Mechanical bounce of the contacts. (It takes time for this debounce to subside and as a consequence detention during switching).
  • Switching noise.
  • Physical abrasion of the contacts, with frequent use and as a consequence requires more frequent monitoring and service.
  • Has a very high inductance, which leads to higher noise throughout the system.
  • Large size.
  • High current consumption
  • If more than one relay is connected to the embedded system, an external power supply is required.

MOSFET

A diagram of a load

Description automatically generated

Picture 5. MOSFET control system

 

The use of MOSFET[5] transistor is possible only for sensors that consume only DC current and it is an optimal solution in contrast to relays. The MOSFE does not have any of the disadvantages that relays have. In particular, the transistor has no mechanical switches and works silently, does not have a large inductance and when switching does not create electromagnetic noise in the system. The switching speed of the transistor is many times faster than that of a mechanical relay. With the help of transistor it is easy to realize Pulse Width Modulation (PWM), which allows smooth load control and more accurate control. And also in Pulse Width modulation mode, we can keep the load control within a well-defined range. To handle AC current, we can use a semistor. This is an element that is similar to a transistor but can handle AC current.

Optocoupler

An optocoupler[6] is a remarkable electronic element that allows the embedded system to be physically separated from the load. An optocoupler can replace a MOSFET, but an optocoupler is much safer because it consists of two physically independent parts. The first part is the LED, which we control through the embedded system and the second part, which can consist of a transistor or other semiconductor element. The main thing is that the control of the second part is not mechanical, but through a pulse of light, which is created by the light diode and thus there is no direct mechanical connection between these two parts of the optocoupler. This property is important when we control sensitive devices and sensors. The optocoupler is mainly used for small loads, mainly logic elements or low-power sensors.

A diagram of a circuit

Description automatically generated

Picture 6. Optocoupler and embedded system

 

TRIAC.( TRIode for Alternating Current)

TRIA[7] is an electronic element, its main feature is that it can operate with AC current.

A diagram of a circuit

Description automatically generated

Picture 7. TRIAC and embedded system

 

To control the load only in the mode on or off, it is recommended to install Optocoupler with zero detector[8], it will turn off and turn on the load only in moments of AC voltage transition in the network through 0, which greatly reduces noise in the control system.

CONCLUSION

As we can see the use of mechanical relay is the simplest way of control. Mechanical relay can be used with DC and AC current. But mechanical relay has some disadvantages, such as electromagnetic switching noise and limited lifetime. But it is the most common way to control the load. But if you need to change the voltage smoothly and control the load accurately, then a MOSFET is the way to use. Using optocoupler will allow to physically separate the project into two parts, which will protect the embedded system from overloads. Of the three algorithms considered, the change prediction method is the best and most accurate. It allows you to very accurately control the load without overstepping the border of the hysteresis.

 

References:

  1. Richard C. Dorf. Systems, Controls, Embedded Systems, Energy, and Machines, CRC Press 2017, P. 23 - 56.
  2. Richard C. Dorf, Robert H. Bishop, Modern Control Systems, Pearson 2017, P. 56 - 58.
  3. Alexandru Forrai, Embedded Control System Design A Model Based Approach, Springer Berlin Heidelberg 2013, P. 65 - 69.
  4. Tim Wescott, Applied Control Theory for Embedded Systems, Elsevier Science 2011, P. 123 - 140.
  5. Mohamed Khalgui, Hans-Michael Hanisch, Reconfigurable Embedded Control Systems Applications for Flexibility and Agility, Information Science Reference 2011, P. 102 -105.
  6. Arben Çela, Mongi Ben Gaid, Xu-Guang Li, Silviu-Iulian Niculescu, Optimal Design of Distributed Control and Embedded Systems, Springer International Publishing 2013, P.140 - 156.
  7. Arnold S. Berger, Arnold H. Berger, Embedded Systems Design An Introduction to Processes, Tools, and Techniques, Taylor & Francis 2002, P. 106 - 123.
  8. Arnold S. Berger, Debugging Embedded and Real-Time Systems The Art, Science, Technology, and Tools of Real-Time System Debugging, Elsevier Science 2020, P. 202 -207.
Информация об авторах

Bachelor of Science, The Azrieli College of Engineering in Jerusalem (JCE), Israel, Jerusalem

бакалавр наук, Академический инженерный колледж Азриэли, Израиль, г. Иерусалим

Журнал зарегистрирован Федеральной службой по надзору в сфере связи, информационных технологий и массовых коммуникаций (Роскомнадзор), регистрационный номер ЭЛ №ФС77-54434 от 17.06.2013
Учредитель журнала - ООО «МЦНО»
Главный редактор - Ахметов Сайранбек Махсутович.
Top