Light source control system based on RS485 serial port communication

Through the light source control system based on RS485 serial port communication, the problem of complicated serial port switching when PLC controls multiple sets of digital controllers is solved, efficient unified control of multiple sets of light sources is achieved, operating efficiency is improved and compatible with conventional communication interfaces.

CN119946964APending Publication Date: 2025-05-06SHENZHEN CITY CELEBR-CRYSTAL OPTOELECTRONIC LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510365873.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-26
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

In industrial application scenarios, when using a PLC to control multiple sets of digital controllers, it is necessary to frequently switch the serial ports to communicate with light source controllers of different types and powers, resulting in complex operation and inefficient efficiency.

Method used

A light source control system based on RS485 serial communication is adopted. The system includes a power supply module, a main control module, a light source driving module, a logic processing module, an overcurrent protection module, a serial communication module and a synchronous trigger input and output module. Through these modules, unified control of multiple groups of light sources is realized.

Benefits of technology

It realizes the use of multiple sets of controllers to control multiple light sources simultaneously, improves control efficiency, simplifies operational flow, and is compatible with the conventional RS232 communication interface.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119946964A_ABST
    Figure CN119946964A_ABST
Patent Text Reader

Abstract

The invention discloses a light source control system based on RS485 serial port communication. The light source control system comprises a power supply module used for supplying power to a whole circuit; the main control module is used for light source control; the light source driving module is used for controlling on-off and brightness of the light source; the logic processing module is used for processing PWM signals and switching between a normally-on mode and a trigger mode; the overcurrent protection module is used for protecting the circuit; the serial port communication module is used for bidirectional communication between the controller and external equipment; and the synchronous trigger input and output module is used for synchronously controlling the light source to be lightened when the controller receives an external trigger signal. According to the invention, a plurality of groups of controllers can be used for controlling a plurality of groups of light sources, the plurality of groups of controllers can be controlled at the same time, the number and types of the controlled light sources can be many, resources are greatly saved, and meanwhile, the production efficiency is greatly improved; according to the utility model, the problem that a single PLC (Programmable Logic Controller) is tedious to control multiple controllers is solved through RS485 communication, and meanwhile, an RS232 communication interface is reserved, so that the controller can be compatible with a conventional controller for use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a light source controller for adjusting the brightness and stroboscopic frequency of various light sources, and in particular to a light source control system based on RS485 serial port communication. Background Art

[0002] The main purpose of the light source controller for machine vision is to power the light source, control the brightness of the light source and control the lighting status (on / off) of the light source. It can also achieve the stroboscopic effect of the light source by giving the controller a trigger signal, thereby greatly extending the life of the light source. Commonly used controllers on the market are analog controllers and digital controllers. Analog controllers are adjusted manually, and digital controllers can be remotely controlled by computers or other devices. In industrial application scenarios, PLCs are often used to send instructions to control digital controllers to control light sources, and controllers are divided into various models to control various types of light sources with different interfaces and different powers. At this time, a usage scenario is generated, that is, using one PLC to control multiple groups of digital controllers. Conventional digital controllers use RS232 serial port communication. The PLC is connected to the controller serial port and can send commands through the serial port to control the light source. However, when one PLC is used to control multiple groups of digital controllers, for example, the usage scenario requires multiple groups of light sources, including low-power 24V strip light sources, 5V point light sources, and ultra-high-power surface light sources. At this time, if a PLC wants to send commands to control various types of light sources, it needs to be equipped with different controllers. To control these controllers, it is necessary to frequently switch serial ports to communicate with different controllers. This is prone to errors and has low efficiency. Therefore, a solution that can more easily control these digital controllers is needed. Summary of the invention

[0003] The purpose of the present invention is to provide a multifunctional power distribution cabinet to solve the above technical problems.

[0004] To achieve the above purpose, the present invention adopts the following technical solutions:

[0005] The light source control system based on RS485 serial communication is characterized by including

[0006] A power supply module for supplying power to the entire circuit;

[0007] Main control module for light source control;

[0008] A light source driving module for controlling the on / off and brightness of the light source;

[0009] A logic processing module for processing PWM signals and switching between constant light mode and trigger mode;

[0010] Overcurrent protection module for protecting circuit;

[0011] Serial communication module for two-way communication between the controller and external devices;

[0012] A synchronous trigger input and output module is used for the controller to synchronously control the lighting of the light source when receiving an external trigger signal.

[0013] As a further solution of the present invention, in the power supply module, the 24V input voltage is filtered by capacitors C3 and C4 and connected to the voltage input pin 1 of the chip U10. Pins 3 and 5 of the chip U10 are connected to GND. The voltage output pin 2 and the voltage feedback pin 4 of the chip U10 are respectively connected to the two ends of L3. At the same time, the two ends of L3 are connected to GND through a voltage zener diode D3 and a capacitor C8 to form a freewheeling loop to generate a continuous output voltage. The output voltage is filtered by capacitor C9 and then connected to GND through a voltage zener diode D5 to generate a stable DC 5V output for use by the subsequent circuit. The 5V voltage is connected to pin 3 of the chip U11, pin 1 of the chip U11 is connected to GND, pin 2 and pin 4 are connected and then filtered through capacitors C30 and C31 to GND, and the 5V is converted into a stable 3.3V to power the microcontroller.

