An ADS marker light control method based on Bluetooth communication
By using a Bluetooth communication method with a custom fixed frame structure and state machine mechanism, the problems of low communication reliability and complex maintenance in ADS sign light control are solved, achieving efficient and reliable light control and fault diagnosis, and improving system security and maintenance convenience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- YIPU PHOTOELECTRIC (TIANJIN) CO LTD
- Filing Date
- 2026-06-26
- Publication Date
- 2026-07-24
Smart Images

Figure CN122458286A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of autonomous driving technology, and in particular to an ADS sign light control method based on Bluetooth communication. Background Technology
[0002] With the increasing maturity of autonomous driving technology, many vehicles are equipped with dedicated ADS (Autonomous Driving Domain Controller) indicator lights to clearly indicate their autonomous driving status. These indicator lights are typically controlled by an onboard autonomous driving domain controller or a host computer such as a user's mobile phone. The reliability, real-time performance, and maintainability of their control logic directly affect driving safety and user experience. Currently, how to achieve efficient, reliable, and easy-to-maintain wireless control of these indicator lights has become a key technical issue of concern in this field.
[0003] There are two main types of typical control schemes applied to ADS (Autonomous Driving System) sign lights. The first is a hard-wired signal control scheme, where the sign light is directly connected to specific input / output pins of the autonomous driving domain controller via physical wiring harnesses, using high and low level signals to directly control the light's on / off state. The second is a simplified wireless control scheme, some designs incorporating wireless communication modules such as Bluetooth, achieving remote control of the light by sending simple on / off commands. In a typical simplified Bluetooth control scheme, the communication protocol is relatively simple; for example, only a single byte or fixed string is defined as the on / off command, lacking a complete frame structure design. For receiving and processing, simple single-byte interrupt reception or fixed-length buffers are typically used for storage. The control method is a one-way command transmission; the host computer does not confirm the light's execution result after sending the on / off command.
[0004] The aforementioned existing technical solutions have significant shortcomings in practical applications. Hard-wired solutions suffer from inherent problems such as high wiring costs, inflexible deployment, and the inability to obtain lighting status feedback. Simple wireless control solutions have poor communication reliability; due to the lack of or reliance on simple accumulation and verification, they are highly susceptible to data errors in complex in-vehicle electromagnetic environments, leading to malfunctioning lights and potentially transmitting incorrect autonomous driving status information to the outside world. Existing solutions lack an effective closed-loop status feedback mechanism; after the host computer issues a command, it cannot know whether the lights have been successfully turned on or off. When the lights or drive circuit malfunctions, the system completely loses its diagnostic capabilities, posing a safety hazard. Simple solutions lack multi-command processing capabilities; for example, when commands of different lengths, such as reading status and turning lights on / off, are received mixed together, data overwriting or misalignment in the receiving buffer is highly likely. Existing Bluetooth control solutions involve cumbersome pairing and reset operations, typically requiring specialized tools or complex procedures to clear pairing information, causing significant inconvenience for vehicle maintenance and main control device replacement. Summary of the Invention
[0005] To address the problems of low communication reliability, lack of closed-loop status feedback, error-prone multi-command processing, and cumbersome Bluetooth reset operation in existing ADS sign light control systems, this invention provides an ADS sign light control method based on Bluetooth communication.
[0006] The technical solution adopted by this invention to solve its technical problem is: an ADS sign light control method based on Bluetooth communication. Preferably, it is applied to a sign light terminal including a microcontroller (MCU), a Bluetooth module, and an LED driver circuit. The method includes: S1: using a custom fixed frame structure with a verification mechanism for Bluetooth communication; S2: receiving Bluetooth command frames from the host computer through a state machine mechanism, and automatically identifying the command type according to the length of the received frame, storing command frames of different lengths into different buffers; S3: verifying the received command frames, executing corresponding control operations after successful verification, and actively replying to the host computer with a response frame and a status reporting frame after executing the light switching command, forming a control closed loop.
[0007] Preferably, the S1 custom fixed frame structure includes, in sequence: start code, command word, data length, data field, CRC16 check bit, and stop code.
[0008] Preferably, S2 receives Bluetooth command frames from the host computer through a state machine mechanism and automatically identifies the command type based on the length of the received frame. Specifically, it includes: Idle state: waiting for and recognizing the start code; upon receiving the start code, storing subsequent bytes in a temporary buffer and switching to the receiving state; Receiving state: continuously receiving bytes and storing them in the temporary buffer; upon receiving a stop code, determining the command type based on the total length of the current frame: if the total frame length is a first preset length, it is determined to be a light status acquisition command frame, and the complete frame is copied to the first buffer; if the total frame length is a second preset length, it is determined to be a light on / off command frame, and the complete frame is copied to the second buffer; then, the receiving completion flag is set, and the system returns to the idle state.
[0009] Preferably, the first preset length is 11 bytes and the second preset length is 12 bytes.
[0010] Preferably, the step of verifying the received instruction frame specifically involves: performing CRC16 calculation on the data from the start code to the end of the data field in the received frame, and comparing the calculation result with the CRC16 check bits in the frame.
[0011] Preferably, the state machine mechanism further includes error recovery: if the expected codeword is not received in any step of the receiving state, the state machine is immediately reset to zero and returned to the idle state.
[0012] Preferably, the method further includes a long-press reset step: detecting the duration of pressing the reset button, and when the duration of pressing reaches a preset threshold, sending a predefined Bluetooth reset frame to the Bluetooth module via UART, so that the Bluetooth module clears the pairing information and enters the broadcast state.
[0013] Preferably, the custom fixed frame structure allows the data length field to dynamically define the actual length of the data field, so that the frame format can carry a variable-length data field.
[0014] The beneficial effects of this invention are as follows: By employing a custom fixed frame structure with CRC16 checksum, it effectively detects and discards erroneous data frames caused by electromagnetic interference, significantly improving communication reliability and ensuring accurate lighting control. Through a closed-loop mechanism of actively replying with response frames and status reporting frames after instruction execution, the host computer can obtain the actual execution status of the lights in real time, achieving fault diagnosis capabilities and significantly enhancing system security. The dual-buffer variable-length frame discrimination mechanism completely isolates different instructions in terms of physical storage and logical processing, eliminating the risk of data overwriting or misalignment. The long-press reset function provides users with the most intuitive Bluetooth pairing reset method, which can be completed without any tools, greatly reducing maintenance costs. The state machine receiving mechanism has anomaly recovery capabilities, effectively preventing communication deadlock and ensuring continuous link availability. Attached Figure Description
[0015] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0016] Figure 1 This is a schematic diagram of the optimal embodiment of the ADS sign light control method based on Bluetooth communication according to the present invention. Detailed Implementation
[0017] 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.
[0018] Figure 1 This is a schematic diagram of the optimal embodiment of an ADS sign light control method based on Bluetooth communication according to the present invention. Figure 1In the illustrated embodiment, the method is applied to a sign light, which specifically includes a microcontroller (MCU), a Bluetooth module, and an LED driver circuit. The MCU, acting as the control core, is electrically connected to both the Bluetooth module and the LED driver circuit. The Bluetooth module is used for wireless communication with an external host computer, which can be an in-vehicle autonomous driving domain controller or a user's smartphone. The LED driver circuit controls the illumination of the ADS sign light according to the instructions from the MCU.
[0019] The present invention provides an ADS sign light control method based on Bluetooth communication, which includes the following detailed steps in a specific embodiment.
[0020] S1: Bluetooth communication is performed using a custom fixed frame structure with a verification mechanism.
[0021] In this embodiment, the custom fixed frame structure sequentially includes a start code, a command word, a data length, a data field, a CRC16 checksum, and a stop code. The start code identifies the beginning of a complete instruction frame and is typically set to a fixed byte value, such as the hexadecimal number 0xAA. The command word distinguishes different instruction types, such as a light-on / off instruction or a light status acquisition instruction, and occupies one byte. The data length field indicates the byte length of the following data field, and this length value can be dynamically defined according to actual needs. The data field carries specific parameters related to the instruction, such as the target status value in a light-on / off instruction. The CRC16 checksum occupies two bytes and is used to perform cyclic redundancy check on all or part of the data in the frame, excluding the start code and stop code, to verify the integrity of data transmission. The stop code identifies the end of an instruction frame and is also typically set to a fixed byte value, such as the hexadecimal number 0xBB.
[0022] This custom fixed frame structure allows the data length field to dynamically define the actual length of the data field, enabling the entire frame format to carry variable-length data fields. For example, when transmitting commands without additional parameters, such as retrieving light status, the data length field can be set to 0, in which case the entire frame structure does not contain any valid data field bytes. When transmitting commands to turn a light on or off, the data length field can be set to 1, and the data field will contain a status byte indicating whether the light is on or off. This variable-length design gives the frame structure good scalability.
[0023] S2: Receives Bluetooth command frames from the host computer through a state machine mechanism, and automatically identifies the command type according to the length of the received frame, storing command frames of different lengths into different buffers.
[0024] In this embodiment, the state machine mechanism includes an idle state and a receive state. This state machine mechanism is implemented by the program logic inside the microcontroller (MCU) and is used to reliably parse the byte stream received through the Bluetooth module.
[0025] In idle state, the microcontroller (MCU) continuously monitors the received data from the Bluetooth module. When a start code, such as the hexadecimal number 0xAA, is detected in the data stream, the MCU determines that it may be the start of a new instruction frame. Subsequently, the MCU stores the subsequent bytes after the start code one by one into a temporary byte buffer, and at the same time transitions the state machine from idle state to receive state.
[0026] In receive mode, the microcontroller (MCU) continues to receive subsequent bytes and continuously stores these bytes in the aforementioned temporary buffer. During the reception process, the MCU continuously monitors for stop codes, such as the hexadecimal number 0xBB. Once a stop code is received, the MCU considers the current complete instruction frame to have been received. At this point, the MCU automatically determines the specific type of the instruction frame based on the total length of the currently received complete instruction frame, i.e., the total number of bytes contained from the start code to the stop code.
[0027] When the total length of the current frame calculated by the microcontroller (MCU) is a first preset length, the instruction frame is determined to be a light status acquisition instruction frame. This light status acquisition instruction frame is used to request the indicator light to report its current light status. When the total length of the current frame is a second preset length, the instruction frame is determined to be a light on / off instruction frame. This light on / off instruction frame is used to instruct the indicator light to perform a light-on or light-off operation. In this embodiment, the first preset length is preferably 11 bytes, and the second preset length is preferably 12 bytes. The difference between these two instruction frame lengths stems from the fact that the data field of the light on / off instruction frame has one more byte of switching parameters than the data field of the light status acquisition instruction frame. After completing the instruction type identification, the microcontroller (MCU) copies the complete frame from the temporary buffer to different dedicated buffers. For example, the light status acquisition instruction frame is copied to the first buffer, and the light on / off instruction frame is copied to the second buffer. Subsequently, the microcontroller (MCU) sets a reception completion flag to notify the main program that a new valid instruction has arrived. Finally, the state machine automatically returns to the idle state, waiting for the start code of the next instruction frame.
[0028] To ensure robust communication, the state machine mechanism also includes error recovery functionality. At any step of the receive state, if the microcontroller (MCU) fails to receive the expected codeword—for example, failing to receive the command word or data length within the expected time after the start code, or receiving an illegal byte that does not conform to the frame structure definition—the state machine is immediately reset to zero, the temporary buffer is cleared, and a forced return to the idle state is initiated. This error recovery mechanism effectively prevents communication deadlocks caused by data misalignment or interference.
[0029] S3: Verify the received command frame. If the verification is successful, execute the corresponding control operation. After executing the light switch command, actively reply to the host computer with a response frame and a status report frame to form a control closed loop.
[0030] In this embodiment, the specific operation for verifying the received instruction frame is as follows: The microcontroller (MCU) performs a CRC16 calculation on the data segment from the start code to the end of the data field in the received complete instruction frame, i.e., from the first byte after the start code to the last byte of the data field. This CRC16 calculation can employ a commonly used CRC16 algorithm, such as the CRC16-CCITT algorithm with a polynomial of 0x8005. After the calculation, the MCU compares the calculated CRC16 check result with the CRC16 check bits carried in the instruction frame. If they match, it indicates that no errors occurred during the transmission of the frame data, and the verification passes; if they do not match, it indicates that the data may be affected by electromagnetic interference, resulting in bit errors. The MCU discards the instruction frame and does not perform any control operations.
[0031] After successful verification, the microcontroller (MCU) parses the command word and data field, and executes the corresponding control operation. If the current command is a light-on / off command, the MCU outputs a corresponding level signal to the LED driver circuit based on the switching parameters in the data field, thereby turning the ADS light on or off. After executing the light-on / off operation, the MCU proactively replies to the host computer via Bluetooth with a response frame, which confirms that the light-on / off command has been received and executed. Simultaneously, the MCU also proactively replies to the host computer with a status report frame, which contains the actual status information of the ADS light, such as whether it is on or off. Through this dual feedback mechanism of proactively replying with response frames and status report frames, the host computer can accurately know the execution result of the command, thus forming a complete control closed loop. If the current command is a command to obtain the light status, the MCU directly reads the current status of the LED driver circuit after verification and proactively replies to the host computer with a status report frame, without needing to reply with a response frame.
[0032] In a preferred embodiment, the method further includes a long-press reset step. A reset button is provided on the circuit board at the indicator light end, and this reset button is connected to an input pin of a microcontroller (MCU). The MCU continuously monitors the duration of the reset button press. When the MCU detects that the reset button has been pressed for a preset threshold duration, such as 5 seconds, the MCU determines that the user needs to perform a Bluetooth reset operation. At this time, the MCU sends a predefined Bluetooth reset frame to the Bluetooth module via the UART interface. This Bluetooth reset frame can be a series of AT commands in a specific format, such as AT+RESET or a custom command to clear pairing information. After receiving the reset frame, the Bluetooth module immediately clears the paired device information stored internally and actively enters broadcast mode, waiting for a new host computer to initiate Bluetooth pairing and connection. This long-press reset step requires no special tools, greatly simplifying the complexity of on-site maintenance and equipment replacement.
[0033] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. The above descriptions are only preferred embodiments of this application. It should be noted that due to the limitations of written expression, while there are objectively infinite specific structures, those skilled in the art can make several improvements, modifications, or changes without departing from the principles of this application, and can also combine the above technical features in an appropriate manner. These improvements, modifications, changes, or combinations, or the direct application of the inventive concept and technical solution to other situations without modification, should all be considered within the scope of protection of this application.
Claims
1. A method for controlling ADS sign lights based on Bluetooth communication, characterized in that, The method, applied to a sign light comprising a microcontroller (MCU), a Bluetooth module, and an LED driver circuit, includes: S1: Bluetooth communication is performed using a custom fixed frame structure with a verification mechanism; S2: Receives Bluetooth command frames from the host computer through a state machine mechanism, and automatically identifies the command type according to the length of the received frame, storing command frames of different lengths into different buffers. S3: Verify the received instruction frame. If the verification is successful, execute the corresponding control operation. After executing the light switch instruction, actively reply to the host computer with a response frame and a status report frame to form a control closed loop.
2. The ADS sign light control method based on Bluetooth communication according to claim 1, characterized in that, The S1 custom fixed frame structure includes, in sequence: Start code, command word, data length, data field, CRC16 check bit, and stop code.
3. The ADS sign light control method based on Bluetooth communication according to claim 1, characterized in that, The S2 receives Bluetooth command frames from the host computer through a state machine mechanism and automatically identifies the command type based on the length of the received frame, specifically including: Idle state: Waiting for and recognizing the start code. Once the start code is received, subsequent bytes are stored in a temporary buffer and the system switches to receive state. Reception state: Continuously receive bytes and store them in the temporary buffer. When a stop code is received, determine the instruction type based on the total length of the current frame: if the total frame length is the first preset length, it is determined to be a light status acquisition instruction frame, and the complete frame is copied to the first buffer; if the total frame length is the second preset length, it is determined to be a light on / off instruction frame, and the complete frame is copied to the second buffer; then set the reception completion flag and return to the idle state.
4. The ADS sign light control method based on Bluetooth communication according to claim 3, characterized in that, The first preset length is 11 bytes, and the second preset length is 12 bytes.
5. The ADS sign light control method based on Bluetooth communication according to claim 1, characterized in that, The verification of the received instruction frame specifically includes: Perform CRC16 calculation on the data from the start code to the end of the data field in the received frame, and compare the calculation result with the CRC16 check bits in the frame.
6. The ADS sign light control method based on Bluetooth communication according to claim 3, characterized in that, The state machine mechanism also includes error recovery: If the expected codeword is not received at any step in the receiving state, the state machine is immediately reset to zero and returned to the idle state.
7. The ADS sign light control method based on Bluetooth communication according to claim 1, characterized in that, This also includes a long press reset step: The duration of pressing the reset button is detected. When the duration of pressing reaches a preset threshold, a predefined Bluetooth reset frame is sent to the Bluetooth module via UART, causing the Bluetooth module to clear the pairing information and enter the broadcast state.
8. The ADS sign light control method based on Bluetooth communication according to claim 2, characterized in that, The custom fixed frame structure allows the data length field to dynamically define the actual length of the data field, so that the custom fixed frame structure can carry data fields of variable length.