A method for time-synchronized measurement of single-pixel spectrometers for digital micromirror devices
By establishing a rigorous opto-electro-mechanical closed-loop handshake mechanism in the digital micromirror device spectrometer system, the problem of insufficient synchronization between pattern playback and acquisition end was solved, achieving high timing consistency and stable data measurement, and improving the system's synchronization accuracy and robustness of continuous operation.
Patent Information
- Application Number
- CN202611056087.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-16
- Publication Date
- 2026-11-10
AI Technical Summary
Existing spectrometer systems based on digital micromirror devices suffer from insufficient synchronization between pattern playback and acquisition, leading to problems such as data misalignment, missed sampling, duplicate sampling, unclear round boundaries, interface blockage, and result contamination. They are particularly unstable in high-frequency and high-dimensional data scenarios.
By establishing a strict opto-mechatronics underlying closed-loop handshake mechanism, pattern preloading, state stabilization, acquisition triggering, first packet confirmation, and anomaly recovery management are carried out to ensure that each external trigger signal corresponds to an independent sampling data packet. This constructs a strongly verified timing closed loop, realizes absolute traceability of data and physical actions, eliminates data pollution, and improves the system's synchronization accuracy and stability.
It achieves high temporal consistency measurement at various scales, completely eliminates data misalignment, improves the continuous operation stability and result reliability of the system, avoids deadlock and data pollution caused by unreasonable parameters, and improves the measurement accuracy and efficiency in high-frequency and high-dimensional data scenarios.
Smart Images