[0014] As a further solution of the present invention, in the main control module, pins 9, 24, 36 and 48 of the main control microcontroller U1 are connected to VCC3V3, and pins 8, 23, 35 and 47 are connected to GND to power the microcontroller U3. Pins 5 and 6 of the main control microcontroller U1 are connected to both ends of Y1, Y1 is connected in parallel with resistor R13, and both ends of resistor R32 are connected to GND through capacitors C5 and C6 respectively to form a crystal oscillator circuit to provide a stable clock signal for the main control microcontroller U1. Pins 10, 11, 12 and 13 of the main control microcontroller U1 output four independent PWM signals through the output comparison function of the timer. The four output signals here are connected to the pins of the chip U9 of the light source driving module. 1. Pin 4, pin 9, and pin 12 are connected to each other, and the four light source outputs are controlled by the logic circuit. Pin 20 and pin 44 are pulled down to the ground through resistors R22 and R21 respectively, so that the microcontroller U3 is in the burning mode and can burn the program normally. Pin 33 is connected to 5V through the pull-up resistor R12, so that its normal state is high level. Pin 30 and pin 31 are connected to pin 11 and pin 12 of the chip U5 of the serial communication module respectively, and the TTL serial port level of the microcontroller is converted to RS232 level through chip U5 to communicate with the outside. Pin 21 and pin 22 are connected to the resistor R81 of the serial communication module and pin 1 of chip U6 respectively, and the TTL level of the microcontroller is converted to RS485 level to communicate with the outside.

[0015] As a further solution of the present invention, in the light source driving module, 4 independent PWM signals are used to control 4 NMOS tubes Q1, NMOS tube Q2, NMOS tube Q3, and NMOS tube Q4 which are connected in series with the 4 light sources to 24V, wherein the gate of Q1 is connected to the resistor R54 in the logic processing module and then to the pin 3 of the chip U9, the gate of the NMOS tube Q2 is connected to the resistor R56 in the logic processing module and then to the pin 6 of the chip U9, the gate of the NMOS tube Q3 is connected to the resistor R57 in the logic processing module and then to the pin 8 of the chip U9, and the gate of the NMOS tube Q4 is connected to the resistor R55 in the logic processing module and then to the pin 11 of the chip U9, so that the independent outputs of the 4 light sources are controlled by the 4 independent output signals of the logic processing module.

[0016] The models of NMOS tube Q1, NMOS tube Q2, NMOS tube Q3 and NMOS tube Q4 in the light source driving module are HG012N06L.

[0017] As a further solution of the present invention, in the logic processing module, the pin 1 of the chip U9 is connected to the pin 10 of the chip U1 in the main control module, the pin 2 of the chip U9 is connected to the pin 3 of the chip U8 and is pulled up to 5V through R61, the pin 3 of the chip U9 is connected to R54, and the other end of R54 is connected to the gate of the NMOS tube Q1 in the light source driving module, and the pin 4 of the chip U9 is connected to Figure 2 Pin 11 of chip U1, pin 5 of chip U9 is connected to pin 4 of chip U8 and pulled up to 5V through R62, pin 6 of chip U9 is connected to resistor R56, and the other end of R56 is connected to the gate of NMOS tube Q2 in the light source driver module. Pin 7 of chip U9 is connected to GND, pin 8 of chip U9 is connected to resistor R57, and the other end of R57 is connected to the gate of NMOS tube Q3 in the light source driver module, pin 9 of chip U9 is connected to pin 12 of chip U2 in the main control module, pin 10 of chip U9 is connected to pin 10 of chip U8 and pulled up to 5V through resistor R63, pin 11 of chip U9 is connected to R55, and the other end of R55 is connected to Figure 3 The gate of NMOS tube Q4 in the middle, chip U9 pin 12 is connected to Figure 2Pin 13 of U2, chip U9 pin 13 is connected to pin 10 of chip U8 and pulled up to 5V through R64, chip U9 pin 14 is connected to 5V power supply and connected to capacitor C28 to GND, chip U8 pin 14 is connected to 5V power supply and connected to capacitor C29 to GND, pin 7 is directly connected to GND, chip U8 pin 1, pin 5, pin 8, pin 12 are respectively connected to the synchronous trigger input and output module, and pulled up to 5V through resistors R21A, R21B, R21C, and R21D, U8 pin 2, pin 6, pin 9, and pin 13 are all connected and connected to pin 33 of U1 in the light source driver module, the model of chip U9 is 74HC08D, and the model of chip U8 is SN74LS266.

