MCU-controlled robot head single-wire USB sensor expansion interface method

By using a single-wire USB sensor expansion interface method controlled by an MCU, the problems of limited functionality and insufficient scalability in the expansion design of robot head sensors are solved. This method enables the flexibility of multi-sensor access and high-bandwidth data transmission, simplifies hardware design, and reduces costs.

CN121958172BActive Publication Date: 2026-07-31BEIJING ACCELERATED EVOLUTION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING ACCELERATED EVOLUTION TECH CO LTD
Filing Date
2025-12-05
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing robot head extension designs are customized, with limited functionality and scalability, making it difficult to flexibly connect multiple sensors within a limited space. At the same time, it is difficult to balance the flexibility and signal integrity of sensor cables.

Method used

A single-wire USB sensor expansion interface method controlled by an MCU is adopted to expand the sensor through a single-wire USB interface. The MCU is used to identify, configure and manage the peripheral interface, and the sensor parameters are optimized by combining ant colony algorithm to ensure high-bandwidth data transmission and power supply stability.

Benefits of technology

It enables flexible access to multiple sensors within a limited space, maintains head movement flexibility, simplifies hardware design, reduces costs, and improves system adaptability and upgrade potential.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121958172B_ABST
    Figure CN121958172B_ABST
Patent Text Reader

Abstract

This invention discloses a method for expanding the single-wire USB sensor interface of a robot head using an MCU. This invention relates to the field of robot interface expansion technology. The method involves connecting the target robot's controller to a head expansion interface board via a single-wire USB connector, scanning and identifying the connected USB peripheral expansion interface MCU; the controller sends a query command to the MCU, which then powers on the peripheral expansion interfaces sequentially and queries the status and supported modes of each interface via the I2C bus; the MCU summarizes the peripheral expansion interface information and feeds it back to the controller, which then generates a data packet based on a configuration file. This invention expands the robot head sensors through a single-wire USB interface, avoiding the problems of limited functionality and scalability associated with customized designs. It allows for flexible connection of multiple sensors within the limited head space while maintaining the flexibility of head movement. MCU control ensures that adding or replacing sensors does not require redesigning the entire circuitry, significantly improving the system's adaptability and upgrade potential.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of robot interface expansion technology, specifically a method for expanding the single-wire USB sensor interface of a robot head controlled by an MCU. Background Technology

[0002] With the development of robotics technology, especially with the increasing demand for applications in industry, service, and medical fields, robot systems need to have higher flexibility, accuracy, and adaptability to cope with different operational tasks. The robot head usually integrates a variety of sensors, such as RGBD, radar, IMU, and ring microphone. The data acquisition and processing of sensors are the core of robot intelligence. As robots are empowered by AI, the number of sensing devices will increase. At the same time, to enhance the adaptability of robots, the robot head is generally a moving part, which puts forward higher requirements for the flexibility, wire diameter, and signal integrity of cables.

[0003] Currently, robot head extensions are all custom-designed, offering limited functionality and scalability. Some even use rigid connections between the head and the main body to ensure reliable connections, sacrificing the head's flexibility. Therefore, the problem this invention aims to solve is how to extend robot head sensors using a single USB cable, ensuring cable flexibility while meeting high-bandwidth data transmission and power supply requirements through a fixed wire diameter, and facilitating the expansion of various interface devices via a USB docking station. To this end, we propose a single-wire USB sensor extension interface method for robot heads controlled by an MCU. Summary of the Invention

[0004] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a method for expanding a single-wire USB sensor interface in a robot head controlled by an MCU, comprising the following steps:

[0005] S1. Connect the target robot's controller to the head expansion interface board via a single-wire USB connector, and scan and identify the connected USB peripheral expansion interface MCU.

[0006] S2. The controller sends a query command to the MCU. The MCU powers on the peripheral expansion interfaces in sequence and queries the status and supported modes of each interface through the I2C bus.

[0007] S3, the MCU summarizes the peripheral expansion interface information and feeds it back to the controller. The controller generates a data packet, i.e., a configuration packet, based on the configuration file.

[0008] S4. Based on the peripheral expansion interface requirements, the MCU is configured to output the corresponding voltage power supply via the embedded DC / DC module, and a USB communication link is established.

[0009] S5. Based on the USB communication link, the MCU receives the configuration packet and adjusts and configures the various requirements of the peripheral expansion interface in combination with the ant colony algorithm, and starts each peripheral expansion interface to start working.

[0010] S6. The MCU executes the functions of the peripheral expansion interface and feeds back to the controller after completion. The controller collects the data from each peripheral expansion interface for further processing.

[0011] S7, the MCU starts a cycle monitoring process, scans the status of peripheral expansion interfaces, sends a status packet to the controller when an abnormality occurs, and responds to instructions to adjust the operating status of peripheral expansion interfaces. The controller controls peripheral expansion interfaces through the USB interface.

[0012] Preferably, S1 specifically includes:

[0013] Connect the target robot's controller to the head expansion interface board via a single-wire USB connector to complete the hardware connection. The controller starts the initialization program, checks the USB connection status, and ensures that the connection is normal and the head expansion interface board is in a ready-to-recognize state.

[0014] The controller sends a scanning command via the USB interface to activate the identification function of the head expansion interface board. Based on the MCU response command of the head expansion interface board, it starts a self-test program to identify the connected peripheral expansion interface and feeds back the interface information to the controller.

