Turbidity measuring method and turbidity sensor

By controlling the infrared emitting device to emit preset pulse width light pulses and simultaneously collecting scattered light signals, combined with peak point identification and median filtering technology, the defects of existing turbidity sensors in LED driving mode, signal linearity and detection range are solved, realizing high-precision and stable turbidity measurement, especially with higher resolution and reliability under low turbidity conditions.

CN121783915APending Publication Date: 2026-04-03HANGZHOU SUPMEA AUTOMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202512007291.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-29
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing turbidity sensors have significant drawbacks in terms of LED driving method, signal linearity, calibration complexity, and detection range, resulting in unstable and inaccurate measurement results, especially insufficient resolution under low turbidity conditions.

Method used

By controlling the infrared emitting device to emit light pulses within a preset pulse width range, the waveform of the scattered light signal is simultaneously acquired, the peak point is identified, and the turbidity is calculated using adjacent sampled values. Combined with median filtering technology, a linear function relationship is established to achieve high signal-to-noise ratio and anti-interference capability.

Benefits of technology

It significantly improves the linear relationship between turbidity and light intensity, reduces calibration complexity, ensures measurement accuracy and stability, and has higher resolution and reliability, especially in the low turbidity range, while extending the lifespan of the light source.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121783915A_ABST
    Figure CN121783915A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of turbidity measurement, and discloses a turbidity measurement method and a turbidity sensor.The method comprises the steps that an infrared emission device is controlled to emit light pulses in a preset pulse width range to a water sample to be measured, and scattered light signal waveforms in the water sample to be measured are synchronously collected; identifying a peak point in the scattered light signal waveform, and determining a peak sampling moment corresponding to the peak point; obtaining a first sampling value at a previous moment adjacent to the peak sampling moment and a second sampling value at a next moment based on the scattered light signal waveform; and calculating the turbidity of the to-be-detected water sample based on the first sampling value and the second sampling value. Through the collaborative design of pulse driving and sampling at adjacent moments on two sides of a peak value, the linearity, the stability and the resolution of turbidity measurement are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of turbidity measurement technology, specifically to a turbidity measurement method and a turbidity sensor. Background Technology

[0002] Currently, turbidity measurement methods are developing towards technological refinement, application scenario segmentation, and stringent quality control. Modern turbidity detection generally specifies the use of infrared LEDs as the light source to effectively avoid interference from water sample color on measurement results, and imposes more stringent and standardized requirements on the angle of the scattered light detector (mainly using 90° scattered light) to improve the accuracy and consistency of the instrument. Against this backdrop, the increasing accuracy requirements of sensors also pose new challenges to the modulation technology of LED light sources.

[0003] Most turbidity sensors on the market currently use a constant voltage output from a DAC to drive a constant current source circuit. This driving method has significant drawbacks: firstly, long-term constant current operation can accelerate the decay of infrared LED light, causing light intensity drift and affecting the long-term stability of turbidity measurements; secondly, the linear relationship between turbidity and detected light intensity is poor under this method, and measurement deviations are still prone to occur after calibration, sometimes even requiring a nonlinear calibration model, increasing the complexity of production line calibration. Furthermore, limited by the driving method and signal processing capabilities, the detection range of such sensors is typically narrow (generally 0.1–1000 NTU), and under low turbidity conditions, the weak scattered light signal can easily lead to inaccurate detection and insufficient resolution.

[0004] In summary, existing turbidity sensors have significant shortcomings in terms of LED driving methods, signal linearity, calibration complexity, and detection performance. There is an urgent need for a high-precision turbidity measurement solution that can improve light source stability, enhance signal linearity, simplify calibration procedures, and expand the detection range. Summary of the Invention

[0005] In view of this, the present invention provides a turbidity measurement method and a turbidity sensor to solve the problem of poor linearity of turbidity measurement results in the prior art.

[0006] In a first aspect, the present invention provides a turbidity measurement method, comprising: controlling an infrared emitting device to emit light pulses with a preset pulse width range to a water sample to be tested, and simultaneously acquiring the waveform of scattered light signal in the water sample to be tested; identifying peak points in the waveform of the scattered light signal and determining the peak sampling time corresponding to the peak points; obtaining a first sampling value at the previous moment and a second sampling value at the next moment adjacent to the peak sampling time based on the waveform of the scattered light signal; and calculating the turbidity of the water sample to be tested based on the first sampling value and the second sampling value.

