Development of a banknote bundling machine control system based on multiple microcontrollers
2026-04-06 03:51:08··#1
Abstract: This paper introduces the main functions, hardware structure, and software functions of the control system. The implementation theory and programming ideas of each main module are briefly introduced. The system features good dynamic performance, high control precision, and high reliability. Keywords:single -chip microcomputer; Control ; Step motor A banknote bundling machine is an operating device widely used in financial systems such as banks, post offices, securities companies, and mints. Banknote bundling involves tying a bundle of banknotes into a double cross shape using strapping. The entire process is divided into four sub-actions: tying the horizontal line, tying the first vertical line, tying the second vertical line, and resetting. The mechanical mechanism completes four rotations throughout the process. The fully automatic banknote bundling machine control system realizes the functions of controlling the bundling mechanism to automatically complete the entire process, adjusting the welding head temperature, and bundling pressure. The system has the advantages of high precision, high reliability, and low cost. 1. Control System Functions and Design 1.1 Control System Workflow [align=center] Figure 1 Schematic Diagram of Control System Workflow [/align] Traditional banknote bundling machines have discontinuous four rotational movements, requiring manual operation for position control. We use three stepper motors, each controlling one degree of freedom. One motor controls the X degree of freedom; one motor controls the Y degree of freedom; and one motor controls the θ degree of freedom. The microcontroller achieves high positioning accuracy through precise control of the motors, which drive the mechanical device to complete the movement of the four positions. 1.2 Hardware Composition and Principle of the Control System [align=center] Figure 2 Schematic Diagram of System Principle [/align] The entire control system is mainly divided into the following parts: keyboard unit, main control unit, and position unit. The principle block diagram of the entire system is shown in Figure 2. 2. System Software Design The system software design follows a structured programming approach, dividing the entire program into several subroutines (modules) for easy debugging and checking. Because the system is relatively complex and distributed, each microcontroller has a corresponding main program and related subroutines. A brief introduction to several main programs follows. 2.1 Initialization Subroutine: The initialization subroutine primarily initializes the 89C51 system resources, including timers, interrupts, serial communication, and the 8255A. 2.2 Keyboard Program: The keyboard program initializes the keyboard unit, illuminates corresponding function indicator lights, retrieves key values, sets the soldering head temperature, and establishes communication with the main control unit. 2.3 Main Control Program: The main control program handles communication with the keyboard and position units, fault alarms, bundling of various denominations, control of various functional motors, and their manual operation. 2.4 Bundling Operation Subroutine: The bundling operation subroutine controls the raising and lowering of the pressure plate, pressure sensor detection, tape feeding motor, tape pulling motor, and bottom soldering motor. 2.5 Position Control Program: The program handles communication with the keyboard main control unit, control of the position motors corresponding to various denominations, and manual operation of each motor. 3. Implementation of Sub-functional Modules in System Hardware The entire hardware system is designed using a modular approach, resulting in a more complete overall system structure, improved performance, and easier debugging and maintenance. 3.1 Keyboard Module The keyboard uses the A and C ports of the 8255A to expand into a 4×4 keyboard with 12 function keys. This system uses a program scanning method to identify the keys. The microcontroller first sets all PC ports of the 8255A to low level, then reads the A port. If not all A ports are high, a 10ms delay is set for debouncing, and then the A port is read again. If not all A ports are high, it indicates no key is pressed. To further determine the pressed key position, PC0=0, PC1=PC2=PC3=1, and the A port is read. The low-level bits on the A port indicate the pressed key position. This process continues until all keys are checked and found to be unpressed, indicating interference or misoperation. At the end of the scan, the pressed key position information is stored in a memory unit. This information is then sent to the main microcontroller via RS-422 serial communication, enabling it to control the motor to perform the corresponding bundling action and provide manual motor control. 3.2 Stepper Motor Control Module Stepper motors are important actuators in mechatronic products. In this system, we use a three-phase asynchronous stepper motor. If higher requirements are placed on the stability and control precision of the stepper motor, a microstepping motor controller can be used. This control module uses a double three-beat positive drive pulse method. According to the system's speed requirements, the pulse sent from P0.0 of the 89C51 microcontroller is multiplied by n and sent to the cp terminal of the ring distributor CH250. The three output signals of CH250 are the control signals for the A, B, and C phases of the stepper motor. Its frequency is 1/3 of the CP signal frequency. The control principle is shown in the figure. If the P0 port of the 89C51 is directly used as the control signal for the A, B, and C phases, the frequency can be changed by resetting the timing constant. The disadvantage of this method of controlling the speed is that the error gradually increases with the increase of the speed. We can calculate that when the speed is W revolutions per minute, the timing [align=center]Figure 3 Stepper Motor Control Principle Diagram[/align] microseconds is 500,000/W. With a 12MHz crystal oscillator, the microcontroller's smallest timing unit is 1μS. Assuming a step angle of 3°, we divide each 120 steps into long and short steps (because the timer cannot be set to a decimal place). When W=1200, one step occurs every 416.67μS. Therefore, we divide one 120-step cycle into 80 steps of 417μS and 40 steps of 416μS. This control method achieves an accuracy of approximately 1700±1 revolutions. However, the error gradually increases with the rotational speed. This is because: firstly, the error is larger at high crystal frequencies than at low frequencies; secondly, the indefinite time (approximately 1 microsecond) for program entry and exit interrupts is sufficient to introduce significant errors in microsecond-level timing. We use an n-multiplier; when n=20 and W>4000, the output frequency of P0.0 does not exceed 400Hz. We still use the timer interrupt method, achieving an accuracy of 4000±1 revolutions. The essence of using a frequency multiplier is to maximize the timing period and minimize the impact of various uncertain times on the timing. The frequency multiplier incorporates a phase-locked loop (PLL), and the multiplication factor n is determined by the program. The CH250 ring distributor is an integrated circuit specifically designed for the drive control of three-phase asynchronous stepper motors. It can distribute the input CP pulse into three-phase drive signals A, B, and C. For the drive signals to drive the stepper motor coils, they must pass through a drive circuit. (As shown in Figure 4) [align=center] Figure 4 Stepper Motor Drive Circuit Diagram[/align] Only one phase of the drive circuit is shown in the figure; the other two phases are identical. In the figure, the transistor acts as a switch. When it is off, no current flows through the collector, and the switch is open; when it is saturated, the collector current is at its maximum, and the switch is closed. This switching action is controlled by the base current. The drive circuit consists of two transistors, T2 and T3, forming a Darlington power amplifier to drive the three windings of the stepper motor. The optocoupler's function is to eliminate various interference signals and isolate the control and drive signals. When the control signal is low, T1 is off, the output is high, the infrared LED is off, the phototransistor is off, and no current flows through the winding. When the control signal is high, T1 is saturated and conducting, the infrared LED lights up, and the phototransistor conducts, providing base current to the power drive stage transistor, causing it to conduct and powering the winding. The series resistor Ra in the stepper motor winding limits the current in the winding, and the diode connected in parallel in the winding provides protection, providing a magnetic energy release circuit when the power is off, preventing damage to the transistor. 3.3 Welding Power Control Unit [align=center] Figure 5 Welding Power Control Principle Diagram[/align] Welding power control is achieved by controlling the voltage through pulse width modulation. Here we mainly use the 8-bit D/A converter chip AD558 and the PWM control chip SG3524. The AD558 consists of an internal latch, a T-type decoding network using R~2R, and a transistor switch. It only requires a +5V power supply, and the output analog voltage range is 0~2.56V. The SG3524 is a fixed-frequency, dual-output pulse width modulator (PWM). It has two connection methods: one is to feed the main circuit output back to the inverting input of the chip's internal comparator amplifier to adjust the PWM duty cycle of the output circuit; the other is to configure the chip's error comparator amplifier as a voltage follower, taking the feedback signal from the main circuit and applying it to the non-inverting input of the error comparator amplifier. Here, we use the second method. The power control module works as follows: After receiving keyboard information, the microcontroller writes the corresponding temperature value into address unit 3800H of the DAC558. The DAC558 directly outputs the corresponding voltage after digital-to-analog conversion. The SG3524 generates a pulse width signal proportional to the input value, and then, through a voltage regulation module, makes the output AC voltage positively correlated with the input digital signal. The AC voltage is then connected to the soldering head via a transformer to heat the soldering head. 3.4 Serial Communication Module: During operation, the control system requires precise position control. Each action requires each position motor and function motor to accurately and reliably reach its corresponding position. The position motors and function motors are controlled by different microcontrollers. Therefore, communication reliability is crucial for this system. Since the RS-232C communication protocol uses single-ended input/output for level conversion, noise interference during transmission can distort the signal, resulting in poor anti-interference capability. Therefore, we adopted the RS-422 communication protocol, which offers stronger anti-interference capabilities. The interface chip used is the MAX1490, a single-chip opto-isolated full-duplex serial communication interface chip manufactured by Maxim Integrated. This chip has high integration. The RS-422 interface structure constructed from it is simple and has good electrical isolation. The baud rate is set to 90Kbps. Data reception between microcontrollers uses a polling method, while data transmission uses an interrupt method. Sending data via interrupts meets the real-time communication requirements. To prevent motor malfunctions, four action information flags are enabled in the storage unit. Each time the receiver receives a motor position information, it sets the corresponding action flag to 1. If the same action information is received consecutively, an alarm will be issued. In the position control program, each motor movement checks the corresponding flag. If the flag is 1, the motor starts; upon reaching the desired position, the corresponding flag is automatically cleared. 4. Conclusion The fully automatic bundling control system has a high degree of automation and short operation time. Extensive experiments show that the system has advantages such as high precision, good reliability, low cost, and strong anti-interference ability. References: 1. He Limin. MCS-51 Series Single-Chip Microcomputer Application System Design. Beijing: Beijing University of Aeronautics and Astronautics Press, 1990. 2. Wang Furui. Complete Guide to Single-Chip Microcomputer Measurement and Control System Design. Beijing: Beijing University of Aeronautics and Astronautics Press, 1999.