Українська   Русский
DonNTU   Masters' portal

Abstract

When writing this essay master's work is not yet completed. Final Completion: June 2019. The full text of the work and materials on the topic can be obtained from the author or his manager after the specified date.

Content

Introduction

Using remote monitoring and event logging devices taking place in the external environment, is an important part of automation in the enterprise. Very often the main problem is the integration of several different types of devices having sensors and / or actuators in a single network for reliable exchange of the necessary information between them. To do this, you can apply ready-made complex solutions that usually require significant cost. But in some cases it is possible to use cheaper, simple in execution. and debugging, but no less reliable microcontroller technology.

Modern microcontrollers are a good technical solution to many similar problems. The network technology market also offers many protocol options for building industrial or even a household network. Among them, the Modbus protocol was chosen, which has a clear specification, widespread, reliable and simple from a development point of view. The aim of the graduation project is a hardware and software implementation of the Modbus network, the nodes of which are a personal computer and is connected to it via a serial interface device based microcontroller.

This project is aimed at using, first of all, in industrial communication networks, but it can also be used to solve everyday problems of controlling various processes from a regular computer. One of the main factors of the feasibility of the project should be the economic benefit from the implementation. It is on this that the ability to widely disseminate the project to cover the initial cost and profit. In turn, enterprises will be able to minimize the cost of equipment and get good network performance.

1. Theme urgency

The project is mainly focused on use in industrial plants for monitoring and control. production, as well as for use in household and educational tasks. Cost-benefit analysis showed good results in terms of project profitability, therefore that the production of such equipment is cheaper than the use of finished expensive equipment. The work is relevant for developers of automatic control systems and control. It is simple and reliable way to solve industrial or domestic problems.

2. Goal and tasks of the research

The subject of research and development are microcontroller networks that operate, in particular, based on the Modbus protocol. The goal of the work is hardware and software implementation of the Modbus network on the serial port.

The main objectives of the study:

  1. Slave-based microcontroller with support for communication via RS-232
  2. Software firmware for slave
  3. PC software with the ability to poll the slave

3. Review of research and development

The research topic is quite popular in national and international sources. And alas, not popular in local.

3.1 Overview of international sources

The [ 1 ] source provides the largest and most complete description of the MODBUS protocol, its functions, modifications, commands, diagnostics, and so on. This manual will provide invaluable assistance in the study and use of the protocol. The author is MODICON, Inc. North Andover is a city in Essex, Massachusetts, USA. This guide is written for those who will use the Modicon Modbus and messages for communication in applications modicon programmable controllers. It describes how messages are created and how transactions occur using the Modbus protocol. The [ 2 ] Merlin Guerin Networking Guide describes in detail the characteristics of the data transmission medium used for Power Logic equipment. The following issues will be addressed: implementation at the device level (level 1), Modbus protocol supported by this environment (corresponds to OSI model level 2). Chapter 3 discusses some aspects of the application level (Hardware Implementation), however, to a large extent this level concerns application software, which is not is the subject of this guide. Next, we have a [ 3 ] source for Atmel, a manufacturer of semiconductor electronic components. In January 2016, Microchip buys Atmel for $ 3.56 billion. From the source it is known that The first Atmel microcontroller appeared in 1993 and was based on the classic Intel 8051 microcontroller core. Microcontrollers MCS-51, AT91SAM and AT91CAP (based on the ARM core) are also considered there, microcontrollers on their own Atmel AVR and AVR32 cores, radio frequency (RF) devices, memory chips of types EEPROM and flash (including memory based on DataFlash), and some number of other products in the same industry.

3.2 Overview of national sources

We know from [ 4 ] that the book is devoted to the practical use of AVR single-chip AVR microcontrollers from ATMEL. Considered architecture, its features. The main electrical parameters and temporal characteristics are given. Described in detail the internal device microcontrollers, command systems, peripherals, and methods programming with examples of the implementation of some algorithms for specific digital devices. This article [ 5 ] is devoted to working with a COM port using threads under Windows OS. All the programs presented here are written in C ++ Builder 6 using the Windows interface, object classes and WINAPI functions. If you have not worked with a COM port in Windows, we recommend that you first read the section "Program Description", which describes the initialization of the port and how to work with it. The book [ 6 ] contains methodological and reference materials on visual systems. C ++ Builder 6 and 2006 Object Oriented Programming, as well as previous versions C ++ Builder. The technique of building application programs that implement textual and graphical editors, animation and multimedia, work with databases, creating reports, applications for Internet, distributed applications, clients and servers. Data access technologies considered ADO, InterBase Express, dbExpress, COM server components, COM distributed application technology, action scheduling technique, many components. The reference part of the book contains materials by C ++ language, C ++ Builder functions and Windows API (over 570 functions), C ++ Builder types and classes, their properties, methods and events. In the [ 7 ] article published in the magazine Amateur Radio Badlo and S. Badlo - husband and wife describe the converter archives based on MODBUS. The following source [ 8 ] reviews and compares popular open industrial networks. The [ 9 ] source shows market values and provides detailed specifications for electronic components. The article [ 10 ] lets us know that while saving the processor core and AVR architecture Atmel continues to improve the performance of AVR off-premise units.