[0007] The turbidity measurement method provided by this invention controls an infrared emitting device to emit light pulses of a preset pulse width and simultaneously collects scattered light signals. This concentrates light energy into a short emission time, enhancing the instantaneous signal-to-noise ratio and facilitating the detection of weak scattered signals from water samples at low turbidity levels. Simultaneously, by identifying peak points in the scattered light signal waveform and calculating turbidity based on adjacent sample values ​​from the previous and next moments, the method effectively avoids potential instantaneous interference (such as Brownian motion of particles) that might occur when directly using peak points. This makes the characteristic values ​​more representative of stable scattered light intensity. This invention significantly improves the linear relationship between turbidity and light intensity, reduces calibration complexity, and ultimately achieves more accurate and stable turbidity measurement, especially with higher resolution and reliability in the low turbidity range.

[0008] In one optional implementation, the preset pulse width range is 300μs to 400μs.

[0009] The turbidity measurement method provided by this invention achieves the best balance between light energy concentration and heat dissipation control in a pulse width range of 300μs to 400μs. This ensures that the light pulse has sufficient energy to excite a scattered signal that can be acquired with a high signal-to-noise ratio, while controlling the duration of a single emission within an extremely short range. This minimizes the accumulation of junction temperature and the light decay rate of the infrared light source, thus fundamentally guaranteeing the long-term stability of the light source and the consistency of the measurement.

[0010] In one optional implementation, the process of calculating the turbidity of the water sample to be tested based on the first sampling value and the second sampling value includes: calculating the arithmetic mean of the first sampling value and the second sampling value as a characteristic value characterizing the intensity of scattered light; and determining the turbidity of the water sample to be tested based on the characteristic value.

[0011] The turbidity measurement method provided by this invention obtains a smooth signal near the peak value by using the arithmetic mean of the first sample value and the second sample value as the characteristic value characterizing the intensity of scattered light. This effectively integrates signal energy and improves the stability of the characteristic value. Furthermore, by avoiding the direct use of the peak point itself, which may be subject to instantaneous interference, it significantly suppresses single-point fluctuations caused by random movement of particles in water or circuit noise, thereby improving the linear correspondence between the characteristic value and turbidity.

[0012] In one optional implementation, the process of determining the turbidity of the water sample to be tested based on the feature value includes: obtaining a preset linear function relationship between the turbidity value and the feature value; performing median filtering on multiple feature values ​​obtained from consecutive calculations to obtain filtered feature values; and substituting the filtered feature values ​​into the linear function relationship to calculate the turbidity of the water sample to be tested.

[0013] The turbidity measurement method provided by this invention constructs a stable and efficient turbidity calculation process by acquiring a preset linear function relationship and performing median filtering on multiple characteristic values ​​before inputting the calculation. By performing median filtering on multiple continuously obtained characteristic values, impulsive deviations caused by random interference can be effectively filtered out, thereby outputting a stable characteristic value that better represents the turbidity state of the water sample being tested. Finally, the filtered stable characteristic value is substituted into the linear relationship for direct calculation, which not only ensures the real-time nature of the measurement results but also significantly enhances the anti-interference ability, repeatability, and overall reliability of the final turbidity value.

[0014] Secondly, the present invention provides a turbidity sensor, comprising: a controller, a sampling device, and an infrared emitting device, wherein a first output terminal and a second output terminal of the controller are respectively connected to the control terminal of the sampling device and the control terminal of the infrared emitting device, and an input terminal of the controller is connected to the output terminal of the sampling device. The controller is used to execute the method of the first aspect or any corresponding embodiment thereof; the infrared emitting device is used to emit light pulses with a preset pulse width range to the water sample to be tested based on the control signal output by the controller; the sampling device is used to collect the scattered light signal in the water sample to be tested based on the synchronous trigger signal output by the controller, and then output the scattered light signal waveform to the controller.