[0018] As a further solution of the present invention, in the overcurrent protection module, the output terminal P3A, the output terminal P3B, the output terminal P3C, and the output terminal P3D are respectively connected to the drains of the NMOS tube Q1, the NMOS tube Q2, the NMOS tube Q3, and the NMOS tube Q4, and the other ends are connected in parallel to 24V, the sources of the NMOS tube Q1, the NMOS tube Q2, the NMOS tube Q3, and the NMOS tube Q4 are connected in parallel to the pin 1 of the chip U10 in the overcurrent protection module and the resistor R9, the other end of the resistor R9 is connected to GND, and the gates of the NMOS tube Q1, the NMOS tube Q2, the NMOS tube Q3, and the NMOS tube Q4 are respectively connected to the resistor R54, the resistor R56, and the resistor R57 in the logic processing module. 7. Resistor R55, pin 1 of chip U10 is connected to the source of NMOS tube Q1, NMOS tube Q2, NMOS tube Q3, NMOS tube Q4 and R9, pin 2 is connected to GND, pin 3 is connected to 5V, pin 5 is connected to resistor R25, the other end of resistor R25 is connected to 5V, pin 6 is connected to resistor R24, the other end of resistor R24 ​​is connected to pin 32 of U1 in the main control module, there is a reference voltage of 0.2V, when the voltage of sampling resistor R9 is greater than 0.2V, pin 6 GATE will output a low level, and this low level signal will be input to the I / O port of the microcontroller. Once it is a low level, the output of the PWM signal will be cut off, thereby achieving the purpose of protecting the circuit. The model of chip U10 is H5119L.

[0019] As a further scheme of the present invention, in the serial communication module, pin 1 and pin 3 of chip U5 are connected through capacitor C11, pin 4 and pin 5 are connected through C13, pin 11 of chip U5 is connected to pin 30 of chip U1 in the main control module, pin 12 of chip U5 is connected to pin 31 of chip U1 in the main control module, pin 15 of chip U5 is connected to GND, pin 6 of chip U5 is connected to GND through C14, pin 13 and pin 14 of chip U5 are respectively connected to pin 1 and pin 2 of 3Pin terminal P3, pin 3 of 3Pin terminal P3 is connected to GND, pin 2 of chip U5 is connected to GND through C10, and pin 16 of chip U5 is connected to 5V and then connected to GND through C12. Pin 1 of chip U6 is pulled up to 5V through R82 and connected to pin 22 of chip U1 in the main control module. Pin 2 and pin 3 of chip U6 are connected and then pulled up to 5V through resistor R80 and connected to the collector of NMOS tube Q8. Pin 4 and pin 5 of chip U8 are connected to GND, pin 6 is pulled up to 5V through R84, pin 7 is pulled down to GND through resistor R83, pin 8 of chip U6 is connected to 5V and connected to GND through capacitor C80, the base of NMOS tube Q8 is connected to pin 21 of chip U1 in the main control module through resistor R81, and the emitter is connected to GND, the 2Pin terminal P8 is connected to both ends of R85 and then connected to pin 6 and pin 7 of U6, and the model of chip U5 is MAX232.

[0020] As a further solution of the present invention, in the synchronous trigger input and output module, the pin 2 of the chip U4A, the chip U4B, the chip U4C, and the chip U4D are directly connected to the pin 1 of the 5Pin terminal P5, the pin 4 of the chip U4A, the chip U4B, the chip U4C, and the chip U4D are directly connected to GND, the pin 1 of the chip U4A is connected to the pin 2 of the 5Pin terminal P5 through R20A, the pin 1 of the chip U4B is connected to the pin 3 of the 5Pin terminal P5 through R20B, and the pin 1 of the chip U4C is connected to the 5Pin terminal P5 through the resistor R20C. Pin 4 of chip U4D, pin 1 of chip U4D is connected to pin 5 of 5Pin terminal P5 through resistor R20D, pin 3 of U4A is pulled up to 5V through resistor R21A and connected to pin 1 of U8 in the logic processing module, pin 3 of chip U4B is pulled up to 5V through resistor R21B and connected to pin 5 of U8 in the logic processing module, pin 3 of chip U4C is pulled up to 5V through R21C and connected to pin 8 of chip U8 in the logic processing module, and pin 3 of U4D is pulled up to 5V through resistor R21D and connected to pin 12 of chip U8 in the logic processing module.

[0021] As a further solution of the present invention, the model of the chip U10 in the power supply module is LM2576S-5.

[0022] As a further solution of the present invention, the model of the main control microcontroller U1 in the main control module is STM32F103C8T6.

[0023] Compared with the prior art, the present invention has the following advantages: the present invention can realize the control of multiple groups of light sources by using multiple groups of controllers, the present invention can control multiple groups of controllers at the same time, and multiple channels of a single controller can be connected to multiple light sources, so the number and types of light sources controlled can be large, which not only greatly saves resources, but also greatly improves production efficiency;

[0024] The present invention not only realizes RS485 communication to solve the cumbersome problem of a single PLC controlling multiple controllers, but also retains the RS232 communication interface, so that it can be compatible with conventional controllers. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 It is a circuit diagram of the power supply module of the present invention.

[0026] Figure 2 It is the circuit diagram of the main control module of the present invention.

[0027] Figure 3 It is a circuit diagram of a light source driving module of the present invention.

[0028] Figure 4 It is a circuit diagram of the logic processing module of the present invention.

[0029] Figure 5 It is the circuit diagram of the overcurrent protection module of the present invention.

[0030] Figure 6 It is the circuit diagram of the overcurrent protection module of the present invention.

