CN110868566A - Wireless video transmission method for transformer internal inspection robot - Google Patents

Wireless video transmission method for transformer internal inspection robot Download PDF

Info

Publication number
CN110868566A
CN110868566A CN201911037447.5A CN201911037447A CN110868566A CN 110868566 A CN110868566 A CN 110868566A CN 201911037447 A CN201911037447 A CN 201911037447A CN 110868566 A CN110868566 A CN 110868566A
Authority
CN
China
Prior art keywords
data
counter
camera
subprogram
module
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.)
Pending
Application number
CN201911037447.5A
Other languages
Chinese (zh)
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.)
Heibei University
Original Assignee
Heibei 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 Heibei University filed Critical Heibei University
Priority to CN201911037447.5A priority Critical patent/CN110868566A/en
Publication of CN110868566A publication Critical patent/CN110868566A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/18Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0893Caches characterised by their organisation or structure
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/28Handling requests for interconnection or transfer for access to input/output bus using burst mode transfer, e.g. direct memory access DMA, cycle steal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Multimedia (AREA)
  • Closed-Circuit Television Systems (AREA)

Abstract

The invention relates to a wireless video transmission method of a transformer internal inspection robot. The embedded technology is combined with the Internet of things technology, and the wireless video transmission under the complex condition is realized by utilizing the MICO Internet of things real-time operating system. The modular design is adopted, the data acquisition terminal is divided into an upper computer control terminal and a lower computer data acquisition terminal, the lower computer is used for acquiring, processing and transmitting video data, and the upper computer is used for receiving and displaying videos. The invention uses DAM double-buffer mode to buffer data, realizes the parallel operation of data acquisition and output, and greatly reduces the load of the processor. The invention can realize wireless real-time transmission of image video information in the closed environment under the closed metal shielding environment.

Description

一种变压器内检机器人无线视频传输方法A wireless video transmission method for transformer internal inspection robot

技术领域technical field

本发明涉及一种视频传输方法,具体地说是一种变压器内检机器人无线视频传输方法。The invention relates to a video transmission method, in particular to a wireless video transmission method of a transformer internal inspection robot.

背景技术Background technique

在当今电力设备的运行和维护中,变压器不仅属于电力系统中最重要的和最昂贵的设备之一,而且也是导致电力系统出现事故较多的设备之一,它的可靠性直接关系到电网能否安全、高效、经济的运行。根据大型电力变压器的检修规程要求,每5年需要进行一次吊罩检修,采取吊罩拆箱的内检方法有着发现故障准确彻底的优点,但存在现场内检费用非常高且工期长等缺点。如果能够实现不进行吊罩拆箱也能获得变压器内部的有用信息,则是变压器检修的革命性变化。由于变压器内部环境复杂,容器内部具有很好的密闭性,传统的有线传输方式将难以实现,这就导致了变压器内检机器人在变压器内部采集得到的信息尤其是视频信息将难以传输到外界环境。In the operation and maintenance of today's power equipment, the transformer is not only one of the most important and expensive equipment in the power system, but also one of the equipment that causes many accidents in the power system. Its reliability is directly related to the power grid energy. safe, efficient and economical operation. According to the requirements of the maintenance procedures for large power transformers, it is necessary to carry out hood maintenance every 5 years. The internal inspection method of unpacking the hood has the advantages of accurate and thorough fault detection, but there are disadvantages such as very high on-site internal inspection costs and long construction period. If it is possible to obtain useful information inside the transformer without unpacking the hood, it will be a revolutionary change in transformer maintenance. Due to the complex internal environment of the transformer and the good airtightness inside the container, the traditional wired transmission method will be difficult to achieve, which makes it difficult to transmit the information collected by the transformer internal inspection robot inside the transformer, especially the video information, to the external environment.

如何将变压器内部的内检机器人采集得到的视频信息传输到外界环境中,是一个亟需解决的关键问题。How to transmit the video information collected by the internal inspection robot inside the transformer to the external environment is a key problem that needs to be solved urgently.

发明内容SUMMARY OF THE INVENTION

本发明的目的就是提供一种变压器内检机器人无线视频传输方法,以解决变压器内检机器人在变压器内部采集得到的视频信息难以传输到外界环境的问题。The purpose of the present invention is to provide a wireless video transmission method for a transformer internal inspection robot, so as to solve the problem that the video information collected by the transformer internal inspection robot inside the transformer is difficult to transmit to the external environment.

本发明是这样实现的:一种变压器内检机器人无线视频传输方法,包括以下步骤:The present invention is realized as follows: a wireless video transmission method for a transformer internal inspection robot, comprising the following steps:

a.在变压器内设置内检机器人,并在内检机器人上设置下位机,在变压器外部设置上位机以及与上位机相连接的路由器,下位机包括核心控制器、图像采集模块、无线传输模块、电源模块、下位存储模块以及SDRAM模块,上位机包括控制模块、显示模块以及上位存储模块;a. Set up an internal inspection robot in the transformer, and set a lower computer on the internal inspection robot, and set up an upper computer and a router connected to the upper computer outside the transformer. The lower computer includes a core controller, an image acquisition module, a wireless transmission module, The power supply module, the lower memory module and the SDRAM module, and the upper computer includes a control module, a display module and an upper memory module;