[0015] The turbidity sensor provided by this invention not only drives the infrared emitting device to emit concentrated light pulses to optimize the signal-to-noise ratio and light source lifespan, but also ensures that the sampling device accurately captures the waveform of the scattered light signal during the duration of the light pulse through a hardware-level synchronous triggering mechanism. This ensures high-precision timing alignment between signal generation and acquisition at the system level, giving the sensor advantages such as high linearity, long light source lifespan, and high low-turbidity detection capability. Furthermore, it seamlessly integrates anti-interference strategies such as peak adjacent sampling and median filtering from the above methods with the sampling device, thereby significantly suppressing noise and improving signal stability and measurement repeatability.

[0016] In one optional embodiment, the infrared emitting device includes: a signal processing unit and an infrared output unit, wherein the input terminal of the signal processing unit receives a control signal, and the output terminal of the signal processing unit is connected to the input terminal of the infrared output unit. The signal processing unit is used to perform level conversion and isolation on the control signal and then output a driving signal. The infrared output unit is used to emit light pulses with a preset pulse width range to the water sample to be tested based on the driving signal.

[0017] The turbidity sensor provided by this invention features a signal processing unit that performs level conversion and electrical isolation on the control signal from the controller. This enhances the signal's driving capability and anti-interference ability, ensuring stable and reliable control of subsequent power circuits. Furthermore, it effectively blocks electrical noise that may be generated by the power stage from being reverse-coupled to the sensitive control circuit, guaranteeing system stability. The infrared output unit, based on the processed clean drive signal, accurately reconstructs and emits light pulses that meet preset pulse width requirements. This not only ensures both the timing and waveform quality of the light pulses but also improves the flexibility and reliability of the circuit design, thereby further enhancing the overall measurement accuracy and long-term operational stability of the turbidity sensor.

[0018] In one optional embodiment, the infrared output unit includes: a comparator circuit, a switch circuit, and an infrared output circuit. The first input terminal of the comparator circuit receives a driving signal, the second input terminal of the comparator circuit is connected to the output terminal of the infrared output circuit, and the output terminal of the comparator circuit is connected to the control terminal of the switch circuit. The comparator circuit is used to control the switch circuit to switch on / off states based on the driving signal. The control terminal of the infrared output circuit is connected to the output terminal of the switch circuit, and the infrared output circuit is used to output light pulses based on the on / off state of the switch circuit.

[0019] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the method described in the first aspect or any corresponding embodiment thereof.

[0020] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the method described in the first aspect or any corresponding embodiment thereof.

[0021] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to perform the method described in the first aspect or any corresponding embodiment thereof. Attached Figure Description

[0022] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0023] Figure 1 This is a schematic flowchart of a first method for measuring turbidity according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a second process for a turbidity measurement method according to an embodiment of the present invention; Figure 3 This is a waveform diagram of the scattered light signal according to an embodiment of the present invention; Figure 4 This is a comparison chart of the detection effects of the embodiments of the present invention and the prior art; Figure 5 This is a composition diagram of a turbidity sensor according to an embodiment of the present invention; Figure 6 This is a detailed circuit diagram of an infrared emitting device according to an embodiment of the present invention; Figure 7 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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, 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.

[0025] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.

[0026] This embodiment provides a turbidity measurement method, such as Figure 1 As shown, it includes: Step S1: Control the infrared emitting device to emit light pulses with a preset pulse width range to the water sample to be tested, and simultaneously collect the waveform of the scattered light signal in the water sample to be tested.

[0027] Specifically, the controller generates a PWM signal with a specific duty cycle and frequency. This PWM signal is input to the infrared transmitter and converted into a high-precision current pulse, driving the infrared LED to emit light pulses within a preset pulse width range. Simultaneously, the rising edge or high-level active segment of this PWM signal is used as a hardware trigger source to activate the sampling device for synchronous acquisition of scattered light signals from the water sample. This hardware-level synchronization mechanism ensures that the light pulse emission time is aligned with the signal acquisition start time, effectively eliminating software delay instability.

[0028] Optionally, the preset pulse width range is 300μs to 400μs. The pulse width range of 300μs to 400μs achieves the best balance between light energy concentration and heat dissipation control. It can ensure that the light pulse has enough energy to excite a scattered signal that can be acquired with a high signal-to-noise ratio, and can control the duration of a single emission within an extremely short range. This minimizes the junction temperature accumulation and light decay rate of the infrared light source, and fundamentally ensures the long-term stability of the light source and the consistency of the measurement.

[0029] Step S2: Identify the peak points in the scattered light signal waveform and determine the peak sampling time corresponding to the peak points.

