Resistance-type sensor-based low-frequency analog quantity sampling circuit and acquisition method thereof

Through the low-frequency analog quantity sampling circuit based on resistive sensors, the fixed capacitor charging time is monitored by the MCU timer, and the analog quantity acquisition with high quantization resolution is achieved, solving the low-resolution and high cost of the existing technology. The problem is applicable to ordinary low-priced MCUs.

CN118944667AInactive Publication Date: 2024-11-12ZHEJIANG LEIYA ELECTRONICS CO LTD

Patent Information

Application Number
CN202411423825.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2024-11-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing resistance sensors are concentrated in low-frequency analog signal, with low quantization resolution and high cost. Especially in ordinary low-priced MCUs, the AD conversion circuit configuration is insufficient, making it difficult to obtain high quantization resolution.

Method used

Design a low-frequency analog quantity sampling circuit based on resistive sensors. Using sampling resistors, fixed capacitors, reference voltage, voltage comparator and MCU, the charging time of fixed capacitors is monitored by a timer, and the analog quantity signal quantized by time is obtained to realize High-quantitative resolution acquisition, simple structure and low cost, suitable for multiple simultaneous acquisition.

Benefits of technology

The quantization index of 16-bit resolution is obtained without AD conversion circuit, which is low in cost, making up for the insufficient built-in ADC port of MCU and realizes analog quantity acquisition with high quantization resolution, suitable for ordinary low-priced MCUs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118944667A_ABST
    Figure CN118944667A_ABST
Patent Text Reader

Abstract

The low-frequency analog quantity sampling circuit comprises a sampling resistor, a fixed capacitor, a reference voltage, a voltage comparator and an MCU, one end of the sampling resistor is connected with a constant voltage source, the other end of the sampling resistor is connected with the fixed capacitor, and the sampling resistor and the fixed capacitor are connected in series to form an RC charging circuit. One end of the fixed capacitor is grounded, the non-grounded end of the fixed capacitor is coupled to an I / 01 port of the MCU, the end, coupled to the MCU, of the fixed capacitor is coupled to one input end of the voltage comparator, the reference voltage is connected with the other input end of the voltage comparator, the output end of the voltage comparator is connected with an I / 02 port of the MCU, and a timer is configured in the MCU. The circuit obtains the digital quantity of the analog quantity signal quantified by time, the sampling circuit is simple in structure and low in cost, can be expanded into multiple paths for simultaneous acquisition, and can obtain high quantization resolution when being applied to a common low-price MCU (Microprogrammed Control Unit).
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of sensors, and in particular to a low-frequency analog quantity sampling circuit based on a resistance type sensor and a sampling method thereof. Background Art

[0002] Resistive sensors detect a certain characteristic or state of the measured value by measuring the change in resistance value. The acquisition of analog quantity is generally to convert the analog quantity into voltage, and then quantize the analog quantity through AD conversion circuit and convert it into digital quantity. Its quantization resolution is related to the AD conversion circuit. The higher the quantization resolution, the higher the conversion cost. For low-frequency analog signals, if the analog quantity is converted into the charging time of the capacitor, the digital value of the analog signal can be obtained without the AD conversion circuit, and the quantization resolution can be greatly improved. Summary of the invention

[0003] In view of the shortcomings of the background technology, the technical problem to be solved by the present invention is to provide a low-frequency analog sampling circuit based on a resistive sensor, which obtains the digital quantity of the analog signal quantized by time. The sampling circuit has a simple structure and low cost, and can be expanded to multi-channel simultaneous acquisition. At the same time, when it is suitable for ordinary low-priced MCUs, high quantization resolution can be obtained.

[0004] The present invention is completed by adopting the following technical scheme: a low-frequency analog quantity sampling circuit based on a resistive sensor, comprising a sampling resistor, a fixed capacitor, a reference voltage, a voltage comparator and an MCU, wherein one end of the sampling resistor is connected to a constant voltage source, the other end of the sampling resistor is connected to the fixed capacitor, the sampling resistor and the fixed capacitor are connected in series to form an RC charging circuit, one end of the fixed capacitor is grounded, the non-grounded end of the fixed capacitor is coupled to the I / 01 port of the MCU, one end of the fixed capacitor coupled to the MCU is coupled to an input end of the voltage comparator, the reference voltage is connected to the other input end of the voltage comparator, the output end of the voltage comparator is connected to the I / 02 port of the MCU, and a timer is configured in the MCU.

