Development of a tracked platform control system

In this paper, the authors describe in detail the technology of development and creation of a tracked robot, presenting sketches of parts and components. In addition to the mechanical part, the paper presents the development technology of an automated control system based on the ARM STM32, taking into account the bounce of buttons and other engineering subtleties. The authors presented a number of documents developed in accordance with State Standards, such as a functional automation diagram and a circuit diagram. The authors devote a large amount of material to photographic materials demonstrating the efficiency of development.


Introduction
On the basis of a tracked platform, it is possible to build both combat robotic mechanisms with a portable ammunition and all-terrain transporters that can transport cargo in terms of production or the external environment [1]. Periodically, the enterprises need to remotely manage various objects. As a rule, this need arises in several situations: when it is necessary to protect a person from the negative effects of the environment or the loads to which the object is exposed; when the characteristics of the device do not allow direct human participation in its management; when full autonomy of the system is required. A very urgent task is the development of systems for manual control of tracked platforms.
The task of managing tracked platforms comes down to controlling 2 DC motors. Today, there are several different approaches to controlling DC motors. The simplest of these is to connect the motors through a relay to a power source. There is also an approach to control such motors by including the supply of a rheostat into the break, which allows you to make a smooth adjustment of the current in the circuit. And, the third, last method is control with the help of a current driver and a power MOSFET transistor through a microcontroller by generating a PWM signal of different duty cycle [2]. In this paper, the authors consider an approach to the development of an automated control system for a tracked platform with the inclusion in the power supply circuit of the relay and the use of a wired console.

Сonception
When creating a track, its potential carrying capacity, overall dimensions, availability of a platform for the location of batteries, electromechanical drives, a contact relay group and a control board are taken into account. Overall dimensions of the platform 475×350×75 mm, such dimensions allow to accommodate all the above elements. Figure 1 and Figure 2 show a general view of the trolley.  The design is made of two symmetrical sides. The side is an electric tracked truck. There is also a set of gears for transmitting the rotation to the tracks. The sides are connected by a metal profile by the method of electric arc welding. Such a connection will give the proper strength and reliability in operation. The motor transmits rotation through a gearbox to a gear wheel, which is mounted on a rectangular axis (Figure 3). This allows you to transfer almost all the energy of rotation in a rigid hook. Through the central hole with the help of a stud fastens this wheel to the frame of the cart. If it is decided to remove the cart from the tracks, there are three small holes that are used to connect to a conventional wheel. The rotation is transmitted to the tracks by means of a drive gear, which is fitted onto the rectangular spindle with a square hole. The wheel taking the rotation from the spindle transmits it to other wheels and a tracked track. The material of these gears -organic sheet glass State Standart 10667-90 (GOST 10667-90). This material is easily processed by cutting, drilling and milling. The control object is shown in Figure 4, the maximum working load is 67 kg.