[0030] Specifically, the controller performs numerical analysis on the discrete voltage sequence continuously sampled by the sampling device, and identifies the global maximum point in the sequence through a comparison algorithm. This point corresponds to the peak intensity of the scattered light pulse. At the same time, the position of this peak point in the sampling sequence is recorded. Combined with the sampling frequency of the sampling device, the time coordinate corresponding to the peak can be accurately calculated, thereby quantifying the peak feature into specific time coordinate parameters.

[0031] Step S3: Based on the waveform of the scattered light signal, obtain the first sampled value of the previous moment adjacent to the peak sampling moment and the second sampled value of the next moment.

[0032] Specifically, based on the time-series coordinates of the peak point determined in step S2, two sampled values ​​corresponding to the previous and next sampling times of the coordinates are extracted from the original sampling sequence. By avoiding the peak point itself, two adjacent observation data with a fixed time interval with the peak point are selected, thus avoiding the instantaneous interference that the sampled values ​​may be subject to when the peak point is used directly.

[0033] Step S4: Calculate the turbidity of the water sample to be tested based on the first and second sample values.

[0034] Specifically, the two obtained sampling values ​​are fused into a single light intensity feature value using a predetermined statistical algorithm. This value represents the stable intensity level of the scattered light pulse in the peak region. Then, this feature value is substituted into a conversion model that has been pre-calibrated with a standard turbidity solution. The model calculates and directly outputs the corresponding turbidity value, ultimately achieving a high-precision quantitative measurement of the turbidity of the water sample to be tested.

[0035] The turbidity measurement method provided in this embodiment controls an infrared emitting device to emit light pulses of a preset pulse width and simultaneously collects scattered light signals. This concentrates light energy into a short emission time, enhancing the instantaneous signal-to-noise ratio and facilitating the detection of weak scattered signals from low-turbidity water samples. Simultaneously, by identifying peak points in the scattered light signal waveform and calculating turbidity based on adjacent sample values ​​from the previous and next moments, it effectively avoids potential instantaneous interference (such as Brownian motion of particles) that might occur when directly using peak points. This makes the characteristic values ​​more representative of stable scattered light intensity. This embodiment significantly improves the linear relationship between turbidity and light intensity, reduces calibration complexity, and ultimately achieves more accurate and stable turbidity measurement, especially with higher resolution and reliability in the low-turbidity range.

[0036] In some alternative implementations, the process of calculating the turbidity of the water sample to be tested based on the first and second sample values ​​is as follows: Figure 2 As shown, it includes: Step S41: Calculate the arithmetic mean of the first sample value and the second sample value as a characteristic value representing the intensity of scattered light.

[0037] Specifically, calculating the arithmetic mean of the first and second sampled values ​​as a feature value essentially utilizes the temporal symmetry of the scattered light pulse waveform in the peak region for signal smoothing. By acquiring light intensity information at two different sampling times, random measurement errors that may be included in single-point sampling are effectively suppressed. This step, based on the quasi-symmetric characteristics of the light pulse waveform in the peak region, constructs a feature value that characterizes the intensity of scattered light by calculating the arithmetic mean of two adjacent sampled values ​​before and after the peak point. During light scattering, although the Brownian motion of a single particle causes instantaneous fluctuations in the scattered light signal, the scattered light pulse still exhibits an approximately symmetrical distribution in the time dimension macroscopically. Averaging two sampling points with equal time intervals on both sides of the peak is essentially performing symmetrical weighting of the pulse signal in the time domain, which can effectively suppress random spike interference caused by the instantaneous motion of particles while retaining the main energy information of the pulse. Using this arithmetic mean as a point estimator has a smaller variance than a single sampled value, and can more stably reflect the true level of scattered light intensity, providing a more robust input parameter for subsequent turbidity calculations.