b.将MICO系统移植到下位机的核心控制器中;b. Transplant the MICO system to the core controller of the lower computer;

c.对MICO系统进行初始化,并进入主程序循环;c. Initialize the MICO system and enter the main program loop;

d.调用子程序对SDRAM进行初始化;d. Call the subroutine to initialize the SDRAM;

e.调用子程序进行无线网络连接,使下位机的无线传输模块与路由器相连接,;e. Call the subroutine to connect the wireless network, so that the wireless transmission module of the lower computer is connected to the router;

f.调用子程序为图像采集模块准备数据缓存的内存空间,在SDRAM上设置数据缓存区,并将该数据缓存区分为两个缓存区;f. Call the subroutine to prepare the memory space of the data cache for the image acquisition module, set the data cache area on the SDRAM, and divide the data cache area into two cache areas;

g.调用子程序对图像采集模块进行初始化,打开摄像头开始图像采集;g. Call the subroutine to initialize the image acquisition module, and turn on the camera to start image acquisition;

h.调用子程序创建TCP服务线程,并等待上位机控制模块通过路由器与下位机相连接;h. Call the subroutine to create a TCP service thread, and wait for the upper computer control module to connect with the lower computer through the router;

i.上位机与下位机相连接,数据缓存区开启DAM双缓存模式对来自图像采集模块的图像数据流进行缓存,并开始进行视频传输。i. The upper computer is connected to the lower computer, and the data buffer area opens the DAM double buffer mode to buffer the image data stream from the image acquisition module, and starts video transmission.

在每个子程序调用完毕后都对子程序返回是否错误进行判断,如果子程序返回错误,则通过串口输出状态信息,若子程序返回没有错误,则调用下一个子程序;在创建TCP服务线程子程序中,若返回正确,则通过串口输出TCP服务的IP地址和端口号,同时等待上位机连接。After each subroutine is called, it is judged whether the subroutine returns an error. If the subroutine returns an error, the status information is output through the serial port. If the subroutine returns no error, the next subroutine is called; when creating a TCP service thread subroutine , if the return is correct, the IP address and port number of the TCP service will be output through the serial port, while waiting for the host computer to connect.

步骤f中划分的两个缓存区分别为第一缓存区和第二缓存区;在步骤i中,开始视频传输后,首先使用第一缓存区存储数据,当第一缓存区填充满后,DMA切换到第二缓存区,使用第二缓存区存储数据,此时,核心控制器的CPU读取第一缓存区中的数据,并通过无线网络将数据传输到上位机;当第二缓存区填充满后,DMA切换到第一缓存区,使用第一缓存区储存数据,核心控制器的CPU读取第二缓存区中的数据,并通过无线网络将数据传输到上位机;不断重复上述过程,直到完成视频传输任务。The two buffer areas divided in step f are the first buffer area and the second buffer area respectively; in step i, after video transmission is started, the first buffer area is first used to store data, and when the first buffer area is full, the DMA Switch to the second buffer area and use the second buffer area to store data. At this time, the CPU of the core controller reads the data in the first buffer area and transmits the data to the upper computer through the wireless network; when the second buffer area is filled After it is full, the DMA switches to the first buffer area, uses the first buffer area to store data, the CPU of the core controller reads the data in the second buffer area, and transmits the data to the upper computer through the wireless network; repeat the above process continuously, until the video transfer task is completed.

在步骤e中,由主程序调用WIFI连接网络连接子程序,读取外接FLASH中预设的参数值,包括路由器名称和网络连接密码,初始化WLAN参数和网络协议栈,然后进行网络连接,并判断是否连接成功,如果连接成功,将获取终端在当前网络的IP和端口号,并通过串口的透传模块上传到上位机,如果连接失败,通过串口输出连接失败的信息。In step e, the main program calls the WIFI connection network connection subroutine, reads the preset parameter values in the external FLASH, including the router name and network connection password, initializes the WLAN parameters and network protocol stack, and then performs network connection, and judges Whether the connection is successful, if the connection is successful, the IP and port number of the terminal in the current network will be obtained, and uploaded to the host computer through the serial port transparent transmission module. If the connection fails, the connection failure information will be output through the serial port.

在步骤g中,首先调用摄像头子程序打开摄像头,配置中断、DMA、DCMI相关初始化参数设置,配置摄像头参数,然后重启摄像头并读取摄像头ID,判断是否读取成功,如果失败则输出错误信息,如果成功则配置摄像头输出数据的格式以及输出图像的分辨率,将核心控制器的DCMI摄像头接口设置为与摄像头输出相同的格式,接收摄像头传来的数据,开启DCMI连续捕获图像功能,使能DCMI接口,完成视频流的传输准备。In step g, first call the camera subroutine to open the camera, configure interrupt, DMA, DCMI related initialization parameter settings, configure the camera parameters, then restart the camera and read the camera ID to determine whether the reading is successful, if it fails, output an error message, If successful, configure the format of the camera output data and the resolution of the output image, set the DCMI camera interface of the core controller to the same format as the camera output, receive the data from the camera, enable the DCMI continuous image capture function, and enable the DCMI interface to complete the transmission preparation of the video stream.