[0031] Figure 7 Circuit diagram of the serial communication module of the present invention.

[0032] Figure 8 Circuit diagram of the serial communication module of the present invention.

[0033] Fig. 9 It is a circuit diagram of a synchronous trigger input and output module of the present invention. DETAILED DESCRIPTION

[0034] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0035] The light source control system based on RS485 serial communication includes:

[0036] A power supply module for supplying power to the entire circuit;

[0037] Main control module for light source control;

[0038] A light source driving module for controlling the on / off and brightness of the light source;

[0039] A logic processing module for processing PWM signals and switching between constant light mode and trigger mode;

[0040] Overcurrent protection module for protecting circuit;

[0041] Serial communication module for two-way communication between the controller and external devices;

[0042] A synchronous trigger input and output module is used for the controller to synchronously control the lighting of the light source when receiving an external trigger signal.

[0043] Conventional light sources on the market are rated at 24V, so choose a DV24V output switching power supply or adapter as the power supply. The power supply module needs to power the entire circuit. Therefore, in addition to the 24V output, 5V and 3.3V microcontrollers of various chips are also required. The specific solution is as follows Figure 1 As shown:

[0044] Power supply module, the input voltage of 24V (VCC24) is filtered by two capacitors C3 and C4 (connected to GND), and connected to the voltage input pin 1 (IN) of LM2576S-5 (U10). Pin 3 (GND) and pin 5 (ON / OFF) of U10 are connected to GND. The voltage output pin 2 (OUT) and the voltage feedback pin 4 (FB) of U10 are respectively connected to the two ends of L3. At the same time, the two ends of L3 are connected to GND through D3 and C8 to form a freewheeling loop to generate a continuous output voltage. The output voltage is filtered by C9 (connected to GND), and then connected to GND through the voltage stabilizing diode D5, generating a stable DC 5V (VCC5) output for use by the subsequent circuit. The 5V (VCC5) voltage is connected to pin 3 (IN) of ASM1117-3.3 (U11), pin 1 (GND) of U11 is connected to GND, pin 2 (OUT) and pin 4 (OUT) are connected and then connected to GND through C30 and C31 for filtering, converting 5V to a stable 3.3V (VCC3V3) to power the microcontroller.

[0045] like Figure 2As shown, pin 9 (VDDA), pin 24 (VDD_1), pin 36 (VDD_2), and pin 48 (VDD_3) of U1 in the main control module are connected to VCC3V3, and pin 8 (VSSA), pin 23 (VSS_1), pin 35 (VSS_2), and pin 47 (VSS_3) are connected to GND to power the microcontroller U3. Pin 5 (OSCIN) and pin 6 (OSCOUT) of U1 are connected to both ends of Y1, Y1 is connected in parallel with R13, and both ends of R32 are connected to GND through C5 and C6 to form a crystal oscillator circuit, providing a stable clock signal for the microcontroller U1. U1 pin 10 (PA0), pin 11 (PA1), pin 12 (PA2), and pin 13 (PA3) output 4 independent PWM signals through the output comparison function of the timer. The four output signals here are Figure 4 Pin 1, pin 4, pin 9, and pin 12 of U9 are connected to each other, and the four light source outputs are controlled by the logic circuit. Pin 20 (PB2 / BOOT1) and pin 44 (BOOT0) are pulled down to ground through resistors R22 and R21 respectively, which puts the microcontroller U3 in the burning mode and can burn the program normally. Pin 33 (PA12) is connected to 5V (VCC5) through the pull-up resistor R12, making its normal state high. Pin 30 (PA9) and pin 31 (PA10) are connected to Figure 7 The pin 11 (T1IN) and pin 12 (R1OUT) of U5 are connected to the external communication. The TTL serial port level of the microcontroller is converted to RS232 level through the U5 chip. Pin 21 (PB10) and pin 22 (PB11) are connected to Figure 8 R81 in is connected to pin 1 (RO) of U6, converting the TTL level of the microcontroller into RS485 level for external communication.

[0046] The light source driver module mainly uses the switch of MOS tube to control the on and off and brightness of the light source, such as Figure 3 As shown, the light source driver module uses 4 independent PWM signals to control 4 NMOS tubes (Q1, Q2, Q3, Q4) HG012N06L connected in series with the 4 light sources to 24V (VCC24), where the gate of Q1 is connected to Figure 4 The resistor R54 is connected to the pin 3 of U9, and the gate of Q2 is connected to Figure 4 The resistor R56 is connected to the pin 6 of U9, and the gate of Q3 is connected to Figure 4 The resistor R57 is connected to the pin 8 of U9, and the gate of Q4 is connected to Figure 4 The middle resistor R55 is connected to the pin 11 of U9, so that the independent outputs of the four light sources are controlled by the four independent output signals of the logic processing module.