[0015] The controller receives peripheral expansion interface information from the MCU, verifies and confirms it. After confirming that there are no errors, the controller records the peripheral expansion interface information and completes the initialization configuration.

[0016] Preferably, S2 specifically includes:

[0017] The controller sends a query command to the MCU via a single-wire USB interface. The query command includes a query request for the status and supported modes of the peripheral expansion interface. The MCU receives the query command and prepares to perform subsequent operations.

[0018] After receiving the query command, the MCU powers on the peripheral expansion interfaces in a preset order to ensure that each peripheral expansion interface is in a detectable state. The MCU communicates with each interface chip through the I2C bus to query the status of the interface and the supported communication modes.

[0019] The MCU summarizes and organizes the peripheral expansion interface status and supported mode information obtained from the query, forms a complete feedback data packet, and sends the feedback data packet back to the controller via the USB interface for subsequent processing and configuration.

[0020] Preferably, S3 specifically includes:

[0021] After the MCU completes the status query of the peripheral expansion interface through the I2C bus, it encapsulates the information according to the preset data structure (interface number, communication protocol, power requirements, etc.) and sends it to the controller through the USB batch transmission channel to ensure data integrity and real-time performance.

[0022] After receiving peripheral expansion interface information from the MCU, the controller parses it according to the preset configuration file and generates a configuration data packet containing the interface working mode, sampling period, output frequency and synchronization requirements.

[0023] The controller sends the generated configuration data packet to the MCU via the USB interface. The MCU receives and parses the configuration packet, adjusts the working status of the peripheral expansion interface according to the configuration requirements, and completes the initialization configuration.

[0024] Preferably, S4 specifically includes:

[0025] Based on the power demand parameters (voltage / current) of the peripheral expansion interface, the MCU dynamically adjusts the feedback resistor network of the embedded DC / DC module through the built-in DAC, outputs a matching voltage in real time and monitors the load current to ensure power supply stability;

[0026] The MCU configures the USB controller pins to high-speed mode (480Mbps), loads the device descriptor and enables the bulk transfer endpoint, establishes a physical connection with the host through differential signal lines (D+ / D-), and completes link layer enumeration and speed negotiation;

[0027] The MCU and controller exchange data through a USB bulk transfer channel, using CRC16 checksum to ensure transmission integrity, configuring a NAK retry mechanism to deal with transient interference, and synchronously establishing heartbeat packets to detect link activity and ensure communication reliability.

[0028] Preferably, S5 specifically includes:

[0029] The MCU receives the configuration packet sent by the controller via the USB communication link and parses the various configuration parameters of the peripheral expansion interface.

[0030] Based on the parsed configuration parameters, the MCU dynamically adjusts the settings of the peripheral expansion interfaces using the ant colony algorithm, optimizing the working mode, sampling period, output frequency, and synchronization function of each peripheral expansion interface to achieve the best operating state.

[0031] After the optimization configuration is completed, the MCU starts the expansion interfaces of each peripheral device, enabling them to start working according to the adjusted configuration parameters, ensuring that the peripheral devices operate as required.

[0032] Preferably, the process of dynamically adjusting the settings of peripheral expansion interfaces using the ant colony algorithm is as follows:

[0033] After receiving the configuration packet via USB communication, the MCU performs protocol parsing and data verification, extracts configuration parameters of peripheral expansion interfaces including working mode, sampling period, output frequency and synchronization function, and constructs a multi-objective optimization model based on the parsing results. The configuration parameters are used as optimization variables, and a fitness function is defined to comprehensively evaluate energy efficiency, response speed and stability. The pheromone matrix is ​​initialized through the ant colony algorithm to simulate the search behavior of ant colonies in the parameter space.

[0034] The MCU executes the ant colony algorithm iteratively. Each ant generates candidate parameter combinations based on pheromone concentration and heuristic rules. The performance of each combination is evaluated through a fitness function, and the pheromone concentration is dynamically updated. High fitness paths enhance pheromone, while low fitness paths reduce pheromone volatilization. During the optimization process, peripheral constraints, including clock resources and power consumption limits, are monitored in real time, and the pheromone update strategy is dynamically adjusted to avoid getting trapped in local optima and finally converge to the global optimal parameter set.

[0035] The MCU loads the globally optimal parameter set output by the ant colony algorithm into each peripheral expansion interface through register writing or memory mapping, completes the real-time configuration of various configuration parameters, activates peripherals according to priority during startup, and monitors the initialization status. During operation, it continuously collects actual working parameters, compares them with the optimization target through a closed-loop feedback mechanism, and dynamically fine-tunes the parameters to ensure that the peripherals always operate in the optimal state, balancing performance and resource efficiency.

[0036] Preferably, S6 specifically includes:

[0037] Based on the optimized configuration parameters, the MCU starts and executes the functions of the peripheral expansion interface. After completion, it generates an execution status flag (success / failure) and corresponding performance data, and feeds them back to the controller through an interrupt or polling mechanism.

[0038] The controller synchronously collects real-time data from various peripheral expansion interfaces through register reading, memory mapping, or DMA, merges them into a unified data frame and marks it with a timestamp to ensure the spatiotemporal consistency of multi-channel data;

[0039] The controller parses and verifies the collected data, generates control commands based on preset threshold judgment rules, dynamically adjusts peripheral configuration parameters, and forms a closed-loop control system of execution-feedback-optimization.

