Intelligent control method and device for lightweight embedded terminal, equipment and medium
By generating instruction prompt text locally on the embedded device and guiding the cloud to generate structured execution instructions, the problem of hardware device intelligence relying on the cloud is solved, and an efficient intelligent control experience is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHU HAI RU RAN ZHI NENG KE JI YOU XIAN GONG SI
- Filing Date
- 2026-03-31
- Publication Date
- 2026-06-09
AI Technical Summary
Due to hardware resource limitations, IoT and embedded devices cannot directly run large language models or complex agent logic, causing the intelligence of hardware devices to rely on the cloud. This results in excessive cloud computing load, slow response speed, and numerous interaction rounds, thus reducing the user experience.
Command prompt text is generated locally on the embedded hardware device and encapsulated into a session request data packet that conforms to the cloud-based large language model specification. The cloud generates structured execution commands through preset command mapping prompt words, and the device only parses and executes them, avoiding multiple rounds of semantic parsing and interaction.
Significantly reduce cloud computing load, decrease the number of interactions between devices and the cloud, and improve hardware response speed and user intelligent control experience.
Smart Images

Figure CN122179463A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of intelligent control technology, and in particular to a lightweight embedded intelligent control method, device, equipment and medium. Background Technology
[0002] With the development of Large Language Model (LLM) technology, agent-based intelligent applications are gradually becoming mainstream. However, in the fields of IoT and embedded systems, many hardware devices are limited by power consumption, cost, and size, making it impossible to directly run large language models or complex agent logic. The intelligence of these hardware devices relies entirely on the cloud, resulting in excessive cloud computing load. Ultimately, this leads to slow hardware response times, numerous interactions between hardware devices and the cloud, and a reduced user experience of intelligent control. Summary of the Invention
[0003] The main objective of this disclosure is to provide a lightweight embedded intelligent control method, device, equipment, and medium that can improve the response speed of hardware devices and enhance the user's intelligent control experience.
[0004] To achieve the above objectives, a first aspect of this disclosure provides a lightweight embedded intelligent control method applied to an embedded hardware device, comprising: Receive control commands for the embedded hardware device, and concatenate the preset command mapping prompt words with the control commands to generate command prompt text; The instruction prompt text is encapsulated into a session request data packet conforming to the cloud-based large language model specification, and the session request data packet is sent to the cloud-based large language model. After parsing the session request data packet, the cloud-based large language model generates a corresponding structured execution instruction based on the control instruction under the guidance of the instruction mapping prompt words, and generates a session response data packet based on the structured execution instruction. Receive the session response data packet currently returned by the cloud-based large language model, and parse the session response data packet to obtain the structured execution instruction; The corresponding operation is executed based on the structured execution instructions.
[0005] In some embodiments, performing the corresponding operation based on the structured execution instructions includes: Execute the corresponding operation based on the structured execution instructions, and generate the current execution result; The current execution result is encapsulated into a new session request data packet, and the new session request data packet is sent to the cloud-based large language model. After parsing the new session request data packet, the cloud-based large language model regenerates a new structured execution instruction based on the execution result in the current dialogue context, and generates a new session response data packet based on the new structured execution instruction. The system receives the new session response data packet returned by the cloud-based large language model, parses the new session response data packet to obtain a new structured execution instruction, and executes the corresponding operation based on the new structured execution instruction until the control instruction is completed.
[0006] In some embodiments, after encapsulating the current execution result into a new session request data packet and sending the new session request data packet to the cloud-based large language model, the lightweight embedded intelligent control method further includes: If the received session response data packet does not contain a structured execution instruction, the control instruction is deemed complete.
[0007] In some embodiments, after determining that the control instruction has been completed when the received session response data packet does not contain a structured execution instruction, the lightweight embedded intelligent control method further includes: The execution results of the tasks corresponding to the control commands are summarized to generate task completion feedback information, which is then sent to the corresponding user terminal.
[0008] In some embodiments, the preset instruction mapping prompt includes a device role definition field, an available executable instruction list field, an instruction parameter specification field, and an output format constraint field; wherein, the available executable instruction list field records the name, function description, and parameter requirements of each instruction that the embedded hardware device can execute, and the output format constraint field is used to limit the output format and content rules of the structured execution instructions generated by the cloud-based large language model.
[0009] In some embodiments, performing the corresponding operation based on the structured execution instructions includes: Parse the instruction identifier and parameter information in the structured execution instructions; The embedded hardware device's built-in firmware is invoked to call the functional module corresponding to the instruction identifier, and the corresponding functional module is controlled to perform the corresponding operation based on the parameter information.
[0010] In some embodiments, the intelligent control method for the lightweight embedded terminal further includes: Receive a prompt word update instruction and parse the prompt word update instruction to obtain the update content and update type, wherein the update type includes at least one of addition, modification, and deletion; Based on the update type and the update content, the locally stored command mapping prompts are adjusted accordingly to generate updated command mapping prompts.
[0011] To achieve the above objectives, a second aspect of this disclosure provides a lightweight embedded intelligent control device, comprising: The prompt text generation module is used to receive control commands for the embedded hardware device and concatenate preset command mapping prompt words with the control commands to generate command prompt text; The data packet sending module is used to encapsulate the instruction prompt text into a session request data packet that conforms to the cloud-based big language model specification, and send the session request data packet to the cloud-based big language model, so that after the cloud-based big language model parses the session request data packet, it generates a corresponding structured execution instruction based on the control instruction under the guidance of the instruction mapping prompt words, and generates a session reply data packet based on the structured execution instruction; The data packet receiving module is used to receive the session response data packet currently returned by the cloud-based large language model, and parse the session response data packet to obtain the structured execution instruction; The instruction control module is used to execute corresponding operations based on the structured execution instructions.
[0012] To achieve the above objectives, a third aspect of this disclosure provides an electronic device, the electronic device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the lightweight embedded intelligent control method described in the first aspect embodiment.
[0013] To achieve the above objectives, a fourth aspect of the present disclosure provides a storage medium, which is a computer-readable storage medium storing a computer program that, when executed by a processor, implements the lightweight embedded intelligent control method described in the first aspect embodiment.
[0014] The beneficial effects of the embodiments disclosed herein include: This embodiment of the disclosure deploys the method locally on the embedded hardware device. It concatenates preset instruction mapping prompts with control instructions to generate instruction prompt text, encapsulates this text into a session request data packet conforming to the cloud-based large language model specification, and sends it to the cloud. The preset instruction mapping prompts accurately guide the cloud-based large language model to generate structured execution instructions that the device can directly execute. This eliminates the need for multiple rounds of complex semantic parsing and interactive confirmation by the cloud, significantly reducing the cloud's computational load, decreasing the number of interaction rounds between the embedded hardware device and the cloud, and avoiding latency losses caused by multiple rounds of interaction. Ultimately, the device only needs to parse the single session response data packet returned by the cloud to obtain the structured execution instructions and perform the corresponding operations. The entire process requires only the hardware device to perform lightweight control instruction reception, concatenation of preset instruction mapping prompts and control instructions, data packet encapsulation and parsing, and instruction execution. There is no need to run a large language model or complex agent logic locally on the device, effectively improving the hardware device's response speed and enhancing the user's intelligent control experience. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of an application environment for the lightweight embedded intelligent control method provided in the embodiments of this disclosure; Figure 2 This is a flowchart illustrating the lightweight embedded intelligent control method provided in this embodiment of the present disclosure. Figure 3 yes Figure 2 A flowchart further includes step S104; Figure 4 yes Figure 2 Another process diagram further included in step S104; Figure 5 This is another schematic flowchart of the lightweight embedded intelligent control method provided in this embodiment of the present disclosure; Figure 6 This is a schematic diagram of the functional modules of the lightweight embedded intelligent control device provided in the embodiments of this disclosure; Figure 7 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this disclosure. Detailed Implementation
[0016] The accompanying drawings in the embodiments clearly and completely describe the technical solutions in the embodiments of this disclosure. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments in this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0017] It is understood that in the specific embodiments of this disclosure, which involve retrieving control commands, command prompt mapping words, and related data, when the above embodiments of this disclosure are applied to specific products or technologies, permission or consent can be obtained from the target, and the collection, use, and processing of related data must comply with relevant laws, regulations, and standards.
[0018] Furthermore, when the embodiments of this disclosure need to retrieve control commands, command prompt mapping words, and related data, separate permission or separate consent to the control commands, command prompt mapping words, and related data can be obtained through pop-up windows or by jumping to a confirmation page. After clearly obtaining separate permission or separate consent to the control commands, command prompt mapping words, and related data, the necessary control commands, command prompt mapping words, and related data for enabling the embodiments of this disclosure to operate normally can then be obtained.
[0019] In this disclosure, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0020] Please see Figure 1 , Figure 1 A schematic diagram of the scenario for implementing the lightweight embedded intelligent control method provided in this embodiment of the disclosure includes: an embedded hardware device 11 and a cloud 12.
[0021] For example, the embedded hardware device 11 can receive control commands for itself, and concatenate preset command mapping prompts with the control commands to generate command prompt text; encapsulate the command prompt text into a session request data packet conforming to the specifications of the 12 major cloud language models, and send the session request data packet to the 12 major cloud language models, so that after parsing the session request data packet, the 12 major cloud language models generate corresponding structured execution commands based on the control commands under the guidance of the command mapping prompts, and generate session reply data packets based on the structured execution commands; receive the session reply data packets currently returned by the 12 major cloud language models, and parse the session reply data packets to obtain structured execution commands; and execute the corresponding operations based on the structured execution commands.
[0022] The embedded hardware device 11 can be a lightweight device such as an intelligent voice interaction device, a smart wearable device, a smart home appliance, or an in-vehicle terminal, but it is not limited to these. Due to limitations in power consumption, cost, and size, it typically has only KB-level or a very small amount of MB-level memory and cannot directly run large models or complex agent core logic. The hardware device 11 and the cloud 12 can be directly or indirectly connected through wired or wireless communication methods, and this disclosure does not impose any limitations.
[0023] The cloud can include servers, which can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Additionally, server 12 can also be a node server in a blockchain network. A large language model is deployed in the cloud, which can intelligently interact and control hardware device 11.
[0024] It should be noted that, Figure 1 The schematic diagram of the implementation environment shown is merely an example. The scenarios described in this disclosure are intended to more clearly illustrate the technical solutions of this disclosure and do not constitute a limitation on the technical solutions provided in this disclosure. As those skilled in the art will know, with the evolution of technology and the emergence of new business scenarios, the technical solutions provided in this disclosure are also applicable to similar technical problems.
[0025] Please see Figure 2 , Figure 2 This is a flowchart illustrating the lightweight embedded intelligent control method provided in this embodiment. This lightweight embedded intelligent control method can be applied to the embedded hardware device described in the above embodiments. The embedded hardware device can be simply referred to as a hardware device or device. The lightweight embedded intelligent control method includes steps S101 to S104: Step S101: Receive control commands for the embedded hardware device, and concatenate the preset command mapping prompts with the control commands to generate command prompt text; Step S102: Encapsulate the instruction prompt text into a session request data packet that conforms to the cloud-based big language model specification, and send the session request data packet to the cloud-based big language model, so that after the cloud-based big language model parses the session request data packet, it generates the corresponding structured execution instruction based on the control instruction under the guidance of the instruction mapping prompt words, and generates a session reply data packet based on the structured execution instruction. Step S103: Receive the session response data packet returned by the cloud-based large language model and parse the session response data packet to obtain structured execution instructions; Step S104: Execute the corresponding operation based on the structured execution instructions.
[0026] Regarding step S101 above, the embedded hardware device refers to a resource-constrained IoT terminal device, or simply a hardware device. It may contain microcontrollers such as ESP32 or STM32, and have limited RAM and Flash storage, such as a memory size of a few hundred KB to a few MB. With such a memory size, it is impossible to run a complete large language model or complex intelligent agent logic. Control commands are natural language commands issued by the user through voice, APP, or other interactive methods, such as commands sent from the terminal to the hardware device like "Turn on the air conditioner when the temperature is above 25 degrees" or "Turn on the living room lights."
[0027] The preset command mapping prompts are text segments pre-programmed into the device firmware. These prompts guide the cloud-based large language model to understand the device's capabilities and invocation methods. The concatenation process involves linking the fixed command mapping prompts with the user-inputted control commands to form complete command prompt text. For example, the prompt "You are a smart home assistant, you can perform the following operations:..." is concatenated with the user command "Read the current temperature and humidity" to form a single text segment. In this way, the embedded hardware device does not need to understand semantics; it only needs to perform simple text concatenation to construct a context that meets the input requirements of the large language model.
[0028] It should be noted that, by concatenating preset instruction mapping prompts with control instructions, this embodiment of the present disclosure builds a bridge between device capabilities and user intent, enabling the cloud-based large language model to accurately understand which operations the device can perform and how to invoke these operations. This avoids running complex inference models on the embedded end and greatly reduces device resource consumption.
[0029] Regarding step S102 above, the session request data packet refers to a data format conforming to the API call specification of the cloud-based large language model, such as the JSON body in an HTTP / HTTPS request. It can contain the model name, temperature parameters, and a message list, including system messages and user messages. The embedded hardware device uses the generated instruction prompt text as a user message, and may attach system role messages to further standardize model behavior. It then encapsulates this into JSON format and sends it to the service address of the cloud-based large language model via an HTTP POST request. The cloud-based large language model is a large language model deployed in the cloud, often simply referred to as the large model, and can perform model inference and task scheduling.
[0030] It's important to note that after receiving a request, the cloud-based large language model, guided by the command mapping prompts, parses the user's control commands and maps them into structured execution instructions that the device can execute. A structured execution instruction is a machine-readable instruction format, such as a JSON object, containing fields like command name and parameters, such as {"command": "read_temp_humi", "parameters": {}}. Based on the list of available commands defined in the command mapping prompts, the cloud-based large language model selects the best-matching command, fills in the parameters, and generates structured output. Finally, the structured execution instruction is placed in a session response data packet and returned to the embedded hardware device.
[0031] It should be noted that, by delegating the complex semantic parsing task to the cloud-based large language model, while the embedded hardware device is only responsible for simple HTTP request encapsulation and sending, any low-end MCU with network connectivity can acquire intelligent agent capabilities, thus realizing lightweight intelligent control with end-to-cloud collaboration.
[0032] Regarding step S103 above, the embedded hardware device receives the HTTP response returned by the cloud through its communication module, parses the JSON data in the response body, and extracts the structured execution instructions. The parsing process involves only simple JSON parsing and does not require complex natural language processing, thus placing extremely low demands on the computing power and memory of the embedded hardware device. Furthermore, if the returned structured execution instructions contain multiple instructions, the device can store them sequentially or execute them one by one. If the response does not contain any structured execution instructions, the device can determine whether the task has been completed or an error has occurred based on a preset strategy.
[0033] It should be noted that, by allowing the cloud-based large language model to directly output structured instructions, the embedded hardware device only needs to perform lightweight parsing to obtain executable operations, thus avoiding multi-turn interactions and complex semantic understanding, and significantly improving response speed and reliability.
[0034] In step S104 above, the embedded hardware device calls the corresponding functional module in its firmware to perform the actual operation based on the parsed structured execution instructions. For example, if the instruction is {"command": "read_temp_humi"}, the device calls the sensor driver to read temperature and humidity sensor data; if the instruction is {"command": "send_ir", "parameters": {"code": "0x10EF"}}, the device calls the infrared emission module to send the specified infrared code. After execution, the device can generate execution results and can continue to interact with the cloud as needed to complete more complex task sequences.
[0035] It should be noted that, by completely handing over the instruction execution right to the local firmware, the device only needs to call the corresponding hardware interface according to the instruction, without having to perform reasoning or decision-making on the end side, making the entire control process lightweight and efficient, while maintaining the device's autonomous execution capability.
[0036] In summary, this embodiment of the present disclosure, through the execution of the lightweight embedded intelligent control method in steps S101 to S104, deploys the method locally on the embedded hardware device. It concatenates preset instruction mapping prompts with control instructions to generate instruction prompt text, encapsulates this text into a session request data packet conforming to the cloud-based large language model specification, and sends it to the cloud. The preset instruction mapping prompts accurately guide the cloud-based large language model to generate structured execution instructions that the device can directly execute. This eliminates the need for multiple rounds of complex semantic parsing and interactive confirmation on the cloud, significantly reducing the computational load on the cloud, decreasing the number of interaction rounds between the embedded hardware device and the cloud, and avoiding latency losses caused by multiple rounds of interaction. Ultimately, the device only needs to parse the single session response data packet returned by the cloud to obtain the structured execution instructions and perform the corresponding operation. The entire process requires only the hardware device to perform lightweight control instruction reception, concatenation of preset instruction mapping prompts and control instructions, data packet encapsulation and parsing, and instruction execution. It eliminates the need to run a large language model or complex agent logic locally on the device, effectively improving the hardware device's response speed and enhancing the user's intelligent control experience.
[0037] The following is a detailed description of the further contents included in steps S101 to S104 in the embodiments of this disclosure.
[0038] Please see Figure 3 , Figure 3 yes Figure 2 The flowchart further includes step S104. In some embodiments, during the execution of the corresponding operation based on the structured execution instructions, steps S201 to S203 may also be included: Step S201: Execute the corresponding operation based on the structured execution instructions and generate the current execution result; Step S202: Based on the current execution result, a new session request data packet is encapsulated and sent to the cloud-based large language model. After the cloud-based large language model parses the new session request data packet, it regenerates a new structured execution instruction based on the execution result in the current dialogue context, and generates a new session response data packet based on the new structured execution instruction. Step S203: Receive the new session response data packet returned by the cloud-based large language model, parse the new session response data packet to obtain the new structured execution instruction, and execute the corresponding operation based on the new structured execution instruction until the control instruction is completed.
[0039] In the above steps, the execution result is the feedback information generated by the device after executing the structured instructions, such as the temperature and humidity values obtained after reading the temperature and humidity sensor, or the success / failure status after sending an infrared code. The execution result can be converted into a text description, such as "Current temperature 25℃, humidity 60%". The new session request data packet is based on the original dialogue history, adding the execution result as a new user message to the session. At the same time, it can continue to carry instruction mapping prompts or reuse existing system messages to form a new request and send it to the cloud-based large language model. After receiving the request containing the execution result, the cloud-based large language model will determine whether to continue to the next operation based on the current dialogue context. If so, it will generate a new structured execution instruction; if the task has been completed, it can return a response without instructions, directly output summary text, or stop responding. This process can be repeated multiple times, forming an iterative execution, feedback, and re-execution loop, enabling the device to complete complex multi-step tasks.
[0040] For example, a user issues the command, "Read the temperature and humidity. If the temperature is above 28°C, turn on the fan; if the humidity is below 50%, turn on the humidifier." The device first concatenates the prompt with the command and sends it to the cloud. The cloud returns the first structured execution command: {"command": "read_temp_humi", "parameters": {}}. After execution, the device obtains a temperature of 30°C and humidity of 45%, and sends the result "temperature 30°C, humidity 45%" as a new message to the cloud. After analyzing the context, the cloud determines that the temperature is above 28°C and the humidity is below 50%, and generates two structured execution commands: first, it returns {"command": "turn_on_fan", "parameters": {"level": "medium"}}, and then in the next round, it returns {"command": "turn_on_humidifier", "parameters": {"level": "high"}}. The device executes these two commands sequentially. After each execution, the result is sent back until the cloud determines that the task is complete and returns a response of no instruction, or the device waits for a timeout after the last transmission without receiving a new instruction, then the current control process ends.
[0041] It should be noted that the embodiments of this disclosure, through an iterative execution, feedback, and re-execution mechanism, enable embedded devices to engage in multi-turn dialogue-style collaboration with a large language model in the cloud to complete complex automated tasks. The cloud is responsible for planning and decision-making, while the device is responsible for execution and feedback. Each performs its specific function, ensuring both intelligence and maintaining the lightweight nature of the device. Simultaneously, a dual completion determination mechanism combining structured instruction detection and waiting timeout ensures the reliability of task termination conditions, avoiding infinite loops or infinite waiting.
[0042] In some embodiments, after encapsulating the current execution result into a new session request data packet and sending the new session request data packet to the cloud-based large language model, it can also be determined that the control instruction is complete when the parsed received session response data packet does not contain a structured execution instruction.
[0043] In the above steps, the session response data packet can contain two types of content: one is a response containing structured execution instructions, instructing the device to continue execution; the other is a response without structured execution instructions, such as the large model directly outputting a summary text of task completion, outputting an empty instruction field, or not responding with any instructions. The cloud-based large language model can be guided to choose one of these options to end the current dialogue and control flow based on pre-configured instruction prompt text. The hardware device determines whether the task is complete by detecting whether the response contains the expected structured instruction field. If no structured execution instructions are detected, the current control flow is terminated, and resources are released.
[0044] It should be noted that the embodiments of this disclosure determine task completion by judging whether the response contains structured execution instructions, avoiding the need for additional agreed status codes or complex state machines, and simplifying the logic on the device side.
[0045] Furthermore, in this embodiment, there are multiple ways to determine the completion of the control command. Besides detecting whether the session reply data packet contains a structured execution instruction, a waiting time mechanism can be used to set the termination method. For example, the hardware device can preset a timeout period, start a timer after sending the execution result, and determine that the task is complete if no structured execution instruction is received from the cloud within the timeout period. This timeout mechanism can effectively cope with network fluctuations, cloud response delays, or large models returning empty responses, preventing the device from entering an infinite waiting state. Further, in conjunction with the above embodiments, these two determination methods can be used together. For example, priority can be given to detecting whether the reply contains a structured execution instruction; if it does, execution continues; if it does not contain it and the timeout has not occurred, completion is determined; if no reply is received after the timeout, completion is also determined.
[0046] In some embodiments, when the received session response data packet does not contain a structured execution instruction, after determining that the control instruction has been completed, the execution results of the task corresponding to the control instruction can be summarized to generate task completion feedback information, and the task completion feedback information can be sent to the corresponding user terminal.
[0047] In the steps described above, the task completion feedback information can be the key execution results recorded by the device throughout the interaction process. The device can send the task completion feedback information to the user terminal, such as a mobile app or smart speaker, through its own communication interface, such as MQTT, Bluetooth, or Wi-Fi module, so that the user can be informed of the task execution results in a timely manner. The aggregation method can be to retain the last execution result or to combine all execution results.
[0048] It should be noted that by feeding back the execution results to the user, this embodiment of the disclosure forms a complete interactive loop, thereby improving the user experience.
[0049] In some embodiments, the preset instruction mapping prompt includes a device role definition field, an available executable instruction list field, an instruction parameter specification field, and an output format constraint field; wherein, the available executable instruction list field records the name, function description, and parameter requirements of each instruction that can be executed by the embedded hardware device, and the output format constraint field is used to limit the output format and content rules of the structured execution instructions generated by the cloud-based large language model.
[0050] The Device Role Definition field describes the device's identity and functional scope to the large model, such as "You are a smart home assistant, connected to a temperature and humidity sensor and an infrared transmitter." The Available Executable Command List field lists all commands supported by the device in a structured manner. Each command includes a name, function description, required parameters, and their types, such as "command: read_temp_humi, description: read current temperature and humidity, parameters: none." The Command Parameter Specification field further refines the parameter types, value ranges, and whether they are required, ensuring the large model generates correct parameters. The Output Format Constraint field forces the large model to output in a specific format, such as "output in JSON format, do not output any extra text," enabling the device to parse stably. These fields together constitute a complete skill description, allowing the large model to accurately understand the device's capabilities and how to invoke it in every conversation.
[0051] For example, a complete instruction mapping prompt can be as follows: "You are a smart home assistant. You have connected a sensor device. You can perform the following operations, outputting in plain JSON format, without any additional text."
[0052] List of available commands: command: read_temp_humi, description: reads the current temperature and humidity, parameters: none; command: send_ir, description: send infrared signal, parameter: {"code": "hex_string"}; command: turn_on_fan, description: turn on the fan, parameter: {"level": "low|medium|high"}; The user command "Turn on the fan, medium speed" is concatenated into the large model output: {"command": "turn_on_fan", "parameters": {"level": "medium"}}. It should be noted that, through carefully designed instruction mapping prompts, the capability boundaries and calling protocols of the hardware device are communicated to the large model in natural language, enabling the large model to accurately understand and generate executable instructions. This achieves flexible declaration and dynamic expansion of device capabilities. At the same time, the output format constraints ensure the stability and reliability of the device-side parsing.
[0053] Please see Figure 4 , Figure 4 yes Figure 2 Another flowchart further includes step S104. In some embodiments, during the execution of the corresponding operation based on the structured execution instructions, steps S301 to S302 may also be included: Step S301: Parse the instruction identifier and parameter information in the structured execution instructions; Step S302: Call the function module corresponding to the instruction identifier in the built-in firmware of the embedded hardware device, and control the corresponding function module to perform the corresponding operation based on the parameter information.
[0054] In the above steps, the structured execution instruction is a JSON object containing a `command` field and a `parameters` field. The `command` field is the instruction identifier, and the `parameters` field contains the parameter information. When the hardware device parses the instruction, it extracts the `command` value and then finds the corresponding firmware function or hardware driver according to a predefined mapping table. For example, if the `command` field is "read_temp_humi", the sensor reading function is called; if the `command` field is "send_ir", the infrared transmission function is called, and the `code` value from the `parameters` field is passed as a parameter. During execution, the hardware device can also monitor the execution status, such as whether the sensor reading was successful or whether the fan started normally, and convert the results into subsequent feedback.
[0055] It should be noted that, by mapping instruction identifiers to specific functional modules in the firmware, this embodiment decouples cloud-based instructions from local hardware execution. The hardware device only needs to maintain a simple instruction function mapping table to support a wide range of hardware operations. Furthermore, adding new functions only requires updating the mapping table or prompts, without upgrading the core firmware logic. Simultaneously, the flexible parsing of parameter information allows the device to adapt to diverse control needs, improving the precision of control.
[0056] Please see Figure 5 , Figure 5 This is another schematic flowchart of the intelligent control method for a lightweight embedded terminal provided in this disclosure. In some embodiments, the intelligent control method for a lightweight embedded terminal may further include steps S401 to S402: Step S401: Receive the prompt word update instruction and parse the prompt word update instruction to obtain the update content and update type. The update type includes at least one of addition, modification, and deletion. Step S402: Based on the update type and update content, adjust the locally stored command mapping prompts accordingly to generate updated command mapping prompts.
[0057] In the steps described above, the prompt word update instruction can originate from the cloud, the user's device, or the local firmware update module. This instruction carries modification information for the instruction-mapped prompt words, such as adding a new instruction, modifying the parameter description of an existing instruction, or deleting at least one of the following: adding a new instruction, modifying the parameter description of an existing instruction, or deleting an unsupported instruction. After parsing the update type and content, the hardware device applies it to the locally stored prompt word text. For example, the device may have a pre-set basic prompt word at the factory. Subsequent OTA upgrades can dynamically add new instructions, such as adding the "play_music" instruction. Upon receiving the update instruction, the device appends the new instruction information to the prompt word and saves it to non-volatile memory. Afterward, the prompt word sent to the cloud by the hardware device will contain the newly added instruction, allowing the device's capabilities to be expanded at any time without requiring hardware replacement.
[0058] It should be noted that the embodiments of this disclosure realize online expansion and upgrading of hardware device functions by dynamically updating prompt words, which greatly enhances the flexibility and maintainability of the device, and users can obtain new intelligent control capabilities without replacing hardware.
[0059] It should be noted that the embedded hardware device in this disclosure embodiment can be any home appliance product with network connectivity and programmable control functions, such as smart lamps, smart sockets, smart air conditioners, smart curtains, smart speakers, etc. Taking a smart lamp as an example, the lightweight embedded intelligent control method of this disclosure embodiment runs on the microcontroller unit integrated inside. After the user issues a control command such as "adjust the light to warm yellow and brightness to 80%" via voice or mobile APP, the smart lamp concatenates the locally pre-stored command mapping prompt with the command and sends it to the cloud big language model. Under the guidance of the prompt, the cloud generates a structured execution command such as {"command": "set_light", "parameters": {"color": "warm_yellow", "brightness": 80}}. After the smart lamp parses the command, it calls the LED driver module in its firmware to convert the warm yellow color into RGB values and the brightness of 80% into PWM duty cycle, accurately controlling the LED beads to emit the light color desired by the user. Throughout the process, smart lighting fixtures only need to complete lightweight instruction splicing, HTTP communication, JSON parsing, and hardware driver calls. They do not need to run large model inference inside the lighting fixtures to achieve intelligent linkage between natural language semantic understanding and complex control logic, which significantly improves the intelligence level of home appliances and user experience.
[0060] Please see Figure 6 This disclosure also provides a lightweight embedded intelligent control device that can implement the above-described lightweight embedded intelligent control method. The lightweight embedded intelligent control device includes: The prompt text generation module 601 is used to receive control commands for embedded hardware devices and concatenate preset command mapping prompt words with the control commands to generate command prompt text; The data packet sending module 602 is used to encapsulate the instruction prompt text into a session request data packet that conforms to the cloud-based big language model specification, and send the session request data packet to the cloud-based big language model, so that after the cloud-based big language model parses the session request data packet, it generates the corresponding structured execution instruction based on the control instruction under the guidance of the instruction mapping prompt words, and generates a session reply data packet based on the structured execution instruction; The data packet receiving module 603 is used to receive the session response data packet currently returned by the cloud-based large language model, and parse the session response data packet to obtain structured execution instructions; The instruction control module 604 is used to execute corresponding operations based on structured execution instructions.
[0061] In summary, the lightweight embedded intelligent control device, through the execution of the lightweight embedded intelligent control method in the above embodiments, deploys the method locally on the embedded hardware device. It concatenates preset instruction mapping prompts with control instructions to generate instruction prompt text, encapsulates it into a session request data packet conforming to the cloud-based large language model specification, and sends it to the cloud. The preset instruction mapping prompts accurately guide the cloud-based large language model to generate structured execution instructions that the device can directly execute. This eliminates the need for multiple rounds of complex semantic parsing and interactive confirmation on the cloud, significantly reducing the cloud's computational load, decreasing the number of interaction rounds between the embedded hardware device and the cloud, and avoiding latency losses caused by multiple rounds of interaction. Ultimately, the device only needs to parse the single session response data packet returned by the cloud to obtain the structured execution instructions and execute the corresponding operations. The entire process requires only the hardware device to perform lightweight control instruction reception, concatenation of preset instruction mapping prompts and control instructions, data packet encapsulation and parsing, and instruction execution. It does not require running a large language model or complex agent logic locally on the device, effectively improving the hardware device's response speed and enhancing the user's intelligent control experience.
[0062] The specific implementation of the lightweight embedded intelligent control device is basically the same as the specific embodiment of the lightweight embedded intelligent control method described above, and will not be repeated here. Subject to meeting the requirements of the embodiments of this disclosure, the lightweight embedded intelligent control device may also be equipped with other functional modules to implement the lightweight embedded intelligent control method described above.
[0063] This disclosure also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned lightweight embedded intelligent control method. This electronic device can be any intelligent terminal, including tablet computers, in-vehicle computers, etc.
[0064] Please see Figure 7 , Figure 7 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 701 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this disclosure. The memory 702 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 702 can store operating devices and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 702 and is called and executed by the processor 701 to execute the lightweight embedded intelligent control method of the embodiments of this disclosure. The input / output interface 703 is used to implement information input and output; The communication interface 704 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 705 transmits information between various components of the device (e.g., processor 701, memory 702, input / output interface 703, and communication interface 704); The processor 701, memory 702, input / output interface 703, and communication interface 704 are connected to each other within the device via bus 705.
[0065] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned lightweight embedded intelligent control method.
[0066] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0067] The embodiments described in this disclosure are for the purpose of more clearly illustrating the technical solutions of this disclosure and do not constitute a limitation on the technical solutions provided by this disclosure. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by this disclosure are also applicable to similar technical problems.
[0068] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this disclosure, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0069] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0070] Those skilled in the art will understand that all or some of the steps, apparatuses, or functional modules / units in the methods disclosed above can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0071] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in this disclosure and the foregoing drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0072] It should be understood that in this disclosure, "at least one item" means one or more, and "more than one" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0073] In the several embodiments provided in this disclosure, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0074] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0075] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0076] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0077] The preferred embodiments of the present disclosure have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present disclosure. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and spirit of the present disclosure shall be within the scope of the claims of the present disclosure.
Claims
1. A lightweight embedded intelligent control method, applied to embedded hardware devices, characterized in that, include: Receive control commands for the embedded hardware device, and concatenate the preset command mapping prompt words with the control commands to generate command prompt text; The instruction prompt text is encapsulated into a session request data packet conforming to the cloud-based large language model specification, and the session request data packet is sent to the cloud-based large language model. After parsing the session request data packet, the cloud-based large language model generates a corresponding structured execution instruction based on the control instruction under the guidance of the instruction mapping prompt words, and generates a session response data packet based on the structured execution instruction. Receive the session response data packet currently returned by the cloud-based large language model, and parse the session response data packet to obtain the structured execution instruction; The corresponding operation is executed based on the structured execution instructions.
2. The lightweight embedded intelligent control method according to claim 1, characterized in that, The execution of the corresponding operation based on the structured execution instructions includes: Execute the corresponding operation based on the structured execution instructions, and generate the current execution result; The current execution result is encapsulated into a new session request data packet, and the new session request data packet is sent to the cloud-based large language model. After parsing the new session request data packet, the cloud-based large language model regenerates a new structured execution instruction based on the execution result in the current dialogue context, and generates a new session response data packet based on the new structured execution instruction. The system receives the new session response data packet returned by the cloud-based large language model, parses the new session response data packet to obtain a new structured execution instruction, and executes the corresponding operation based on the new structured execution instruction until the control instruction is completed.
3. The lightweight embedded intelligent control method according to claim 2, characterized in that, After encapsulating the current execution result into a new session request data packet and sending the new session request data packet to the cloud-based large language model, the lightweight embedded intelligent control method further includes: If the received session response data packet does not contain a structured execution instruction, the control instruction is deemed complete.
4. The lightweight embedded intelligent control method according to claim 3, characterized in that, When the received session response data packet does not contain a structured execution instruction, after determining that the control instruction has been completed, the lightweight embedded intelligent control method further includes: The execution results of the tasks corresponding to the control commands are summarized to generate task completion feedback information, which is then sent to the corresponding user terminal.
5. The lightweight embedded intelligent control method according to claim 1, characterized in that, The preset instruction mapping prompt includes a device role definition field, an available executable instruction list field, an instruction parameter specification field, and an output format constraint field; wherein, the available executable instruction list field records the name, function description, and parameter requirements of each instruction that the embedded hardware device can execute, and the output format constraint field is used to limit the output format and content rules of the structured execution instructions generated by the cloud-based large language model.
6. The lightweight embedded intelligent control method according to claim 1, characterized in that, The execution of the corresponding operation based on the structured execution instructions includes: Parse the instruction identifier and parameter information in the structured execution instructions; The embedded hardware device's built-in firmware is invoked to call the functional module corresponding to the instruction identifier, and the corresponding functional module is controlled to perform the corresponding operation based on the parameter information.
7. The lightweight embedded intelligent control method according to claim 1, characterized in that, The lightweight embedded intelligent control method also includes: Receive a prompt word update instruction and parse the prompt word update instruction to obtain the update content and update type, wherein the update type includes at least one of addition, modification, and deletion; Based on the update type and the update content, the locally stored command mapping prompts are adjusted accordingly to generate updated command mapping prompts.
8. A lightweight embedded intelligent control device, characterized in that, include: The prompt text generation module is used to receive control commands for the embedded hardware device and concatenate preset command mapping prompt words with the control commands to generate command prompt text; The data packet sending module is used to encapsulate the instruction prompt text into a session request data packet that conforms to the cloud-based big language model specification, and send the session request data packet to the cloud-based big language model, so that after the cloud-based big language model parses the session request data packet, it generates a corresponding structured execution instruction based on the control instruction under the guidance of the instruction mapping prompt words, and generates a session reply data packet based on the structured execution instruction; The data packet receiving module is used to receive the session response data packet currently returned by the cloud-based large language model, and parse the session response data packet to obtain the structured execution instruction; The instruction control module is used to execute corresponding operations based on the structured execution instructions.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the lightweight embedded intelligent control method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the lightweight embedded intelligent control method according to any one of claims 1 to 7.