[0005] The above-mentioned acquisition method of the low-frequency analog quantity sampling circuit based on the resistance type sensor has the following steps: Step 1, the fixed capacitor is discharged quickly, the fast discharge time is t1, and the voltage across the capacitor drops to V0; Step 2, the constant voltage source charges the fixed capacitor through the sampling resistor, the timer of the MCU starts timing, the voltage across the capacitor increases, and the capacitor voltage is transmitted to the voltage comparator through an input terminal of the voltage comparator. The voltage comparator compares the capacitor voltage with the reference voltage V1. When the capacitor voltage exceeds the reference voltage V1, the potential of the output terminal of the voltage comparator flips, the MCU generates an interrupt, stops the timer timing, and obtains the first sampling time t. The sampling time value t is directly proportional to the analog sampling resistance value; Step 3: after a delay of t2, repeat step 1 to quickly discharge the fixed capacitor, and repeat step 2 to collect the next sampling time value t; Step 4, collecting the charging time of the capacitor at a certain sampling time interval, obtaining the sampling time value of the interval collection, and obtaining the digital quantity of the analog signal quantized by time based on the fact that the sampling time value is proportional to the resistance.

[0006] Furthermore, in step 1, the fixed capacitor fast discharge step includes that the MCU first sets the I / 01 port to quasi-bidirectional mode and pulls the I / 01 port low, the fixed capacitor is short-circuited to the ground, the fixed capacitor is quickly discharged, and after the delay time t1, the voltage across the capacitor drops to 0 volts, and the fixed capacitor is discharged.

[0007] Furthermore, the sampling time interval should be greater than the charging time required for the RC charging circuit to charge from 0 volts to V1, and the reference voltage V1 should be less than the voltage V2 of the constant voltage source.

[0008] Beneficial effects of the present invention: 1. The charging time of the fixed capacitor is monitored by the timer interval in the MCU. According to the change of the charging time, the change of the analog quantity is quantified by time, without the need for conversion through the AD conversion circuit. The change of the measured analog quantity is converted into the change of resistance, and further converted into the change of the charging time of the fixed capacitor.

[0009] 2. This circuit and acquisition method are used for ordinary low-priced MCUs. Ordinary low-priced MCUs can only be configured with AD conversion circuits with a resolution of only 8 or 10 bits, but can be configured with a 16-bit timer to obtain a 16-bit resolution quantization index and obtain a high quantization resolution.

[0010] 3. The sampling circuit has a simple structure and low cost, and can be expanded to multi-channel simultaneous acquisition to make up for the situation where the built-in ADC port of the MCU is insufficient in some application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 It is a schematic diagram of a first embodiment of a low-frequency analog quantity sampling circuit based on a resistance type sensor; Figure 2 It is a schematic diagram of a voltage analog quantity sampling circuit based on a resistance type sensor; Figure 3 It is a schematic diagram of a second embodiment of a low-frequency analog quantity sampling circuit based on a resistance type sensor; Figure 4 It is a schematic diagram of a third embodiment of a low-frequency analog quantity sampling circuit based on a resistance type sensor. DETAILED DESCRIPTION

[0012] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation mode, structure, characteristics and effects of the present invention are described in detail below in combination with the accompanying drawings and preferred embodiments.

[0013] Reference Figure 1-2 As shown, the first embodiment of the present invention provides a low-frequency analog quantity sampling circuit based on a resistive sensor, including a sampling resistor 1, a fixed capacitor 2, a reference voltage 3, a voltage comparator 4 and an MCU 5. One end of the sampling resistor is connected to a constant voltage source 6, and the other end of the sampling resistor is connected to the fixed capacitor, and the sampling resistor and the fixed capacitor are connected in series to form an RC charging circuit. One end of the fixed capacitor is grounded, and the non-grounded end of the fixed capacitor is coupled to the I / 01 port of the MCU. The end of the fixed capacitor coupled to the MCU is coupled to an input end of the voltage comparator, the reference voltage is connected to the other input end of the voltage comparator, and the output end of the voltage comparator is connected to the I / 02 port of the MCU. A timer is configured in the MCU. Specifically, the input end of the voltage comparator includes a positive input end and a negative input end. When the end of the fixed capacitor coupled to the MCU is coupled to the positive input end of the voltage comparator, the reference voltage is connected to the negative input end of the voltage comparator, and vice versa. The sampling circuit is suitable for analog quantities such as temperature, light intensity, weight or pressure, and can also be used for voltage analog quantities.