[0047] like Figure 4As shown, pin 1 of U9 (74HC08D) in the logic processing module is connected Figure 2 U1 pin 10 (PA0), U9 pin 2 is connected to U8 pin 3 and pulled up to 5V (VCC5) through R61, U9 pin 3 is connected to R54, and the other end of R54 is connected to Figure 3 The gate of Q1 in the Figure 2 U1 pin 11 (PA1), U9 pin 5 is connected to U8 pin 4 and pulled up to 5V (VCC5) through R62, U9 pin 6 is connected to R56, and the other end of R56 is connected to Figure 3 The gate of Q2 in the middle. U9 pin 7 is connected to GND. U9 pin 8 is connected to R57, and the other end of R57 is connected to Figure 3 The gate of Q3, U9 pin 9 is connected to Figure 2 U2 pin 12 (PA2), U9 pin 10 is connected to U8 pin 10 and pulled up to 5V (VCC5) through R63. U9 pin 11 is connected to R55, and the other end of R55 is connected to Figure 3 The gate of Q4, U9 pin 12 is connected to Figure 2 In the example, U2 pin 13 (PA3) and U9 pin 13 are connected to U8 pin 10 and pulled up to 5V (VCC5) through R64. U9 pin 14 is connected to 5V (VCC5) power supply and C28 is connected to GND. The remaining pin connections of U8 (SN74LS266) are as follows: U8 pin 14 is connected to 5V (VCC5) power supply and C29 is connected to GND, and pin 7 is directly connected to GND. U8 pin 1, pin 5, pin 8, and pin 12 are connected to Fig. 9 Pull up to 5V (VCC5) through R21A, R21B, R21C, and R21D. U8 pins 2, 6, 9, and 13 are all connected and connected to Figure 2 Pin 33 (PA12) of U1 in FIG.

[0048] Two logic gate chips are used, namely SN74LS266 (XOR gate) and 74HC08D (AND gate). The logic of SN74LS266 (XOR gate) is that the output is 1 if the input is the same, and the output is 0 if the input is different. Taking pins 1, 2, and 3 as an example, 1 and 2 are inputs, and 3 is output. It is used here to determine whether the trigger signal 1A is consistent with the signal of the MCU I / O port PA12. The output signal 1OUT is pulled up to 1 by default. When the outputs of 1A and PA12 are inconsistent, 1OUT is 0, and when they are consistent, 1OUT is 1; the logic of 74HC08D (AND gate) is that the input is 1 at the same time, the output is 1, otherwise it is 0. Taking pins 1, 2, and 3 as an example, it is used here to determine the logic of the PWM signal output by the previous level 1OUT and the PA0 output. The output is 1 only when 1OUT is 1 and the PWM output of PA0 is high. The output signal here is directly used to drive the NMOS tube in the above light source driver module.

[0049] In the overcurrent protection module, Figure 5 Circuit connection relationship: Output terminals P3A, P3B, P3C, and P3D are connected to the drains of Q1, Q2, Q3, and Q4 respectively, and the other ends are connected in parallel to 24V (VCC24). The sources of Q1, Q2, Q3, and Q4 are connected in parallel to Figure 6 The pin 1 (CS) of U10 is connected to R9, and the other end of R9 is connected to GND. The gates of Q1, Q2, Q3, and Q4 are connected to Figure 4 R54, R56, R57, and R55.

[0050] Figure 6 Circuit connection relationship: Pin 1 (CS) of U10 (H5119L) is connected to the source of Q1, Q2, Q3, Q4 and R9, Pin 2 (GND) is connected to GND, Pin 3 (VDD) is connected to 5V (VCC5), Pin 5 (PWM) is connected to R25, and the other end of R25 is connected to 5V (VCC5), Pin 6 (GATE) is connected to R24, and the other end of R24 is connected to Figure 2 Pin 32 (PA11) of U1 in the circuit. The chip H5119L is used here, which has a 0.2V reference voltage. When the voltage of the sampling resistor R9 is greater than 0.2V, the 6-pin GATE will output a low level. This low level signal is input to the I / O port of the microcontroller. It can be judged in the program. Once it is a low level, the output of the PWM signal is cut off, thereby achieving the purpose of protecting the circuit. The specific circuit is as follows Figure 5 , Figure 6 As shown;

[0051] The controller uses two serial ports, using RS232 protocol and RS485 protocol respectively. The RS232 communication is implemented as follows: Figure 7 As shown, in the serial communication module, Figure 7 Circuit connection relationship: Pin 1 and pin 3 of U5 are connected through C11, pin 4 and pin 5 are connected through C13, and U5 pin 11 (TIIN) is connected to Figure 2 U1 pin 30 (PA9), U5 pin 12 (R1OUT) connected to Figure 2 In the figure, U1's pin 31 (PA10) and U5's pin 15 (GND) are connected to GND, U5's pin 6 is connected to GND through C14, U5's pin 13 (R1IN) and pin 14 (T1OUT) are connected to 3Pin terminal P3's pin 1 and pin 2 respectively, P3's pin 3 is connected to GND, U5's pin 2 (VDD) is connected to GND through C10, and U5's pin 16 (VCC) is connected to 5V (VCC) and then to GND through C12. The MAX232 chip is used here to convert RS232 and TTL levels. P2 is an external communication interface, where pin 1 is RX and pin 2 is TX, to achieve two-way communication between the controller and external devices. Figure 8 Circuit connection relationship: Pin 1 of U6 is pulled up to 5V (VCC) through R82 and connected Figure 2 U1 pin 22 (PB11), U6 pin 2, pin 3 are connected and pulled up to 5V (VCC) through R80 and connected to the collector of Q8, U8 pin 4 and pin 5 are connected to GND, pin 6 is pulled up to 5V (VCC) through R84, pin 7 is pulled down to GND through R83, U6 pin 8 is connected to 5V (VCC5) and connected to GND through C80. The base of Q8 is connected through R81 Figure 2 Pin 21 (PB10) of U1 in the circuit, the emitter is connected to GND. The 2Pin terminal P8 is connected to both ends of R85 and then to Pin 6 and Pin 7 of U6. RS485 communication is half-duplex communication, that is, data cannot be received synchronously while sending data. Therefore, when the microcontroller sends data to the outside, it is called a driver, and when it receives external data, it is called a receiver. The output of the MAX485 driver is a differential output, and the output voltage is 0V~+3.3V when unloaded. RS485 has an enable control line (high level is valid). The logic high level (1) on DE will enable the differential output of the driver. The input of the MAX485 receiver is a differential input. If RE is low, the receiver is enabled, otherwise the receiver is disabled.