[0040] Preferably, S7 specifically includes:

[0041] The MCU starts a cycle monitoring process, which scans the hardware status of peripheral expansion interfaces in real time through registers or memory mapping, generates status flags, and immediately encapsulates a status packet (including error code and timestamp) and sends it to the controller through the interrupt mechanism to trigger the fault handling process.

[0042] After receiving the status packet, the controller parses the error type and sends an adjustment command through the USB interface. The MCU responds to the adjustment command and updates the peripheral configuration through register writing or memory mapping to correct the operating status.

[0043] After the MCU performs the adjustment, it continuously monitors the peripheral performance indicators, calculates the peripheral performance estimation coefficient, analyzes the overall trend of peripheral performance, and then feeds back the optimization results to the controller. The controller generates iterative suggestions based on the verification data and sends them back to the MCU via the USB interface, forming a closed-loop upgrade process of detection-adjustment-verification. The peripheral performance indicators include response latency, data throughput, resource utilization, synchronization error, and data accuracy.

[0044] Preferably, the calculation process for the peripheral performance estimation coefficient is as follows:

[0045] Continuously collect the actual values ​​of various peripheral performance indicators before and after the MCU completes configuration adjustments, including response latency, data throughput, resource utilization, synchronization error, and data accuracy;

[0046] For each peripheral performance index, extract the baseline value determined according to the system design, and then calculate the ratio of each peripheral performance index to its corresponding baseline value to obtain the normalized ratio.

[0047] For each normalized ratio obtained, the sum of squares is calculated, and then the square root of the sum of squares is calculated and its reciprocal is taken to obtain the performance deviation impact value. The reciprocal of the sum of squares is calculated, and the logarithm of the reciprocal is calculated to obtain the reinforcement deviation value.

[0048] Multiply the performance deviation impact value by the enhancement deviation value to obtain the final performance estimation coefficient. Then compare the performance estimation coefficients before and after the MCU configuration adjustment to analyze the overall trend of peripheral performance.

[0049] This invention provides a method for an MCU-controlled single-wire USB sensor expansion interface for a robot head. It offers the following advantages:

[0050] (i) The single-wire USB sensor expansion interface method for robot head controlled by the MCU enables the expansion of robot head sensors through a single-wire USB interface, avoiding the problems of limited functionality and weak expandability caused by customized design. It allows for flexible access to multiple sensors within the limited head space while maintaining the flexibility of head movement. MCU control means that the addition or replacement of sensors does not require redesigning the overall circuit, which significantly improves the adaptability and upgrade space of the system.

[0051] (ii) The single-wire USB sensor expansion interface method for robot head controlled by the MCU adopts a unified single-wire USB interface, which reduces the need for various customized interface circuits and power supply circuits, thereby simplifying hardware design and reducing manufacturing costs. The MCU is responsible for the identification, configuration and management of the interface, which standardizes the access of each sensor, reduces design complexity and error rate, and also helps to reduce the cost of later maintenance and upgrades. Attached Figure Description

[0052] Figure 1 This is a schematic diagram illustrating the workflow of the MCU-controlled robot head single-line USB sensor expansion interface method of the present invention.

[0053] Figure 2 This is a schematic diagram of the method flow for the MCU-controlled robot head single-line USB sensor expansion interface method of the present invention. Detailed Implementation

[0054] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0055] Example 1, please refer to Figure 1 , Figure 2 This invention provides a technical solution: a method for a single-wire USB sensor expansion interface for a robot head controlled by an MCU, comprising the following steps:

[0056] S1. Connect the target robot's controller to the head expansion interface board via a single-wire USB connector. Scan and identify the connected USB peripheral expansion interface MCU. Connect the target robot's controller to the head expansion interface board via a single-wire USB connector to complete the hardware connection. The controller starts the initialization program, checks the USB connection status, and ensures that the connection is normal and the head expansion interface board is in the identification state. The controller sends a scanning command through the USB interface to activate the identification function of the head expansion interface board. Based on the MCU response command of the head expansion interface board, it starts a self-test program, identifies the connected peripheral expansion interface, and feeds back the interface information to the controller. The controller receives the peripheral expansion interface information fed back by the MCU, verifies and confirms it. After confirming that there are no errors, the controller records the peripheral expansion interface information and completes the initialization configuration.

[0057] The specific work is as follows: After the target robot's controller physically connects to the head expansion interface board via a single-wire USB connector (standard or locking type), it initiates the initialization program. The controller first checks the USB connection status to verify the communication link's normality, including signal integrity, power stability (5V / 20W power supply), and whether the cable flexibility meets the head's movement requirements. Simultaneously, the controller confirms the interface board is in a ready-to-recognize state via the USB protocol layer to ensure subsequent commands can be correctly received. The controller sends a scan command through the USB interface to activate the head expansion interface board's recognition function. After receiving the command, the MCU on the head expansion interface board starts a self-test program, sequentially checking multiple USB 3.0 ports. The connection status of the hub, USB to network / UART / CAN circuit, and extended MCU circuit is monitored. The MCU interacts with each interface chip via the I2C bus to identify the type of connected peripherals (such as cameras, LiDAR, IMU, etc.) and their supported communication protocols (such as UART, CAN). After identification, the MCU summarizes the peripheral interface information and feeds it back to the controller to ensure that the controller can fully grasp the hardware configuration of the head-end extended interface. The controller receives the peripheral extended interface information fed back by the MCU, verifies and confirms it, and ensures the accuracy and completeness of the feedback information through a preset verification mechanism and data verification. After confirmation, the controller records the peripheral extended interface information and completes the initialization configuration.