[0014] When analog quantities such as temperature, light intensity, weight or pressure change, the analog value is proportional to the change in resistance, and the change in resistance is proportional to the change in capacitor charging time, so the change in analog value is proportional to the change in charging time. By collecting the time required for the capacitor to charge to a fixed voltage value, an analog quantity based on time quantization is obtained. The change in the measured analog quantity is converted into a change in resistance, and further converted into a change in the charging time of a fixed capacitor, without the need for conversion through an AD conversion circuit.

[0015] Specifically, let V0 be the initial voltage on the capacitor, V2 be the voltage to which the capacitor is finally charged, that is, the voltage of the constant voltage source, V t is the voltage value at time t Since V t =V0+(V2-V0)*[1-EXP(-t / RC)] So t=R*C*Ln[(V2-V0) / (V2-V t )] When charged to the reference voltage V1, that is, V t =V1, t=R*C*Ln[(V2-V0) / (V2-V1)] It can be simplified to t = R * K, where K = C*Ln[(V2-V0) / (V2-V1)] When V0=0, V1 and V2 take fixed values, K is a constant, so time t is directly proportional to R.

[0016] In particular, analog quantities such as pressure, weight, temperature, and light intensity are proportional to resistance within a certain range. Therefore, these analog quantities are proportional to time and can be expressed by the formula y=k*(t-t0)+y0. y is the measured value, y0 is the analog value when the charging time is t0, and k is the proportionality coefficient.

[0017] Specifically, taking weight as an example, when the weight is 0 (only tare weight), the charging time t0 is measured, and when the weight is 1 kg, the charging time t1 is measured, then k=(1-0) / (t1-t0). When the time t is measured at a certain weight y, the weight y=(t-t0) / (t1-t0) This method and sampling circuit are also applicable to voltage analog quantity, refer to Figure 2 As shown in the figure, the values ​​of resistor R and capacitor C are fixed. When there is no signal, the acquisition time t is also fixed. When the signal voltage is positive, the acquisition time t will become smaller, and when the signal voltage is negative, the acquisition time t will become larger. It can be seen that the time difference is still proportional to the input signal amount, and the analog quantity based on time quantization is obtained.

[0018] The above-mentioned acquisition method of the low-frequency analog quantity sampling circuit based on the resistance type sensor has the following steps: Step 1: The fixed capacitor is discharged quickly, wherein the fast discharge time is t1. When the fixed capacitor is discharged, the voltage across the capacitor drops to 0, and the MCU timer starts timing.

[0019] Specifically, in order to make the capacitor charge and discharge in an orderly manner, the fixed capacitor fast discharge step includes: the MCU first sets the I / 01 port to the quasi-bidirectional mode, and pulls the I / 01 port low, and the fixed capacitor is in a short-circuit state to the ground. The fixed capacitor is quickly discharged, and after the delay time t1, the voltage across the capacitor drops to 0, and the fixed capacitor is discharged. At this time, the MCU sets the I / 01 port to the open-drain mode, and the fixed capacitor is in an open-circuit state to the ground.

[0020] Step 2: The constant voltage source charges the fixed capacitor through the sampling resistor, the voltage across the capacitor increases, and the capacitor voltage is transmitted to the voltage comparator through the first input terminal of the voltage comparator, and the voltage comparator compares the capacitor voltage with the reference voltage. When the capacitor voltage exceeds the reference voltage, the potential at the output terminal of the voltage comparator flips, the MCU generates an interrupt, stops the timer, and obtains the first sampling time t. The sampling time value t is proportional to the analog sampling resistor value; The specific steps of charging the fixed capacitor include: MCU sets the I / 01 port to open drain mode, and the fixed capacitor is in an open circuit state to the ground. The constant voltage source charges the fixed capacitor through the sampling resistor, and the MCU starts the timer to start timing. When the charge exceeds the reference voltage V1, the comparator output flips, the MCU generates an interrupt, stops the timer timing, and obtains the charging time t.

