Coding machine electric control system developed based on single-chip microcomputer
Through the electronic control system based on microcontroller, sensors, image recognition and calibration feedback modules are integrated to build a closed-loop control mechanism, which solves the cost and accuracy problems of small and medium-sized coding machines, and achieves high integration and adaptive coding control.
Patent Information
- Application Number
- CN202510562558.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-05
AI Technical Summary
The existing coder control system is costly, has low integration and poor flexibility, making it difficult to meet the needs of small and medium-sized automation equipment. The lack of real-time closed-loop feedback mechanism leads to low coding accuracy, which is prone to problems such as position deviation and ghosting.
The electronic control system based on a microcontroller is adopted, and the sensor module, image recognition module and calibration feedback module are integrated to build a closed-loop control mechanism, and the coding offset is corrected in real time through the image recognition module, and the coding delay and displacement compensation parameters are dynamically adjusted through the delay control module.
It realizes low-cost and high-integration coding control, improves coding accuracy and consistency, adapts to changes in conveying speed, has self-learning and adaptability, and improves system stability and maintenance.
Smart Images

Figure CN120428619A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a computer and auxiliary equipment, and more specifically to the field of coding machines, and more specifically to an electronic control system for a coding machine developed based on a single-chip microcomputer. Background Art
[0002] Coding machines, a key component of industrial automation production lines, are widely used in industries such as food, pharmaceuticals, chemicals, and electronics. They are used to print identification information such as production dates, batch numbers, serial numbers, QR codes, and barcodes on product or packaging surfaces. The control performance of coding systems directly impacts the accuracy, clarity, and consistency of printing, which in turn impacts product traceability and regulatory compliance.
[0003] Existing coding machine control systems are usually implemented using PLC controllers or logic circuits. Their characteristics are fixed control methods and fast response speeds, but they are also high in overall cost, limited in integration, and poor in flexibility. They are unable to meet the needs of small and medium-sized automation equipment for control systems with low cost, high integration, easy maintenance, and multi-functional expansion.
[0004] Some low-cost coding equipment uses timers or simple single-chip microcomputer control circuits to drive the coding action with sensor trigger signals. However, most of them are open-loop control structures and cannot make real-time corrections based on the coding effect. They are prone to printing position deviations, content ghosting or omissions. Especially when the conveying speed changes or the performance of the actuator fluctuates, the coding accuracy is difficult to guarantee.
[0005] With the development of image processing and recognition technology, some studies have gradually attempted to integrate image recognition modules into coding quality detection for post-inspection. However, these methods are still mainly based on manual judgment and post-processing, lacking a real-time closed-loop feedback mechanism with the control system, and are unable to achieve dynamic correction and systematic adjustment of coding offsets. Summary of the Invention
[0006] In order to solve the problems in the prior art, the present invention provides an electronic control system for a coding machine developed based on a single-chip microcomputer, which is characterized by comprising:
[0007] The single-chip microcomputer control module is used as the control core of the system, receiving various input signals and outputting control instructions;
[0008] A sensor module is used to detect whether the coded object has reached the predetermined coding position and send a detection signal to the single chip control module;
[0009] An actuator, used for driving the coding terminal to complete the coding action according to the control instructions of the single chip control module;
[0010] An image recognition module is located near the coding area and is used to capture images of the coded item after coding and identify whether the coding position and content deviate from the predetermined standards.
[0011] A calibration feedback module, configured to send the coding offset information identified by the image recognition module to the single chip control module;
[0012] The delay control module is arranged inside the single chip control module and is used to dynamically adjust the coding delay parameters or the displacement compensation parameters of the actuator according to the received coding offset information.
[0013] Furthermore, the single-chip microcomputer control module is STM32, ATmega, PIC or ESP32.
[0014] Furthermore, the sensor module includes a non-contact photoelectric sensor or a laser beam sensor.
[0015] Furthermore, the sensor module further includes:
[0016] Adjustable mounting bracket;
[0017] Multi-channel redundant detection mechanism;
[0018] Ambient light interference suppression function;
[0019] And digital filtering and signal shaping circuits.
[0020] Furthermore, the actuator is a replaceable accessory, and the replaceable accessory includes an electromagnetic drive structure, a stepper motor drive structure, a servo motor drive structure or a pneumatic drive structure.
[0021] Furthermore, the image recognition module includes an image acquisition unit, an image processing unit, a recognition algorithm module and a communication interface unit.
[0022] Furthermore, the image recognition module is used to identify the boundaries, position, clarity and character information of the actual printed content, and compare it with the preset coding template to determine whether there is offset, missing, blurry, ghosting or coding error.
[0023] Furthermore, the calibration feedback module includes: a data receiving interface, a protocol parsing unit, an error modeling and dynamic analysis unit, a feedback control interface, and a redundancy protection mechanism and fault tolerance strategy.
[0024] Furthermore, the delay control module includes a coding delay parameter calculation unit, a displacement compensation parameter output unit and a control instruction generator.
[0025] Furthermore, the delay control module uses a nonlinear mapping function or a lookup table method to convert the coding offset into a delay compensation, and further integrates the product conveying speed, the distance from the sensor to the coding terminal, the actuator response time and the image recognition delay to calculate the final coding delay time.
[0026] The electronic control system of a coding machine developed based on a single chip microcomputer provided by the present invention has the following beneficial effects:
[0027] This system uses a single-chip microcomputer as the control core, integrating sensor detection, image recognition, calibration feedback and delay control functions, replacing the traditional PLC control method, effectively reducing the system hardware cost, with a compact structure, suitable for small and medium-sized automated coding equipment.
[0028] The sensor module detects object position and, combined with the microcontroller's timing and interrupt control mechanisms, achieves precise timing control of the coding action. This adapts to varying conveyor speeds and object spacing, improving coding accuracy and consistency. The image recognition module captures the coded image information, determines if the coded content is offset, blurred, or missing, and transmits this offset information back to the control system in real time via the calibration feedback module, establishing a closed-loop control mechanism that effectively improves print quality and system stability.
[0029] The delay control module calculates the optimal coding delay based on factors such as image recognition results, conveyor speed, and actuator response time, and compensates for displacement at the coding station when necessary, achieving dual control in both time and space domains and improving system adaptability. The calibration feedback module records historical offset data, establishes an offset trend model, and automatically adjusts control parameters when systematic errors occur. Its self-learning and adaptive capabilities adapt to the effects of equipment aging or changes in the external environment on coding accuracy.
[0030] In summary, the present invention can significantly improve the intelligence, automation and maintainability of the coding process while ensuring system stability and coding accuracy, and has good practical value and promotion prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0032] Figure 1 It is a system diagram of the method of the present invention. DETAILED DESCRIPTION
[0033] Below, the invention is preferably described with reference to the accompanying drawings and specific embodiments.
[0034] This embodiment solves the above problem through the following steps:
[0035] In one embodiment, reference Figure 1 The coding machine of the present invention belongs to computers and auxiliary equipment, and provides a coding machine electronic control system developed based on a single-chip microcomputer. The coding machine electronic control system uses the single-chip microcomputer as the control core and integrates sensor detection, coding execution control, image recognition feedback and delay adjustment functions. It is suitable for industrial production scenarios where information is printed on continuously moving objects. It can achieve high-precision control and dynamic calibration of coding actions, and has the advantages of high control accuracy, low cost, and strong system integration.
[0036] The electronic control system includes the following modules:
[0037] The single-chip microcomputer control module is used as the control core of the system, receiving various input signals and outputting control instructions.
[0038] The single-chip control module serves as the core control unit for the entire coding machine's electronic control system, coordinating data exchange and logic control between various submodules to achieve precise scheduling of the entire coding process. This module receives signal inputs from devices such as the sensor module, image recognition module, and human-computer interaction module through multiple input channels. Based on preset control logic and operating parameters, it calculates and controls output instructions, which are used to drive the actuator to complete the coding action or adjust delay time and position compensation in real time, thereby achieving efficient closed-loop control of the coding process.
[0039] The single-chip microcomputer control module can be a high-performance microcontroller such as STM32, ATmega, PIC or ESP32 with multiple I / O interfaces, timers, interrupt mechanisms, PWM output and communication functions. It has the advantages of fast running speed, real-time response, low power consumption and strong scalability, and can meet the coding machine's needs for high-precision timing control and multi-source data fusion processing.
[0040] The sensor module is used to detect whether the coded object has reached the predetermined coding position and send a detection signal to the single chip control module.
[0041] The sensor module is used to detect the real-time position of coded items conveyed on the production line to determine whether they have reached the set coding trigger position. This module is a key pre-trigger source for the system's coding operations. It features high detection accuracy, fast response speed, and strong adaptability, ensuring that coding instructions are synchronized with the item's position.
[0042] Specifically, the sensor module is preferably a set of non-contact photoelectric sensors or laser beam sensors. Depending on the specific application scenario, inductive, ultrasonic, infrared reflective, or visual recognition sensors can also be used. When an item on the conveyor belt passes the sensor setting point, the sensor output jumps from a low level to a high level (or vice versa), thereby generating a coding trigger signal.
[0043] The signal is connected to the MCU control module through the digital IO port or interrupt pin. After receiving the trigger signal, the MCU calculates the delay time t according to the system configuration parameters, such as the conveying speed, the distance between the dock and the sensor, the actuator response delay, etc. s And drive the coding action.
[0044] To improve the adaptability and stability of the system, the sensor module may further include:
[0045] Adjustable mounting bracket to accommodate products of different sizes and shapes;
[0046] Multi-channel redundant detection mechanism: when the main sensor fails, the backup channel can seamlessly take over the detection task;
[0047] Ambient light interference suppression function is used to ensure that the sensor maintains high sensitivity and anti-misjudgment capabilities under complex working conditions such as strong light, reflection, dust, etc.
[0048] Digital filtering and signal shaping circuits are used to eliminate sensor output jitter and improve the stability of the trigger signal.
[0049] Furthermore, to further improve coding accuracy, in certain application scenarios, the sensor module can also integrate an encoder interface or work in conjunction with a motion detection module (such as MPU6050) to achieve real-time acquisition of conveying speed or position changes, and assist the microcontroller in dynamically adjusting the timing of coding.
[0050] The actuator is used to drive the coding terminal to complete the coding action according to the control instructions of the single-chip control module.
[0051] The actuator receives control commands from the microcontroller and drives the marking station to complete the coding operation according to preset rhythm, position, and motion parameters. It is the key unit in the electronic control system of the coding machine to achieve physical action output. The actuator converts the control signals output by the microcontroller into mechanical energy, enabling the marking station to complete operations such as imprinting, inkjet printing, or marking on the target object within a specified time.
[0052] Furthermore, the actuator is a replaceable accessory, and the replaceable accessory includes the following forms:
[0053] The electromagnetic drive structure (electromagnet) is suitable for thermal coding or ribbon coding. The single chip microcomputer controls the power on and off of the electromagnet through the MOS tube. When the coding instruction is received, the electromagnet is quickly attracted to drive the coding terminal to move downward to complete the imprinting. After that, the spring resets and the coding process is completed.
[0054] Stepper motor drive structures are suitable for applications requiring high-precision displacement or programmable position control, such as laser coding, thermal transfer printing, or inkjet printing. A single-chip microcontroller controls the stepper motor's rotation via a driver chip (such as the A4988 or TB6600), enabling precise movement of the marking terminal between multiple points. Stepper motors can also be combined with photoelectric encoders to form closed-loop control.
[0055] The servo motor drive structure is suitable for industrial coding equipment with medium-to-high speed and high-precision requirements. It can achieve acceleration regulation and closed-loop position control, with short response time and strong dynamic performance. The microcontroller coordinates the execution process through PWM control signals and position feedback.
[0056] In a pneumatic drive structure, if the coding system uses a solenoid valve to control the cylinder to drive the marking terminal, the actuator also includes the solenoid valve, cylinder, and air circuit system. The microcontroller output control level drives the solenoid valve on and off, controlling the flow of compressed air into and out of the cylinder cavity to achieve the pushing and returning of the marking terminal.
[0057] The actuator and the single chip control module are linked by digital control signals, and the control method may include:
[0058] Monostable trigger control, suitable for electromagnet coding method, controls the power-on time by fixed pulse width;
[0059] Pulse control + step calculation, suitable for stepper motor coding, coding position and motion path are programmable;
[0060] PWM speed regulation and position feedback closed-loop control are suitable for servo coding systems to improve accuracy and response consistency.
[0061] In order to improve the controllability and consistency of the system's coding action, the actuator may further include:
[0062] Soft start and stop logic to reduce mechanical shock during docking;
[0063] The action completion feedback signal is used to notify the microcontroller that the coding is completed and it can enter the next working cycle;
[0064] The multi-point coding management module controls the coordinated operation of multiple actuators when multiple characters or patterns need to be printed on different parts of an object.
[0065] The image recognition module is set near the coding area and is used to collect images of the coded items after coding and identify whether the coding position and content deviate from the predetermined standards.
[0066] The image recognition module is set in the detection area downstream of the coding terminal, located on the item conveying path after coding is completed. It maintains visual alignment with the coding area or a side shooting angle. It can perform real-time image acquisition and recognition processing on the surface of the coded product. It is a key component for achieving closed-loop control of coding quality.
[0067] The image recognition module includes:
[0068] An image acquisition unit, such as a CMOS image sensor or a digital camera (e.g., OpenMV, ESP32-CAM, or an industrial-grade camera), is used to capture the local surface image of the object being coded;
[0069] An image processing unit, such as a microcontroller or AI coprocessor embedded in the camera module, is used to perform pre-processing on the captured images, such as edge detection, character recognition, and positioning analysis;
[0070] The recognition algorithm module is used to identify the boundaries, position, clarity and character information of the actual printed content in the image, and compare it with the preset coding template to determine whether there are any problems such as offset, missing, blurry, ghosting or coding errors;
[0071] The communication interface unit is used to transmit recognition results, offset data, confidence scores and other information to the microcontroller control module.
[0072] After the coding action is completed, the product moves with the conveyor belt into the field of view of the image recognition module, and the image recognition module automatically captures the image and starts the recognition process. The image recognition module compares the position coordinates (x actual ,y actual ) and the preset reference coordinates (x ref ,y ref ), calculate the offset:
[0073] Δx=x actual -x ref ,Δy=y actual -y ref
[0074] The degree of deviation is quantitatively scored. If the deviation exceeds the set tolerance threshold ε, a calibration instruction or alarm signal is sent to the microcontroller control module to adjust the timing or nozzle position of the next coding, forming a closed-loop control mechanism for coding quality.
[0075] Further optionally, the image recognition module may also specifically have the following functions:
[0076] Character integrity analysis: Identify printing anomalies such as missing codes, broken strokes, and character adhesion;
[0077] Code content verification: Perform OCR recognition and comparison between the printed result and the expected content to prevent content errors;
[0078] Image quality scoring mechanism: Generates a coding image quality score based on image clarity, contrast, edge sharpness and other indicators as one of the product qualification criteria;
[0079] Abnormal sample recording and uploading: The identified abnormal images are stored or uploaded to the server via wireless module for subsequent tracing or quality analysis;
[0080] Model self-learning mechanism: Optimizes the image recognition algorithm through historical offset data and calibration results to achieve dynamic prediction and adaptive control of the coding position.
[0081] The calibration feedback module is used to send the coding offset information identified by the image recognition module to the single chip control module.
[0082] The calibration feedback module is used to transmit the identified coding offset information, quality score, recognition confidence, and correction suggestions to the single-chip control module after the image recognition module completes the recognition and error analysis of the coding image, so as to achieve real-time adjustment of the coding control parameters and build a closed-loop coding control system driven by the recognition results.
[0083] The calibration feedback module includes:
[0084] Data receiving interface: used to receive the coding offset information output by the image recognition module, the offset includes horizontal offset Δx, vertical offset Δy, character boundary blur, printing quality score Q, etc.
[0085] Protocol parsing unit: parses, decodes and standardizes the format of the data transmitted by the image recognition module to ensure consistency with the communication protocol of the microcontroller.
[0086] Error modeling and dynamic analysis unit: used to record historical coding deviation data and establish deviation trend model Predict and analyze the error change trend and revise the coding parameters accordingly. Specifically:
[0087] The calibration feedback module integrates an error tracking model and a slip prediction mechanism. Taking each coding offset as an input sample, the next offset trend is predicted using the following formula:
[0088]
[0089] Among them, α is the dynamic learning rate, is the predicted offset. If the predicted value shows a systematic offset, the correction control value δt is sent to the microcontroller in advance. s Or displacement compensation δ x .
[0090] Feedback control interface: The above analysis results, offset data or control compensation δt s etc., are converted into control instructions and sent to the microcontroller control module in real time through communication interfaces such as SPI, I2C, UART or GPIO.
[0091] Redundant protection mechanism and fault-tolerant strategy: When recognition data is missing, unreliable, or the recognition deviation suddenly changes, the module can automatically switch to the default control strategy to prevent the coding quality from being affected by a single recognition error.
[0092] The delay control module is arranged inside the single chip control module and is used to dynamically adjust the coding delay parameters or the displacement compensation parameters of the actuator according to the received coding offset information.
[0093] The delay control module is embedded in the single-chip control module and is used to dynamically optimize the output timing and spatial position of the coding control signal based on the offset information transmitted by the image recognition module and the calibration feedback module, ensuring that the coding action is accurately synchronized with the physical position of the coded object.
[0094] The delay control module includes:
[0095] The coding delay parameter calculation unit is used to receive the product conveying speed v, the distance from the sensor to the coding terminal d, and the actuator response time t e The offset Δx returned by the image recognition module is used to calculate the compensated delay time t in real time. s ,Right now:
[0096]
[0097] A set of nonlinear mapping functions or table lookup methods are introduced inside the delay control module to convert the coding offset Δx into delay compensation δt
[0098]
[0099] Among them, k1, k2, b1, b2, and c are all fitting coefficients.
[0100] The displacement compensation parameter output unit is used in the structure where the coding system allows the print head to move slightly (such as stepper motor drive) or has a multi-point coding requirement. This module generates the print head fine-tuning control instruction δ based on Δx and Δy x and δ y Used to adjust the coding position or trajectory; realize "time domain + space domain" dual compensation.
[0101] The control instruction generator is used to output the calculated delay parameters and displacement parameters to the timer, interrupt manager or servo drive module, driving the actuator to complete the coding action according to the precise beat and position.
[0102] Through the above method, the dynamic response under different speed ranges and coding modes can be adapted; the problems of nonlinear response of the actuator and system hysteresis can be solved; and the stability of the coding position can be significantly improved.
[0103] In a further implementation, the delay control module dynamically calculates the timing of triggering the coding by combining the following multiple real-time variables:
[0104] The real-time velocity v(t) of the object is obtained by an encoder, IMU or velocity sensor);
[0105] Coding position offset Δx (from image recognition);
[0106] Actuator response delay t e (may be calibrated or estimated periodically);
[0107] Image recognition delay t i ;
[0108] The temperature compensation coefficient γ(T) is used to cope with the influence of ambient temperature on electromagnetic response.
[0109] The final coding delay is:
[0110]
[0111] In a further implementation, delay drift monitoring and adaptive adjustment are performed.
[0112] The system continuously records s Compared with the historical data of Δx, if it is found that the coding offset trend drifts monotonically over time (for example, due to hardware aging, belt elongation, insufficient pressure), the delay control module activates the self-learning mechanism:
[0113] Fitting the offset trend curve Δx=f(n)
[0114] Automatically make a slight correction to the original delay baseline t0:
[0115]
[0116] Where η is the learning rate, is the offset trend gradient, Indicates the delay baseline of the nth time slot.
[0117] Through the above method, self-compensation for system aging can be achieved; the frequency of manual recalibration can be reduced; and the equipment operation cycle and maintenance interval can be extended.
[0118] The prior art mentioned in the above background technology section and specific embodiments section of the present invention can be regarded as part of the present invention and used to understand the meaning of some technical features or parameters.
Claims
1. A coding machine electronic control system developed based on a single chip microcomputer, characterized in that: include: The single-chip microcomputer control module is used as the control core of the system, receiving various input signals and outputting control instructions; A sensor module is used to detect whether the coded object has reached the predetermined coding position and send a detection signal to the single chip control module; An actuator, used for driving the coding terminal to complete the coding action according to the control instructions of the single chip control module; An image recognition module is located near the coding area and is used to capture images of the coded item after coding and identify whether the coding position and content deviate from the predetermined standards. A calibration feedback module, configured to send the coding offset information identified by the image recognition module to the single chip control module; The delay control module is arranged inside the single chip control module and is used to dynamically adjust the coding delay parameters or the displacement compensation parameters of the actuator according to the received coding offset information.
2. The electronic control system for a coding machine developed based on a single chip microcomputer according to claim 1 is characterized in that: The single chip microcomputer control module is STM32, ATmega, PIC or ESP32.
3. The electronic control system for a coding machine developed based on a single chip microcomputer according to claim 1 is characterized in that: The sensor module includes a non-contact photoelectric sensor or a laser beam sensor.
4. The electronic control system for a coding machine developed based on a single chip microcomputer according to claim 1 is characterized in that: The sensor module further includes: Adjustable mounting bracket; Multi-channel redundant detection mechanism; Ambient light interference suppression function; And digital filtering and signal shaping circuits.
5. The electronic control system for a coding machine developed based on a single chip microcomputer according to claim 1 is characterized in that: The actuator is a replaceable accessory, and the replaceable accessory includes an electromagnetic drive structure, a stepper motor drive structure, a servo motor drive structure or a pneumatic drive structure.
6. The electronic control system for a coding machine developed based on a single chip microcomputer according to claim 1 is characterized in that: The image recognition module includes an image acquisition unit, an image processing unit, a recognition algorithm module and a communication interface unit.
7. The electronic control system for a coding machine developed based on a single chip microcomputer according to claim 1 is characterized in that: The image recognition module is used to identify the boundaries, position, clarity and character information of the actual printed content, and compare it with the preset coding template to determine whether there is offset, missing, blurry, ghosting or coding error.
8. The electronic control system for a coding machine developed based on a single chip microcomputer according to claim 1 is characterized in that: The calibration feedback module includes: Data receiving interface, protocol parsing unit, error modeling and dynamic analysis unit, feedback control interface, as well as redundant protection mechanism and fault-tolerant strategy.
9. The electronic control system for a coding machine developed based on a single chip microcomputer according to claim 1 is characterized in that: The delay control module includes a coding delay parameter calculation unit, a displacement compensation parameter output unit and a control instruction generator.
10. The electronic control system for a coding machine developed based on a single chip microcomputer according to claim 1 is characterized in that: The delay control module uses a nonlinear mapping function or a lookup table method to convert the coding offset into delay compensation, and further integrates the product conveying speed, the distance from the sensor to the coding terminal, the actuator response time and the image recognition delay to calculate the final coding delay time.
Citation Information
Patent Citations
Astatic laser coding machine and coding method
CN105345267A
Code spraying machine system capable of identifying code spraying position for intelligent manufacturing production line
CN114771107A
Coding quality control method and system of laser vision coding machine
CN119658151A
Plane automatic jet printing equipment
CN119734527A
Cable jacket printing meter rice display device
CN206370315U
Cited By
Automatic coding control method and device for motor shell
CN121448025A