[0038] In light scattering measurements, conventional high-frequency pulse-driven methods, due to their dense excitation sequence, are highly susceptible to random light intensity disturbances caused by Brownian motion of microorganisms and suspended particles in the water, leading to a decrease in the signal-to-noise ratio of the scattered signal. This embodiment employs a low-frequency modulation strategy, controlling the infrared emitter to emit wide-pulse light pulses of 300μs to 400μs, thus allowing the scattered light signal to be sufficiently broadened and smoothed in the time domain. Based on this, an arithmetic average is performed on two sampling points with equal time intervals on either side of the pulse peak. Essentially, this is a symmetrical weighted fusion of the signal in the time domain. This processing not only preserves the main energy characteristics of the pulse but also effectively suppresses spike noise caused by the instantaneous random motion of particles. Furthermore, the synergy between low-frequency excitation and symmetrical sampling further reduces the temporal coupling interference of Brownian motion on the measurement results.

[0039] Step S42: Determine the turbidity of the water sample to be tested based on the characteristic value.

[0040] Optionally, the process of determining the turbidity of the water sample to be tested based on the characteristic value includes: (1) Obtain the linear function relationship between the preset turbidity value and the characteristic value.

[0041] Specifically, by obtaining a linear function relationship between a preset turbidity value and a characteristic value, a deterministic mapping model between optical measurement signals and physical parameters was established. In low-concentration turbidity measurements, the intensity of scattered light and the concentration of suspended particles exhibit an approximately linear relationship. By using a standard turbidity solution for system calibration, the slope and intercept parameters of this linear function can be obtained, forming a stable conversion reference.

[0042] (2) After performing median filtering on multiple eigenvalues ​​obtained from consecutive calculations, the filtered eigenvalues ​​are obtained.

[0043] Specifically, to improve the accuracy of the calculation results, the controller repeatedly collects the first and second sample values, calculates multiple corresponding feature values, and then performs median filtering on the feature values ​​obtained from the multiple consecutive calculations. The controller sorts the consecutively collected feature values ​​by numerical value and selects the value at the middle of the sequence as the output. Median filtering can suppress impulse noise and effectively filter out abnormal values ​​caused by large particles in the water passing through the measurement area or transient interference from the circuit.

[0044] (3) Substitute the filtered feature values ​​into the linear function relationship to calculate the turbidity of the water sample to be tested.

[0045] Specifically, the process of substituting the filtered feature values ​​into a linear function relationship to calculate turbidity achieves the final conversion from optical signals to water quality parameters. The preprocessed light intensity feature values ​​are used as input variables, and numerical calculations are performed using a calibrated linear function to output the corresponding turbidity values.

[0046] Specifically, such as Figure 3 As shown, the controller synchronously plots the waveform of the scattered light signal based on the light pulses output by the infrared transmitter. It finds the largest peak in the waveform and selects two sampling points to the left and right of the peak. The sampling point on the left is the sampling point at the previous moment of the peak, and the sampling point on the right is the sampling point at the next moment of the peak. With the peak as the axis of symmetry, the sampling values ​​at moments before and after the maximum value are averaged along the sampling time axis, which greatly reduces the fluctuations caused by the Brownian motion interference of microorganisms or particulate matter in the water during the turbidity detection process.

[0047] For example, Figure 4 The graph shows a comparison of the light intensity ADC code values ​​per millisecond before and after correction. It is clear that the corrected light intensity ADC code value using the calculation method provided in this embodiment has almost no fluctuations and is more stable.

[0048] This embodiment provides a turbidity sensor, such as Figure 5 As shown, the device includes: a controller 1, a sampling device 2, and an infrared emitting device 3. The first output terminal and the second output terminal of the controller 1 are respectively connected to the control terminal of the sampling device 2 and the control terminal of the infrared emitting device 3. The input terminal of the controller 1 is connected to the output terminal of the sampling device 2. The controller 1 is used to execute the method of the above embodiment or any corresponding implementation method. The infrared emitting device 3 is used to emit light pulses with a preset pulse width range to the water sample to be tested based on the control signal output by the controller 1. The sampling device 2 is used to collect the scattered light signal in the water sample to be tested based on the synchronous trigger signal output by the controller 1, and then output the scattered light signal waveform to the controller 1.

[0049] Specifically, Figure 5 In this process, controller 1 generates dual control signals with precise timing relationships based on a preset algorithm: one control signal drives the infrared emitting device 3 to emit light pulses of a specific pulse width within a specified time window; the other synchronous trigger signal is output to the sampling device 2 at the instant the light pulse is emitted by the infrared emitting device 3, enabling it to operate and ensuring strict time alignment between the photoelectric conversion and signal acquisition process and the light pulse emission. The sampling device 2 converts the acquired scattered light signal into a digital waveform sequence containing time and intensity information, which is transmitted to controller 1 in real time. Controller 1 then performs a complete algorithm processing flow on the received waveform data, including peak detection, feature extraction, and turbidity calculation, according to the method described in the above embodiment.

