USB-HID data analysis converter
The USB-HID data converter addresses integration issues by providing a flexible and cost-effective solution for integrating USB-HID devices into industrial controllers, improving compatibility and reducing maintenance costs.
Patent Information
- Application Number
- CN202510383925.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-19
- Publication Date
- 2025-07-15
AI Technical Summary
In the field of industrial control, USB-HID human-computer interactive equipment cannot access control equipment at high performance and low cost, and the existing RS-232 serial bus interface equipment is costly, incomplete, and poor data resolution capabilities, resulting in high maintenance risks and costs, and equipment of different brands cannot be flexibly replaced.
Design a USB-HID data analysis converter, including a USB interface, a microprocessor, a serial communication interface and a data format selection switch, which can convert USB data into serial port data, and supports RS-232 and RS-485 interfaces, providing data format selection, and adapt to USB-HID devices of different brands and performances.
It realizes the low-cost and efficient access control equipment of USB-HID devices, supports ultra-long-distance transmission, reduces maintenance costs, and improves the convenience and flexibility of equipment use.
Smart Images

Figure CN120316043A_ABST
Abstract
Description
[0001] This application is a divisional application of the applicant Xiaoju Technology (Shenzhen) Co., Ltd., with an application date of December 19, 2019, an application number of 201911318702.3, and an invention title of "USB-HID Data Analysis Converter". Technical Field
[0002] The present invention relates to the field of USB communication technology, and particularly to a USB-HID data analysis converter. Background Art
[0003] In the industrial control field, control devices such as PLC (Programmable Logic Controller), motion controllers, and servo controllers need to directly connect input devices such as barcode scanners and keyboards. Only dedicated input devices with RS-232 serial bus interfaces can be selected or customized.
[0004] With the popularization of USB (Universal Serial Bus), the number of input devices such as barcode scanners and keyboards using the USB-HID human-computer interaction device protocol in the market has gradually increased. The above-mentioned input devices with RS-232 serial bus interfaces have gradually stopped production and withdrawn from the market. However, due to the short communication distance of the USB universal serial bus, poor anti-interference performance and instability in long-distance transmission, it is not suitable for large-scale use in the industrial control field. As a result, in the field of automatic control and industrial control, input devices cannot be connected to control devices with high performance and low cost; when directly selecting or customizing dedicated input devices with RS-232 serial bus interfaces, problems such as high cost, incomplete functions, and poor data analysis ability are faced. When indirectly using input devices such as barcode scanners and keyboards using the USB-HID human-computer interaction device protocol to connect to a computer, and parsing and processing the input data through the USB-HID protocol driver pre-installed in the computer operating system, and then uploading it to the industrial control bus and sending it to the control device through relevant industrial control software, the application cost is extremely high and the real-time performance is not high.
[0005] In addition, when control device manufacturers connect input devices with RS-232 serial bus interfaces, due to the inconsistent message protocol formats of such devices, one brand needs to be adapted for each brand. Only input devices of a single brand can be selected and used as an integral part of the control device unit, rather than making them into independent input modules with standard interfaces and standard protocols; this results in the inability to flexibly replace input devices of different brands and different performances, greatly increasing the maintenance risk and maintenance cost. Summary of the Invention
[0006] The present invention aims to solve at least one of the technical problems in the related art to some extent. For this purpose, the object of the present invention is to provide a USB-HID data parsing converter.
[0007] To achieve the above object, a USB-HID data parsing converter according to an embodiment of the present invention includes:
[0008] A USB interface for connecting to a USB-HID interaction device;
[0009] A microprocessor connected to the USB interface for receiving USB data input by the USB interface and parsing and converting the data to form serial port data;
[0010] A serial communication interface connected to the microprocessor for sending the serial port data to a control device;
[0011] A data format selection switch connected to the microprocessor for a user to operate to select the data format of the serial port data output by the serial communication interface.
[0012] The USB-HID data parsing converter provided according to an embodiment of the present invention can convert between a USB interface and a serial communication interface. In this way, it can enable USB-HID interaction devices (such as barcode scanners, keyboards, etc.) to access control devices such as PLC programmable logic controllers, motion controllers, and servo controllers conveniently, quickly, and at low cost. In addition, the USB-HID data parsing converter of the present invention has a data format selection switch, which can be operated by the user to select the data format of the serial port data output by the serial communication interface. In this way, control device manufacturers can use the USB-HID data parsing converter of the present invention as the interface end of USB-HID machine interaction devices, facilitating the matching of different brands, different performances, and different functions of USB-HID machine interaction devices widely sold in the market, improving the convenience of using input devices, and reducing the maintenance risk and maintenance cost caused by reasons such as faults and losses of input devices.
[0013] In addition, the USB-HID data parsing converter according to the above embodiment of the present invention may further have the following additional technical features:
[0014] According to an embodiment of the present invention, the data format selection switch includes at least a first switch and a second switch, and the microprocessor is used to control the serial communication interface to selectively output one of multiple formats according to the state combination of the first switch and the second switch.
[0015] According to an embodiment of the present invention, it further includes a status indication circuit, which is connected to the microprocessor and is used to indicate the USB interface status or the data reception status.
[0016] According to an embodiment of the present invention, the status indication circuit includes a relay, which is connected to the microprocessor and is used to be disconnected or closed under the control of the microprocessor.
[0017] According to an embodiment of the present invention, the relay is a solid-state relay. The anode of the solid-state relay is connected to a DC power supply through a resistor, the cathode of the solid-state relay is connected to the microprocessor, and two output control terminals of the solid-state relay are adapted to be connected to the control device.
[0018] According to an embodiment of the present invention, two output control terminals of the solid-state relay are also respectively grounded through a TVS diode.
[0019] According to an embodiment of the present invention, the serial communication interface includes an RS-232 interface and an RS-485 interface.
[0020] According to an embodiment of the present invention, it further includes a logic gate. Two input terminals of the logic gate are respectively connected to the RS-232 interface and the RS-485 interface, and an output terminal of the logic gate is connected to the microprocessor.
[0021] According to an embodiment of the present invention, the model of the microprocessor is VNC2, the model of the RS-232 interface is ST3222EB, the model of the RS-485 interface is ADM3485E, and the logic gate is M74VHC1GT08.
[0022] Additional aspects and advantages of the present invention will be given in part in the following description, become apparent in part from the following description, or be understood through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on the structures shown in these drawings.
[0024] Figure 1 It is a principle block diagram of the USB-HID data parsing converter in the embodiment of the present invention;
[0025] Figure 2 It is a circuit diagram of the USB-HID data parsing converter in the embodiment of the present invention.
[0026] The realization, functional features and advantages of the present invention will be further described in conjunction with the embodiments and with reference to the accompanying drawings. Detailed implementation manners
[0027] The embodiments of the present invention will be described in detail below. The examples of the embodiments are shown in the accompanying drawings, in which the same or similar reference numerals indicate the same or similar elements or elements with the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to explain the present invention, and should not be construed as limiting the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without making creative efforts belong to the scope of protection of the present invention.
[0028] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "circumferential", "radial", etc. indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as limiting the present invention.
[0029] In addition, the terms "first" and "second" are only used for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present invention, "a plurality of" means two or more unless otherwise specifically defined.
[0030] In the present invention, unless otherwise clearly defined and limited, the terms "mounted", "connected", "connected to", "fixed", etc. should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and it may be the internal communication of two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0031] In the present invention, unless otherwise clearly defined and limited, the first feature being "on" or "under" the second feature may include direct contact between the first and second features, or may include the first and second features not being in direct contact but in contact through additional features therebetween. Moreover, the first feature being "above", "over" and "on top of" the second feature includes the first feature being directly above and obliquely above the second feature, or merely indicating that the horizontal height of the first feature is higher than that of the second feature. The first feature being "under", "below" and "beneath" the second feature includes the first feature being directly below and obliquely below the second feature, or merely indicating that the horizontal height of the first feature is less than that of the second feature.
[0032] The USB-HID data parsing converter according to an embodiment of the present invention will be described in detail below with reference to the accompanying drawings.
[0033] Refer to Figure 1 As shown, the USB-HID data parsing converter according to an embodiment of the present invention includes a USB interface 100, a microprocessor 200, a serial communication interface 300 and a data format selection switch 400.
[0034] Specifically, the USB interface 100 is used to connect to a USB-HID interaction device. That is, the USB interface 100 provides a data connection interface for the USB-HID interaction device, and moreover, the USB interface 100 can also provide a working power supply (such as +5.0V) for the USB-HID interaction device. Specifically, the USB-HID interaction device generally has a connecting wire with a USB connector. Inserting the USB connector of the connecting wire into the USB interface 100 of the USB-HID data parsing converter of the present invention can realize the connection between the USB-HID interaction device and the USB-HID data parsing converter. The USB data of the USB-HID interaction device can be sent to the microprocessor 200 through the USB interface 100.
[0035] The microprocessor 200 is connected to the USB interface 100, and is used to receive the USB data input by the USB interface 100, and parse and convert the USB data to form serial port data. The microprocessor 200 integrates functions such as a Universal Asynchronous Receiver / Transmitter (UART), a USB host controller (USB-HOST), and General Purpose Input / Output (GPIO). When a USB-HID interaction device is connected to the USB interface 100, the USB host controller USB-HOST can provide host services for the USB-HID class human-computer interaction device, receive and process the USB data transmitted by the USB-HID interaction device, complete data parsing and conversion to form serial port data, and send it to the serial communication interface through the internal Universal Asynchronous Receiver / Transmitter UART.
[0036] The serial communication interface 300 is connected to the microprocessor 200, and is used to send the serial port data to the control device. The serial communication interface 300 is one of the data transceiver interfaces of the USB-HID data parser / converter, and it can send the serial port data sent by the internal Universal Asynchronous Receiver / Transmitter UART of the microprocessor in the RS-232 electrical standard. It can also receive information transmitted in the RS-232 electrical standard and transmit it to the internal Universal Asynchronous Receiver / Transmitter UART of the microprocessor 200.
[0037] Optionally, the serial communication interface 300 includes an RS-232 interface 301 and an RS-485 interface 302. In this way, the two serial communication interfaces can provide more flexible choices to meet the user's needs.
[0038] The data format selection switch 400 is connected to the microprocessor 200, and is used for the user to operate to select the data format of the serial port data output by the serial communication interface 300. Since the message protocol formats of the control devices and USB-HID interaction devices of different brands and manufacturers are not unified, for a control device of a certain brand, a corresponding brand of USB-HID interaction device needs to be configured. Therefore, there are limitations in the user's selection and use of control devices and USB-HID interaction devices. The USB-HID data parser / converter provided by the present invention can use the data format selection switch 400 to select the data format of the serial port data output by the serial communication interface 300, so that the user can select the protocol format suitable for the USB-HID interaction device and the control device.
[0039] According to the USB-HID data parsing converter provided by the embodiments of the present invention, the USB interface 100 can be converted into a serial communication interface 300. In this way, USB-HID interaction devices (such as barcode scanners, keyboards, etc.) can be conveniently, quickly and low-costly connected to control devices such as PLC programmable logic controllers, motion controllers and servo controllers. The USB-HID data parsing converter of the present invention has an RS-485 interface, which can realize networking of multiple USB-HID interaction devices on one bus. Compared with selecting input devices with RS-232 interfaces, the purchase cost of communication conversion modules is reduced; and ultra-long-distance remote transmission of data information of USB-HID interaction devices is realized. The USB-HID data parsing converter of the present invention has a data format selection switch 400, and the data format selection switch 400 can be operated by the user to select the serial data format output by the serial communication interface 300. In this way, control device manufacturers can use the USB-HID data parsing converter of the present invention as the interface end of USB-HID machine interaction devices, which is convenient for matching USB-HID machine interaction devices of different brands, different performances and different functions widely sold in the market, improving the usability of input devices and reducing the maintenance risks and maintenance costs caused by reasons such as failures and losses of input devices.
[0040] In addition, with the popularization of USB-HID interaction devices using Bluetooth wireless technology, the combination of USB-HID interaction devices using Bluetooth wireless technology and the USB-HID data parsing converter of the present invention can more efficiently solve the wireless application of input devices in industrial control sites. Taking the automotive interior assembly control device as an example: Precise process control and full-node data recording are required for automotive interior assembly. Input devices with RS-232 serial bus interfaces often cause inconvenience in use due to wire entanglement, and even interfere with the assembly process; using the USB-HID data parsing converter of the present invention and adapting it to USB-HID interaction devices with Bluetooth wireless technology can effectively improve such problems.
[0041] In an embodiment of the present invention, the data format selection switch 400 at least includes a first switch M0 and a second switch M1, and the microprocessor 200 is used to control the serial communication interface 300 to selectively output one of multiple formats according to the state combination of the first switch M0 and the second switch M1.
[0042] That is to say, the user can switch the different states of the first switch M0 and the second switch M1, and then select the serial data format output by the serial communication interface 300. Exemplarily, the first switch M0 and the second switch M1 can be combined to form four combination states, and then four data formats can be set respectively, as shown in the following table:
[0043] M0 M1 Data format Data format reference format Close Close Format 0 <Data start character> <id><ASCII-encoded data information><End-of-data character> < / id> Open Close Format 1 <ASCII-encoded data information> Close Open Format 2 <USB-HID Communication Protocol - Usage ID Purpose Identification Name> Open Open Format 3 <ASCII-encoded data information> + <CR character>
[0044] In this way, by using the combined states of the first switch M0 and the second switch M1, the selection of four data formats can be achieved, meeting the convenience requirements of users for the selection and use of control devices and USB-HID interaction devices.
[0045] In an embodiment of the present invention, a status indication circuit 500 is further included. The status indication circuit 500 is connected to the microprocessor 200 to indicate the USB interface status or the received data status. In this way, during use, the user can, through the status indication circuit, learn the USB interface status, that is, whether a USB-HID interaction device is connected to the USB interface 100, or learn whether the USB-HID data parsing converter has received data through the status indication circuit 500, etc., thereby facilitating the correct use of the USB-HID data parsing converter by the user.
[0046] Specifically, referring to Figure 2 As shown, the status indication circuit 500 may include a relay K1. The relay K1 is connected to the microprocessor 200 and is used to be disconnected or closed under the control of the microprocessor 200. During specific use, the output end of the relay K1 can be connected to a control device (such as a PLC controller). In this way, when the relay K1 is disconnected or closed, a status signal can be output to the control device, and the control device can learn the USB interface status or the received data status based on this status signal.
[0047] Preferably, the relay K1 is a solid-state relay. The anode of the solid-state relay is connected to the DC power supply +3.3V through a resistor R1, the cathode of the solid-state relay is connected to the microprocessor 200, and the two output controlled terminals PORT and P_COM of the solid-state relay are adapted to be connected to the control device. That is, during specific use, the two output controlled terminals PORT and P_COM of the solid-state relay are connected to the control device. When the microprocessor 200 controls the solid-state relay to be disconnected or closed, the output controlled terminals PORT and P_COM of the solid-state relay can output a status signal to the control device.
[0048] In this embodiment, by using a solid-state relay, based on the characteristics of the solid-state relay such as no contacts, long service life, high reliability, safe use, and low electromagnetic interference, it can ensure that the use performance of the USB-HID data parsing converter of the present invention is reliable and stable, and has a longer service life.
[0049] Advantageously, the two output control terminals PORT and P_COM of the solid-state relay are grounded through a TVS diode respectively. The TVS (Transient Voltage Suppression Diode) can provide overvoltage protection for the status indication circuit in this way.
[0050] In an embodiment of the present invention, a logic gate 202 is further included. Two input terminals of the logic gate 202 are respectively connected to the RS-232 interface 301 and the RS-485 interface 302, and an output terminal of the logic gate 202 is connected to the microprocessor 200. Since the RS-232 interface 301 and the RS-485 interface 302 share one receiving pin on the microprocessor 200 in this embodiment, a logic gate 202 is provided in this embodiment to solve the competition and hazard problems of the two signals of the RS-232 interface 301 and the RS-485 interface 302.
[0051] Refer to Figure 2 as shown Figure 2 The figure shows an example circuit structure of the USB-HID data parsing converter provided by the embodiment of the present invention. For the sake of convenience of description, only the parts related to the embodiment of the present invention are shown.
[0052] Next, in combination with Figure 2 , the working process of the USB-HID data parsing converter of the present invention will be described:
[0053] The crystal oscillator Y1 provides a working clock for the microprocessor 200.
[0054] The pins USB1 DM and USB1 DP of the USB host controller USB-HOST of the microprocessor 200 are respectively connected to the USB connector through series resistors R2 and R4, which function to input data information or command information.
[0055] The pins IO BUS2 and IO BUS3 of the general-purpose input / output port GPIO of the microprocessor 200 are respectively connected to the first switch M0 and the second switch M1 for data format selection, which function to input selection signals.
[0056] The pin IO BUS1 of the general-purpose input / output port GPIO of the microprocessor 200 is connected to the cathode pin of the relay K1. When the pin IO BUS1 outputs a low level, the relay K1 closes, and vice versa.
[0057] The pins IO BUS10 and IO BUS11 of the general-purpose input / output port GPIO of the microprocessor 200 are respectively connected to the enable control pin and the turn-off control signal pin Connection. When the IO BUS10 pin outputs a low level and the IO BUS11 pin outputs a high level, the RS-232 conversion chip U2 works normally; when the IO BUS10 pin outputs a high level and the IO BUS11 pin outputs a low level, the RS-232 conversion chip U2 enters the low-power mode.
[0058] The pins IO BUS8 and IO BUS9 of the general-purpose input / output port GPIO of the microprocessor 200 are respectively connected to the transmit enable pin DE and the receive enable pin of the RS-485 conversion chip U3. When the IO BUS8 pin outputs a low level and the IO BUS9 pin outputs a low level, the RS-485 conversion chip U3 operates in the differential receive mode; when the IO BUS8 pin outputs a high level and the IOBUS9 pin outputs a high level, the RS-485 conversion chip U3 operates in the differential transmit mode; when the IO BUS8 pin outputs a low level and the IO BUS9 pin outputs a high level, the RS-485 conversion chip U3 operates in the low-power mode.
[0059] The transmit data pin TXD of the universal asynchronous receiver / transmitter UART of the microprocessor 200 is respectively connected to the data receive pin T2 IN of the RS-232 conversion chip U2 and the data receive pin DI of the RS-485 conversion chip U3, and the receive data pin RXD of the universal asynchronous receiver / transmitter UART is connected to the logic gate chip U4; the input pins A and B of the logic gate chip U4 are respectively connected to the data output pin R2OUT of the RS-232 conversion chip U2 and the data output pin RO of the RS-485 conversion chip U3.
[0060] The T2 OUT and T2 IN pins of the RS-232 conversion chip U2 are respectively connected to the received signal and the transmitted signal that conform to the RS-232 bus electrical standard externally.
[0061] A matching resistor R3 is connected in series between the A+ and B- pins of the RS-485 conversion chip U3, and is respectively connected to the A+ and B- differential signals that conform to the RS-485 bus electrical standard externally.
[0062] The microprocessor 200 provides host services to the USB-HID mutual device, receives and processes the USB data transmitted by the USB-HID mutual device, automatically completes data parsing and conversion to form serial port data, and sends it to the RS-232 conversion chip U2 or the RS-485 conversion chip U3 through the internal universal asynchronous receiver / transmitter UART. The microprocessor 200 also supports parsing data reading, function setting and command execution functions by receiving AT commands or Modbus RTU instructions.
[0063] The specific working process is exemplified by connecting a barcode scanner in a USB-HID interactive device: In the automatic transmission mode of the USB-HID data parsing converter, when the data format is set to Format 1, connect the barcode scanner to the USB interface 100 of the USB-HID data parsing converter. After scanning the barcode "0123456789" with the barcode scanner, the microprocessor 200 will automatically complete the USB-HID data parsing conversion and send the parsed data in the form of ASCII code "0123456789" through the serial communication interface 300.
[0064] In the embodiment of the present invention, the model of the microprocessor 200 is VNC2, the model of the RS-232 conversion chip is ST3222EB, the model of the RS-485 conversion chip is ADM3485E, and the model of the logic gate chip is M74VHC1GT08.
[0065] In the description of this specification, the description with reference to terms such as "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0066] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structural transformation made by using the description of the specification and drawings of the present invention under the inventive concept of the present invention, or any direct / indirect application in other related technical fields is included in the patent protection scope of the present invention.
Claims
1. A USB-HID data parsing converter, characterized in that, Including: A USB interface for connecting a USB-HID interaction device; A microprocessor connected to the USB interface, configured to receive USB data input by the USB interface and parse and convert the data to form serial port data; An RS-485 interface connected to the microprocessor for sending the serial port data to a control device. Wherein, the microprocessor parses data reading, function setting, and command execution by receiving AT commands or Modbus RTU instructions.
2. The USB-HID data parsing converter according to claim 1, wherein It further includes a data format selection switch connected to the microprocessor for a user to operate to select the serial port data format output by the RS-485 interface.
3. The USB-HID data parsing converter according to claim 1, characterized in that The data format selection switch includes at least a first switch and a second switch, and the microprocessor is configured to control the RS-485 interface to selectively output one of multiple formats according to the state combination of the first switch and the second switch.
4. The USB-HID data parsing converter according to claim 1, characterized in that, It further includes a status indication circuit connected to the microprocessor for indicating the USB interface status or the received data status.
5. The USB-HID data parsing converter according to claim 4, wherein The status indication circuit includes a relay connected to the microprocessor for being disconnected or closed under the control of the microprocessor.
6. The USB-HID data parsing converter according to claim 5, wherein The relay is a solid-state relay, the anode of the solid-state relay is connected to a DC power supply through a resistor, the cathode of the solid-state relay is connected to the microprocessor, and two output control terminals of the solid-state relay are adapted to be connected to the control device.
7. The USB-HID data parsing converter according to claim 6, wherein The two output control terminals of the solid-state relay are also respectively grounded through a TVS diode.
8. The USB-HID data parsing converter according to claim 1, characterized in that The model of the microprocessor is VNC2, and the model of the RS-485 interface is ADM3485E.