[0052] ED: 1 transmission enable; 0 transmission disable RE: 0 reception enable; 1 reception disable. That is, we need to switch the levels of ED and RE to control whether the MAX485 chip is in transmission mode or reception mode. A circuit for automatically switching reception mode is designed. The specific idea is as follows: The circuit here implements an automatic switching of transmission and reception mode. Transmission mode: When TX sends 0, transistor Q8 is not turned on, DE is connected to a high level, and enters the transmission mode. The 485 chip will reflect the level on DI to the AB pin for output. Because DI is grounded, the AB pin will transmit 0. Therefore, when TXD sends 0, the AB pin sends 0. When TX sends 1, transistor Q8 is turned on, RE is connected to a low level, and enters the reception mode. The AB pin of the 485 chip enters a high-impedance state, because R3 pulls A high and R2 pulls B low, so AB transmits 1. Therefore, when TXD sends 1, the AB pin sends 1. In summary, when TXD sends 1, AB sends 1; when TXD sends 0, AB sends 0. Receiving mode: The MCU pin RX is used, and the data is displayed on the RXD pin. In the process of receiving data, the TX pin is always kept at a high level. When TXD is at a high level, RE is at a low level, which just changes to the receiving state. Then the RO pin of the 485 chip (that is, the pin connected to RX) will receive the data transmitted by AB. The trigger mode means that when an external trigger signal is received, the controller synchronously controls the light source to light up. The specific implementation method is as follows Fig. 9 As shown: Fig. 9 Circuit connection relationship: Pin 2 of U4A, U4B, U4C, and U4D is directly connected to pin 1 of P5, and pin 4 of U4A, U4B, U4C, and U4D are all directly connected to GND. U4A pin 1 is connected to pin 2 of 5-pin terminal P5 through R20A, U4B pin 1 is connected to pin 3 of 5-pin terminal P5 through R20B, U4C pin 1 is connected to pin 4 of 5-pin terminal P5 through R20C, and U4D pin 1 is connected to pin 5 of 5-pin terminal P5 through R20D. U4A pin 3 is pulled up to 5V (VCC5) through R21A and connected to Figure 4 U8 pin 1 is connected to U4B pin 3, which is pulled up to 5V (VCC5) through R21B and connected to Figure 4 U8 pin 5 is connected to U4C pin 3, which is pulled up to 5V (VCC5) through R21C and connected to Figure 4 U8 pin 8 is connected to U4D pin 3, which is pulled up to 5V (VCC5) through R21D and connected to Figure 4 Connected to pin 12 of U8.

[0053] Taking U4A as an example, using the optocoupler PC814, the optocoupler input receives an external trigger signal, thereby controlling signal 1A through the external trigger signal, and 1A controls the output of the logic circuit module to control the output of the light source driver module. Through the functions of each module, a light source controller with RS485 serial port communication can be realized. This solution is applied to light source controllers of different models and types, and multiple groups of controllers can be mounted on a set of communication lines. The PLC can control each controller separately by sending instructions containing addresses, thereby forming a light source control system that can control various types of light sources.

[0054] The above is a preferred embodiment of the present invention. For ordinary technicians in this field, according to the teachings of the present invention, without departing from the principles and spirit of the present invention, changes, modifications, substitutions and variations made to the implementation methods are still within the scope of protection of the present invention.

Claims

1. The light source control system based on RS485 serial communication is characterized by: including a power supply module for supplying power to the entire circuit; Main control module for light source control; A light source driving module for controlling the on / off and brightness of the light source; A logic processing module for processing PWM signals and switching between constant light mode and trigger mode; Overcurrent protection module for protecting circuit; Serial communication module for two-way communication between the controller and external devices; A synchronous trigger input and output module is used for the controller to synchronously control the lighting of the light source when receiving an external trigger signal.