DAM的数据填充算法如下:The data filling algorithm of DAM is as follows:

设置DMA计数器装载次数为1,根据DMA一次传输的字节数计算填满缓存区所需计数器初值,如果所需计数器初值小于等于计数器的阈值,则装载一次计数器即可填满缓存区,如果所需计数器初值超过计数器阈值,则将所需计数器初值除以2,装载次数乘以2,将将所需计数器初值除以2得到的新的计数器初值与计数器阈值比较,不断重复上述过程直到计数器初值小于或等于计数器阈值为止。Set the loading times of the DMA counter to 1, and calculate the initial value of the counter required to fill the buffer area according to the number of bytes transferred by DMA at a time. If the initial value of the required counter is less than or equal to the threshold value of the counter, the buffer area can be filled by loading the counter once. If the initial value of the required counter exceeds the counter threshold, divide the initial value of the required counter by 2, multiply the number of loading times by 2, and compare the new initial value of the counter obtained by dividing the initial value of the required counter by 2 with the counter threshold, and continuously Repeat the above process until the initial value of the counter is less than or equal to the counter threshold.

本发明通过内检机器人进入变压器内部进行图像采集与处理,然后将数据通过无线网络传输到上位机,上位机将下位机采集到的图像信息显示出来,从而实现变压器内部视频的无线实时传输。将嵌入式技术与物联网技术相结合,利用MICO物联网实时操作系统实现在复杂情况下的无线视频传输。采用模块化设计,分为上位机控制端和下位机数据采集端,实现了下位机进行视频数据的采集、处理与传输,上位机进行视频的接收与显示。为了保证MICO系统在核心控制器上能够稳定运行,外扩了一枚SDRAM芯片。本发明使用DAM双缓存模式缓存数据,DAM负责填充数据缓存区,CPU负责网络数据传输,实现数据采集和输出的并行操作,大大减小了处理器的负荷。In the invention, the internal inspection robot enters the inside of the transformer for image acquisition and processing, and then the data is transmitted to the upper computer through the wireless network, and the upper computer displays the image information collected by the lower computer, thereby realizing the wireless real-time transmission of the internal video of the transformer. Combining embedded technology with Internet of Things technology, using MICO Internet of Things real-time operating system to achieve wireless video transmission in complex situations. The modular design is adopted, which is divided into the upper computer control terminal and the lower computer data acquisition terminal, which realizes the collection, processing and transmission of video data by the lower computer, and the reception and display of the video by the upper computer. In order to ensure that the MICO system can run stably on the core controller, an external SDRAM chip is expanded. The invention uses the DAM double buffer mode to buffer data, the DAM is responsible for filling the data buffer area, the CPU is responsible for network data transmission, realizes the parallel operation of data acquisition and output, and greatly reduces the load of the processor.

本发明能够在密闭金属屏蔽环境下实现对密闭环境内的图像视频信息的无线实时传输。The invention can realize wireless real-time transmission of image and video information in the closed environment under the closed metal shielding environment.

附图说明Description of drawings

图1是本发明视频传输系统的示意图。FIG. 1 is a schematic diagram of a video transmission system of the present invention.

图2是本发明的视频传输流程图。FIG. 2 is a flow chart of the video transmission of the present invention.

图3是本发明网络连接的流程图。FIG. 3 is a flow chart of the network connection of the present invention.

图4是本发明图像采集的流程图。Fig. 4 is a flow chart of the image acquisition of the present invention.

图5是本发明TCP传输服务流程图。FIG. 5 is a flow chart of the TCP transmission service of the present invention.

图6是本发明DMA双缓存模式的流程图。FIG. 6 is a flow chart of the DMA double buffer mode of the present invention.

图7是本发明DMA数据填充算法的流程图。FIG. 7 is a flow chart of the DMA data filling algorithm of the present invention.

具体实施方式Detailed ways

本发明包括以下步骤:The present invention includes the following steps:

a.在变压器内设置内检机器人,并在内检机器人上设置下位机,在变压器外部设置上位机以及与上位机相连接的路由器,下位机包括核心控制器、图像采集模块、无线传输模块、电源模块、下位存储模块以及SDRAM模块,上位机包括控制模块、显示模块以及上位存储模块;a. Set up an internal inspection robot in the transformer, and set a lower computer on the internal inspection robot, and set up an upper computer and a router connected to the upper computer outside the transformer. The lower computer includes a core controller, an image acquisition module, a wireless transmission module, The power supply module, the lower memory module and the SDRAM module, and the upper computer includes a control module, a display module and an upper memory module;

b.将MICO系统移植到下位机的核心控制器中;b. Transplant the MICO system to the core controller of the lower computer;

c.对MICO系统进行初始化,并进入主程序循环;c. Initialize the MICO system and enter the main program loop;

d.调用子程序对SDRAM进行初始化;d. Call the subroutine to initialize the SDRAM;

e.调用子程序进行无线网络连接,使下位机的无线传输模块与路由器相连接,;e. Call the subroutine to connect the wireless network, so that the wireless transmission module of the lower computer is connected to the router;