4. Industrial microcontroller network based on MODBUS protocol

4.1 The concept of industrial network

Industrial network - a data network connecting sensors, actuators, controllers and used in industrial automation. Devices use the network for various purposes. The main one is data transfer between sensors controllers and actuators. Based on this, configuration is performed. sensors, their power and calibration, control of certain production processes.

Industrial networks have several advantages, including:
- Increasing the distance to sensors and actuators
- Simplified Peripherals Management
- Simplified to make changes to the system by adding or disconnecting some nodes
- Convenience of remote control, adjustment and diagnostics of peripheral equipment

The term "microcontroller network", which is key in this work, in most cases can be explained as follows. These are several devices based on microcontroller, which are interconnected to certain physical and software tools, perform:
a) receiving and processing information from sensors in order to control the parameter of the external environment or transfer this information to another device on the network
b) a specific task that another (perhaps the most important) device on the network provides to them

4.2 Types of industrial networks

There are many protocol solutions for solving the set tasks. The most common in the CIS countries are:
1) Industrial Ethernet - an Ethernet option, used in industry, has such advantages as a relatively low price, high transfer rate of large amounts of data. At the same time, there are high costs for transferring data of small size, greater physical vulnerability compared to other networks
2) HART is a digital industrial protocol for combining analog sensors and debugging them. It is cheap, easy to install, has high noise immunity, but works at low speeds.
3) CAN - a standard for automotive automatics, focused on networking of various sensors and actuators, it has high speed, noise immunity, but there are also disadvantages (limited packet size, speed reduction in proportion to the growth of the network);
4) ProfiBus - an open industrial network with a wide range of speeds. It is relatively expensive compared to other solutions. high costs of sending short messages. The choice of a protocol decision, as always, is completely determined by current tasks, that need to be addressed in the enterprise. But it is also necessary to take into account the possibility of simple reorganization of the network, making it more universal.

4.3 MODBUS protocol overview

Modbus [ 1 ] is a communication protocol with a client-server architecture. It is widely used in industry for organizing communication between electronic devices. Can use for data transmission serial communication lines RS-485, RS-422, RS-232, and TCP / IP (Modbus TCP) networks. Modbus was developed by Modicon (currently owned by Schneider Electric) for use in its programmable logic controllers. MODICON controllers first used serial interface RS-232. Later, the RS-485 interface was used, as it provides higher reliability, allows the use of longer lines connection and connect to one line several devices.

Modbus refers to the application layer protocols of the OSI network model. Controllers on the Modbus bus communicate using a client-server model, based on transactions consisting of request and response. Usually there is only one server in the network, the so-called “master” device. and several clients - “slave” devices. Master device initiates transactions (transmits requests). Slave devices transmit the data requested by the master device or perform the requested actions. The principal may be addressed individually to the subordinate or initiate broadcast transmission for all slave devices.

The slave generates a message and returns it in response to the request addressed to him. When a broadcast request is received, no response is generated. Protocol is a necessary part of the system. It defines as Master (MS) and Slave (SL) establish and terminate a contact, how the sender and the recipient are identified, how Messaging occurs as errors are detected. The protocol runs the request and response cycle, which occurs between MS and SL devices.

Some features of the Modbus protocol are fixed. These include: frame format, frame sequencing, handling communication errors and exceptions, and performing functions. Other characteristics are chosen by the user. These include: type of communications, baud rate, parity, number of stop bits and transfer mode (ASCII or RTU). User selectable parameters are set (in hardware or software) at each station. These parameters cannot be changed while the system is running.

Modbus is a very common protocol among CIS countries. It is used by dozens of companies developers choose it because of the simplicity of logic and independence of the type of interface. He also, along with other protocols, such as CAN, Profibus, is used in the development automatic home control systems "smart home". If we talk about the industry, the most common interface for Modbus is serial communication lines RS-232/422/485. In terms of network software implementation developers usually use several standard functions provided by the specification (reading, writing status inputs, operations with bits and bytes), sometimes adding custom functions. The type and format of such functions depends on the specific hardware platform on which those SL devices operated by MS are built, but you can often do without them. In fact, for network implementation, the main factors are the availability of a serial interface. between MS and SL, SL support for several standard functions and the host program for polling SL. All additional elements, both in hardware and in software, depend on specific tasks of customer technology. The protocol allows to combine up to 247 slave-devices in one network. But physical data lines may limit this amount. For example, RS-485 interface, which is most often used in industrial Modbus networks, gives you the opportunity to connect up to 32 slave devices.
Modbus networks have two main topologies [ 2 ]:
- "tire";
- point-to-point.
It is clear that the first combines the master and several slave devices (RS-485 networks). In the second there is only one slave device (RS-232 / RS-485).

Given that the point-to-point topology is a simpler option for studying and implementations, and also because it allows the usual COM port, which is still fairly common on desktops, for implementing a Modbus network The point-to-point topology is "point-to-point" (Pic. 1).