[0058] S2. The controller sends a query command to the MCU. The MCU powers on the peripheral expansion interfaces in sequence and queries the status and supported modes of each interface through the I2C bus. The controller sends a query command to the MCU through a single-wire USB interface. The query command contains a query request for the status and supported modes of the peripheral expansion interfaces. The MCU receives the query command and prepares to execute subsequent operations. After receiving the query command, the MCU powers on the peripheral expansion interfaces in a preset order to ensure that each peripheral expansion interface is in a detectable state. The MCU communicates with each interface chip through the I2C bus to query the status of the interface and the supported communication modes. The MCU summarizes and organizes the queried peripheral expansion interface status and supported mode information to form a complete feedback data packet, and feeds the feedback data packet back to the controller through the USB interface for its subsequent processing and configuration.

[0059] The specific workflow is as follows: The controller sends a query command to the MCU via a single-wire USB interface. This query command includes a request to check the status and supported modes of the peripheral expansion interfaces, initiating the initialization detection process. Upon receiving the query command, the MCU immediately enters a response state, preparing to execute subsequent operations. Simultaneously, the MCU's communication module is in standby mode to ensure accurate reception and parsing of the query command from the controller. After receiving the query command, the MCU powers on the peripheral expansion interfaces sequentially according to a preset order, ensuring that each peripheral expansion interface is in a detectable state. This orderly power-on operation avoids current surges or detection conflicts caused by simultaneous power supply. Subsequently, the MCU communicates with each interface chip via the I2C bus to query the interface status and supported communication modes. The use of the I2C bus ensures efficient and stable communication, enabling the MCU to quickly obtain detailed information about the peripheral expansion interfaces, including the interface connection status and supported communication protocols. The MCU summarizes and organizes the queried peripheral expansion interface status and supported mode information to form a complete feedback data packet. This feedback data packet contains key information about all peripheral expansion interfaces. The MCU sends the feedback data packet to the controller via the USB interface. The high bandwidth of the USB interface ensures fast and reliable data transmission, allowing the controller to obtain detailed information about the peripheral expansion interfaces.

[0060] S3. The MCU summarizes the peripheral expansion interface information and feeds it back to the controller. The controller generates a data packet, i.e., a configuration packet, according to the configuration file. This packet contains the interface working mode, sampling period, output frequency, and synchronization requirements. After the MCU completes the peripheral expansion interface status query via the I2C bus, it encapsulates the information according to the preset data structure (interface number, communication protocol, power requirements, etc.) and sends it to the controller via the USB batch transmission channel to ensure data integrity and real-time performance. After receiving the peripheral expansion interface information fed back by the MCU, the controller parses it according to the preset configuration file and generates a configuration data packet containing the interface working mode, sampling period, output frequency, and synchronization requirements. The controller sends the generated configuration data packet to the MCU via the USB interface. The MCU receives and parses the configuration packet, adjusts the working status of the peripheral expansion interface according to the configuration requirements, and completes the initialization configuration.

[0061] The specific tasks are as follows: After the MCU completes the status query of the peripheral expansion interface, it encapsulates the query results according to a preset data structure. The data structure includes information such as interface number, communication protocol, and power requirements to ensure the integrity and standardization of the information. After encapsulation, the MCU sends the data to the controller through the USB bulk transmission channel. The bulk transmission channel has the characteristics of high bandwidth and low latency, which can effectively ensure the real-time performance and integrity of data transmission, enabling the controller to quickly obtain detailed status information of the peripheral expansion interface. After receiving the peripheral expansion interface information from the MCU, the controller parses the data according to the preset configuration file. The configuration file specifies the expected working mode, sampling period, output frequency, and synchronization requirements of each interface. After parsing, the controller generates a configuration data packet based on the parsing results, reflecting the operating requirements of the peripheral expansion interface. After receiving the configuration data packet sent by the controller, the MCU immediately parses it. Based on the parsing results, the MCU adjusts the working status of the peripheral expansion interface according to the configuration requirements, including setting the working mode of the interface, adjusting the sampling period, configuring the output frequency, and implementing the synchronization function between interfaces. The MCU ensures that the peripheral expansion interface can operate according to the requirements of the controller, completing the initialization configuration of the entire system.

[0062] S4. Based on the peripheral expansion interface requirements, the MCU is configured to output the corresponding voltage power supply from the embedded DC / DC module and establish a USB communication link. According to the power requirement parameters (voltage / current) of the peripheral expansion interface, the MCU dynamically adjusts the feedback resistor network of the embedded DC / DC module through the built-in DAC, outputs the matching voltage in real time and monitors the load current to ensure power supply stability. The MCU configures the USB controller pin to high-speed mode (480Mbps), loads the device descriptor and enables the bulk transfer endpoint, establishes a physical connection with the host through differential signal lines (D+ / D-), completes link layer enumeration and speed negotiation, and the MCU and controller exchange data through the USB bulk transfer channel. CRC16 check is used to ensure transmission integrity, a NAK retry mechanism is configured to deal with transient interference, and a heartbeat packet is established synchronously to detect link activity and ensure communication reliability.