2. The light source control system based on RS485 serial communication as claimed in claim 1, characterized in that: In the power supply module, the 24V input voltage is filtered by capacitors C3 and C4, and connected to the voltage input pin 1 of chip U10. Pins 3 and 5 of chip U10 are connected to GND. The voltage output pin 2 and voltage feedback pin 4 of chip U10 are respectively connected to the two ends of L3. At the same time, the two ends of L3 are connected to GND through a voltage zener diode D3 and capacitor C8 to form a freewheeling loop to generate a continuous output voltage. The output voltage is filtered by capacitor C9 and then connected to GND through a voltage zener diode D5 to generate a stable DC 5V output for use by the subsequent circuit. The 5V voltage is connected to pin 3 of chip U11, pin 1 of chip U11 is connected to GND, pin 2 and pin 4 are connected and then filtered through capacitors C30 and C31 to GND, and the 5V is converted into a stable 3.3V to power the microcontroller.

3. The light source control system based on RS485 serial communication as claimed in claim 1, characterized in that: In the main control module, pin 9, pin 24, pin 36, and pin 48 of the main control microcontroller U1 are connected to VCC3V3, and pin 8, pin 23, pin 35, and pin 47 are connected to GND to power the microcontroller U3. Pin 5 and pin 6 of the main control microcontroller U1 are connected to both ends of Y1, Y1 is connected in parallel with resistor R13, and both ends of resistor R32 are connected to GND through capacitor C5 and capacitor C6 to form a crystal oscillator circuit to provide a stable clock signal for the main control microcontroller U1. Pin 10, pin 11, pin 12, and pin 13 of the main control microcontroller U1 output 4 independent PWM signals through the output comparison function of the timer. The four output signals here are connected to pin 1, pin 4, and pin 5 of the chip U9 of the light source driver module. Pin 9 and pin 12 are connected to each other, and the four light source outputs are controlled by the logic circuit. Pin 20 and pin 44 are pulled down to ground through resistors R22 and R21 respectively, so that the microcontroller U3 is in burning mode and can burn the program normally. Pin 33 is connected to 5V through a pull-up resistor R12, so that its normal state is high level. Pin 30 and pin 31 are connected to pin 11 and pin 12 of the chip U5 of the serial communication module respectively, and the TTL serial port level of the microcontroller is converted to RS232 level through chip U5 to communicate with the outside. Pin 21 and pin 22 are connected to the resistor R81 of the serial communication module and pin 1 of chip U6 respectively, and the TTL level of the microcontroller is converted to RS485 level to communicate with the outside.

4. The light source control system based on RS485 serial communication as claimed in claim 1, characterized in that: In the light source driving module, 4 independent PWM signals are used to control 4 NMOS tubes Q1, NMOS tube Q2, NMOS tube Q3, and NMOS tube Q4 which are connected in series with the 4 light sources to 24V, wherein the gate of Q1 is connected to the resistor R54 in the logic processing module and then to the pin 3 of the chip U9, the gate of the NMOS tube Q2 is connected to the resistor R56 in the logic processing module and then to the pin 6 of the chip U9, the gate of the NMOS tube Q3 is connected to the resistor R57 in the logic processing module and then to the pin 8 of the chip U9, and the gate of the NMOS tube Q4 is connected to the resistor R55 in the logic processing module and then to the pin 11 of the chip U9, so that the independent outputs of the 4 light sources are controlled by the 4 independent output signals of the logic processing module. The models of NMOS tube Q1, NMOS tube Q2, NMOS tube Q3 and NMOS tube Q4 in the light source driving module are HG012N06L.

5. The light source control system based on RS485 serial communication as claimed in claim 1, characterized in that: In the logic processing module, Pin 1 of chip U9 is connected to pin 10 of chip U1 in the main control module, pin 2 of chip U9 is connected to pin 3 of chip U8 and is pulled up to 5V through R61, pin 3 of chip U9 is connected to R54, and the other end of R54 is connected to the gate of NMOS tube Q1 in the light source driving module, pin 4 of chip U9 is connected to pin 11 of chip U1 in Figure 2, pin 5 of chip U9 is connected to pin 4 of chip U8 and is pulled up to 5V through R62, pin 6 of chip U9 is connected to resistor R56, and the other end of R56 is connected to the gate of NMOS tube Q2 in the light source driving module. Pin 7 of chip U9 is connected to GND, pin 8 of chip U9 is connected to resistor R57, the other end of R57 is connected to the gate of NMOS tube Q3 in the light source driver module, pin 9 of chip U9 is connected to pin 12 of chip U2 in the main control module, pin 10 of chip U9 is connected to pin 10 of chip U8 and is pulled up to 5V through resistor R63, pin 11 of chip U9 is connected to R55, the other end of R55 is connected to the gate of NMOS tube Q4 in Figure 3, pin 12 of chip U9 is connected to pin 13 of U2 in Figure 2, pin 13 of chip U9 is connected to pin 10 of chip U8 and is pulled up to 5V through R64, and pin 10 of chip U8 is connected to pin 11 of chip U8 and is pulled up to 5V through R64. Pin 14 of chip 9 is connected to 5V power supply and capacitor C28 is connected to GND, pin 14 of chip U8 is connected to 5V power supply and capacitor C29 is connected to GND, pin 7 is directly connected to GND, pin 1, pin 5, pin 8 and pin 12 of chip U8 are respectively connected to the synchronous trigger input and output module, and pulled up to 5V through resistors R21A, R21B, R21C and R21D, pin 2, pin 6, pin 9 and pin 13 of U8 are all connected and connected to pin 33 of U1 in the light source driver module, the model of chip U9 is 74HC08D, and the model of chip U8 is SN74LS266.