Simple Modbus network with

Figure 1 – Simple Modbus network with "point-to-point" topology

The task of development is the hardware-software implementation of the network point-to-point topology, the nodes of which will exchange messages by protocol, and the software of both nodes will fully comply with the standard Modbus specification.

Consider sending a message.

sending a message

Figure 2 – Sending a message
(animation: 6 frames, 5 cycles of repetition, 27.9 kilobytes)

When transferring data lines, messages are placed in the "envelope". The “envelope” leaves the device through the “port” and is “forwarded” along the lines to the addressed device. The Modbus protocol describes an “envelope” in the form of message frames. The information in the message is the address of the desired recipient, what the recipient must do, the data necessary to accomplish this, and the reliability control mechanism. When a message reaches the SL interface, it enters the addressed device via a similar “port”. The addressed device opens the envelope, reads the message, and, if there are no errors, performs the required task. Then it puts a reply message in the envelope and sends it to the "sender". The information in the reply message is the address of the device being addressed, the task that was performed, the data obtained as a result of the task, and the reliability control mechanism.

4.4 Development of the concept of the local network

Slave device developed must meet the following requirements:
- have a microcontroller for the main part, which can control the entire operation of the device and ensure proper communication with the PC
- to give the opportunity to track the processes of receiving and transmitting information using the display
- to have the necessary components for the exchange of information with a PC through the RS-232 interface

4.5 LAN software development

The first developed test software for the microcontroller. It should:
- check the general operability of the concept (setting communication between USART and the COM port of the computer, displaying information on the LCD screen, indication using LEDs)
- to show the maximum exchange rate between the PC and the Slave-device
- realize the exchange under the Modbus protocol according to the standard specification
- support several standard Modbus functions (read / write cells / registers, output device information) and, possibly, several user
- to respond to time delays, if any, occurred while receiving a request from MS
- it is desirable to change the connection speed during operation
- according to the protocol, calculate the checksum of the received packet and compare it with the existing one
- send specification-specific error messages, if any, occur during the messaging process
- ensure successful exchange with various questionnaire programs that send Modbus requests

After implementing the Slave program, you need to develop a PC program for convenient polling and Slave control devices. Software for MS should:
- to be able to configure, send and receive bytes through one of the PC COM ports
- implement user-friendly automatic generation of ModBus requests by selecting the device address, function number and internal device addresses and entering values to be recorded in the SL internal memory
- display all necessary information about the connection, sent and received messages, errors and other service information
- support several standard Modbus functions, as well as a number of user-defined functions for testing such functions in SL
- in the same way as SL, to respond to possible time delays during the reception of a message and monitor possible errors in the transmission of messages

4.6 LAN study

General requirements for the experiment
The scheme of the experiment is constructed as follows:
- test of the SL device (screen, communication at default speed)
- checking the operation of standard Modbus functions in various modes using a third-party questionnaire and comparing the results with the results of the survey by the developed software
- Modbus custom function test
- checking the stability of the network at different speeds

Findings

Analysis of the sources showed that this topic is relevant both in the international and national scientific communities, but alas, not in the local one. In the abstract, the concept of industrial network, types of industrial networks was reviewed, the MODBUS protocol was reviewed, Considered the development of the scheme and software network, as well as its study. Further work will be directed to the implementation of the conceived and planned diploma plan.

References

  1. Modbus Protocol. Reference Guide. Modicon, Inc. North Andover, Massachusetts 01845, 1996. – 121 с.
  2. Руководство по организации сети Modbus. / Merlin Gerin. Schneider Electric – 01/2007. – 94 с.
  3. Atmel corporation – Industry Leader in the Design and Manufacture of Advanced Semiconductors [Электронный ресурс]. – Режим доступа к электронному ресурсу: https://www.microchip.com/.
  4. Евстифеев А.В. Микроконтроллеры AVR семейства Tiny и Mega фирмы «ATMEL». / Евстифеев А.В. : - М.: Издательский дом «Додэка-ХХІ», 2004. - 560 с.
  5. Работа с COM-портом с помощью потоков [Электронный ресурс]. – Режим доступа к электронному ресурсу: http://piclist.ru/S-COM-THREAD-RUS/S-COM-THREAD-RUS.html#5.
  6. Архангельский А.Я., Тагин М.А. Программирование в С++ Builder 6 и 2006 : - Бином-Пресс, 2007. – 1182 с.
  7. Бадло Е., Бадло С. Modbus на привязи. Удаленный промышленный индикатор.[Текст] / Радиолюбитель, №7. – 2009. – С. 31.
  8. Обзор и сравнение популярных открытых промышленных сетей. [Текст] / Интернет-ресурс. – Режим доступа: www/URL: http://plc4good.org.ua/post_print.php?id=29.
  9. ATmega16 Data Sheet, Rev. 2466L – 06/05 / Atmel Corporation.
  10. Кривченко И., Ламберт Е. AVR-микроконтроллеры: семь ярких лет становления. Что дальше? Часть 2. / Компоненты и технологии, №2. – 2004. – С. 32.