f.调用子程序为图像采集模块准备数据缓存的内存空间,在SDRAM上设置数据缓存区,并将该数据缓存区分为两个缓存区;f. Call the subroutine to prepare the memory space of the data cache for the image acquisition module, set the data cache area on the SDRAM, and divide the data cache area into two cache areas;

g.调用子程序对图像采集模块进行初始化,打开摄像头开始图像采集;g. Call the subroutine to initialize the image acquisition module, and turn on the camera to start image acquisition;

h.调用子程序创建TCP服务线程,并等待上位机控制模块通过路由器与下位机相连接;h. Call the subroutine to create a TCP service thread, and wait for the upper computer control module to connect with the lower computer through the router;

i.上位机与下位机相连接,数据缓存区开启DAM双缓存模式对来自图像采集模块的图像数据流进行缓存,并开始进行视频传输。i. The upper computer is connected to the lower computer, and the data buffer area opens the DAM double buffer mode to buffer the image data stream from the image acquisition module, and starts video transmission.

如图1所示,本发明首先提出了一种变压器内检机器人视频传输系统,该系统包括上位机、下位机以及路由器。上位机为无线传输系统的软件空控制中心,对下位机终端传输来的视频数据进行解算。下位机为视频采集终端,与上位机之间无线连接,实时检测变压器内部环境并将视频信息传输到上位机,从而实现对变压器内部的检查。As shown in FIG. 1 , the present invention first proposes a video transmission system for a transformer internal inspection robot, which includes an upper computer, a lower computer and a router. The upper computer is the software air control center of the wireless transmission system, and it solves the video data transmitted from the lower computer terminal. The lower computer is a video acquisition terminal, which is wirelessly connected to the upper computer, detects the internal environment of the transformer in real time and transmits the video information to the upper computer, so as to realize the inspection of the inside of the transformer.

其中,上位机包括:Among them, the host computer includes:

控制模块,负责上位机与下位机建立连接并接收下位机返回的状况信息;The control module is responsible for establishing the connection between the upper computer and the lower computer and receiving the status information returned by the lower computer;

显示模块,对下位机传输过来的视频信息进行实时的显示;The display module displays the video information transmitted from the lower computer in real time;

上位存储模块,对接收到的信息进行存储。The upper storage module stores the received information.

下位机包括:The lower computer includes:

核心控制器,具体采用STM32F429IGT6单片机,负责驱动图像采集模块进行图像采集和处理;The core controller, specifically using STM32F429IGT6 single-chip microcomputer, is responsible for driving the image acquisition module for image acquisition and processing;

图像采集模块,通过STM32F4系列单片机特有的DAMI接口与核心控制器连接,实时采集变压器内部环境的图像信息;The image acquisition module is connected to the core controller through the unique DAMI interface of the STM32F4 series single-chip microcomputer, and collects the image information of the internal environment of the transformer in real time;

无线传输模块,通过SDIO接口与主控芯片连接,用于上位机与下位机进行远程数据传输通信;The wireless transmission module is connected to the main control chip through the SDIO interface, which is used for remote data transmission and communication between the upper computer and the lower computer;

电源模块,包括转换模块,为核心控制器、无线传输模块以及图像采集模块供电;The power module, including the conversion module, supplies power to the core controller, the wireless transmission module and the image acquisition module;

SDRAM模块,为STM32F4系列单片机外扩一枚SDRAM芯片,用于数据的缓存,具体型号为IS42S16400J。The SDRAM module is an external expansion of an SDRAM chip for the STM32F4 series single-chip microcomputer, which is used for data cache. The specific model is IS42S16400J.

本发明无线传输模块选用的是SDIO接口的WIFI模块,传统的WIFI模块采用串口转WIFI的数据传输方式,其速度只有普通串口的传输速度,适用于数据少,实时性低的场合,而SDIO接口的WIFI模块数据传输速度最高可达24MB,满足视频传输速度的要求。The wireless transmission module of the present invention selects the WIFI module with SDIO interface. The traditional WIFI module adopts the data transmission method of serial port to WIFI, and its speed is only the transmission speed of ordinary serial port, which is suitable for occasions with less data and low real-time performance, while SDIO interface The data transmission speed of the WIFI module can reach up to 24MB, which meets the requirements of video transmission speed.

本发明使用的是MICO物联网实时操作系统,需要先在变压器内检机器人视频传输系统上移植MICO系统,具体步骤如下:The invention uses the MICO Internet of Things real-time operating system, and needs to transplant the MICO system on the transformer internal inspection robot video transmission system first, and the specific steps are as follows:

步骤1,进行准备工作,准备MiCOKit套件、Keil5开发软件以及相关硬件设备;Step 1, do the preparatory work, prepare MiCOKit kit, Keil5 development software and related hardware equipment;

步骤2,对存储空间进行分配,将FLASH划分为BootLoader区、Application区以及RF固件区;Step 2, allocate storage space, divide FLASH into BootLoader area, Application area and RF firmware area;

步骤3,移植BootLoader,在MiCOKit里添加一个新硬件平台,根据下位机终端硬件参数修改对应代码使BootLoader与我们终端硬件相匹配;Step 3, transplant BootLoader, add a new hardware platform in MiCOKit, and modify the corresponding code according to the hardware parameters of the lower computer terminal to make BootLoader match our terminal hardware;