Figure CN123065599A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of optical precision measurement, rapid signal acquisition and electromechanical collaborative control technology, and particularly relates to a time-synchronous measurement method for a single-pixel spectrometer for digital micromirror devices. Background Technology
[0002] Currently, existing scanning measurement systems based on Digital Micromirror Devices (DMDs), spatial light modulators, or fast pattern projection devices, such as single-pixel computational spectrometers or imagers, typically involve the following physical measurement chain: the spatial light modulator modulates the incident light using feature encoding; a photodetector converts the modulated light signal into an analog electrical signal; and finally, a data acquisition board (DAQ) digitizes the signal. Therefore, the measurement system usually requires strict synchronization between the DMD's pattern playback cycle and the data sampling cycle of the acquisition card to ensure that each acquired data point precisely corresponds to a specific spatially or spectrally encoded pattern.
[0003] However, in practical engineering applications, the above measurement scheme has the following drawbacks and shortcomings: 1. The pattern playback end and the acquisition end usually only rely on simple start triggering or fixed delay coordination, lacking hierarchical control over key time nodes such as DMD cache status confirmation, status stabilization, DAQ pre-triggering (i.e., Arm status confirmation) and the arrival of the first valid trigger, which can easily cause data misalignment.
[0004] 2. Treating the acquisition process as a continuous streaming process rather than a finite sampling process where one trigger corresponds to one sampling packet can easily lead to problems such as missed sampling, repeated sampling, trigger misalignment, or unclear round boundaries under high-frequency pattern switching conditions.
[0005] 3. As the frequency of measurement tasks increases, in continuous line scanning scenarios, if the entire set of patterns is reloaded in each round, the inter-round delay and instability will increase significantly; if the playback state is simply reused instead of starting from the first image, it will easily lead to a mismatch in pattern numbers between the current round and the next round.
[0006] 4. When the measurement dimension is further expanded to the area scanning imaging scene, the amount of data increases exponentially. If the data display, whole round stitching, image rendering and file export are all completed in the main thread of the system, it is very easy to cause problems such as interface blocking, processing delays and crashes when running multiple rounds of area scanning continuously.
[0007] 5. In exception handling, the current measurement scheme lacks the distinction between "whether the current round has received some data". Once a timeout or thread blocking occurs, it may directly retry and mix incomplete data with valid data, resulting in deep result pollution.
[0008] 6. Existing solutions typically lack pre-start verification of timing margins. For example, they do not constrain the pattern period, sampling window length, and remaining safety margin, which allows the system to force its way into the scanning process even when the parameters are not configured reasonably, ultimately leading to missed triggers, premature stopping, or deadlock in multiple rounds of continuous scanning.
[0009] Therefore, in response to the technical defects of existing DMD single-pixel spectrometer systems, such as timing drift under high-speed modulation of optoelectronic hardware, unstable connection of continuous scanning cycles, easy freezing of high-dimensional data throughput of the host computer, and easy incomplete data contamination results when facing abnormal physical interference, the aim is to achieve high stability of line scanning measurement and area scanning measurement by establishing a strict opto-mechatronics bottom-level closed-loop handshake and abnormal fuse mechanism to prevent contamination. Summary of the Invention
[0010] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a time-series synchronization measurement method for single-pixel spectrometers based on digital micromirror devices (DMDs). This method enables unified management of pattern preloading, state stabilization, acquisition triggering, pattern playback, first packet confirmation, packet waiting, acquisition completion, and anomaly recovery, thereby completely establishing a data link from basic line scanning to high-dimensional surface scanning. This comprehensively improves the system's synchronization accuracy, continuous operation stability, and result reliability at various scales. This method is specifically designed for single-pixel spectrometers and imaging systems based on DMDs. It is applicable not only to single or continuous spectral line scanning measurements but also to complex scenarios such as high-data-throughput spectral surface scanning imaging measurements. It is particularly suitable for high-time-consistency measurement systems that require a strict one-to-one correspondence between high-speed pattern playback and analog signal acquisition.
[0011] The technical problem solved by this invention is achieved through the following technical solution: A method for time-synchronous measurement of a single-pixel spectrometer for a digital micromirror device, the method comprising the following steps: S1. Obtain the pattern playback parameters of the DMD and the sampling parameters of the data acquisition terminal DAQ. The playback parameters include the current pattern list and playback frequency of the DMD, and the sampling parameters include the sampling rate, number of sampling points and trigger source of the DAQ terminal. S2. Perform adaptive verification of timing margin before startup based on the parameters; S3. Divide the measurement process into multiple independent rounds for execution; S4. Before the start of each round, perform pattern cache preloading and hard wait, and perform underlying cache preloading for the pattern group corresponding to the current round; after success, perform hard wait to ensure that the hardware pattern cache and physical state are stable. S5. Put the DAQ into a limited sampling trigger waiting state, so that each external trigger signal corresponds to an independent sampling data packet; S6. After confirming that DAQ is in a ready state, control DMD to execute a single-round pattern sequence playback; S7. Perform initial trigger monitoring and room synchronization monitoring on the collected data; S8. When the expected number of data packets is reached, determine that the current round of data collection is complete, and output the arrival time of the first data packet, the maximum packet interval, and the average packet interval timing diagnostic information of the current round. When a round fails, the data reception status of the current round is checked: if no valid data has been received in the current round, a safe retry mechanism is allowed; if some valid data has been received in the current round, automatic retry is prohibited, and a protective stop and cache cleanup are immediately performed to prevent incomplete data from contaminating subsequent measurements. S9. When the scanning mode is continuous line scanning, the currently loaded cached pattern group is reused, and a single round of playback is forced to be executed again from the first image after the previous round is completed; when the scanning mode is area scanning, the acquisition is advanced sequentially according to the spatial position, and the data reconstruction and splicing export are completed asynchronously in the background working thread.
[0012] Furthermore, the adaptive verification of S2 includes calculating the pattern period, sampling window length, and remaining timing margin based on the pattern playback frequency, sampling rate, and number of sampling points, and preventing measurement from starting when the remaining timing margin is lower than a preset threshold.
[0013] Moreover, S3 specifically involves dividing the continuous scanning task into multiple independently executed single-round measurement units, each round having an independent synchronization control process and state management.
[0014] Furthermore, the first trigger monitoring of S7 sets the timeout start point of the first sampled data packet to the moment when the DMD pattern playback starts successfully; the packet synchronization monitoring monitors the time interval between adjacent sampled data packets after receiving the first sampled data packet, and determines the round failure when the time interval exceeds a preset threshold.
[0015] The positive effects that this invention can produce are: 1. A strong verification timing closed loop was constructed: Parameter verification, pattern preloading, acquisition end Arm, playback end triggering and "first packet confirmation" are linked into a complete timing link through a single-round handshake mechanism, which completely eliminates the "first packet mismatch" and data misalignment caused by the lack of handshake in traditional systems.
[0016] 2. Avoid misjudgments caused by command delays: The countdown start point for the first trigger timeout is set "after the pattern is actually played successfully", which effectively avoids the problem of premature consumption of the trigger waiting budget due to the delay in the issuance of communication bus commands.
[0017] 3. Achieve absolute traceability of data and physical actions: By forcibly adopting the mechanism of "one hardware trigger corresponds to one finite sampling package", a strict one-to-one correspondence between physical feature patterns and underlying "sampling packages" is established, which greatly improves the traceability of results.
[0018] 4. Construct a hierarchical end-to-end anomaly diagnosis system: By implementing four levels of timing constraints, including serial Arm timeout, first trigger timeout, per packet waiting threshold, and "whole round acquisition" timeout, high-precision anomaly monitoring is achieved, improving the system's ability to identify external physical interference.
[0019] 5. Blocking circuit breakers to prevent data contamination: The system distinguishes between "failure without data" and "failure with partial data," ensuring that the system only retryes when there is zero risk of contamination; if incomplete data is found, the system is forced to shut down and clean it up, meeting the stringent requirements of precision optical instruments for the purity of measurement data.
[0020] 6. Balancing scanning speed and accuracy in line scan reuse: In continuous line scan scenarios, it breaks the conventional approach of "heavy load per round" or "continuous blind play". By reusing cached pattern groups and forcibly restarting the first image, it achieves extremely high operating efficiency while ensuring absolute accuracy of round boundaries.
[0021] 7. Asynchronous face scanning immune to memory overflow: When dealing with massive face scanning data, a strategy of decoupling and separating group-by-group state updates and background splicing is adopted to avoid interface freezing and memory overflow caused by high-frequency drawing, which greatly enhances the robustness of continuous system operation.
[0022] 8. Adaptive verification to prevent physical deadlock in advance: By introducing a timing safety margin verification algorithm before system startup, unreasonable sampling windows can be identified in advance during the parameter configuration stage, and operation instructions that may cause missed triggers, premature stops or deadlocks can be intercepted from the root.
[0023] 9. This invention forces the playback control of DMD to adopt a single-sequence finite playback mode instead of an infinite loop playback mode, thereby ensuring that each round of measurement has an absolutely clear round boundary; after each successful reading of a finite sampling data packet, the synchronous DAQ immediately sends an event notification to the upper-layer control logic that the current packet has arrived, replacing the batch refresh mechanism, thereby realizing immediate "first packet confirmation" and real-time measurement status update; the surface scan measurement adopts an asynchronous architecture that separates "group-by-group incremental dimensionality reduction display" and "background whole-round stitching" to avoid main thread interface blocking caused by a large amount of data and improve the system responsiveness and stability of continuous high-dimensional surface scans. Attached Figure Description
[0024] Figure 1 This is a flowchart of the measurement process of the present invention; Figure 2 This is a diagram illustrating the timing interaction process of a single-round scan in this invention. Figure 3 This is a state transition relationship diagram under the online scanning measurement mode of the present invention; Figure 4 This is a state transition diagram of the present invention in the surface scan measurement mode; Figure 5 This is the recovery logic diagram for the abnormal cycle situation of the present invention. Detailed Implementation
[0025] The present invention will be further described in detail below through specific embodiments. The following embodiments are merely descriptive and not limiting, and should not be used to limit the scope of protection of the present invention.
[0026] Example 1: System Structure Example An innovative method for time-synchronous measurement of single-pixel spectrometers for digital micromirror devices is as follows: Figure 1 As shown, this embodiment provides a time-series synchronous scanning measurement system based on a single-wheel handshake mechanism for a DMD single-pixel spectrometer. The overall architecture of the system adopts a hierarchical and modular decoupled design, specifically including the following core modules: 1. The host computer controller, as the highest scheduling center of the entire system, is responsible for responding to user interaction commands and providing global control interfaces such as "start line scan", "start surface scan", and "stop scan". It calls the timing coordinator to execute specific physical control logic and performs lifecycle management for the round state manager.
[0027] 2. The timing coordinator, as the core hub for hardware and software synchronization, is responsible for taking over the underlying control timing. It has built-in single-round handshake logic, executed in a strict sequence: hard wait after preload, lightweight confirmation during pre-wait, and finally, single-round playback of the starting pattern. This module directly controls the DMD and DAQ, and updates the round state manager in real time during operation.
[0028] 3. Round Status Manager: This function maintains an independent data loop during high-speed scanning. Internally, it records and maintains key status information such as "Current Round Number," "First Packet Confirmation," "Number of Packets Received," "Number of Packets Processed," and "Maximum Packet Interval," providing data support for system anomaly diagnosis and packet interval monitoring.
[0029] 4. The DMD playback module directly controls the DMD's state machine. It is responsible for executing preloaded pattern groups, setting the playback start point, setting the number of images to play, and executing a single round of controlled playback or stopping the cleanup action after receiving instructions from the timing coordinator.
[0030] 5. The DAQ acquisition module is responsible for the acquisition and digitization of physical analog signals. Under the control of the timing coordinator, this module first enters the Armed state waiting to be triggered. Then, at the hardware level, it reads single packet data one by one according to the external trigger pulse, or cancels the current round when an abnormal command is received. The valid measurement packets acquired by this module will output the measurement results to the line scan module or the area scan module, depending on the current operating mode.
[0031] 6. The line scan module is used to process one-dimensional spectral or feature acquisition tasks. It receives measurement packets from the acquisition module, is responsible for pattern grouping, performs buffered pattern reuse in continuous line scan scenarios, and finally reconstructs the line scan results, outputting the rendered data to the results display module.
[0032] 7. The surface scanning module is used to process two-dimensional or high-dimensional spatial data acquisition tasks. After receiving the measurement packet, it executes a group-by-group acquisition logic to update the results line by line and output them to the results display module in a way that reduces the system load. At the same time, after a round of spatial group acquisition is completed, the large batch of raw data for that round is submitted to the background stitching and export module for processing.
[0033] 8. The background stitching and export module, as an asynchronous data processing unit independent of the front-end rendering, is responsible for receiving rounds of data submitted by the surface scanning module. Internally, it sequentially performs region image normalization and global mesh stitching, and supports exporting the final result as a standard image file or vector graphics. The generated stitched image result will be sent back to the result display module for visualization.
[0034] 9. Results Display Module: As the final data presentation layer of the system, it centrally receives rendering instructions from the line scan module, the area scan module, and the background stitching and export module, and is responsible for displaying the line scan results, area scan curves, and high-dimensional stitched images on the graphical interface.
[0035] Example 2: Single-round timing synchronization and handshake control process like Figure 2 As shown, this embodiment details the rigorous single-round handshake interaction process performed by the various core modules of the DMD single-pixel spectrometer during a single-round scan to eliminate timing misalignments and physical jitter. This process specifically includes the following stages: 1. During the pre-start adaptive parameter verification phase, when the host computer controller sends a "scan start" command to the lower-level timing coordinator, the system does not immediately drive the physical hardware. Instead, it first enters the parameter adaptive verification logic. The timing coordinator submits the currently configured DMD parameters, such as pattern playback frequency, sampling rate, number of sampling points per round, and safety threshold, to the "parameter adaptive verification module." This module internally calculates the pattern period, actual sampling window length, and remaining timing margin precisely. If the parameter verification fails, for example, if the sampling window length is greater than the pattern period, or the safety margin is insufficient to withstand normal physical jitter, the verification module outputs a "prevent startup and adjustment suggestion." Based on this, the host computer controller directly terminates the startup process and prompts the user or upper-level logic to adjust the parameters, thereby preventing hardware deadlocks caused by unreasonable parameters at the source. If the parameter verification passes, the verification module outputs a pass signal and suggested parameters, and the timing coordinator officially enters the subsequent physical hardware scheduling process.
[0036] 2. Hardware Cache Preloading and Anti-jitter Hard Wait Phase: During this phase, the timing coordinator sends a command to the DMD device's playback module, requesting it to preload all pattern sets required for the current round into the underlying cache. Upon receiving a "preloading complete" signal from the playback module, the timing coordinator forcibly executes a "hard wait" for a preset period. This hard wait phase aims to eliminate potential mechanical jitter and internal instability that may occur after the hardware receives a large influx of data, ensuring that the underlying hardware is in an absolutely static, ready-to-go state.
[0037] 3. In the pre-Arm lightweight confirmation phase, after the hard wait ends, the timing coordinator does not immediately start acquisition. Instead, it sends a "pre-Arm lightweight confirmation" command to the DMD to detect whether the hardware has the ability to immediately start sequence playback from the first pattern. If the pre-Arm confirmation fails, the timing coordinator immediately reports the error to the host controller and safely terminates the current round; if the pre-Arm confirmation succeeds, i.e., the playback module explicitly replies "playback can start from the first pattern", then the system officially enters the core trigger acquisition closed loop.
[0038] 4. During the acquisition-end readiness phase, to absolutely ensure that "the receiver is ready before the transmitter," the timing coordinator first sends a start command to the DAQ, causing it to enter the Armed state, waiting for external hardware triggering. Only after the DAQ explicitly replies with "Armed complete" feedback does the timing coordinator notify the round status manager to mark the acquisition device as Armed. Only at this point does the timing coordinator issue the final physical execution command to the playback module to "start single-round playback from image 1."
[0039] 5. During the initial trigger monitoring and finite sampling loop phase of the delayed timing, the playback module initiates physical actions upon receiving the instruction and reports "Playback Start Successful" to the timing coordinator. The key innovation of this invention lies in the fact that the timing coordinator only sends the "Start Initial Trigger Timeout Timing" instruction to the round status manager at this point. Setting the timeout countdown start point after the device starts playback perfectly avoids software misjudgments caused by delays in USB or system bus instruction transmission. Subsequently, the system enters the finite sampling loop. Each time a low-level hardware entity triggers, the DAQ generates and encapsulates a finite sampling packet and reports the data to the timing coordinator via an asynchronous callback mechanism. The timing coordinator then drives the round status manager to update the "First Packet Confirmation" status, packet interval, and received packet count in real time.
[0040] 6. Round Closure and Timing Settlement Phase: After all the preset number of sampled packets have been collected, DAQ reports "Current Round Complete" to the timing coordinator. The timing coordinator extracts all underlying monitoring data generated during this round's operation and outputs timing diagnostic information such as "First Packet Delay" and "Packet Interval Statistics" to the round status manager. At this point, the tight timing synchronization handshake process for the current round is securely closed.
[0041] Example 3: Line Scan Mode and Layered Anomaly Recovery Control Process like Figure 3 As shown, this embodiment details the cycle state machine transition process in the system's online scanning measurement mode, and particularly reveals the buffer reuse mechanism during continuous high-frequency scanning. The process specifically includes: Pattern grouping and single-round acquisition: After receiving the "start line scan" command and completing parameter adaptive verification (same as in Example 2), the system divides the global pattern list into multiple fixed-length pattern groups according to the preset single-round capacity. The system extracts the first pattern group and writes it into the underlying cache of the DMD, and executes the single-round handshake acquisition control flow (same as in Example 2). During acquisition, if an underlying hardware anomaly is detected, the system directly switches to the layered anomaly recovery control flow (see Example 5 for details).
[0042] During the cache reuse and restart phase of continuous line scanning, if the current round successfully reaches the expected number of sampling packets, the system sequentially executes the stop and cleanup actions. Subsequently, differentiated round evolution is performed. If continuous line scanning mode is off: the "switch to the next group" logic is executed. If a next group of patterns exists, the new pattern is reloaded and the next round is executed; if not, it flows to the "end" state. If continuous line scanning mode is on: to eliminate repeated USB communication delays, the system directly executes "cache group reuse", that is, without sending new pattern data, it directly reuses the pattern group already residing in the underlying high-speed cache; at the same time, control commands are issued, requiring the hardware to strictly "replay in a single round from the first image" and seamlessly flow back to the "single round handshake acquisition" node.
[0043] Example 4: Surface Scanning High-Dimensional Data Streaming Throughput and Asynchronous Stitching like Figure 4 As shown, this embodiment details the "streaming group advancement" and "asynchronous background splicing" control processes designed to cope with high-dimensional data throughput pressure in the surface scanning mode. Specifically, it includes: After the system completes parameter verification (same as in Example 2), it does not perform full data loading into memory. Instead, it divides the data into multiple lightweight spatial location groups based on physical location. Preloading and single-round handshake acquisition are performed for the current group (same as in Example 2). During acquisition, a "packet-by-packet write" operation is executed, directly filling new data into pre-allocated memory blocks. Simultaneously, a local throttling strategy is implemented: dynamic refreshing is performed only on the currently acquired local one-dimensional feature curve to prevent the main thread UI from freezing due to high-frequency callbacks caused by massive data.
[0044] The spatial group streaming approach ensures that once the data for the current group is collected, if there is still a next group to collect, the system releases the transmission channel for the current group, overwrites the pattern sequence of the next spatial location group into the hardware buffer, and begins collecting data for the next spatial location. This "breaking down" streaming strategy ensures a stable level of memory usage during host computer operation and prevents memory overflow.
[0045] Asynchronous background stitching and visualization: After all group data collection is complete, the system releases control of the underlying hardware, transferring the massive amount of high-dimensional round data to independent worker threads. In the background, region normalization, grid stitching, and data export are automatically executed sequentially to generate standard measurement files. After the energy-intensive computation is complete, the worker thread pushes the final lightweight rendering instructions to the front end to generate and display the latest stitching results.
[0046] Example 5: Layered Timeout Monitoring and Pollution Prevention Anomaly Recovery like Figure 5 As shown, this embodiment details the layered timeout monitoring and pollution prevention anomaly recovery process constructed by the system when facing non-ideal operating conditions such as hardware jitter, cable crosstalk, or communication delays that may occur in the real physical environment during the scanning "round operation". This process completely abandons the traditional infinite blocking waiting or blind retry strategy, and specifically includes the following stages: 1. In the five-level hierarchical anomaly monitoring phase, within any given cycle, the system background thread concurrently executes high-precision multi-level timing monitoring. Once any of the following timing violations is detected, a circuit breaker is triggered: Arm timeout (the synchronous DAQ terminal fails to respond to the start command and enter the Armed state within the specified time); First trigger timeout (after the DMD successfully starts the playback command, the first valid hardware trigger data packet is not received beyond the preset time start point, effectively preventing misjudgments caused by bus command delays); Packet timeout (after the first packet arrives, the waiting time between any two adjacent valid sampling packets exceeds the packet safety threshold); Round timeout (the cumulative running time of the current round exceeds the total budget limit calculated based on parameter adaptive calculation); Playback device anomaly (the DMD's playback control thread times out or the underlying start command physical delivery fails).
[0047] 2. During the fault diagnosis and anti-contamination diversion phase, except for a few extreme anomalies such as equipment physical startup failure that can directly trigger a restart, for all types of timeout faults triggered during the data acquisition process, the system will channel the control flow into the core "fault diagnosis" hub. During this phase, the system strictly adheres to the "data contamination prevention principle" for state diversion: First branch: No valid data in the current round. If the system determines that no valid data packets have been written to disk in the current round when the anomaly occurs, it is assessed that there is no risk of data misalignment or contamination. The system enters "safe retry preparation". First, it "cancels the current round of DAQ" task to release the hardware bus. Then, the system assesses the status of DMD. If the assessment is "protective stop required", it actively issues a "stop and low-level cleanup" command to clear residual images; otherwise, it allows the process to proceed directly. After the cleanup is completed, the system safely "reboots the current round", achieving seamless self-healing.
[0048] The second branch: If the system determines that an anomaly has occurred when the current round has already received some valid data, this means that the data sequence has undergone irreversible physical misalignment. To absolutely prevent this incomplete data from being mixed into subsequent spectral feature reconstruction and contaminating the overall measurement results, the system strictly prohibits automatic retries. The control flow forcibly switches to the "protective stop" branch, immediately locking the communication interface between the upper and lower computers, and triggering the final "scan termination," transforming the implicit data error into an explicit safety shutdown.
[0049] Although embodiments of the invention have been disclosed for illustrative purposes, those skilled in the art will understand that various substitutions, variations, and modifications are possible without departing from the spirit and scope of the invention and the appended claims. Therefore, the scope of the invention is not limited to the contents disclosed in the embodiments.
Claims
1. A method for time-synchronized measurement in a single-pixel spectrometer for a digital micromirror device, characterized in that: The steps of the method are as follows: S1. Obtain the pattern playback parameters of the DMD and the sampling parameters of the data acquisition terminal DAQ. The playback parameters include the current pattern list and playback frequency of the DMD, and the sampling parameters include the sampling rate, number of sampling points and trigger source of the DAQ terminal. S2. Perform adaptive verification of timing margin before startup based on the parameters; S3. Divide the measurement process into multiple independent rounds for execution; S4. Before the start of each round, perform pattern cache preloading and hard wait, and perform underlying cache preloading for the pattern group corresponding to the current round. Upon success, a hard wait is performed to ensure that the hardware pattern buffer and physical state are stable. S5. Put the DAQ into a limited sampling trigger waiting state, so that each external trigger signal corresponds to an independent sampling data packet; S6. After confirming that DAQ is in a ready state, control DMD to execute a single-round pattern sequence playback; S7. Perform initial trigger monitoring and room synchronization monitoring on the collected data; S8. When the expected number of data packets is reached, determine that the current round of data collection is complete, and output the arrival time of the first data packet, the maximum packet interval, and the average packet interval timing diagnostic information of the current round. When a round fails, the data reception status of the current round is checked: if no valid data has been received in the current round, a safe retry mechanism is allowed; if some valid data has been received in the current round, automatic retry is prohibited, and a protective stop and cache cleanup are immediately performed to prevent incomplete data from contaminating subsequent measurements. S9. When the scanning mode is continuous line scanning, the currently loaded cached pattern group is reused, and a single round of playback is forced to be executed again from the first image after the previous round is completed; when the scanning mode is area scanning, the acquisition is advanced sequentially according to the spatial position, and the data reconstruction and splicing export are completed asynchronously in the background working thread.
2. The time-synchronous measurement method for a single-pixel spectrometer of a digital micromirror device according to claim 1, characterized in that: The adaptive verification of S2 includes calculating the pattern period, sampling window length and remaining timing margin based on the pattern playback frequency, sampling rate and number of sampling points, and preventing measurement from starting when the remaining timing margin is lower than a preset threshold.
3. The time-synchronous measurement method for a single-pixel spectrometer of a digital micromirror device according to claim 1, characterized in that: Specifically, S3 involves dividing the continuous scanning task into multiple independently executed single-round measurement units, each round having its own independent synchronization control process and state management.
4. The time-synchronous measurement method for a single-pixel spectrometer of a digital micromirror device according to claim 1, characterized in that: The first trigger monitoring of S7 sets the timeout start point of the first sampled data packet to the moment when the DMD pattern playback starts successfully; the inter-packet synchronization monitoring monitors the time interval between adjacent sampled data packets after receiving the first sampled data packet, and determines the round failure when the time interval exceeds a preset threshold.