[0021] Step 3: After a delay of t2, repeat step 1 to quickly discharge the fixed capacitor, and repeat step 2 to collect the next sampling time value t. That is, the time interval between adjacent samplings is t1+t+t2, and the sampling time interval is greater than the charging time of the RC charging circuit.

[0022] Step 4: Repeat the above steps to cyclically collect the capacitor charging time at a certain sampling time interval to obtain the sampling time value of the interval collection. Based on the fact that the sampling time value is proportional to the resistance, the digital value of the analog signal quantized by time is obtained.

[0023] The above circuit and acquisition method can be applied to ordinary low-priced MCUs. Ordinary low-priced MCUs can only be configured with AD conversion circuits with a resolution of only 8 or 10 bits, but can be configured with a 16-bit timer to obtain a quantization index with a 16-bit resolution and obtain a high quantization resolution. This solves the problem of low quantization resolution of ordinary low-priced MCUs and has low cost. At the same time, the sampling circuit has a simple structure and can be expanded to multi-channel simultaneous acquisition, making up for the situation where the built-in ADC port of the MCU is insufficient in some application scenarios. Example

[0024] Assume that the resistor R is a resistance strain gauge, and the resistance value is 350 ohms. The reference voltage of the inverting input terminal of the comparator is 1.0V, the capacitance value C is 1uF, and the constant voltage source is 3.3V, then the time required for the capacitor to charge from 0V to 1.0V is 126 microseconds. When the stress increases, the resistance is greater than 350 ohms and the charging time is greater than 126 microseconds. The increased stress is proportional to the increased time. The sampling resistor of this embodiment is 350 ohms and the capacitor is 1uF, and other embodiments are not limited to this value.

[0025] Reference Figure 3 The second embodiment of the present invention provides a low-frequency analog quantity sampling circuit based on a resistive sensor, including a sampling resistor, a fixed capacitor and an MCU, wherein a timer is set in the MCU. One end of the sampling resistor is connected to a constant voltage source, the other end of the sampling resistor is connected to the fixed capacitor, the sampling resistor and the fixed capacitor are connected in series to form an RC charging circuit, the MCU has an I / 01 port input port, and the non-grounded end of the fixed capacitor is connected to the I / 01 port.

[0026] The steps for collecting the charging time of a fixed capacitor include: 1) setting the I / 01 port of the MCU to quasi-bidirectional mode first, and pulling the I / 01 port low; 2) the capacitor is discharged quickly, and after a short delay of t1 (discharge time t1), the voltage at both ends drops to 0; 3) setting the I / 01 port to high-impedance input mode, and the MCU starts the timer to start timing; 4) the constant voltage source charges the capacitor through the sampling resistor, and the voltage at both ends of the capacitor increases; 5) the MCU repeatedly reads the value of the I / 01 port. When the capacitor voltage exceeds a certain voltage, the value read by the MCU changes from 0 to 1, and the timer stops timing, and a time t is obtained that is proportional to the sampling resistor value.

[0027] Reference Figure 4 The third embodiment of the present invention provides a low-frequency analog quantity sampling circuit based on a resistive sensor, including a sampling resistor, a fixed capacitor, a switching transistor, a voltage comparator and an MCU, wherein a timer is set in the MCU. The switching transistor is connected in parallel with the fixed capacitor, and its base is connected to the I / 01 port of the MCU through a resistor. When the present embodiment outputs a high potential through the I / 01 port, the switching transistor 8 is turned on, the fixed capacitor 2 is in a short-circuit state to the ground, and the capacitor 2 is discharged quickly. When the I / 01 port outputs a low potential, the switching transistor 8 is turned off, the fixed capacitor is in an open-circuit state to the ground, and the constant voltage source 6 charges the capacitor 2 through the resistor 1. The other steps are the same as those in the first embodiment.

[0028] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technical personnel in this field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any brief modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.

Claims