步骤4,移植Application,根据实际应用来选择移植的应用程序,移植Application和新建工程类似,包括创建文件、芯片选型、头文件路径选择、FLASH存储空间分配等相关参数配置。Step 4: Transplant the Application, and select the transplanted application according to the actual application. The transplanted Application is similar to a new project, including the configuration of related parameters such as file creation, chip selection, header file path selection, and FLASH storage space allocation.

如图2所示,本发明的传输方法主要包括:As shown in Figure 2, the transmission method of the present invention mainly includes:

步骤1,下位机终端上电后,在主控芯片的控制下完成对MiCO系统、外设等外接设行初始化,主要包括SPI、SDIO、USART、看门狗的配置;Step 1. After the lower computer terminal is powered on, the initialization of the MiCO system, peripherals and other external devices is completed under the control of the main control chip, mainly including the configuration of SPI, SDIO, USART, and watchdog;

步骤2,初始化完成后,系统进入主程序循环,对SDRAM进行初始化,通过MiCO系统提供的API子程序判断SDRAM初始化是否正常,如果子程序初始化出现错误,主程序通过串口输出相关信息;Step 2: After the initialization is completed, the system enters the main program loop, initializes the SDRAM, and judges whether the SDRAM initialization is normal through the API subroutine provided by the MiCO system. If the subroutine initialization error occurs, the main program outputs the relevant information through the serial port;

步骤3,SDRAM初始化完成后,然后通过子程序返回值判断是WIFI芯片是否已经连接到指定的无线网络,不管设备是否成功连接到路由器,串口都将输出连接状态的相关信息;Step 3, after the SDRAM initialization is completed, and then determine whether the WIFI chip has been connected to the specified wireless network through the return value of the subroutine, no matter whether the device is successfully connected to the router, the serial port will output the relevant information of the connection status;

步骤4,为摄像头准备数据缓存的内存空间,建立两个数据缓冲数组并清空缓存,获取缓存区地址以便后续写入视频流数据;Step 4, prepare the memory space of the data cache for the camera, establish two data buffer arrays and clear the cache, and obtain the address of the cache area for subsequent writing of video stream data;

步骤5,调用子程序对摄像头初始化,其中包括摄像头接口初始化、配置摄像头输出格式等相关参数设置。In step 5, the subroutine is called to initialize the camera, including initialization of the camera interface, configuration of the camera output format and other related parameter settings.

步骤6,创建TCP服务线程,主程序判断子程序是否有错误,如果有错误串口输出错误信息,如果没有错误主程序串口输出TCP服务的IP地址和端口号。此时下位机终端便成了一个TCP服务器等待远程用户即上位机控制端的连接并提供视频传输服务。Step 6, create a TCP service thread, the main program judges whether there is an error in the subroutine, if there is an error, the serial port outputs an error message, if there is no error, the main program serial port outputs the IP address and port number of the TCP service. At this time, the lower computer terminal becomes a TCP server waiting for the connection of the remote user, that is, the upper computer control terminal, and provides video transmission services.

主程序运行过程中,在每个子程序调用完毕后都对子程序返回是否错误进行判断,如果子程序返回错误,则通过串口输出状态信息,若子程序返回没有错误,则调用下一个子程序。During the running process of the main program, after each subprogram is called, it is judged whether the subprogram returns an error. If the subprogram returns an error, the status information is output through the serial port. If the subprogram returns without error, the next subprogram is called.

如图3所示,本发明的网络连接流程如下:As shown in Figure 3, the network connection process of the present invention is as follows:

步骤1,下位机控制主程序调用WIFI网络连接子程序,创建一个结构体数组用来存储无线网络连接所需的参数;Step 1, the lower computer control main program calls the WIFI network connection subroutine to create a structure array to store the parameters required for the wireless network connection;

步骤2,读取外部FLASH的预设参数值,包括路由器名称和网络连接密码;Step 2, read the preset parameter value of external FLASH, including router name and network connection password;

步骤3,初始化WLAN参数,设置WIFI芯片相关参数包括,信道选择、安全模式、station或AP模式以及连接失败所需等待时间和重连尝试时间;Step 3, initialize the WLAN parameters, and set the relevant parameters of the WIFI chip, including channel selection, security mode, station or AP mode, and waiting time for connection failure and reconnection attempt time;

步骤4,初始化网络协议栈;Step 4, initialize the network protocol stack;

步骤5,连接网络,判断是否连接成功,如果连接成功程序将获取终端在当前网络IP和端口号并通过串口外接透传模块上传到上位机。如果连接失败,将通过串口输出连接失败的信息。Step 5: Connect to the network and determine whether the connection is successful. If the connection is successful, the program will obtain the terminal's current network IP and port number and upload it to the host computer through an external transparent transmission module through the serial port. If the connection fails, the information of connection failure will be output through the serial port.

如图4所示,本发明使用JPEG压缩编码格式作为摄像头采集数据的输出格式,在主程序中通过调用摄像头子程序来对摄像头进行配置和使用,其步骤包括:As shown in Figure 4, the present invention uses the JPEG compression encoding format as the output format of the data collected by the camera, and in the main program, the camera is configured and used by calling the camera subroutine, and the steps include:

步骤1,调用摄像头子程序配置和打开摄像头;Step 1, call the camera subroutine to configure and open the camera;

步骤2,进入子程序配置中断、DMA、DCMI相关初始化参数设置,包括时钟、GPIO、工作模式等;Step 2, enter the subroutine configuration interrupt, DMA, DCMI related initialization parameter settings, including clock, GPIO, working mode, etc.;

步骤3,配置摄像头参数,初始化摄像头SCCB总线,验证MCU与摄像头能否正常通信;Step 3, configure the camera parameters, initialize the camera SCCB bus, and verify whether the MCU and the camera can communicate normally;

步骤4,重启摄像头,读取摄像头ID号,通过与官方提供的ID信息对比,判断是否读取成功;Step 4, restart the camera, read the camera ID number, and judge whether the reading is successful by comparing it with the ID information provided by the official;

步骤5,配置摄像头输出数据的格式;Step 5, configure the format of the camera output data;

步骤6,设置摄像头输出图像分辨率;Step 6, set the camera output image resolution;

步骤7,将核心控制器的DCMI摄像头接口设置成JPEG格式,接收摄像头传来的数据;Step 7, set the DCMI camera interface of the core controller to JPEG format, and receive the data transmitted by the camera;

步骤8,将DCMI接口设置为连续捕获模式用于数据接收;Step 8, setting the DCMI interface to continuous capture mode for data reception;

步骤9,使能DCMI接口,下位机图像采集可以与上位机进行视频流的传输。In step 9, the DCMI interface is enabled, and the image acquisition of the lower computer can transmit the video stream with the upper computer.

如图5所示,本发明的TCP传输服务流程如下:As shown in Figure 5, the TCP transmission service process of the present invention is as follows:

步骤1,主程序通过调用MiCO系统提供的API创建一个TCP服务线程;Step 1, the main program creates a TCP service thread by calling the API provided by the MiCO system;

步骤2,读取WLAN连接的本地IP地址和预设端口号,创建一个socket套接字;Step 2, read the local IP address and preset port number of the WLAN connection, and create a socket;

步骤3,绑定获取的IP地址和端口号;Step 3, bind the obtained IP address and port number;

步骤4,完成上述操作后,服务器进入监听状态等待上位机发来的握手请求;Step 4: After completing the above operations, the server enters the monitoring state and waits for the handshake request sent by the host computer;

步骤5,连接成功后,终端开始视频采集;Step 5: After the connection is successful, the terminal starts video capture;

步骤6,TCP服务器线程从缓存区读取数据,经过无线网络传送至上位机,经过上位机软件解码后将采集到的视频信息显示出来。Step 6, the TCP server thread reads the data from the buffer area, transmits it to the host computer through the wireless network, and displays the collected video information after decoding by the host computer software.

在进行视频传输时,将数据从摄像头中读取出来,每次都需要经过核心控制器的CPU的处理和储存后再经过WIFI芯片发送出去,这样会导致处理器的负荷大大增加,如果使用DMA双缓存模式缓存数据就可以很好的解决这个问题,其中DMA负责填充数据缓冲区,CPU负责网络数据的传输,这样就实现了数据采集和输出的并行操作。本发明应用的是双缓存机制对采集的视频数据进行缓存,同时设计了STM32F4系列单片机DMA的缓存填充相关算法,可以实现在线调整终端缓存区的大小。When performing video transmission, the data is read from the camera, and each time it needs to be processed and stored by the CPU of the core controller and then sent out through the WIFI chip, which will greatly increase the load on the processor. If DMA is used The double-buffer mode buffering data can solve this problem very well, in which the DMA is responsible for filling the data buffer, and the CPU is responsible for the transmission of network data, thus realizing the parallel operation of data acquisition and output. The invention applies the double buffer mechanism to buffer the collected video data, and designs the buffer filling related algorithm of the DMA of the STM32F4 series single-chip microcomputer, so that the size of the terminal buffer area can be adjusted online.

如图6所示, 本发明DMA双缓存模式如下:As shown in Figure 6, the DMA double buffer mode of the present invention is as follows:

步骤1,数据采集端外扩一个8MB的SDRAM用作数据缓存区,由于使用双缓存机制,将其分成两个4MB的缓存区,分别为第一缓存区Data_Buff1和第二缓存区Data_Buff2。Step 1, the data acquisition end expands an 8MB SDRAM as a data buffer area. Due to the double buffer mechanism, it is divided into two 4MB buffer areas, namely the first buffer area Data_Buff1 and the second buffer area Data_Buff2.

步骤2,在STM32F429上开启DMA双缓存模式,将寄存器DMA_SxCR的DBM位设置成1,此时DMA控制器也将自动激活循环模式;Step 2: Turn on the DMA double buffer mode on the STM32F429, and set the DBM bit of the register DMA_SxCR to 1. At this time, the DMA controller will also automatically activate the loop mode;