[0063] The specific tasks are as follows: The MCU dynamically adjusts the feedback resistor network of the embedded DC / DC module based on the power requirements (voltage / current) of the peripheral expansion interface through its built-in digital-to-analog converter (DAC), outputting a voltage that matches the peripheral's requirements in real time. It also ensures power supply stability by monitoring the load current, flexibly adapting to the power requirements of different peripherals and optimizing power management efficiency. The MCU configures the USB controller pins to high-speed mode (480Mbps), loads the device descriptor and enables the bulk transfer endpoint, establishes a physical connection with the host through differential signal lines (D+ / D-), completes link layer enumeration and speed negotiation, and ensures that the USB interface can achieve high speeds. Operating in high-speed mode to meet the needs of high-bandwidth data transmission, and through the loading of device descriptors and the activation of batch transmission endpoints, the MCU and controller interact with data via the USB batch transmission channel. CRC16 checksum is used to ensure transmission integrity. At the same time, a NAK retry mechanism is configured to deal with transient interference, and a heartbeat packet is synchronously established to detect link activity and ensure communication reliability. CRC16 checksum effectively detects errors in the data transmission process, ensuring data integrity and accuracy. The NAK retry mechanism can automatically retry when encountering transient interference to avoid data loss. Heartbeat packet detection is used to monitor the link status in real time to ensure the activity and stability of the communication link.

[0064] S5. Based on the USB communication link, the MCU receives the configuration packet and adjusts and configures the various requirements of the peripheral expansion interface (interface working mode, sampling period, output frequency and synchronization) in combination with the ant colony algorithm. The MCU starts each peripheral expansion interface to work. The MCU receives the configuration packet sent by the controller through the USB communication link, parses the various configuration parameters of the peripheral expansion interface in it, and dynamically adjusts the settings of the peripheral expansion interface according to the parsed configuration parameters in combination with the ant colony algorithm. It optimizes the working mode, sampling period, output frequency and synchronization function of each peripheral expansion interface to achieve the best operating state. After the optimization configuration is completed, the MCU starts each peripheral expansion interface to start working according to the adjusted configuration parameters, ensuring that the peripherals operate as required.

[0065] Furthermore, the process of dynamically adjusting the settings of peripheral expansion interfaces using the ant colony algorithm is as follows: After receiving the configuration packet via USB communication, the MCU performs protocol parsing and data verification, extracting configuration parameters of the peripheral expansion interfaces, including working mode, sampling period, output frequency, and synchronization function. Based on the parsing results, a multi-objective optimization model is constructed, using each configuration parameter as an optimization variable. A fitness function is defined to comprehensively evaluate energy efficiency, response speed, and stability. The pheromone matrix is ​​initialized using the ant colony algorithm to simulate the search behavior of an ant colony in the parameter space. The MCU executes the ant colony algorithm iteratively, with each ant generating candidate parameter combinations based on pheromone concentration and heuristic rules. The performance of each combination is evaluated using the fitness function. The ant colony algorithm updates pheromone concentrations, enhancing pheromone levels on high-fitness paths and reducing pheromone levels on low-fitness paths. During optimization, it monitors peripheral constraints, including clock resources and power consumption limits, in real time and dynamically adjusts the pheromone update strategy to avoid getting trapped in local optima and ultimately converge to the globally optimal parameter set. The MCU loads the globally optimal parameter set output by the ant colony algorithm into each peripheral expansion interface through register writing or memory mapping, completing the real-time configuration of various parameters. During startup, peripherals are activated according to priority, and the initialization status is monitored. During operation, actual working parameters are continuously collected and compared with the optimization target through a closed-loop feedback mechanism to dynamically fine-tune parameters, ensuring that peripherals always operate in the optimal state, balancing performance and resource efficiency.

[0066] The specific work involves: the MCU receiving configuration packets sent by the controller via a USB communication link, parsing them, and extracting various configuration parameters of the peripheral expansion interfaces, including the peripheral's operating mode, sampling period, output frequency, and synchronization requirements. The parsing process ensures data accuracy and integrity. Based on a preset data structure and protocol specification, the MCU parses the configuration packet item by item, converting configuration instructions into specific parameter setting instructions. The MCU then dynamically optimizes the parsed configuration parameters using an ant colony algorithm, treating the peripheral expansion interface's operating mode, sampling period, output frequency, and synchronization function as optimization variables. A multi-objective optimization model is constructed, and by simulating ant colony search behavior, the optimal solution is iteratively sought in the parameter space. Pheromones concentration reflects the fitness of the parameter combination, and the fitness function comprehensively considers energy efficiency, response speed, and stability during the optimization process. The MCU evaluates the constraints of each peripheral expansion interface in real time and dynamically adjusts the pheromone update strategy to avoid getting trapped in local optima. The final optimized configuration contains the best parameter set for each interface, ensuring that the system achieves optimal global performance under resource-constrained conditions while meeting the differentiated needs of different peripherals. After completing the optimized configuration, the MCU loads the adjusted parameters into the control module of each peripheral expansion interface through register writing or memory mapping, including clock division coefficient, ADC sampling rate, PWM duty cycle, and synchronization signal trigger conditions. During startup, the MCU activates the peripheral expansion interfaces in order of priority and monitors the initialization status. If a fault occurs, it rolls back to the default configuration and records the error log. During operation, the MCU continuously monitors the actual working parameters of the peripheral expansion interfaces and dynamically fine-tunes the configuration through a closed-loop feedback mechanism to ensure that the peripherals always run in an optimized state.

