[go: up one dir, main page]

CN106132000B - A kind of digital radio LED light source controller - Google Patents

A kind of digital radio LED light source controller Download PDF

Info

Publication number
CN106132000B
CN106132000B CN201610497684.XA CN201610497684A CN106132000B CN 106132000 B CN106132000 B CN 106132000B CN 201610497684 A CN201610497684 A CN 201610497684A CN 106132000 B CN106132000 B CN 106132000B
Authority
CN
China
Prior art keywords
light source
led light
control unit
pwm
mrow
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201610497684.XA
Other languages
Chinese (zh)
Other versions
CN106132000A (en
Inventor
吴福培
曾志超
方信佳
黎锦田
李昇平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shantou University
Original Assignee
Shantou University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shantou University filed Critical Shantou University
Priority to CN201610497684.XA priority Critical patent/CN106132000B/en
Publication of CN106132000A publication Critical patent/CN106132000A/en
Application granted granted Critical
Publication of CN106132000B publication Critical patent/CN106132000B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H05ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
    • H05BELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
    • H05B45/00Circuit arrangements for operating light-emitting diodes [LED]
    • H05B45/10Controlling the intensity of the light

Landscapes

  • Circuit Arrangement For Electric Light Sources In General (AREA)

Abstract

本发明涉及工业品表面质量检测的机器视觉光源控制,具体地说是涉及一种数字化无线LED光源控制器,包括硬件部分和软件部分。硬件部分包括上位机、无线串口通信模块、嵌入式控制单元、光源驱动电路、LED光源、显示模块和供电电源模块;软件部分包括上位机软件,嵌入式控制单元程序和LED灰度值的调节算法。操作者使用上位机软件给嵌入式控制单元发送指令,嵌入式控制单元在接收指令处理数据后输出相应占空比的PWM波,从而控制LED光源的亮度。本发明发热小、结构合理、能够同时精确稳定地控制四路通道的LED光源,特别是控制指令数据采用非接触式的无线输入,省去了布线的困难,在实际安装使用过程中更加简单。

The invention relates to machine vision light source control for industrial product surface quality detection, in particular to a digital wireless LED light source controller, including a hardware part and a software part. The hardware part includes host computer, wireless serial port communication module, embedded control unit, light source drive circuit, LED light source, display module and power supply module; the software part includes host computer software, embedded control unit program and LED gray value adjustment algorithm . The operator uses the host computer software to send instructions to the embedded control unit, and the embedded control unit outputs a PWM wave with a corresponding duty cycle after receiving the instruction to process the data, thereby controlling the brightness of the LED light source. The invention has low heat generation, reasonable structure, and can accurately and stably control LED light sources of four channels at the same time. In particular, the control command data adopts non-contact wireless input, which saves the difficulty of wiring and is simpler in the actual installation and use process.

Description

一种数字化无线LED光源控制器A digital wireless LED light source controller

技术领域technical field

本发明涉及工业品表面质量检测的机器视觉光源控制,具体地说是涉及一种数字化无线LED光源控制器。The invention relates to machine vision light source control for industrial product surface quality detection, in particular to a digital wireless LED light source controller.

背景技术Background technique

机器视觉系统是利用机器代替人眼获取客观事物的图像,通过计算机和图像处理技术对获取的图像进行处理、分析和识别的系统,包括照明、镜头、相机、图像采集卡和视觉处理器五大部分,每部分均可能影响图像处理的结果,甚至导致机器视觉系统的不稳定。其中光源控制器是最关键的环节之一。Machine vision system is a system that uses machines instead of human eyes to obtain images of objective things, and processes, analyzes and recognizes the acquired images through computer and image processing technology, including lighting, lenses, cameras, image acquisition cards and visual processors. , each part may affect the result of image processing, and even lead to the instability of the machine vision system. Among them, the light source controller is one of the most critical links.

现有的光源控制器存在发热量明显,控制指令输入模块与控制器之间布线麻烦的问题。在工业现场,由于安装环境的限制,有时需要将调节光源亮度的控制信号输入模块与光源控制器的其他模块分离安装。The existing light source controller has the problems of obvious heat generation and troublesome wiring between the control instruction input module and the controller. In the industrial field, due to the limitation of the installation environment, it is sometimes necessary to install the control signal input module for adjusting the brightness of the light source separately from other modules of the light source controller.

发明内容Contents of the invention

本发明为了解决现有的光源控制器在工业现场应用时发热明显,控制指令输入模块与控制器之间布线麻烦的问题,提出了一种数字化无线LED光源控制器。The present invention proposes a digital wireless LED light source controller in order to solve the problems that the existing light source controller generates heat obviously and the wiring between the control command input module and the controller is troublesome when it is applied in the industrial field.

一种数字化无线LED光源控制器,包括软件部分和硬件部分;所述硬件部分包括包括上位机、无线串口通信模块、嵌入式控制单元、光源驱动电路、LED光源、显示模块和供电电源模块;所述上位机通过无线串口通信模块与嵌入式控制单元双向连接,用于发送指令和接收数据;所述嵌入式控制单元通过光源驱动电路与LED光源连接,利用PWM控制技术调节LED光源的亮度;所述显示模块由数码管显示电路构成,与嵌入式控制单元连接,用于显示出通道序号和LED光源的亮度值;所述供电电源模块分别与无线串口通信模块、嵌入式控制单元、光源驱动电路、显示模块连接,提供稳定电源;A digital wireless LED light source controller, including a software part and a hardware part; the hardware part includes a host computer, a wireless serial port communication module, an embedded control unit, a light source driving circuit, an LED light source, a display module and a power supply module; the The upper computer is bidirectionally connected with the embedded control unit through the wireless serial port communication module for sending instructions and receiving data; the embedded control unit is connected with the LED light source through the light source driving circuit, and uses PWM control technology to adjust the brightness of the LED light source; The display module is composed of a digital tube display circuit, connected with the embedded control unit, and used to display the channel number and the brightness value of the LED light source; the power supply module is connected with the wireless serial communication module, the embedded control unit, and the light source drive circuit respectively. , Display module connection, provide stable power supply;

所述软件部分包括上位机软件,嵌入式控制单元程序和LED灰度值调节算法;所述上位机软件用于选择LED光源通道,发送调节LED光源亮度的控制指令;所述嵌入式控制单元程序用于分析、处理接收到的控制指令,然后根据处理的结果调节PWM波的占空比,从而调节LED光源的亮度;所述LED灰度值调节算法,是利用LED光源灰度值与PWM占空比之间的关系,通过间距划分多级的占空比调节可以实现LED光源灰度值的调节;The software part includes host computer software, an embedded control unit program and an LED gray value adjustment algorithm; the host computer software is used to select the LED light source channel and send a control command for adjusting the brightness of the LED light source; the embedded control unit program It is used to analyze and process the received control command, and then adjust the duty cycle of the PWM wave according to the processing result, thereby adjusting the brightness of the LED light source; the LED gray value adjustment algorithm is to use the gray value of the LED light source and the PWM duty cycle The relationship between the duty ratio, the adjustment of the gray value of the LED light source can be realized by dividing the multi-level duty ratio by the spacing;

所述嵌入式控制单元采用LPC2148芯片作为核心控制芯片,所述LED灰度值调节算法包括如下步骤:The embedded control unit adopts the LPC2148 chip as the core control chip, and the LED gray value adjustment algorithm includes the following steps:

S1设置PWM波为单边沿控制的,在PWM周期的开始时都是高电平,并且每个PWM的周期不变,周期大小由以下公式给出:S1 sets the PWM wave to be controlled by a single edge. It is high at the beginning of the PWM cycle, and the cycle of each PWM is constant. The cycle size is given by the following formula:

fcclk表示LPC2148芯片的系统时钟频率,n表示核心控制芯片LPC2148的PWMMR0寄存器的值,TPWM表示每个PWM的周期;f cclk represents the system clock frequency of the LPC2148 chip, n represents the value of the PWMMR0 register of the core control chip LPC2148, and T PWM represents the cycle of each PWM;

S2将PWM波的周期数字化为256份,通过设置核心控制芯片LPC2148的PWM匹配寄存器来控制每个PWM周期中高电平的时间,在嵌入式控制单元程序中,PWM匹配寄存器的值由以下公式给出:S2 digitizes the cycle of the PWM wave into 256 parts, and controls the high level time in each PWM cycle by setting the PWM matching register of the core control chip LPC2148. In the embedded control unit program, the value of the PWM matching register is given by the following formula out:

i=1,2,3,4,5,6;N=0,1,2,3...255;N表示LED光源的灰度值,PWMMRi表示PWM匹配寄存器的值;i=1,2,3,4,5,6; N=0,1,2,3...255; N represents the gray value of the LED light source, PWMMR i represents the value of the PWM matching register;

S3实现间距为的0~255级占空比调节,从而实现0~255的LED光源灰度值的调节,PWM波的占空比为:S3 achieves a spacing of 0-255 level duty cycle adjustment, so as to realize the adjustment of the gray value of the LED light source from 0-255, the duty cycle of the PWM wave is:

DutyRatio表示占空比。DutyRatio represents the duty cycle.

进一步地,所述硬件部分还包括红外控制模块,红外控制模块分为红外遥控按键和红外接收电路,所述红外接收电路与嵌入式控制单元连接,红外遥控按键用于发送指令,红外接收电路用于接收指令并发送给嵌入式控制单元。操作者除了可以通过上位机无线远程控制发送指令给嵌入式控制单元,还可以使用红外控制模块遥控发送指令,支持多种发送指令的模式,节省布线的麻烦。Further, the hardware part also includes an infrared control module. The infrared control module is divided into an infrared remote control button and an infrared receiving circuit. The infrared receiving circuit is connected to the embedded control unit. The infrared remote control button is used to send instructions, and the infrared receiving circuit It is used to receive instructions and send them to the embedded control unit. In addition to sending commands to the embedded control unit through the wireless remote control of the host computer, the operator can also use the infrared control module to remotely send commands, support multiple modes of sending commands, and save the trouble of wiring.

进一步地,所述上位机软件包括界面初始化、串口初始化、选择LED光源通道和发送控制指令四个部分。Further, the host computer software includes four parts: interface initialization, serial port initialization, LED light source channel selection and control instruction sending.

进一步地,所述嵌入式控制单元程序包括设备初始化,检测控制指令、解析控制指令和调节PWM波占空比四个部分,设备初始化包括I/O口初始化、锁相环初始化、红外引脚初始化、串口初始化和脉宽调制初始化。Further, the embedded control unit program includes four parts: device initialization, detecting control instructions, analyzing control instructions and adjusting PWM wave duty cycle, and device initialization includes I/O port initialization, phase-locked loop initialization, and infrared pin initialization , serial port initialization and pulse width modulation initialization.

进一步地,所述LED光源有四路,光源驱动电路包含四通道的驱动电路,用于提供四路LED光源的供电电压。Further, there are four LED light sources, and the light source drive circuit includes a four-channel drive circuit for providing power supply voltages for the four LED light sources.

进一步地,所述无线串口通信模块分为上位机无线串口模块和下位机无线串口模块,上位机无线串口模块与上位机之间双向连接,下位机无线串口模块与嵌入式控制单元的串口之间双向连接,从而实现上位机和嵌入式控制单元之间数据的双向通信。Further, the wireless serial port communication module is divided into an upper computer wireless serial port module and a lower computer wireless serial port module, the upper computer wireless serial port module is bidirectionally connected to the upper computer, and the lower computer wireless serial port module is connected to the serial port of the embedded control unit. Two-way connection, so as to realize the two-way communication of data between the host computer and the embedded control unit.

进一步地,所述嵌入式控制单元采用LPC2148芯片作为核心控制芯片,其输出的PWM波的频率最高达到105数量级。嵌入式控制单元采用LPC2148作为核心控制芯片,用于分析、处理上位机通过无线串口模块发送的和操作者通过红外遥控按键发送的调节LED光源亮度的控制指令,根据分析处理的结果输出相应占空比的PWM波,从而调节LED光源的亮度;同时,嵌入式控制单元可以控制显示模块,让其显示出通道序号和LED光源的亮度值。另外,嵌入式控制单元可以同时独立输出四路不同占空比的PWM波,并且可以实时地调节各路PWM波的占空比,从而达到实时独立地调节四路LED光源亮度的目的。由于采用PWM控制技术调节LED光源的亮度,故本光源控制器的发热并不明显。另外,PWM波的频率可以高达105数量级,足以精确稳定的控制LED光源的亮度,因此在图像采集的过程中,基本不会出现频闪现象。Further, the embedded control unit adopts the LPC2148 chip as the core control chip, and the frequency of the PWM wave output by it can reach the order of 10 5 at most. The embedded control unit uses LPC2148 as the core control chip, which is used to analyze and process the control commands sent by the upper computer through the wireless serial port module and the control commands sent by the operator through the infrared remote control button to adjust the brightness of the LED light source, and output the corresponding duty cycle according to the analysis and processing results. The PWM wave of the ratio can adjust the brightness of the LED light source; at the same time, the embedded control unit can control the display module to display the channel number and the brightness value of the LED light source. In addition, the embedded control unit can independently output four channels of PWM waves with different duty ratios at the same time, and can adjust the duty ratios of each PWM wave in real time, so as to achieve the purpose of independently adjusting the brightness of the four LED light sources in real time. Since the brightness of the LED light source is adjusted by using PWM control technology, the heat generation of the light source controller is not obvious. In addition, the frequency of the PWM wave can be as high as 10 5 orders of magnitude, which is enough to accurately and stably control the brightness of the LED light source, so there is basically no stroboscopic phenomenon in the process of image acquisition.

进一步地,所述光源驱动电路包含高频开关电路。Further, the light source driving circuit includes a high frequency switching circuit.

与现有技术相比,本发明结构合理、能够同时独立精确稳定地控制四路通道的LED光源,采用PWM控制技术调节LED光源的亮度,其发热量小;又因为采用非接触的方式(无线串口通信和红外遥控)输入控制指令数据,克服了布线过程的复杂性,同时不受安装环境的限制。因此,在工业检测的安装使用过程中更加灵活。Compared with the prior art, the present invention has a reasonable structure, can independently, accurately and stably control the LED light source of four channels at the same time, adopts PWM control technology to adjust the brightness of the LED light source, and has a small calorific value; and because it adopts a non-contact method (wireless Serial port communication and infrared remote control) to input control instruction data, which overcomes the complexity of the wiring process and is not limited by the installation environment. Therefore, it is more flexible in the installation and use of industrial inspection.

附图说明Description of drawings

图1是本发明的硬件结构示意图;Fig. 1 is a schematic diagram of hardware structure of the present invention;

图2是本发明的上位机软件流程图;Fig. 2 is a flow chart of upper computer software of the present invention;

图3是本发明的上位机软件界面图;Fig. 3 is the upper computer software interface figure of the present invention;

图4是本发明的嵌入式控制单元程序流程图。Fig. 4 is a program flow chart of the embedded control unit of the present invention.

具体实施方式Detailed ways

本发明提出了一种数字化无线光源控制器,下面结合附图说明具体实施方式。The present invention proposes a digital wireless light source controller, and the specific implementation will be described below with reference to the accompanying drawings.

本发明的包括硬件部分和软件部分,如图1所示,所述硬件部分包括包括上位机、无线串口通信模块、红外控制模块、嵌入式控制单元、光源驱动电路、四路LED光源、显示模块和供电电源模块。The present invention includes a hardware part and a software part. As shown in FIG. 1, the hardware part includes a host computer, a wireless serial port communication module, an infrared control module, an embedded control unit, a light source driving circuit, a four-way LED light source, and a display module. and power supply module.

无线串口通信模块分为上位机无线串口模块和下位机无线串口模块,上位机无线串口模块与上位机之间双向连接,下位机无线串口模块与嵌入式控制单元的串口之间双向连接,从而实现上位机和嵌入式控制单元之间数据的双向通信;The wireless serial port communication module is divided into the upper computer wireless serial port module and the lower computer wireless serial port module. Two-way communication of data between the host computer and the embedded control unit;

红外控制模块分为红外遥控按键和红外接收电路,红外接收电路与嵌入式控制单元连接,红外遥控按键用于发送指令,红外接收电路用于接收指令并发送给嵌入式控制单元;The infrared control module is divided into an infrared remote control button and an infrared receiving circuit, the infrared receiving circuit is connected with the embedded control unit, the infrared remote control button is used to send instructions, and the infrared receiving circuit is used to receive instructions and send them to the embedded control unit;

所述嵌入式控制单元采用LPC2148芯片作为核心控制芯片,其输出的PWM波的频率最高达到105数量级;嵌入式控制单元的PWM波输出接口与光源驱动电路的输入端口连接;The embedded control unit adopts the LPC2148 chip as the core control chip, and the frequency of the PWM wave output by it is up to 10 5 orders of magnitude; the PWM wave output interface of the embedded control unit is connected to the input port of the light source driving circuit;

所述光源驱动电路由高频开关电路和驱动电路构成,用于提供四路LED光源的供电电压,其输出端与四路LED光源的受电端相连;The light source drive circuit is composed of a high-frequency switch circuit and a drive circuit, and is used to provide the power supply voltage of the four-way LED light source, and its output terminal is connected to the receiving end of the four-way LED light source;

同时,嵌入式控制单元还与显示模块单向连接,控制其显示出通道序号和LED光源的亮度值;At the same time, the embedded control unit is also connected to the display module in one direction to control it to display the channel number and the brightness value of the LED light source;

供电电源模块的受电端与外电源相连,而供电端同时与显示模块的受电端、嵌入式控制单元的受电端、光源驱动电路的受电端和无线串口通信模块的受电端相连,为这些模块提供所需电压,以保证它们的正常运行。The power receiving end of the power supply module is connected to the external power supply, and the power supply end is simultaneously connected to the power receiving end of the display module, the power receiving end of the embedded control unit, the power receiving end of the light source driving circuit and the power receiving end of the wireless serial communication module , to provide the required voltage for these modules to ensure their normal operation.

本发明的软件部分包括上位机软件,嵌入式控制单元程序和LED灰度值调节算法。所述上位机软件用于选择LED光源通道,发送调节LED光源亮度的控制指令;所述嵌入式控制单元程序用于分析、处理接收到的控制指令,然后根据处理的结果调节PWM波的占空比,从而调节LED光源的亮度;所述LED灰度值调节算法,是利用LED光源灰度值与PWM占空比之间的关系,通过间距划分多级的占空比调节可以实现LED光源灰度值的调节。The software part of the invention includes upper computer software, embedded control unit program and LED gray value adjustment algorithm. The host computer software is used to select the channel of the LED light source, and sends a control command to adjust the brightness of the LED light source; the embedded control unit program is used to analyze and process the received control command, and then adjust the duty of the PWM wave according to the processing result ratio, thereby adjusting the brightness of the LED light source; the LED gray value adjustment algorithm is to use the relationship between the LED light source gray value and the PWM duty cycle, and the LED light source gray value can be realized by dividing the multi-level duty cycle adjustment by spacing. degree value adjustment.

如图2所示,上位机软件包括界面初始化、串口初始化、选择LED光源通道和发送控制令四个部分。首先对软件界面和串口进行初始化设置,在初始化完成后,判断串口是否已经打开。若未打开,重新初始化串口;若串口已经打开,则选择LED光源通道号,发送调节LED光源亮度的控制指令。As shown in Figure 2, the upper computer software includes four parts: interface initialization, serial port initialization, selection of LED light source channel and sending control orders. First, initialize the software interface and the serial port. After the initialization is completed, determine whether the serial port has been opened. If it is not open, re-initialize the serial port; if the serial port is already open, select the channel number of the LED light source and send the control command to adjust the brightness of the LED light source.

如图3所示,上位机软件的界面包括LED光源灰度值手动输入栏1、LED光源灰度值滑动输入栏2、LED光源通道选择栏3、发送数据4、串口开关5、状态栏6和波特率选择栏7。操作者首先通过波特率选择栏7选择串口通信的波特率,通过串口开关5打开上位机的串口,然后通过LED光源通道选择栏3选择LED光源的通道,接着通过LED光源灰度值手动输入栏1或者通过上下滑动滑块输入LED光源灰度值,最后点击发送数据4,这样便可发送数据。另外,操作者可以从状态栏6中得到上位机串口的状态和LED光源通道的序号。As shown in Figure 3, the interface of the host computer software includes LED light source gray value manual input column 1, LED light source gray value sliding input column 2, LED light source channel selection column 3, sending data 4, serial port switch 5, and status column 6 and baud rate selection column 7. The operator first selects the baud rate of the serial port communication through the baud rate selection column 7, opens the serial port of the upper computer through the serial port switch 5, and then selects the channel of the LED light source through the LED light source channel selection column 3, and then manually selects the channel through the gray value of the LED light source. Input column 1 or enter the gray value of the LED light source by sliding the slider up and down, and finally click Send Data 4, so that the data can be sent. In addition, the operator can get the status of the host computer serial port and the serial number of the LED light source channel from the status bar 6 .

如图4所示,嵌入式控制单元程序包括初始化(I/O口初始化、锁相环初始化、红外引脚初始化、串口初始化和脉宽调制初始化)、检测控制指令、解析控制指令和调节PWM波占空比四个部分。首先对嵌入式控制单元的I/O口、锁相环、红外引脚、串口和脉宽调制进行初始化,然后检测串口和红外引脚是否有控制指令的输入。如果没有检测到控制指令的输入,则继续检测是否有控制指令输入;倘若检测到控制指令的输入,则对控制指令进行解码和分析,最后根据分析的结果调节PWM波的占空比。As shown in Figure 4, the embedded control unit program includes initialization (I/O port initialization, phase-locked loop initialization, infrared pin initialization, serial port initialization and pulse width modulation initialization), detection control instructions, analysis control instructions and PWM wave adjustment The duty cycle has four parts. First, initialize the I/O port, phase-locked loop, infrared pin, serial port and pulse width modulation of the embedded control unit, and then detect whether the serial port and infrared pin have control command input. If the input of the control command is not detected, continue to detect whether there is a control command input; if the input of the control command is detected, the control command is decoded and analyzed, and finally the duty cycle of the PWM wave is adjusted according to the analysis result.

相应的LED灰度值调节算法实施步骤如下:The implementation steps of the corresponding LED gray value adjustment algorithm are as follows:

S1设置PWM波为单边沿控制的,在PWM周期的开始时都是高电平,并且每个PWM的周期不变,本发明设置嵌入式控制单元的核心控制芯片LPC2148的PWMMR0寄存器为256,从而输出的PWM波的周期为256个系统时钟周期,其大小由以下公式给出:S1 sets the PWM wave as single edge control, all high level at the beginning of the PWM cycle, and the cycle of each PWM is constant, the present invention sets the PWMMR0 register of the core control chip LPC2148 of the embedded control unit to be 256, thereby The period of the output PWM wave is 256 system clock periods, and its size is given by the following formula:

fcclk表示LPC2148系统时钟频率,n=256,TPWM表示每个PWM的周期;f cclk represents the LPC2148 system clock frequency, n=256, T PWM represents the period of each PWM;

S2将PWM波的周期数字化为256份,通过设置核心控制芯片LPC2148的PWM匹配寄存器来控制每个PWM周期中高电平的时间,在嵌入式控制单元程序中,设置PWMMR2,PWMMR4,PWMMR5,PWMMR6的值,以控制四路PWM波的占空比。PWMMR2,PWMMR4,PWMMR5,PWMMR6的值由以下公式给出:S2 digitizes the cycle of the PWM wave into 256 parts, and controls the high level time in each PWM cycle by setting the PWM matching register of the core control chip LPC2148. In the embedded control unit program, set the PWMR2, PWMMR4, PWMMR5, PWMMR6 value to control the duty cycle of the four PWM waves. The values of PWMMR2, PWMMR4, PWMMR5, PWMMR6 are given by the following formulas:

i=1,2,3,4,5,6;N=0,1,2,3...255。N表示LED光源的灰度值,PWMMRi表示PWM匹配寄存器的值;i=1,2,3,4,5,6; N=0,1,2,3...255. N represents the gray value of the LED light source, and PWMMR i represents the value of the PWM matching register;

S3实现间距为的0~255级占空比调节,从而实现0~255的LED光源灰度值的调节。PWM波的占空比为:S3 achieves a spacing of 0-255 level duty cycle adjustment, so as to realize the adjustment of the gray value of the LED light source from 0-255. The duty cycle of the PWM wave is:

DutyRatio表示占空比;DutyRatio represents the duty cycle;

上式表明了LED光源灰度值与PWM占空比之间的关系,通过间距为的0~255级的占空比调节可以实现0~255的LED光源灰度值的调节。The above formula shows the relationship between the gray value of the LED light source and the PWM duty cycle, and the passing distance is The 0-255 duty ratio adjustment can realize the adjustment of the gray value of the LED light source from 0-255.

操作者可以通过上位机软件发送调节LED光源亮度的控制指令,这些控制指令经过和上位机双向连接的上位机无线串口模块发送,当与嵌入式控制单元双向连接的下位机无线串口模块接收到这些控制指令后,会将其通过URAT口发送给嵌入式控制单元。嵌入式控制单元接收到调节LED光源亮度的控制指令后,经过嵌入式控制单元程序的分析、处理,随后做出相应的响应,即向光源驱动电路输出相应占空比的PWM波,从而调节LED光源的亮度。另外,操作者也可以通过红外遥控按键发送调节LED光源亮度的控制指令,而红外接收电路则负责接收红外遥控按键发送的控制指令,并且将其发送给嵌入式控制单元。嵌入式控制单元程序对接收到的控制指令进行解码、分析和处理之后,输出相应占空比的PWM波给光源驱动电路,进而控制LED光源的亮度。The operator can send control commands to adjust the brightness of the LED light source through the host computer software. These control commands are sent through the wireless serial port module of the host computer bidirectionally connected with the host computer. When the wireless serial port module of the lower computer bidirectionally connected with the embedded control unit receives these After the control command is sent to the embedded control unit through the URAT port. After the embedded control unit receives the control command to adjust the brightness of the LED light source, it analyzes and processes the embedded control unit program, and then makes a corresponding response, that is, outputs a PWM wave with a corresponding duty cycle to the light source driving circuit, thereby adjusting the LED light source. The brightness of the light source. In addition, the operator can also send a control command to adjust the brightness of the LED light source through the infrared remote control button, and the infrared receiving circuit is responsible for receiving the control command sent by the infrared remote control button and sending it to the embedded control unit. After the embedded control unit program decodes, analyzes and processes the received control instructions, it outputs PWM waves with corresponding duty ratios to the light source drive circuit, and then controls the brightness of the LED light source.

本发明采用非接触的方式输入控制指令数据,克服了布线过程的复杂性,同时不受安装环境的限制,在工业检测的安装使用过程中更加灵活。The invention adopts a non-contact way to input control instruction data, overcomes the complexity of the wiring process, is not limited by the installation environment, and is more flexible in the installation and use process of industrial detection.

Claims (8)

1.一种数字化无线LED光源控制器,其特征在于,包括软件部分和硬件部分;1. A digital wireless LED light source controller, characterized in that it comprises a software part and a hardware part; 所述硬件部分包括上位机、无线串口通信模块、嵌入式控制单元、光源驱动电路、LED光源、显示模块和供电电源模块;所述上位机通过无线串口通信模块与嵌入式控制单元双向连接,用于发送指令和接收数据;所述嵌入式控制单元通过光源驱动电路与LED光源连接,利用PWM控制技术调节LED光源的亮度;所述显示模块由数码管显示电路构成,与嵌入式控制单元连接,用于显示出通道序号和LED光源的亮度值;所述供电电源模块分别与无线串口通信模块、嵌入式控制单元、光源驱动电路、显示模块连接,提供稳定电源;The hardware part includes an upper computer, a wireless serial communication module, an embedded control unit, a light source driving circuit, an LED light source, a display module and a power supply module; the upper computer is bidirectionally connected with the embedded control unit through the wireless serial communication module, For sending instructions and receiving data; the embedded control unit is connected with the LED light source through the light source driving circuit, and uses PWM control technology to adjust the brightness of the LED light source; the display module is composed of a digital tube display circuit, connected with the embedded control unit, It is used to display the channel number and the brightness value of the LED light source; the power supply module is respectively connected with the wireless serial communication module, the embedded control unit, the light source driving circuit, and the display module to provide a stable power supply; 所述软件部分包括上位机软件,嵌入式控制单元程序和LED灰度值调节算法;所述上位机软件用于选择LED光源通道,发送调节LED光源亮度的控制指令;所述嵌入式控制单元程序用于分析、处理接收到的控制指令,然后根据处理的结果调节PWM波的占空比,从而调节LED光源的亮度;所述LED灰度值调节算法,是利用LED光源灰度值与PWM占空比之间的关系,通过间距划分多级的占空比调节可以实现LED光源灰度值的调节;The software part includes host computer software, an embedded control unit program and an LED gray value adjustment algorithm; the host computer software is used to select the LED light source channel and send a control command for adjusting the brightness of the LED light source; the embedded control unit program It is used to analyze and process the received control command, and then adjust the duty cycle of the PWM wave according to the processing result, thereby adjusting the brightness of the LED light source; the LED gray value adjustment algorithm is to use the gray value of the LED light source and the PWM duty cycle The relationship between the duty ratio, the adjustment of the gray value of the LED light source can be realized by dividing the multi-level duty ratio by the spacing; 所述嵌入式控制单元采用LPC2148芯片作为核心控制芯片,所述LED灰度值调节算法包括如下步骤:The embedded control unit adopts the LPC2148 chip as the core control chip, and the LED gray value adjustment algorithm includes the following steps: S1设置PWM波为单边沿控制的,在PWM周期的开始时都是高电平,并且每个PWM的周期不变,周期大小由以下公式给出:S1 sets the PWM wave to be controlled by a single edge. It is high at the beginning of the PWM cycle, and the cycle of each PWM is constant. The cycle size is given by the following formula: <mrow> <msub> <mi>T</mi> <mrow> <mi>P</mi> <mi>W</mi> <mi>M</mi> </mrow> </msub> <mo>=</mo> <mi>n</mi> <mo>&amp;times;</mo> <mfrac> <mn>1</mn> <msub> <mi>f</mi> <mrow> <mi>c</mi> <mi>c</mi> <mi>l</mi> <mi>k</mi> </mrow> </msub> </mfrac> </mrow> <mrow><msub><mi>T</mi><mrow><mi>P</mi><mi>W</mi><mi>M</mi></mrow></msub><mo>=</mo><mi>n</mi><mo>&amp;times;</mo><mfrac><mn>1</mn><msub><mi>f</mi><mrow><mi>c</mi><mi>c</mi><mi>l</mi><mi>k</mi></mrow></msub></mfrac></mrow> fcclk表示LPC2148芯片的系统时钟频率,n表示核心控制芯片LPC2148的PWMMR0寄存器的值,TPWM表示每个PWM的周期;f cclk represents the system clock frequency of the LPC2148 chip, n represents the value of the PWMMR0 register of the core control chip LPC2148, and T PWM represents the cycle of each PWM; S2将PWM波的周期数字化为256份,通过设置核心控制芯片LPC2148的PWM匹配寄存器来控制每个PWM周期中高电平的时间,在嵌入式控制单元程序中,PWM匹配寄存器的值由以下公式给出:S2 digitizes the cycle of the PWM wave into 256 parts, and controls the high level time in each PWM cycle by setting the PWM matching register of the core control chip LPC2148. In the embedded control unit program, the value of the PWM matching register is given by the following formula out: <mrow> <msub> <mi>PWMMR</mi> <mi>i</mi> </msub> <mo>=</mo> <mfrac> <mrow> <mi>P</mi> <mi>W</mi> <mi>M</mi> <mi>M</mi> <mi>R</mi> <mn>0</mn> </mrow> <mn>256</mn> </mfrac> <mo>&amp;times;</mo> <mi>N</mi> </mrow> <mrow><msub><mi>PWMMR</mi><mi>i</mi></msub><mo>=</mo><mfrac><mrow><mi>P</mi><mi>W</mi><mi>M</mi><mi>M</mi><mi>R</mi><mn>0</mn></mrow><mn>256</mn></mfrac><mo>&amp;times;</mo><mi>N</mi></mrow> i=1,2,3,4,5,6;N=0,1,2,3...255,N表示LED光源的灰度值,PWMMRi表示PWM匹配寄存器的值;i=1,2,3,4,5,6; N=0,1,2,3...255, N represents the gray value of the LED light source, PWMMR i represents the value of the PWM matching register; S3实现间距为的0~255级占空比调节,从而实现0~255的LED光源灰度值的调节,PWM波的占空比为:S3 achieves a spacing of 0-255 level duty cycle adjustment, so as to realize the adjustment of the gray value of the LED light source from 0-255, the duty cycle of the PWM wave is: <mrow> <mi>D</mi> <mi>u</mi> <mi>t</mi> <mi>y</mi> <mi>R</mi> <mi>a</mi> <mi>t</mi> <mi>i</mi> <mi>o</mi> <mo>=</mo> <mfrac> <mrow> <msub> <mi>PWMMR</mi> <mi>i</mi> </msub> </mrow> <mrow> <mi>P</mi> <mi>W</mi> <mi>M</mi> <mi>M</mi> <mi>R</mi> <mn>0</mn> </mrow> </mfrac> <mo>=</mo> <mfrac> <mi>N</mi> <mn>256</mn> </mfrac> </mrow> <mrow><mi>D</mi><mi>u</mi><mi>t</mi><mi>y</mi><mi>R</mi><mi>a</mi>><mi>t</mi><mi>i</mi><mi>o</mi><mo>=</mo><mfrac><mrow><msub><mi>PWMMR</mi><mi>i</mi></msub></mrow><mrow><mi>P</mi><mi>W</mi><mi>M</mi><mi>M</mi><mi>R</mi><mn>0</mn></mrow></mfrac><mo>=</mo><mfrac><mi>N</mi><mn>256</mn></mfrac></mrow> DutyRatio表示占空比。DutyRatio represents the duty cycle. 2.根据权利要求1所述的光源控制器,其特征在于,所述硬件部分还包括红外控制模块,红外控制模块分为红外遥控按键和红外接收电路,所述红外接收电路与嵌入式控制单元连接,红外遥控按键用于发送指令,红外接收电路用于接收指令并发送给嵌入式控制单元。2. The light source controller according to claim 1, wherein the hardware part also includes an infrared control module, the infrared control module is divided into an infrared remote control button and an infrared receiving circuit, and the infrared receiving circuit and the embedded control unit connection, the infrared remote control button is used to send instructions, and the infrared receiving circuit is used to receive instructions and send them to the embedded control unit. 3.根据权利要求1所述的光源控制器,其特征在于,所述上位机软件包括界面初始化、串口初始化、选择LED光源通道和发送控制指令四个部分。3. The light source controller according to claim 1, wherein the host computer software includes four parts: interface initialization, serial port initialization, LED light source channel selection and control instruction sending. 4.根据权利要求1所述的光源控制器,其特征在于,所述嵌入式控制单元程序包括设备初始化,检测控制指令、解析控制指令和调节PWM波占空比四个部分,设备初始化包括I/O口初始化、锁相环初始化、红外引脚初始化、串口初始化和脉宽调制初始化。4. light source controller according to claim 1, is characterized in that, described embedded control unit program comprises device initialization, detects control instruction, resolves control instruction and regulates four parts of PWM wave duty cycle, and device initialization comprises I /O port initialization, PLL initialization, infrared pin initialization, serial port initialization and pulse width modulation initialization. 5.根据权利要求1所述的光源控制器,其特征在于,所述LED光源有四路,光源驱动电路包含四通道的驱动电路。5 . The light source controller according to claim 1 , wherein the LED light source has four channels, and the light source driving circuit includes a four-channel driving circuit. 6.根据权利要求1所述的光源控制器,其特征在于,所述无线串口通信模块分为上位机无线串口模块和下位机无线串口模块,上位机无线串口模块与上位机之间双向连接,下位机无线串口模块与嵌入式控制单元的串口之间双向连接,从而实现上位机和嵌入式控制单元之间数据的双向通信。6. The light source controller according to claim 1, wherein the wireless serial port communication module is divided into an upper computer wireless serial port module and a lower computer wireless serial port module, and the upper computer wireless serial port module and the upper computer are bidirectionally connected, The wireless serial port module of the lower computer is bidirectionally connected with the serial port of the embedded control unit, so as to realize the bidirectional communication of data between the upper computer and the embedded control unit. 7.根据权利要求1所述的光源控制器,其特征在于,所述嵌入式控制单元采用LPC2148芯片作为核心控制芯片,其输出的PWM波的频率最高达到105数量级。7 . The light source controller according to claim 1 , wherein the embedded control unit uses an LPC2148 chip as the core control chip, and the frequency of the PWM wave output by it is up to an order of magnitude of 10 5 . 8.根据权利要求1所述的光源控制器,其特征在于,所述光源驱动电路包含高频开关电路。8. The light source controller according to claim 1, wherein the light source driving circuit comprises a high frequency switching circuit.
CN201610497684.XA 2016-06-27 2016-06-27 A kind of digital radio LED light source controller Expired - Fee Related CN106132000B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610497684.XA CN106132000B (en) 2016-06-27 2016-06-27 A kind of digital radio LED light source controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610497684.XA CN106132000B (en) 2016-06-27 2016-06-27 A kind of digital radio LED light source controller

Publications (2)

Publication Number Publication Date
CN106132000A CN106132000A (en) 2016-11-16
CN106132000B true CN106132000B (en) 2018-04-24

Family

ID=57285441

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610497684.XA Expired - Fee Related CN106132000B (en) 2016-06-27 2016-06-27 A kind of digital radio LED light source controller

Country Status (1)

Country Link
CN (1) CN106132000B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106604457B (en) * 2016-12-06 2018-01-05 中国船舶重工集团公司第七0五研究所 Underwater lamp dynamic brightness control system and method based on ambient light detection
CN110189729A (en) * 2019-05-20 2019-08-30 汕头大学 An intelligent teaching guitar
CN110519892A (en) * 2019-09-27 2019-11-29 中山新驱动电子科技有限公司 A kind of control method and system of ZigBee-network
CN111010763B (en) * 2019-11-29 2021-06-25 广州市雅江光电设备有限公司 Dimming method of high-power LED constant current driving device
CN110996441B (en) * 2019-11-29 2021-06-25 广州市雅江光电设备有限公司 Dimming method of LED driving device
CN112867202A (en) * 2020-12-21 2021-05-28 陕西省计量科学研究院 Automatic linkage adjusting and controlling device for brightness of transient standard light source
CN114050810A (en) * 2022-01-13 2022-02-15 武汉通力路达科技有限公司 PWM waveform generation method, device, embedded equipment and storage medium
CN115460729A (en) * 2022-10-10 2022-12-09 深圳市升宏光电科技有限公司 A method and system for controlling multiple LED light sources based on a light source controller

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010054989A (en) * 2008-08-29 2010-03-11 Mitsubishi Electric Corp Gradation control method and display device
CN202425120U (en) * 2011-12-20 2012-09-05 比亚迪股份有限公司 LED color-changing lamp
CN202884837U (en) * 2012-09-18 2013-04-17 深圳市科创新时代电子有限公司 High-power mini light-emitting diode (LED) light-source controller
CN202889708U (en) * 2012-09-18 2013-04-17 深圳市科创新时代电子有限公司 Light controller based on embedded system

Also Published As

Publication number Publication date
CN106132000A (en) 2016-11-16

Similar Documents

Publication Publication Date Title
CN106132000B (en) A kind of digital radio LED light source controller
KR100308681B1 (en) Flat panel display terminal
EP3901943A1 (en) Mini led television control system and method
US9513718B2 (en) User action remote control
CN105976770B (en) A kind of method, apparatus and system of control dim signal
CN103413536B (en) display energy-saving control method
WO2017096665A1 (en) Backlight driver circuit, liquid crystal display and backlight adjusting method
CN110930914B (en) A signal detection circuit, a signal detection method and a display device
CN104575345A (en) OLED module test system and test method
CN103760964A (en) Method and device for adjusting and controlling equipment sleep through infrared induction
WO2019080205A1 (en) Apparatus and method for controlling brightness of light-emitting diode light source
WO2019080206A1 (en) Apparatus and method for controlling brightness of light-emitting diode light source
CN100468511C (en) Liquid crystal display and its refresh rate adjustment method
CN111511083A (en) Visual control method, system, storage medium, computer program, and controller
CN202771771U (en) Time schedule controller and digital display
CN107527594B (en) Pulse signal adjusting circuit and backlight driving circuit of liquid crystal display screen
CN104133309A (en) System and method for detecting LCD module
CN104184954A (en) Optical detection device and synchronous adjustment method thereof
CN103970476B (en) Screen touch method and system
CN105491756B (en) LED light light regulation method
CN205074251U (en) Embedded pearl sorter based on image recognition
CN103973857A (en) Mobile phone calibration device, system and method
CN105611696B (en) Intelligent House Light energy-saving monitoring method
CN207935111U (en) A kind of intelligent electric fan with efficient regulating power
CN208638246U (en) A kind of stepless-adjustment nodal pattern PWM wave signal driving instrument

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20180424

Termination date: 20200627

CF01 Termination of patent right due to non-payment of annual fee