步骤3,开启视频传输后,DMA从DCMI接口接收OV2640发送的数据流,首先使用Data_Buff1来储存数据,当其填充满后,DMA切换到Data_Buff2,此时,CPU读取Data_Buff1中的数据通过无线网络传输到上位机;Step 3. After the video transmission is enabled, the DMA receives the data stream sent by the OV2640 from the DCMI interface. First, the Data_Buff1 is used to store the data. When it is full, the DMA switches to the Data_Buff2. At this time, the CPU reads the data in the Data_Buff1 through the wireless network. transmitted to the host computer;

步骤4,当Data_Buff2填充满后,DMA又切换到Data_Buff1进行数据存储,此时,CPU读取Data_Buff2中的数据通过无线网络传输到上位机。Step 4, when Data_Buff2 is full, the DMA switches to Data_Buff1 for data storage. At this time, the CPU reads the data in Data_Buff2 and transmits it to the host computer through the wireless network.

如图7所示,第一缓存区或第二缓存区的填充是通过算法控制的,本发明DMA数据填充算法如下:As shown in Figure 7, the filling of the first buffer area or the second buffer area is controlled by an algorithm, and the DMA data filling algorithm of the present invention is as follows:

步骤1,设定缓存区大小的初值,设置DMA的FIFO缓存器一次性传输16位数据,即2字节;Step 1, set the initial value of the buffer size, and set the FIFO buffer of the DMA to transmit 16-bit data at one time, that is, 2 bytes;

步骤2,用缓存区大小(以字节为单位)除以2取整计算缓存区填满所需要的次数;Step 2: Divide the buffer size (in bytes) by 2 and round up to calculate the number of times the buffer fills up;

步骤3,比较填满缓存区次数是否超过65535次,如果没有,说明只需一次即可将缓存区填满,而且寄存器初值已通过缓存区大小除以2得到;Step 3, compare whether the number of times the buffer is filled exceeds 65535 times, if not, it means that the buffer can be filled only once, and the initial value of the register has been obtained by dividing the size of the buffer by 2;

步骤4,如果填满缓存区次数超过65535,则说明装载一次寄存器的值无法填满缓存区,那么再除以2,重新转载次数乘以2,然后把得到的寄存器初值与65535比较,依次类推直至计算出来的寄存器初值小于或等于65535为止,可以得到MA_SxNDTR寄存器初值和重新装载次数。Step 4. If the number of times of filling the buffer area exceeds 65535, it means that the value of the register loaded once cannot fill the buffer area, then divide by 2, multiply the number of reloads by 2, and then compare the obtained initial value of the register with 65535, and in turn By analogy until the calculated initial value of the register is less than or equal to 65535, the initial value of the MA_SxNDTR register and the number of reloads can be obtained.

Claims (6)

1. A wireless video transmission method for a transformer internal inspection robot is characterized by comprising the following steps:
a. the transformer is internally provided with an internal inspection robot, a lower computer is arranged on the internal inspection robot, an upper computer and a router connected with the upper computer are arranged outside the transformer, the lower computer comprises a core controller, an image acquisition module, a wireless transmission module, a power supply module, a lower storage module and an SDRAM (synchronous dynamic random access memory) module, and the upper computer comprises a control module, a display module and an upper storage module;
b. transplanting the MICO system into a core controller of a lower computer;
c. initializing the MICO system and entering a main program loop;
d. calling a subprogram to initialize the SDRAM;
e. calling the subprogram to carry out wireless network connection, so that a wireless transmission module of the lower computer is connected with the router;
f. calling a subprogram to prepare a memory space of data cache for the image acquisition module, setting a data cache region on the SDRAM, and dividing the data cache region into two cache regions;
g. calling a subprogram to initialize an image acquisition module, and starting a camera to acquire an image;
h. calling a subprogram to create a TCP service thread and waiting for the connection of the upper computer control module and the lower computer through the router;
i. the upper computer is connected with the lower computer, and the data cache region starts a DAM double-cache mode to cache the image data stream from the image acquisition module and starts video transmission.
2. The wireless video transmission method of the transformer internal inspection robot according to claim 1, wherein it is determined whether or not the subprogram returns an error after each subprogram is called, if the subprogram returns an error, state information is output through a serial port, and if the subprogram returns no error, the next subprogram is called; and in the process of creating the TCP service thread subprogram, if the return is correct, outputting the IP address and the port number of the TCP service through the serial port, and waiting for the connection of an upper computer.
3. The wireless video transmission method for the inspection robot in the transformer according to claim 1, wherein the two buffer areas divided in the step f are a first buffer area and a second buffer area respectively; in the step i, after video transmission is started, firstly using a first cache region to store data, when the first cache region is filled, DMA is switched to a second cache region, and the second cache region is used to store the data, at the moment, a CPU of a core controller reads the data in the first cache region and transmits the data to an upper computer through a wireless network; when the second cache region is filled, the DMA is switched to the first cache region, the first cache region is used for storing data, and a CPU (central processing unit) of the core controller reads the data in the second cache region and transmits the data to the upper computer through a wireless network; and continuously repeating the process until the video transmission task is completed.
4. The wireless video transmission method of the transformer internal inspection robot according to claim 1 or 2, characterized in that in step e, the main program calls a WIFI connection network connection subprogram, reads preset parameter values including a router name and a network connection password in an external FLASH, initializes WLAN parameters and a network protocol stack, then performs network connection, and judges whether the connection is successful, if the connection is successful, acquires an IP and a port number of a terminal in a current network, uploads the IP and the port number to an upper computer through a transparent transmission module of a serial port, and if the connection is failed, outputs information of the connection failure through the serial port.
5. The wireless video transmission method of the robot for transformer internal inspection according to claim 1, wherein in step g, a camera subroutine is first invoked to open the camera, configure initialization parameter settings related to interrupt, DMA, and DCMI, configure camera parameters, then restart the camera and read the camera ID, determine whether reading is successful, output error information if reading is unsuccessful, configure the format of the camera output data and the resolution of the output image if reading is successful, set the DCMI camera interface of the core controller to the same format as the camera output, receive data transmitted from the camera mi, start the DCMI continuous image capturing function, enable the DCMI interface, and complete the preparation for video stream transmission.
6. The wireless video transmission method for the inspection robot in the transformer according to claim 3, wherein the data filling algorithm of the DAM is as follows:
setting the loading times of a DMA counter to be 1, calculating the initial value of a counter required by filling a cache region according to the number of bytes transmitted by the DMA once, if the initial value of the required counter is less than or equal to the threshold value of the counter, filling the cache region by loading the counter once, if the initial value of the required counter exceeds the threshold value of the counter, dividing the initial value of the required counter by 2, multiplying the loading times by 2, comparing the new initial value of the counter obtained by dividing the initial value of the required counter by 2 with the threshold value of the counter, and continuously repeating the process until the initial value of the counter is less than or equal to the threshold value of the counter.
CN201911037447.5A 2019-10-29 2019-10-29 Wireless video transmission method for transformer internal inspection robot Pending CN110868566A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911037447.5A CN110868566A (en) 2019-10-29 2019-10-29 Wireless video transmission method for transformer internal inspection robot

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911037447.5A CN110868566A (en) 2019-10-29 2019-10-29 Wireless video transmission method for transformer internal inspection robot