[0050] The turbidity sensor provided in this embodiment not only drives the infrared emitting device to emit concentrated light pulses to optimize the signal-to-noise ratio and light source lifespan, but also ensures that the sampling device accurately captures the waveform of the scattered light signal during the duration of the light pulse through a hardware-level synchronous triggering mechanism. This ensures high-precision timing alignment between signal generation and acquisition at the system level, giving the sensor advantages such as high linearity, long light source lifespan, and high low-turbidity detection capability. Furthermore, it seamlessly integrates anti-interference strategies such as peak adjacent sampling and median filtering from the above methods with the sampling device, thereby significantly suppressing noise and improving signal stability and measurement repeatability.

[0051] In some alternative implementations, such as Figure 6 As shown, the infrared emitting device includes a signal processing unit 31 and an infrared output unit 32. The input terminal of the signal processing unit 31 receives a control signal CONTROL-1, and the output terminal of the signal processing unit 31 is connected to the input terminal of the infrared output unit 32. The signal processing unit 31 is used to perform level conversion and isolation on the control signal CONTROL-1 and then output a driving signal. The infrared output unit 32 is used to emit light pulses with a preset pulse width range to the water sample to be tested based on the driving signal.

[0052] Specifically, Figure 6 In this process, the signal processing unit 31 receives the CONTROL-1 control signal from the controller. This control signal is a PWM signal with a preset duty cycle. After level conversion and electrical isolation, it is converted into a corresponding pulse drive signal and input to the infrared output unit 32. Based on this drive signal, the infrared output unit 32 controls the periodic on and off of the infrared LED through a constant current drive topology, outputting light pulses within a preset pulse width range: when the drive signal is high, the power switching device in the infrared output unit 32 is turned on, and a constant current flows through the infrared LED, causing it to emit light; when the drive signal is low and invalid, the current path is cut off, and the infrared LED is turned off. The infrared emitting device, through the combined design of level conversion, noise isolation, and constant current drive, ensures both the accurate transmission of the control signal and the periodic stability and reliability of the light pulse emission, providing a high-quality light source output for turbidity measurement.

[0053] Figure 6In the infrared output unit 32, there are: a comparator circuit 321, a switch circuit 322, and an infrared output circuit 323. The first input terminal of the comparator circuit 321 receives a drive signal, the second input terminal of the comparator circuit 321 is connected to the output terminal of the infrared output circuit 323, and the output terminal of the comparator circuit 321 is connected to the control terminal of the switch circuit 322. The comparator circuit 321 is used to control the switch circuit 322 to switch its on / off state based on the drive signal. The control terminal of the infrared output circuit 323 is connected to the output terminal of the switch circuit 322, and the infrared output circuit 323 is used to output light pulses based on the on / off state of the switch circuit 322.

[0054] Specifically, Figure 6 In the circuit, signal processing unit 31 includes capacitors C13 and C15, transistor Q1, reference source U1, Zener diode D1, and resistors R21, R22, R23, and R24. Comparator circuit 321 includes operational amplifier U2B, switching circuit 322 includes capacitor C14, transistors Q2 and Q3, and infrared output circuit 323 includes infrared LED D2, and resistors R29, R30, and R31. The first input terminal of comparator circuit 321 receives the drive signal as a reference, and the second input terminal is connected to the current sampling terminal of infrared output circuit 323 to monitor the actual current in the LED circuit in real time. When the drive signal is valid, comparator circuit 321 generates a corresponding error amplification signal by comparing the difference between the reference voltage and the sampled voltage. This signal controls the conduction level of switching circuit 322 (composed of MOSFET or transistor). The switching circuit 322, acting as a variable impedance element, adjusts the LED circuit current by regulating its own on-resistance, forming a negative feedback control loop: if the sampled current is lower than the set value, the comparator circuit output increases the switching circuit's conductivity, causing the current to rise; conversely, it decreases the conductivity, causing the current to fall. Under this closed-loop regulation, the infrared output circuit 323 maintains a constant operating current, with an output light pulse width of approximately 300μs to 400μs, ensuring consistent light power output for each light pulse.