[0067] S6. The MCU executes the functions of the peripheral expansion interface and feeds back to the controller after completion. The controller collects the data from each peripheral expansion interface for further processing.

[0068] S7, the MCU starts a cycle monitoring process, scans the status of peripheral expansion interfaces, sends a status packet to the controller when an abnormality occurs, and responds to instructions to adjust the operating status of peripheral expansion interfaces. The controller controls peripheral expansion interfaces through the USB interface, assisting in the iterative upgrade of robot sensor expansion solutions.

[0069] Example 2, as Figure 1 , Figure 2As shown, based on Embodiment 1, the present invention provides a technical solution: S6 specifically includes: the MCU starts and executes the function of the peripheral expansion interface according to the optimized configuration parameters, and generates an execution status flag (success / failure) and corresponding performance data after completion, and feeds it back to the controller through an interrupt or polling mechanism. The controller synchronously collects the real-time data of each peripheral expansion interface through register reading, memory mapping or DMA, merges them into a unified data frame and marks the timestamp to ensure the spatiotemporal consistency of multi-channel data. The controller parses and verifies the collected data, generates control instructions based on preset threshold judgment rules, dynamically adjusts the peripheral configuration parameters, and forms an execution-feedback-optimization closed-loop control system.

[0070] The specific tasks are as follows: After loading the optimized configuration parameters, the MCU initializes the peripheral expansion interfaces through register configuration or memory mapping. The MCU monitors the hardware status of the peripherals in real time and generates execution status flags. If all initialization steps are successful, the status flag is set to success, and key performance data (startup latency, resource utilization, first frame data output time, etc.) is recorded. If any step fails, the status flag is set to failure, along with an error code (clock lockout, memory access conflict, communication timeout, etc.). The status flag and performance data are then fed back to the controller through an interrupt mechanism (prioritizing high real-time requirements) or a polling mechanism (suitable for low-power scenarios). The controller synchronously collects real-time data from each peripheral expansion interface, including sensor sampling values ​​and actuator output status, through direct register reading, fast memory mapping access, or DMA automatic transfer. To ensure the quality of the state and communication link, the controller adds a high-precision timestamp (based on the system clock or external synchronization signal) to the collected data frames and uses a buffer queue mechanism to align the arrival times of data from different peripherals. The merged unified data frame contains the peripheral ID, timestamp, original data, and checksum. The integrity is verified by the hardware acceleration module. If the data verification fails, the controller triggers a re-acquisition mechanism; if successful, the data frame is sent to the parsing module. The controller performs threshold judgment on the parsed data (temperature exceeds limits, pressure fluctuations are too large, synchronization errors exceed standards), and generates adjustment instructions based on preset rules. The adjustment instructions update the peripheral configuration parameters through register writing or memory mapping, forming a closed loop of execution-feedback-optimization. During the optimization process, the controller continuously monitors the adjustment effect. If the performance indicators (steady-state error, response speed, energy efficiency ratio) do not meet expectations, a secondary optimization process is initiated.

[0071] S7 specifically includes: MCU startup cycle monitoring process, which scans the hardware status of peripheral expansion interfaces in real time through registers or memory mapping, generates status flags, and immediately encapsulates a status packet (including error code and timestamp) and sends it to the controller through an interrupt mechanism to trigger the fault handling process. After receiving the status packet, the controller parses the error type and sends adjustment instructions through the USB interface. The MCU responds to the adjustment instructions, updates the peripheral configuration through register writing or memory mapping, corrects the operating status, ensures the compatibility of peripheral interfaces with sensor expansion solutions, supports iterative upgrade requirements, and after the MCU performs the adjustment, continuously monitors peripheral performance indicators, calculates peripheral performance estimation coefficients, analyzes the overall trend of peripheral performance, and then feeds back the optimization results to the controller. The controller generates iterative suggestions based on the verification data and sends them back to the MCU through the USB interface, forming a closed-loop upgrade process of detection-adjustment-verification. Among them, peripheral performance indicators include response latency, data throughput, resource utilization, synchronization error, and data accuracy.

[0072] The specific tasks are as follows: During the startup phase, the MCU initializes the periodic monitoring process. Through direct register access or memory mapping, it scans the hardware status of peripheral expansion interfaces in real time, continuously monitoring key parameters including clock signal stability, memory access conflicts, and communication link integrity. It generates binary status flags. If clock lockout, data bus conflict, or communication timeout is detected, the MCU immediately encapsulates a status packet containing an error code, an exception timestamp, and the peripheral ID. This status packet is sent to the controller via a hardware interrupt mechanism, triggering a fault handling process. After receiving the status packet from the MCU, the controller parses the error type and matches it with a preset processing strategy. It then sends adjustment instructions to the MCU via the USB interface. These instructions include peripheral parameter corrections or operating mode switching. The MCU updates the peripheral configuration through register writing or memory mapping to correct the operating status. Simultaneously, a configuration update mechanism is pre-configured. An expansion interface is provided to support future peripheral upgrades and ensure long-term system maintainability. After the MCU completes configuration adjustments, it continuously monitors peripheral performance metrics (response latency, data throughput, resource utilization, synchronization error, and data accuracy), calculates performance estimation coefficients, and analyzes overall trends. The monitoring results are fed back to the controller, which generates iteration suggestions based on verification data (optimizing interrupt priority and adjusting cache allocation strategies) and sends them back to the MCU via USB. The MCU further adjusts parameters according to the suggestions, forming a closed-loop process of detection-adjustment-verification. Response latency is the time it takes for a peripheral to receive a control command and output valid data; data throughput is the amount of valid data successfully transmitted by the peripheral per unit time; resource utilization is the proportion of MCU resources used by the peripheral during operation; synchronization error is the deviation range of timestamps from multiple peripheral data; and data accuracy is the data accuracy after the MCU executes the adjustment instructions.