Publications (1)

Publication Number Publication Date
CN110868566A true CN110868566A (en) 2020-03-06

Family

ID=69653844

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911037447.5A Pending CN110868566A (en) 2019-10-29 2019-10-29 Wireless video transmission method for transformer internal inspection robot

Country Status (1)

Country Link
CN (1) CN110868566A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004030871A1 (en) * 2002-10-07 2004-04-15 Abb Research Ltd A wireless controller anda method for wireless control of a device mounted on a robot
CN103324178A (en) * 2013-06-14 2013-09-25 南昌大学 Wireless robot long-range control system based on WIFI
CN109991892A (en) * 2017-12-29 2019-07-09 中国科学院沈阳自动化研究所 A kind of transformer internal detection robot control system and control method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004030871A1 (en) * 2002-10-07 2004-04-15 Abb Research Ltd A wireless controller anda method for wireless control of a device mounted on a robot
CN103324178A (en) * 2013-06-14 2013-09-25 南昌大学 Wireless robot long-range control system based on WIFI
CN109991892A (en) * 2017-12-29 2019-07-09 中国科学院沈阳自动化研究所 A kind of transformer internal detection robot control system and control method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李学良: "基于STM32和MiCO的局域网无线视频传输系统设计", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Similar Documents

Publication Publication Date Title
US6954806B2 (en) Data transfer apparatus and method
CN111552274B (en) Automotive diagnostic method, apparatus, apparatus, system, and diagnostic connection device
CN100375070C (en) Method for acquiring video data by using camera phone as computer camera
WO2020147246A1 (en) Synchronous display method and apparatus, and storage medium and electronic apparatus
CN107148009B (en) Multi-standard mobile communication network internet data flow measuring device and method thereof
TWI486782B (en) Transmission system capable of dynamically setting transmission profile and its control method
CN114286035B (en) Image acquisition card, image acquisition method and image acquisition system
CN103971500A (en) Data compression transmission method of remote equipment fault information acquisition system
CN110855996B (en) Image coding and decoding and network transmission method and device based on FPGA
CN201403163Y (en) A Network Video Server Based on Embedded Platform
TWI445374B (en) Remote management system and remote management method
CN110868566A (en) Wireless video transmission method for transformer internal inspection robot
CN105450980A (en) Method and system for controlling high-definition aerial photography and returning videos
WO2019095952A1 (en) Synchronization method and apparatus
CN114371674A (en) Method and device for sending analog data frame, storage medium and electronic device
CN112313939B (en) Control method, control system, holder and storage medium
CN100502523C (en) Method and system for testing terminal screen display results
CN112399446A (en) Edge gateway communication method, device, computer equipment and storage medium
CN111666261B (en) Embedded file network server based on seismic data stream
CN111209718B (en) Verification environment platform, verification method, computer device and readable storage medium
CN113128297A (en) Equipment docking method and device, electronic equipment and storage medium
CN104683764B (en) 3G remote transmission IP Cameras based on FPGA Image Compressions
CN111800614B (en) Water quality image acquisition and information transmission system and method based on underwater acoustic communicator networking
CN112419698A (en) Electric energy meter data transmission method, system and device based on distribution line message specification
CN100518130C (en) Embedded network access device and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200306