6. The light source control system based on RS485 serial communication as claimed in claim 1, characterized in that: In the overcurrent protection module, the output terminal P3A, the output terminal P3B, the output terminal P3C, and the output terminal P3D are respectively connected to the drains of the NMOS tube Q1, the NMOS tube Q2, the NMOS tube Q3, and the NMOS tube Q4, and the other ends are connected in parallel to 24V, the sources of the NMOS tube Q1, the NMOS tube Q2, the NMOS tube Q3, and the NMOS tube Q4 are connected in parallel to the pin 1 of the chip U10 in the overcurrent protection module and the resistor R9, the other end of the resistor R9 is connected to GND, and the gates of the NMOS tube Q1, the NMOS tube Q2, the NMOS tube Q3, and the NMOS tube Q4 are respectively connected to the resistors R54, R56, R57, and R58 in the logic processing module.

5. Pin 1 of chip U10 is connected to the source of NMOS tube Q1, NMOS tube Q2, NMOS tube Q3, NMOS tube Q4 and R9, pin 2 is connected to GND, pin 3 is connected to 5V, pin 5 is connected to resistor R25, the other end of resistor R25 is connected to 5V, pin 6 is connected to resistor R24, the other end of resistor R24 ​​is connected to pin 32 of U1 in the main control module, there is a reference voltage of 0.2V, when the voltage of sampling resistor R9 is greater than 0.2V, pin 6 GATE will output a low level, and this low level signal will be input to the I / O port of the microcontroller. Once it is a low level, the output of the PWM signal will be cut off, thereby achieving the purpose of protecting the circuit. The model of chip U10 is H5119L.

7. The light source control system based on RS485 serial communication as claimed in claim 1, characterized in that: In the serial communication module, pin 1 and pin 3 of chip U5 are connected through capacitor C11, pin 4 and pin 5 are connected through C13, pin 11 of chip U5 is connected to pin 30 of chip U1 in the main control module, pin 12 of chip U5 is connected to pin 31 of chip U1 in the main control module, pin 15 of chip U5 is connected to GND, pin 6 of chip U5 is connected to GND through C14, pin 13 and pin 14 of chip U5 are respectively connected to pin 1 and pin 2 of 3Pin terminal P3, pin 3 of 3Pin terminal P3 is connected to GND, pin 2 of chip U5 is connected to GND through C10, and pin 16 of chip U5 is connected to 5V and then to GND through C12. Pin 1 of chip U6 is pulled up to 5V through R82 and connected to pin 22 of chip U1 in the main control module. Pin 2 and pin 3 of chip U6 are connected and then pulled up to 5V through resistor R80 and connected to the collector of NMOS tube Q8. Pin 4 and pin 5 of chip U8 are connected to GND, pin 6 is pulled up to 5V through R84, pin 7 is pulled down to GND through resistor R83, pin 8 of chip U6 is connected to 5V and connected to GND through capacitor C80, the base of NMOS tube Q8 is connected to pin 21 of chip U1 in the main control module through resistor R81, and the emitter is connected to GND, the 2Pin terminal P8 is connected to both ends of R85 and then connected to pin 6 and pin 7 of U6, and the model of chip U5 is MAX232.

8. The light source control system based on RS485 serial communication as claimed in claim 1, characterized in that: In the synchronous trigger input and output module, the pin 2 of chip U4A, chip U4B, chip U4C, and chip U4D is directly connected to the pin 1 of the 5Pin terminal P5, and the pin 4 of chip U4A, chip U4B, chip U4C, and chip U4D are all directly connected to GND. The pin 1 of chip U4A is connected to the pin 2 of the 5Pin terminal P5 through R20A, the pin 1 of chip U4B is connected to the pin 3 of the 5Pin terminal P5 through R20B, and the pin 1 of chip U4C is connected to the pin 4 of the 5Pin terminal P5 through resistor R20C. Pin 1 of chip U4D is connected to pin 5 of 5Pin terminal P5 through resistor R20D, pin 3 of U4A is pulled up to 5V through resistor R21A and connected to pin 1 of U8 in the logic processing module, pin 3 of chip U4B is pulled up to 5V through resistor R21B and connected to pin 5 of U8 in the logic processing module, pin 3 of chip U4C is pulled up to 5V through R21C and connected to pin 8 of chip U8 in the logic processing module, and pin 3 of U4D is pulled up to 5V through resistor R21D and connected to pin 12 of chip U8 in the logic processing module.

9. The light source control system based on RS485 serial communication as claimed in claim 2, characterized in that: The model of chip U10 in the power supply module is LM2576S-5.

10. The light source control system based on RS485 serial communication as claimed in claim 3, characterized in that: The model of the main control microcontroller U1 in the main control module is STM32F103C8T6.