[0055] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.

[0056] The following is a detailed reference. Figure 7The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 001, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 002 or a program loaded from memory 008 into random access memory (RAM) 003. The RAM 003 also stores various programs and data required for the operation of the electronic device. The processor 001, ROM 002, and RAM 003 are interconnected via bus 004. An input / output (I / O) interface 005 is also connected to bus 004.

[0057] Typically, the following devices can be connected to I / O interface 005: input devices 006 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 007 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 008 including, for example, magnetic tapes, hard disks, etc.; and communication devices 009. Communication device 009 allows electronic devices to exchange data via wireless or wired communication with other devices. Although Figure 7 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0058] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 009, or installed from memory 008, or installed from ROM 002. When the computer program is executed by processor 001, it performs the functions defined in the methods of the embodiments of the present invention.

[0059] Figure 7 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0060] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0061] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0062] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method for measuring turbidity, characterized in that, include: The infrared emitting device is controlled to emit light pulses with a preset pulse width range toward the water sample to be tested, and the waveform of the scattered light signal in the water sample to be tested is collected simultaneously. Identify the peak points in the waveform of the scattered light signal and determine the peak sampling time corresponding to the peak points; Based on the waveform of the scattered light signal, obtain the first sample value of the previous moment and the second sample value of the next moment adjacent to the peak sampling moment; The turbidity of the water sample to be tested is calculated based on the first sample value and the second sample value.

2. The turbidity measurement method according to claim 1, characterized in that, The preset pulse width range is 300μs to 400μs.

3. The turbidity measurement method according to claim 1, characterized in that, The process of calculating the turbidity of the water sample to be tested based on the first sample value and the second sample value includes: The arithmetic mean of the first sampled value and the second sampled value is calculated as a characteristic value representing the intensity of the scattered light. The turbidity of the water sample to be tested is determined based on the aforementioned characteristic values.

4. The turbidity measurement method according to claim 3, characterized in that, The process of determining the turbidity of the water sample to be tested based on the feature value includes: Obtain the linear functional relationship between the preset turbidity value and the characteristic value; After performing median filtering on multiple eigenvalues ​​obtained from consecutive calculations, the filtered eigenvalues ​​are obtained. After substituting the filtered feature values ​​into the linear function relationship, the turbidity of the water sample to be tested is calculated.

5. A turbidity sensor, characterized in that, include: The controller, sampling device, and infrared emitting device, among which, The first output terminal and the second output terminal of the controller are respectively connected to the control terminal of the sampling device and the control terminal of the infrared emitting device, and the input terminal of the controller is connected to the output terminal of the sampling device. The controller is used to execute the method according to any one of claims 1 to 4. The infrared emitting device is used to emit light pulses with a preset pulse width range to the water sample to be tested based on the control signal output by the controller. The sampling device is used to collect the scattered light signal in the water sample to be tested based on the synchronous trigger signal output by the controller, and then output the scattered light signal waveform to the controller.

6. The turbidity sensor according to claim 5, characterized in that, The infrared emitting device includes: a signal processing unit and an infrared output unit, wherein... The signal processing unit receives the control signal at its input terminal and connects its output terminal to the input terminal of the infrared output unit. The signal processing unit is used to perform level conversion and isolation on the control signal before outputting a drive signal. The infrared output unit is used to emit light pulses with a preset pulse width range to the water sample to be tested based on the driving signal.

7. The turbidity sensor according to claim 6, characterized in that, The infrared output unit includes: a comparator circuit, a switch circuit, and an infrared output circuit, wherein... The first input terminal of the comparator circuit receives the driving signal, the second input terminal of the comparator circuit is connected to the output terminal of the infrared output circuit, and the output terminal of the comparator circuit is connected to the control terminal of the switch circuit. The comparator circuit is used to control the switch circuit to switch on / off states based on the driving signal. The control terminal of the infrared output circuit is connected to the output terminal of the switching circuit, and the infrared output circuit is used to output light pulses based on the on / off state of the switching circuit.

8. A computer device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the method according to any one of claims 1 to 4.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the method described in any one of claims 1 to 4.

10. A computer program product, characterized in that, Includes computer instructions for causing a computer to perform the method according to any one of claims 1 to 4.