[0073] Furthermore, the calculation process of the peripheral performance estimation coefficient is as follows: continuously collect the actual values ​​of each peripheral performance index before and after the MCU completes the configuration adjustment, including response latency, data throughput, resource utilization, synchronization error and data accuracy. For each peripheral performance index, extract the benchmark value determined according to the system design, and then calculate the ratio of each peripheral performance index to its corresponding benchmark value to obtain the normalized ratio. Perform a sum of squares calculation on each obtained normalized ratio, and then calculate the square root of the sum of squares and take its reciprocal to obtain the performance deviation impact value. Calculate the reciprocal of the sum of squares calculation result and the logarithm of the reciprocal to obtain the reinforcement deviation value. Multiply the performance deviation impact value and the reinforcement deviation value to obtain the final performance estimation coefficient. Then compare the performance estimation coefficients before and after the MCU completes the configuration adjustment to analyze the overall trend of peripheral performance.

[0074] The expression for calculating the performance estimation coefficient is as follows:

[0075] ;

[0076] In the formula: This is a peripheral performance estimation coefficient used to comprehensively evaluate the performance of peripherals. For the first The actual values ​​of the performance indicators of each peripheral device, among which The values ​​range from 1 to 5, corresponding to peripheral performance indicators. For the first The baseline values ​​for each peripheral performance metric are used to normalize the actual values. This represents the impact value of performance deviation. To reinforce the deviation value, it is used to further amplify the difference between the actual value and the benchmark value of the performance indicator.

[0077] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0078] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for expanding a single-wire USB sensor interface in a robot head controlled by an MCU, characterized in that, Includes the following steps: S1. Connect the target robot's controller to the head expansion interface board via a single-wire USB connector, and scan and identify the connected USB peripheral expansion interface MCU. Specifically, this includes: connecting the target robot's controller to the head expansion interface board via a single-wire USB connector to complete the hardware connection; the controller then starts the initialization program, checks the USB connection status, and ensures that the connection is normal and the head expansion interface board is in a state of being ready for recognition. The controller sends a scanning command via the USB interface to activate the identification function of the head expansion interface board. Based on the MCU response command of the head expansion interface board, it starts a self-test program to identify the connected peripheral expansion interface and feeds back the interface information to the controller. The controller receives peripheral expansion interface information from the MCU, verifies and confirms it. After confirming that it is correct, the controller records the peripheral expansion interface information and completes the initialization configuration. S2. The controller sends a query command to the MCU. The MCU powers on the peripheral expansion interfaces in sequence and queries the status and supported modes of each interface through the I2C bus. Specifically, this includes: the controller sending a query command to the MCU via a single-wire USB interface. The query command contains a query request for the status and supported modes of the peripheral expansion interface. The MCU receives the query command and prepares to execute subsequent operations. After receiving the query command, the MCU powers on the peripheral expansion interfaces in a preset order. The MCU communicates with each interface chip through the I2C bus to query the status of the interface and the supported communication modes. The MCU summarizes and organizes the peripheral expansion interface status and supported mode information found, forms a complete feedback data packet, and feeds the feedback data packet back to the controller through the USB interface; S3, the MCU summarizes the peripheral expansion interface information and feeds it back to the controller. The controller generates a data packet, i.e., a configuration packet, based on the configuration file. S4. Based on the peripheral expansion interface requirements, the MCU is configured to output the corresponding voltage power supply via the embedded DC / DC module, and a USB communication link is established. S5. Based on the USB communication link, the MCU receives the configuration packet and adjusts and configures the various requirements of the peripheral expansion interface in combination with the ant colony algorithm; S6. The MCU executes the functions of the peripheral expansion interface and feeds back to the controller after completion. The controller collects the data from each peripheral expansion interface for further processing. S7, the MCU starts a cycle monitoring process, scans the status of peripheral expansion interfaces, sends a status packet to the controller when an abnormality occurs, and responds to instructions to adjust the operating status of peripheral expansion interfaces. The controller controls peripheral expansion interfaces through the USB interface.

2. The MCU-controlled robot head single-wire USB sensor expansion interface method according to claim 1, characterized in that: S3 specifically includes: After the MCU completes the status query of the peripheral expansion interface through the I2C bus, it encapsulates the information according to the preset data structure and sends it to the controller through the USB batch transmission channel. After receiving peripheral expansion interface information from the MCU, the controller parses it according to the preset configuration file and generates a configuration data packet containing the interface working mode, sampling period, output frequency and synchronization requirements. The controller sends the generated configuration data packet to the MCU via the USB interface. The MCU receives and parses the configuration packet, adjusts the working status of the peripheral expansion interface according to the configuration requirements, and completes the initialization configuration.