Management system development
The motor control is based on the idea of alternately switching the relay using the stm32f0 discovery microcontroller [3]. Commands to the controller are given using a remote control with direct galvanic coupling. Since the selected microcontroller has an output voltage of 3V and low current, it will not be possible to connect the relay directly to the microcontroller's leg, so it was decided to design the product, which will be called "discrete logical amplifier". The schematic diagram of this product is provided in Figure 5 [4]. From pin, a protective resistor R1 1K is installed, and the gate contact is pulled to the IOP Conf. Series: Materials Science and Engineering 516 (2019) 012002 IOP Publishing doi:10.1088/1757-899X/516/1/012002 4 ground after 10 KΩ. The protective diode VD1 protects the pin from current surges, during switching on and off of the relay. This approach allows using modularity to achieve ease of connection. Consider the features of connecting buttons on the diagram in Figure 6. When using buttons with mechanical contact inevitably, an effect called "contact bounce" occurs. At first glance, there are no bounce protection for the SB1 and SB2 buttons, and there is no pull-up to power or to ground, which is considered to be a wrong connection of the contacts, but, however, the microcontroller implements a hardware pull-up to the ground. Bounce also cleaned programmatically.
For buttons SB3, SB4, the connection is different from SB1 and SB2. There is a circuitry tightening to the power supply, as well as an RC circuit added parallel to the buttons, which filters the bounce of the contacts. Calculate the main characteristic of the RC circuit -the value of τ.
The calculation is carried out according to the formula τ = RC. For our button, we take a resistor with a nominal value of R = 10 KΩ, and a capacitor with a capacity of C = 0.1 µF. Thus τ = 10,000 Ohm * 0.0000001 F = 0.0001 s. Our τ = 1ms. But it should be remembered that τ shows how much time the capacitor C is charged at 37% of the supply voltage. According to the transitional characteristics of the RC circuit, the full charge of the capacitor occurs over a time interval equal to 5 * τ. Then 5 * 1 ms = 5 ms, this time is enough for the natural disappearance of contact bounce, which means that the parameters of the RC circuit are selected correctly. The resistors are turned on directly to the power supply and to the pin of the microcontroller, and the capacitor is turned on parallel to the button, this creates an RC circuit symmetrical in all directions, with all the states of the buttons. For the buttons SB3, SB4, a different approach to the software processing of clicks occurs, so it was decided to install circuit protection against bounce.  The control line "c" is connected to the elements of the NS relay. The designation of the relay is supplemented in accordance with the electrical principle scheme both on the device and in the field. The registration line consists of a remote control of 4 H buttons, these buttons are also complemented by the designation according to the circuit diagram. The functional connection between the control panel, the controller and the actuators with the switches is clearly traced.
The basis of the algorithm is alternately switching the relay. The relay switches using GPIO, it follows that the system will be controlled by switching the state of the microcontroller's legs. The main part of the program is a cyclical polling of the buttons SB1, SB2, and then sending commands to the microcontroller's legs, but before that it is necessary to initialize the periphery of the microcontroller. According to the polling results of the button, the program either continues to poll other buttons further and execute other commands, or it processes the pressing, incrementing or decrementing the uint8_t numOfGear variable transmission indicator. Then follows a simple but effective bounce protection in the form of a delay of 100ms, which is 20 times longer than the maximum bounce time.
According to the results of the survey of buttons, the controller decides on the choice of the mode of operation of the engine. Since the implementation of the code takes place in the C language, these actions are best carried out with switch -case -break statements. If the numOfGear variable is zero, then the setNeutralGear procedure is called, in this procedure all the legs of the microcontroller are switched to the logical zero mode. By default, when the controller is turned on, this program will be set. Consider the other modes of operation of the robot. If the value numOfGear = 1, then the setFirstGear procedure is called. This procedure includes engines in the forward driving mode. Similarly, the trolley is moving backwards, we simply invert the state of all the output legs. The setReverseGear procedure is responsible for this. Let's now consider a special type of movement -torsion around its axis. In order for it to appear it is necessary that the variable numOfGear be equal to 2. At this point in time, one track moves forward and the second backward, thereby creating a circular motion in place.
Considered all modes of movement forward, backward, parking and turning on the spot. Now we describe the control of turning right and left. To do this, we will take a completely different approach to controlling the pressing of buttons SB3, SB4. This approach does not consist in cyclic polling, but in handling external interrupts. Set up interrupts for triggering on the falling edge. We describe the function of the external interrupt handler. There is a software, handwritten flag -the variable uint8_t sideFlag, it records the number of button presses. The external interrupt system in the STM32 family is divided into lines.
The SB3 button is on line 1, and the SB4 button is on line 5. By interrupting, when entering the handler, we parse the interrupt on which line, and then increment or decrement the sideFlag variable. There is a common global practice to make interrupt handlers as short and as less resource intensive as possible so as not to miss another interrupt and not fall into a hardfault. Figure 9 shows testing a system with a microcontroller, a relay, and a geared motor. Checking the display of high emissions during engine shutdowns, and therefore it is recommended that low-voltage circuits be made as short as possible and kept as far as possible from the engines in order to avoid interference. In this work, a robot with a tracked course was designed, manufactured and programmed. The management program was written in IDE IAR Workbench 8.20, and initialized in the Cube MX program [7]. The drawings were made in the program Compass 16, and the design of the circuitry of the additional product and its printed circuit board in the program Altium Designer 17 [8]. This robot can be easily modified for a wide range of tasks.