1. A low-frequency analog sampling circuit based on a resistive sensor. Its characteristics are: The invention comprises a sampling resistor, a fixed capacitor, a reference voltage, a voltage comparator and an MCU, wherein one end of the sampling resistor is connected to a constant voltage source, the other end of the sampling resistor is connected to the fixed capacitor, the sampling resistor and the fixed capacitor are connected in series to form an RC charging circuit, one end of the fixed capacitor is grounded, the non-grounded end of the fixed capacitor is coupled to an I / 01 port of the MCU, one end of the fixed capacitor coupled to the MCU is coupled to an input end of the voltage comparator, the reference voltage is connected to the other input end of the voltage comparator, the output end of the voltage comparator is connected to an I / 02 port of the MCU, and a timer is configured in the MCU.

2. The acquisition method of the low-frequency analog quantity sampling circuit based on the resistance type sensor according to claim 1, Its characteristics are: The steps are as follows, Step 1: Fast discharge of fixed capacitor, fast discharge time is t 1 , the voltage drop across the capacitor is V 0 , the MCU timer starts counting; Step 2, voltage V 2 The constant voltage source charges the fixed capacitor through the sampling resistor, the voltage across the capacitor increases, and the capacitor voltage is transmitted to the voltage comparator through the first input terminal of the voltage comparator. The voltage comparator compares the capacitor voltage with the reference voltage V 1 When the capacitor voltage exceeds the reference voltage V 1 When the potential at the output of the voltage comparator flips, the MCU generates an interrupt, stops the timer, and obtains the first sampling time t. The sampling time value t is directly proportional to the analog sampling resistance value. Step 3, delay t 2 Then, repeat step 1 to quickly discharge the fixed capacitor, and repeat step 2 to collect the next sampling time value t; Step 4, collecting the charging time of the capacitor at a certain sampling time interval, obtaining the sampling time value of the interval collection, and obtaining an analog quantity based on time quantization based on the fact that the sampling time value is proportional to the resistance.

3. The acquisition method of the low-frequency analog quantity sampling circuit based on the resistance type sensor according to claim 2, Its characteristics are: In step 1, the fixed capacitor fast discharge step includes: MCU first sets the I / 01 port to quasi-bidirectional mode, and pulls the I / 01 port low, the fixed capacitor is short-circuited to the ground, the fixed capacitor is quickly discharged, and the delay time t 1 After that, the voltage across the capacitor drops to 0 volts, and the fixed capacitor is discharged.

4. The acquisition method of the low-frequency analog quantity sampling circuit based on the resistance type sensor according to claim 2, Its characteristics are: The sampling time interval T should be greater than the time it takes for the RC charging circuit to charge from 0 volts to V 1 The required time t, sampling time interval T=t 1 +t+t 2 , the voltage of the constant voltage source V 2 Should be greater than the reference voltage V 1 .

5. A low-frequency analog sampling circuit based on a resistive sensor, Its characteristics are: The invention comprises a sampling resistor, a fixed capacitor and an MCU. A timer is arranged in the MCU. One end of the sampling resistor is connected to a constant voltage source, and the other end of the sampling resistor is connected to the fixed capacitor. The sampling resistor and the fixed capacitor are connected in series to form an RC charging circuit. The MCU has an I / 01 port input port, and the non-grounded end of the fixed capacitor is connected to the I / 01 port.

6. A low-frequency analog sampling circuit based on a resistive sensor, Its characteristics are: It includes a sampling resistor, a fixed capacitor, a switching transistor, a voltage comparator and an MCU. A timer is set in the MCU. The switching transistor is connected in parallel with the fixed capacitor, and its base is connected to the I / O1 port of the MCU through a resistor.

Citation Information

Patent Citations

  • A highly precise simple A / D conversion circuit and its method based on MSP430

    CN101188423A

  • Thermistor temperature sensor

    CN106017717A

  • Analog-to-digital converter based on single-chip microcomputer technology

    CN107222213A

  • MPPT wireless-sensor wind energy collection method based on resistance simulation

    CN108180108A

  • An A / D sampling circuit and a sampling method of a resistance-type sensor powered by alternating current

    CN109873643A

Cited By

  • Non-reference overvoltage / undervoltage protection detection device and method

    CN119780513A