Voltage measuring arrangement with a microcontroller
Patent Information
- Application Number
- DE502023002774
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2022-06-14
- Filing Date
- 2023-05-09
- Publication Date
- 2026-02-12
- Estimated Expiration
- 2043-05-09
AI Technical Summary
Conventional microcontroller-based voltage measurement circuits are limited to a fixed measurement range, resulting in reduced relative resolution for small voltage variations and require pre-amplification, which degrades accuracy and increases complexity.
A voltage measurement arrangement using a microcontroller with a comparator, RC network, and switching device to alternately apply reference and measurement voltages to the comparator inputs, enabling high-resolution measurements in arbitrarily selectable ranges without additional amplification.
Enables precise voltage measurement with adjustable ranges and high resolution, reducing complexity and avoiding gain and offset errors by directly measuring small voltage differences.
Description
Technical field
[0001] The invention relates to an arrangement for voltage measurement, in particular using a microcontroller. Technical background
[0002] Microcontrollers are used in many technical fields for controlling, regulating, or operating technical systems. Microcontrollers offer the possibility of implementing algorithms that evaluate sensor-acquired measurements and use them, for example, to control actuators. Unlike microprocessors, microcontrollers provide additional measurement acquisition capabilities to adapt them to the specific application within the technical system.
[0003] Measurement values from external sensors are often provided as voltage signals, which can be measured and processed using a voltage measurement circuit implemented in the microcontroller. For example, temperature can be measured using a temperature-dependent resistor (NTC or PTC) connected in a resistor bridge. A disadvantage of a voltage measurement circuit typically integrated into a microcontroller is that it is limited to a measurement voltage range defined by the microcontroller's operating voltage, often a separate supply for the ADC. Since the lower voltage limit (0V) is always constant, the measurement range is not entirely freely selectable.
[0004] For example, a 12-bit analog-to-digital converter enables voltage measurement in a measuring range between 0 and 5 V with voltage increments of 5 V 4096 = 0 , 00122 V For example, if a measurement voltage is only to be recorded in the range between 2 and 2.5 V, the relative resolution in this range is reduced to approximately 9 bits.
[0005] Document FR 2 977 748 A1 discloses an electronic circuit comprising a main voltage source and a comparator configured to operate in two modes. The comparator includes a first input supplied by the main voltage source, a second input connected to a reference voltage source, and an output providing the comparator's operating voltage. A capacitor is connected to the first input of the comparator so that it can be charged by the main voltage source when the comparator is in the first operating mode.A stage is provided which allows the capacitor to be discharged when the comparator is in the second operating mode, whereby the ratio between the value of the voltage across the main voltage source and the value of the voltage across the reference voltage source is determined such that the voltage across the capacitor changes essentially linearly with time when it is charged.
[0006] Document US 6,348,798 B1 discloses a voltage measurement circuit configured to measure the voltage level of a voltage source, comprising: (a) a capacitor that charges from the voltage source; (b) a resistor connected between the unknown voltage source and the capacitor; (c) a switch shunt-coupled with the capacitor to discharge the capacitor after it reaches a threshold voltage; and (d) a microcontroller configured to control the switch and measure the time required to charge the capacitor through the resistor to the threshold voltage, the time required to charge the capacitor to the threshold voltage being used to determine the voltage level of the unknown voltage source using at least one stored calibration data value.
[0007] German patent application DE 28 26 723 A1 discloses a method for measuring temperature with a thermistor, wherein a capacitor is charged up to a voltage proportional to the instantaneous size of the thermistor and then discharged to a predetermined value via a resistor of predetermined size, wherein the time interval required for discharge to the predetermined value is measured, which corresponds to the natural logarithm of the resistance value of the thermistor, and wherein the temperature of the thermistor is determined from the time interval as a function of the resistance value of the thermistor.
[0008] In US patent application 2014 / 015513 A1, a sensor arrangement for measuring an electrical voltage is disclosed, wherein a potential point at which the electrical voltage is to be measured relative to a defined electrical potential is connected to a capacitor to which a comparator unit is connected that detects whether a first defined threshold voltage is applied to the capacitor, wherein the sensor arrangement is designed such that it provides an output signal that depends on at least one charging process of the capacitor and includes at least the information about the charging time for charging the capacitor to the first defined threshold voltage, wherein the voltage to be measured charges the capacitor via an intermediate charging resistor and the capacitor is subsequently discharged, wherein the output signal of the sensor arrangement contains at least the information about the charging time.in which the capacitor is charged until the first defined threshold voltage, detected by the comparator unit, is reached.
[0009] Publication GB 1 397 288 A discloses an analog-to-digital converter comprising a comparator with a first and a second input and an output, and a first and a second switch for alternately connecting a first and a second signal level to the first input, the second signal level being used as a first reference level. A storage device is connected between the second input and a second reference level. A current generator supplies either a positive or a negative current to the second input to charge the storage device until a change of state occurs at the output of the comparator.A selector determines the polarity of the current from the generator device depending on the state of the comparator's output signal, and a counting device determines the number of counting pulses emitted by a pulse generator during a counting period corresponding to the period for which the current generator device is applied to the comparator before the comparator's state change occurs.
[0010] It is therefore an object of the present invention to enable sufficiently precise voltage measurement with a microcontroller, even for smaller voltage measurement ranges, particularly at lower differential voltages. In particular, the measurement ranges should be adjustable and allow high-resolution voltage measurement within the adjusted measurement range. Disclosure of the invention
[0011] This problem is solved by the voltage measurement arrangement with a microcontroller according to claim 1, which enables simple voltage measurement with a measurement range-independent resolution even in reduced voltage measurement ranges.
[0012] Further details are specified in the dependent claims.
[0013] According to a first aspect, a voltage measurement arrangement, in particular for use with a microcontroller, is provided for measuring and digitizing a measurement voltage potential or a measurement voltage, comprising: a reference voltage source for providing a reference voltage potential or a reference voltage; a comparator with a first input, a second input, and a comparator output for outputting a high level or a low level of a comparator output signal depending on the sign of a voltage difference between the first and the second input; an RC network consisting of at least one resistor and at least one capacitor, wherein the at least one capacitor is charged and discharged depending on a level of the comparator output signal, in particular via the resistor, wherein the at least one resistor is directly electrically connected to the comparator output and a node between the at least one resistor and at least one capacitor is directly electrically connected to the second input of the comparator; a switching device for alternately controlled application of the reference voltage potential or a reference voltage.the reference voltage or the measurement voltage potential or the measurement voltage to the first input of the comparator, so that a cyclic charging and discharging of the at least one capacitor is achieved, and a time or frequency measuring unit for measuring a period or a frequency of a comparator output signal as an indication of the measurement voltage potential or the measurement voltage.
[0014] Furthermore, the comparator and the switching device can be connected in such a way that when the reference voltage potential is reached by a potential in the RC network that depends on a capacitor voltage potential, or when the reference voltage is reached by a voltage in the RC network that depends on a capacitor voltage, the switching device switches to apply the measurement voltage potential or the measurement voltage to the first input of the comparator.
[0015] Accordingly, the comparator and the switching device can be connected in such a way that when the measurement voltage potential is reached by the potential in the RC network which depends on a capacitor voltage potential, or when the measurement voltage is reached by a voltage in the RC network which depends on a capacitor voltage, the switching device switches to apply the reference voltage potential or the reference voltage to the first input of the comparator.
[0016] It may be provided that the reference voltage source, the comparator, the switching device and a time or frequency measurement unit are included, implemented or integrated in a microcontroller.
[0017] The above voltage measurement arrangement can start with a microcontroller which, in a manner known per se, includes a reference voltage source, e.g. a digital-to-analog converter to provide a reference voltage, a switching device, e.g. an analog multiplexer, a comparator and a time or frequency measurement unit.
[0018] The voltage measurement setup described above cleverly enables the use of microcontroller components to build a high-resolution differential voltage measurement with respect to an arbitrarily selectable or fixed reference voltage potential. This also allows for the measurement of voltages in small measurement ranges with high resolution.
[0019] Conventional voltage measurement circuits in microcontrollers are designed for a fixed measurement range and digitize an analog measurement voltage relative to a ground potential within that range. This results in limited relative resolution for voltages that vary only within a small portion of the measurement range. This problem is typically circumvented by scaling the range of possible measurement voltages through pre-amplification. This requires an amplifier stage, but this degrades the accuracy of the voltage measurement due to gain errors, offset errors, and additional noise. Furthermore, this approach increases the complexity of the circuit.
[0020] The voltage measurement setup described above uses a microcontroller that alternately applies a reference voltage potential (also referred to here as reference voltage relative to ground potential) or a measurement voltage potential (also referred to here as measurement voltage relative to ground potential) to a non-inverting first input of the comparator, for example, by means of a switching device (analog multiplexer). The reference voltage potential or reference voltage lies between a high supply potential and a low supply potential, or the reference voltage is lower than the supply voltage. The switching device / analog multiplexer is controlled by the comparator output signal, so that, depending on the level of the comparator output signal, the reference voltage or the measurement voltage is applied to the non-inverting second input of the comparator.
[0021] Furthermore, the comparator output is coupled to an RC circuit, which is positioned between the comparator output and ground. In this way, the capacitance of the RC circuit is charged when the comparator output signal is high (high supply potential) and discharged when it is low (low supply potential, which can be ground). The capacitor potential is then applied to the inverting (second) input of the comparator.
[0022] The comparator output provides a high level of the comparator output signal when there is a positive voltage difference between the non-inverting first and inverting second inputs of the comparator, and a correspondingly low level when there is a negative voltage difference. A high level of the comparator output signal switches the switching device or analog multiplexer so that the measurement voltage potential is applied to the non-inverting input of the comparator. A low level of the comparator output signal then applies the reference voltage potential to the non-inverting input of the comparator.
[0023] During measurement, a periodic comparator output signal is generated, the frequency and / or period of which can be measured. For this purpose, a time or frequency measurement unit in the form of a counter, timer, or similar device can be used within the microcontroller, which are typically integrated into conventional microcontrollers. The resulting period or frequency of the comparator output signal depends on the measured voltage.
[0024] According to one embodiment, the reference voltage potential or the reference voltage and / or the time constant of the RC network can be selected such that, for a given measuring range of the measuring voltage potential or the measuring voltage itself, a frequency difference (maximum frequency fmax - minimum frequency fmin) of, for example, one decade is obtained in the comparator output signal. Theoretically, any frequency can be set. However, in practice, a compromise must be found between accuracy, speed, and feasibility (in terms of the specifications of the comparator, counters of the microcontroller, etc.). The measurement accuracy of the frequency is crucial for determining the resolution. Calculation example: Microcontroller clock frequency fCPU = 64 MHz, which also serves as the counter frequency of the timer, fmin = 1 kHz, fmax = 10 kHz: N1 = 64 MHz / 1 kHz = 64,000 clock cycles (at an upper measurement voltage) N2 = 64 MHz / 10 kHz = 6,400 clock cycles (at a lower measurement voltage) The measurement range between the upper and lower measurement voltages corresponds to N2 - N1 = 57,600 clock cycles. This allows a resolution of 15.8 bits.
[0025] The voltage measurement setup described above allows microcontrollers to be used for voltage measurement, particularly when they lack an analog-to-digital converter (ADC) or have only a low-resolution one, or when only a small measurement range relative to the supply voltage needs to be measured. Furthermore, the measurement range can be variably adjusted, especially by selecting the reference voltage potential as, for example, the lower voltage threshold, unlike conventional ADCs in microcontrollers, which are based on the low supply voltage potential. Offset errors can also be limited by using only one comparator, and gain errors can be completely avoided by using the measurement voltage directly, i.e., without additional amplification.
[0026] Unlike the dual-slope converter for voltage measurement, the voltage measurement setup described above uses an RC network instead of an integrator. The comparator input is switched between two voltage thresholds, whereas in the dual-slope method, the integrator input is switched. This design offers the advantage of requiring fewer electrical components, and unlike the dual-slope method, frequency measurement is simpler and more accurate (e.g., by clock counting within a constant gate time) than pure time measurement. Furthermore, in this voltage measurement setup, the measurement voltage potential and the reference voltage potential are connected to the same high-impedance first (e.g., non-inverting) input of the comparator, eliminating the need for an additional impedance converter, as is the case with other voltage measurement setups. This reduces the load on the measurement voltage. Brief description of the drawings
[0027] The embodiments are explained in more detail below with reference to the accompanying drawings. These show: Figure 1 is a schematic representation of a voltage measurement arrangement with a microcontroller; and Figure 2 is a signal-time diagram to illustrate the signal waveform of the comparator output signal and the capacitor voltage. Description of embodiments
[0028] Figure 1Figure 1 shows a schematic representation of a voltage measurement arrangement 1 with a microcontroller 2. The microcontroller 2 is used to control or, more generally, to operate a technical system in which an external measurement voltage Umess, for example from a sensor 3, is provided. The measurement voltage Umess can, for example, be a voltage derived from the ohmic resistance of a strain gauge, or the like. The aim is to obtain a digitized sensor signal in the microcontroller 2 that indicates the measurement voltage Umess with high resolution.
[0029] The microcontroller 2 comprises logic and electronic components of a type known per se, of which a comparator 21, an analog multiplexer 22 and a time or frequency measurement unit 23 are used for time or frequency measurement.
[0030] Comparator 21 is implemented in a known manner and has an inverting input CMP_IN- and a non-inverting input CMP_IN+. Comparator 21 is supplied via the supply voltage Uvers = U+ - U- of the microcontroller 2. The supply voltage Uvers is provided as the voltage difference between a high supply potential U+ and a low supply potential U-, which serves primarily as ground potential. Depending on the sign of the voltage difference between the non-inverting (first) input CMP_IN+ and the inverting (second) input CMP_IN-, comparator 21 outputs a low level signal at the comparator output CMP_OUT for a negative voltage difference and a high level signal at the comparator output CMP_OUT for a positive voltage difference.
[0031] The comparator output CMP_OUT is connected to an RC circuit 4, which can be configured as a series connection between a resistor R and a capacitor C. Specifically, the comparator output CMP_OUT is directly electrically connected to the first terminal of resistor R. The second terminal of resistor R is directly electrically connected to the first terminal of capacitor C. The second terminal of capacitor C is directly electrically connected to the low supply potential U-, for example, ground potential.
[0032] The second terminal of resistor R and the first terminal of capacitor C are directly electrically connected to the inverting input CMP_IN- of comparator 21.
[0033] The non-inverting input CMP_IN+ of comparator 21 is connected to an output of an analog multiplexer 22. The analog multiplexer 22 is switched depending on the output signal at the comparator output CMP_OUT of comparator 21.
[0034] On the input side of the analog multiplexer 22, a reference voltage potential Uref, referenced to the low supply potential U-, and a measurement voltage potential Umess, referenced to the low supply potential U-, are present. The reference voltage potential Uref is provided by an adjustable reference voltage source 24 in the microcontroller 2.
[0035] When switched on, the analog multiplexer 22 is configured such that the measurement voltage potential Umess is applied to the non-inverting input CMP_IN+ of the comparator 21. The capacitor C is discharged. This results in a positive voltage difference across the comparator inputs, and therefore the comparator output CMP_OUT is at a high level, i.e., the high supply potential U+.
[0036] The comparator output of comparator 21 is at the high supply potential U+. Through coupling with the RC network 4, capacitor C is charged with the time constant RxC. When the inverting input CMP_IN- of comparator 21 reaches the measurement voltage U mess, comparator 21 switches its output to the low level, i.e., the low supply potential U-, and capacitor C begins to discharge. At the same moment, triggered by the change in the level of the comparator output signal, analog multiplexer 22 switches, thus applying the reference potential U ref to the non-inverting input CMP_IN+ of comparator 21. Capacitor C discharges until the lower threshold applied by the reference potential U ref to the non-inverting input CMP_IN+ of comparator 21 is reached. When this occurs, the comparator output switches to the high level, i.e.,The high supply potential U+, and due to the level change, the analog multiplexer 22 is switched again accordingly. The cycle now begins anew.
[0037] As in Figure 2 As shown, this results in a periodic signal pattern. Figure 2 This shows the course of the capacitor voltage UC and the level of the comparator output signal S CMP_OUT at the comparator output CMP_OUT.
[0038] The following relationship results for the period T of the periodic signal at the comparator output. T = R ⋅ C ⋅ ln U + − U ref U + − U mess ⋅ U mess U ref
[0039] It follows that the closer the measured voltage Umess is to the reference voltage Uref, i.e., the smaller the voltage difference, the higher the frequency of the periodic signal SCMP_OUT at the comparator output CMP_OUT. Furthermore, the frequency range of the periodic comparator output signal can be adjusted as desired by appropriately selecting the resistor R, the capacitor C, and the reference voltage. The comparator output CMP_OUT is also connected to the time or frequency measurement unit 23 to measure the period or frequency, for example, using a frequency counter. These are directly related to the measured voltage Umess, so that the measured voltage Umess can be determined by specifying the period or frequency, provided the other parameters (R, C, U+, Uref) are also known.
Claims
1. Voltage measurement arrangement (1), in particular for use with a microcontroller (2), for measuring and digitizing a measurement voltage potential or a measurement voltage (Umess) with high precision, comprising: - an adjustable reference voltage source (24) for providing a reference voltage potential or a reference voltage (Uref), - a comparator (21) with a first input (CMP_IN+), a second input and a comparator output (CMP_OUT) for outputting a high level or a low level of a comparator output signal depending on a sign of a voltage difference between the first and second inputs (CMP_IN+, CMP_IN-); - an RC network (4) comprising at least one resistor (R) and at least one capacitor (C), wherein the at least one capacitor (C) is charged and discharged depending on a level of the comparator output signal, wherein the at least one resistor is directly electrically connected to the comparator output (CMP_OUT) and a node between the at least one resistor (R) and the at least one capacitor (C) is directly electrically connected to the second input (CMP_IN-) of the comparator (21); - a switching device (22) for an alternately controlled applying of the reference voltage potential or the reference voltage (Uref) or the measurement voltage potential or the measurement voltage (Umess) to the first input (CMP_IN+) of the comparator (21), so that a cyclic charging and discharging of the at least one capacitor (C) is achieved, and - a time or frequency measurement unit (23) for measuring a period duration or a frequency of a periodic comparator output signal as an indication of the magnitude of the measurement voltage potential or the measurement voltage (Umess).
2. Voltage measurement arrangement (1) according to claim 1, wherein the comparator (21) and the switching device (22) are connected to one another in such a way that, when the capacitor voltage potential reaches the reference voltage potential or when the capacitor voltage reaches the reference voltage (Uref), a switching by the switching device (22) takes place to apply the measurement voltage potential or the measurement voltage to the first input (CMP_IN+) of the comparator (21).
3. Voltage measurement arrangement (1) according to claim 1 or 2, wherein the comparator (21) and the switching device (22) are connected to one another in such a way that, when the capacitor voltage potential reaches the measurement voltage potential or when the capacitor voltage reaches the measurement voltage (Umess), a switching by the switching device (22) takes place to apply the reference voltage potential or the reference voltage (Uref) to the first input (CMP_IN+) of the comparator (21).
4. Voltage measurement arrangement (1) according to any one of claims 1 to 3, wherein the adjustable reference voltage source (24), the comparator (21), the switching device (22) and a time or frequency measurement unit are comprised in a microcontroller (2) or are integrated as a microelectronic circuit.
5. Voltage measurement arrangement (1) according to any one of claims 1 to 4, wherein the switching device comprises an analog multiplexer.
6. Voltage measurement arrangement (1) according to any one of claims 1 to 5, wherein the first input of the comparator (21) corresponds to a non-inverting input (CMP_IN+) and the second input of the comparator (21) corresponds to an inverting input (CMP_IN-).
7. Voltage measurement arrangement (1) according to any one of claims 1 to 6, wherein the reference voltage potential or the reference voltage (Uref) and / or the time constant of the RC network (4) are selected such that, for a predetermined measurement range of the measurement voltage potential or the measurement voltage (Umess), a frequency difference of the comparator output signal between the resulting frequencies for the measurement voltage potential or the measurement voltage (Umess) at an upper and a lower limit of the measurement range is in particular between one and three decades, preferably between one and two decades. ]