3. The MCU-controlled robot head single-wire USB sensor expansion interface method according to claim 1, characterized in that: S4 specifically includes: Based on the power requirements of the peripheral expansion interface, the MCU dynamically adjusts the feedback resistor network of the embedded DC / DC module through the built-in DAC, outputs the matching voltage in real time, and monitors the load current. The MCU configures the USB controller pins to high-speed mode, loads the device descriptor and enables the bulk transfer endpoint, establishes a physical connection with the host through differential signal lines, and completes link layer enumeration and speed negotiation. The MCU and controller exchange data through the USB bulk transfer channel, configure the NAK retry mechanism to deal with transient interference, and synchronously establish a heartbeat packet to detect link activity.

4. The MCU-controlled robot head single-wire USB sensor expansion interface method according to claim 1, characterized in that: S5 specifically includes: The MCU receives the configuration packet sent by the controller via the USB communication link and parses the various configuration parameters of the peripheral expansion interface. Based on the parsed configuration parameters, the MCU dynamically adjusts the settings of the peripheral expansion interfaces using the ant colony algorithm, optimizing the working mode, sampling period, output frequency, and synchronization function of each peripheral expansion interface to achieve the best operating state. After the optimization configuration is completed, the MCU starts the expansion interfaces of each peripheral device, enabling them to start working according to the adjusted configuration parameters.

5. The MCU-controlled robot head single-wire USB sensor expansion interface method according to claim 4, characterized in that: The process of dynamically adjusting the settings of peripheral expansion interfaces using the ant colony algorithm is as follows: After receiving the configuration packet via USB communication, the MCU performs protocol parsing and data verification, extracts configuration parameters of peripheral expansion interfaces including working mode, sampling period, output frequency and synchronization function, and constructs a multi-objective optimization model based on the parsing results. The configuration parameters are used as optimization variables, and a fitness function is defined to comprehensively evaluate energy efficiency, response speed and stability. The pheromone matrix is ​​initialized through the ant colony algorithm to simulate the search behavior of ant colonies in the parameter space. The MCU executes the ant colony algorithm iteratively. Each ant generates candidate parameter combinations based on pheromone concentration and heuristic rules. The performance of each combination is evaluated through a fitness function, and the pheromone concentration is dynamically updated. During the optimization process, peripheral constraints, including clock resources and power consumption limits, are monitored in real time, and the pheromone update strategy is dynamically adjusted. Finally, the algorithm converges to the globally optimal parameter set. The MCU loads the globally optimal parameter set output by the ant colony algorithm into each peripheral expansion interface through register writing or memory mapping, completes the real-time configuration of various configuration parameters, activates peripherals according to priority during startup, and monitors the initialization status. During operation, it continuously collects actual working parameters, compares them with the optimization target through a closed-loop feedback mechanism, and dynamically fine-tunes the parameters to ensure that the peripherals always operate in the optimal state.

6. The MCU-controlled robot head single-wire USB sensor expansion interface method according to claim 1, characterized in that: S6 specifically includes: Based on the optimized configuration parameters, the MCU starts and executes the functions of the peripheral expansion interface. After completion, it generates an execution status flag and corresponding performance data, which are fed back to the controller through interrupt or polling mechanism. The controller synchronously collects real-time data from various peripheral expansion interfaces through register reading, memory mapping, or DMA, merges them into a unified data frame, and marks it with a timestamp. The controller parses and verifies the collected data, generates control commands based on preset threshold judgment rules, dynamically adjusts peripheral configuration parameters, and forms a closed-loop control system of execution-feedback-optimization.

7. The MCU-controlled robot head single-wire USB sensor expansion interface method according to claim 1, characterized in that: Specifically, S7 includes: The MCU starts a cycle monitoring process, which scans the hardware status of peripheral expansion interfaces in real time through registers or memory mapping, generates status flags, and immediately encapsulates a status packet and sends it to the controller through an interrupt mechanism to trigger the fault handling process. After receiving the status packet, the controller parses the error type and sends an adjustment command through the USB interface. The MCU responds to the adjustment command and updates the peripheral configuration through register writing or memory mapping to correct the operating status. After the MCU performs the adjustment, it continuously monitors the peripheral performance indicators, calculates the peripheral performance estimation coefficient, analyzes the overall trend of peripheral performance, and then feeds back the optimization results to the controller. The controller generates iterative suggestions based on the verification data and sends them back to the MCU via the USB interface, forming a closed-loop upgrade process of detection-adjustment-verification. The peripheral performance indicators include response latency, data throughput, resource utilization, synchronization error, and data accuracy.

8. The MCU-controlled robot head single-wire USB sensor expansion interface method according to claim 7, characterized in that: The calculation process for the peripheral performance estimation coefficient is as follows: Continuously collect the actual values ​​of various peripheral performance indicators before and after the MCU completes configuration adjustments, including response latency, data throughput, resource utilization, synchronization error, and data accuracy; For each peripheral performance index, extract the baseline value determined according to the system design, and then calculate the ratio of each peripheral performance index to its corresponding baseline value to obtain the normalized ratio. For each normalized ratio obtained, the sum of squares is calculated, and then the square root of the sum of squares is calculated and its reciprocal is taken to obtain the performance deviation impact value. The reciprocal of the sum of squares is calculated, and the logarithm of the reciprocal is calculated to obtain the reinforcement deviation value. Multiply the performance deviation impact value by the enhancement deviation value to obtain the final performance estimation coefficient. Then compare the performance estimation coefficients before and after the MCU configuration adjustment to analyze the overall trend of peripheral performance.