Method and apparatus for digitizing a voltage

When digitizing a voltage, a capacitor is charged, through an impedance, to a voltage value (Um) dependent on the voltage to be digitized. The limits of that one of a plurality of voltage ranges in which said voltage value (Um) lies, are ascertained, and the two limits of that voltage range are defined as a first limit and second limit; the voltage at the capacitor is modified to the first limit by a charge modification circuit containing an impedance, and a first time interval needed therefor is identified; the voltage at the capacitor is modified to the second limit; the voltage at the capacitor is modified from the second to the first limit via the charge modification circuit. A seond time interval needed therefor is identified. Based on values of the first time interval and second time interval, a digital value is calculated, which serves as an indication of how much the voltage value (Um) at the capacitor differs from one of said two limits.

FIELD OF THE INVENTION

The invention relates generally to a method for digitizing the voltage at a capacitor, and a device for carrying out such a method and, more particularly, to the application of such a method and device for controlling the rotation speed of a fan driven by an electronically commutated DC motor.

BACKGROUND

For digitization of an analog voltage, many microcontrollers (μCs) are equipped with an A/D converter that allows a relatively coarse conversion, e.g. to 4-bit accuracy. A substantially greater accuracy (e.g. 8 bits) is usually needed for digital controllers, however, and consequently requires a higher-resolution A/D conversion than is possible with the hardware of such a μC.

SUMMARY OF THE INVENTION

An object of the invention is therefore to make available a new method for digitization, as well as a device for carrying out such a method.

According to the invention, this object in achieved by first coarsely classifying the voltage on the capacitor into one of a plurality of contiguous voltage ranges, each defined by a respective first limit and a respective second limit, to derive the Most Significant Bits (MSB) of the digitized voltage value, and then modifying the capacitor voltage within the identified range, measuring the time intervals needed to do so. The results of the measurements are used to derive Least Significant Bits (LSB) of the digitized voltage value, thus increasing accuracy.

Determination of the first and second limits can be accomplished with the hardware present in many microcontrollers, and the result is a coarse digitization, i.e. a coarse datum. Subsequent active modification of the voltage at the capacitor enables a more accurate measurement in which the size of that capacitor affects only how long the measurement lasts, but not its accuracy. Deviation of the capacitor value from its nominal value thus does not create an accuracy problem. It is thereby possible to increase the A/D conversion accuracy with very simple means and substantially without additional cost, since what is now obtained, in addition to the coarse datum regarding the first and second limits, is a fine datum, concerning the magnitude of the voltage value at the capacitor, within the range between the first and second limits.

A device according to the present invention has a charging circuit, including an impedance, for charging the capacitor to the value to be digitized, charge modification apparatus for modifying the capacitor voltage successively to respective ends of the voltage range, measuring the time intervals (T1, T2) required, and a calculation apparatus for deriving additional bits of the digitized voltage value, based upon the values of the aforementioned time intervals. An arrangement of this kind has a very simple configuration with high measurement accuracy.

A preferred use or application for the invention is in the control of the rotation speed of a fan driven by an electronically commutated motor (ECM).

DETAILED DESCRIPTION OF A PREFERRED EMBODIMENT

FIG. 1shows, at the right, a computer20, e.g. a Microchip 16C621A μC from the Microchip company of Chandler, Ariz. This contains a resistor chain22which is at a constant voltage Uss of e.g. +3.0 V and contains fifteen resistors that are partially indicated at24,26,28,30. Some of the nodes between these resistors are indicated at32,34,36,30.FIG. 1shows only a small portion of this resistor chain22.

μC20furthermore contains a comparator40whose output42is connected to switching logic (ALU)44of μC20, associated with which is a program in a ROM46, which in this case is preferably a constituent of μC20and usually is programmed when the latter is manufactured.

The device in the embodiment shown inFIG. 1serves to digitize a potential at a node62of a voltage divider50. The latter contains an NTC (Negative Temperature Coefficient) resistor52which is arranged between ground54and a node56and has connected in parallel with it a resistor58whose function is to optimize the range of the output signals of voltage divider50for subsequent digitization.

Node56is connected via a resistor60to node62, and the latter is connected via a resistor64to regulated voltage Uss.

A comparator66is wired as an impedance converter by the fact that its output68is connected to negative input70. Positive input72is connected to node62. The function of resistor60is evident here: if NTC resistor52is short-circuited by a fault, resistor60causes the potential obtained at node62to be different from that at ground, thus preventing a fault state from being reported during digitization. This is a “fail-safe” feature.

Impedance converter66is thus controlled by the potential at node62, but prevents the occurrence of any feedback from its output to NTC resistor52.

Output68of impedance converter66is connected via a resistor76to a node78that is connected via a capacitor80to ground54.

In operation, capacitor80charges, through impedance converter66and resistor76, to a voltage value Um that is a function of the potential at node62, i.e. a function of the temperature at NTC resistor52. This voltage value Um at capacitor80is digitized by the device shown inFIG. 1, i.e. converted into a numerical value that then serves, for example, as the basis for generating a target value for the rotation speed of an electronically commutated motor (ECM)156. The latter can serve, for example, to drive a fan83that, like motor156, is indicated only symbolically. For example, fan83is given a low rotation speed when the temperature at NTC resistor52is low, and a high rotation speed when that temperature is high.

Node78is connected to the positive input of comparator40, and is connected, via a resistor84whose resistance is low by comparison with resistor76, to a node86to which is connected drain terminal D of a p-channel MOSFET (Metal Oxide Semiconductor Field Effect Transistor)88whose source S connects to +Uss and to which is connected drain terminal D of an n-channel MOSFET90whose source S is connected to ground54, MOSFETs88,90are constituents of μC20, and their gates G are controlled by the latter's arithmetic & logic unit (ALU)44, via the connections shown symbolically at A and B, in accordance with the program (FIG. 3) in ROM (Read Only Memory)46.

Node78is also connected, via a resistor94, to the drain terminal of an n-channel MOSFET96(in μC20) whose source S is connected to ground54. Gate G of transistor96is controlled by logic unit44via a connection98.

Negative input100of comparator40can be connected via an electronic switch102to node32, likewise via an electronic switch104to node36, likewise via an electronic switch106to node38(and analogously, via additional switches that are not depicted, to the other nodes of resistor chain22).

Electronic switch102is controlled by logic unit44via an effective connection108. Electronic switch104is likewise controlled by logic unit44via an effective connection110, and electronic switch106via an effective connection112, and likewise for all the other electronic switches.

Manner of Operation

As shown inFIG. 2, firstly, in a Phase=0, capacitor80is charged through impedance converter66and impedance76to a voltage value Um that, in the exemplary embodiment, is a function of the temperature at NTC resistor52.

Then, in a Phase=1, resistor chain24,26, . . .28,30is used to determine which of several voltage ranges contains said voltage value Um.

The potential is 0 V at ground54, 0.2 V at node32, 0.4 V at node34, and so on up to 2.6 V at node36and 2.8 V at node38.

When switch102is closed, the negative input of comparator40receives a potential of +0.2 V; and if the potential at node78is greater than 0.2 V, there is then no change at output42of comparator40.

For the coarse measurement, the various electronic switches102,104,106, etc. are individually closed successively. If the potential at node36(2.6 V) is still lower than voltage value Um at capacitor80, but the potential at node38(2.8 V) is higher, it is then apparent that voltage value Um must lie between 2.6 and 2.8 V, i.e. the lower limit of the ascertained voltage range is 2.6 V, and the upper limit is 2.8 V. This yields a coarse digitization of the voltage value Um; in other words, the most significant bits (MSBs) are thus obtained upon digitization.

Then, in a Phase=2 (FIG.2), transistor88is switched on while transistor90remains blocked. This causes capacitor80to charge through transistor88and resistor84, as depicted inFIG. 2at101. Electronic switch106remains closed, and when the potential at the positive input of comparator40reaches a value of 2.8 V, comparator40switches over and transistor88is once again made nonconductive by logic unit44and its effective connection A. The time interval T1, during which transistor88is closed, is measured and stored.

Capacitor80is then discharged through resistor84and transistor90to the lower limit of the voltage range, i.e. in this example to +2.6 V, as depicted at103in FIG.2. The voltage at capacitor80is then 2.6 V. During this process, switch106is opened and switch104is closed.

Transistor90is then blocked, transistor88is switched on, switch104is opened, and switch110is switched on. This is done by logic unit44under the control of the program in ROM46.

As a result, capacitor80is charged via transistor88and resistor84from +2.6 V to +2.8 V, as depicted at105inFIG. 2, and a time interval T2, during which transistor88is conductive, is measured. This occurs in Phase=4 (FIG.2).

The reason for the various phases inFIG. 2is as follows: when the invention is utilized in an electronically commutated motor156, which is a preferred application, μC20must also perform many other tasks, e.g. commutating motor156, regulating its rotation speed, limiting its current, etc.; it is therefore advantageous to divide the measurement described above into a number of short modules that can be executed not in direct succession, but with small time gaps. μC20then always has computation time available to perform other time-critical functions in the interim. The fact that the measurement can be subdivided into a number of short modules therefore represents a great advantage of the method and the device according to the present invention.

Once time intervals T1and T2have been measured, the value for the least significant bits (LSBs) is calculated from them using the formula
LSBs=(T2−T1)/T2*16(1)

For example, if T1=T2, equation (1) yields the binary value 0000b.

Since the charging process through resistor84and transistor88can be regarded as almost linear, the size of capacitor80plays a role only in that a larger capacitor means a longer charging time, i.e. a longer measurement time. The tolerances of capacitor80therefore have no influence on this type of measurement, and a very accurate fine digitization result is obtained.

If it is determined during the measurement in Phase=1 that voltage value Um at capacitor80is higher than 2.8 V, transistor96that connects node78to ground54via resistor94is then switched on by logic unit44. Resistors76and94then constitute a voltage divider, and the voltage value to be measured at capacitor80is correspondingly reduced. The voltage at capacitor80can thereby be lowered into a range below 2.8 V so that a measurement becomes possible. The result must then be multiplied by a factor determined by the ratio between resistors76and94.

FIG. 3shows a preferred program routine for the measurement. It is preferably a component of a larger program, e.g. for controlling an electronically commutated motor. The construction of this “SW Routine” is based on the concept that only short program portions (modules), lasting e.g. less than 200 μs, are executed at each pass.

Firstly, after the beginning118of this routine, a test is made at S120as to whether the program is in Phase=0.

This is evident from the state of a higher-level phase counter or pointer that continuously cycles through the following states:

This can also be referred to as a “state machine,” i.e. in practice it is a variable in the processor's RAM that is continuously updated to the current state and indicates the present status of the target value identification process.

If the response in S120is Yes, the program goes to S122“Charge C,” i.e. transistors88,90, and96are blocked so that capacitor80can charge to voltage value Um that is to be measured, and the program waits for a corresponding time. It then proceeds via S149to the end S124of this routine, and in S149the phase counter is advanced from Phase=0 to Phase=1.

If the response in S120is No, the program goes to S126, where it checks whether the pointer is at Phase=1. If Yes, then in S128“Find “N”,” the voltage range N containing the voltage to be measured at capacitor80is determined by switching electronic switches102,104,106, etc. on and off. For example, if the voltage at capacitor80is 2.7 V, the voltage range N is between 2.6 and 2.8 V. This allocation to one of several voltage ranges results in a coarse digitization, yielding the most significant bits (MSBs) for digitization.

Once this voltage range has been determined, the program goes via S149to the end S124of the routine, and in S149the phase counter is advanced to Phase=2.

If the response in S126is No, the program goes to S130, where it checks whether the pointer is already at Phase=3. If Yes, then in S132(Discharge to “N”) capacitor80is discharged to the lower limit of voltage range N, i.e. to 2.6 V in the example described. The program then goes directly to S136“Charge to N+1,” where capacitor80is charged from 2.6 V (in this example) to the upper limit of voltage range N, i.e. to 2.8 V. Time T2is measured in the process. The program then goes to the end S124of the routine, and in S149the phase counter is advanced to Phase=4.

If the response in S130is No, the program goes to S138, where it checks whether the pointer is pointing to Phase=2. If Yes, the program goes to S136, where the capacitor80is charged from its instantaneous voltage Um that is to be measured to the upper voltage limit N+1 of voltage range N, i.e. to +2.8 V in the example described. Time interval T1is measured in the process (cf. FIG.2). The program then goes to the end S124of the routine, and in S149the phase counter is advanced to Phase=3.

If the response in S138is No, the program goes to S140, where it checks whether the pointer is pointing to Phase=4. If Yes, then in S136capacitor80is charged from the lower limit of voltage range N (i.e. from 2.6 V in this example) to the upper limit N+1 (i.e. to 2.8 V in this example); simultaneously, the time interval T2is measured, as depicted in FIG.2and already described in detail therein. In S149the phase counter is then advanced to Phase=5.

If the response in S140is No, the program goes to S142, where it checks whether the pointer is pointing to Phase=5. If Yes, the program goes to S144, where the least significant bits (LSBs) are calculated using equation (1) and are added to the most significant bits (MSBs) that were determined previously in S128. The voltage Um at capacitor80has then been digitized. In S149the phase counter is then advanced to “Phase=Sensor Break.”

If the response in S142is No, the program goes to S146, where it checks whether the phase counter is pointing to “Phase=Sensor Break.” If Yes, the program goes to S148“CTRL Sensor Fault,” where it checks whether the voltage at capacitor80has reached approximately the value Uss, which corresponds to an interruption in the connection to resistor52. If so, an appropriate action is initiated, e.g. outputting of a fault or alarm signal; and in the context of a motor156for a fan83, the rotation speed is increased to a value such that cooling is ensured in all situations. The program then goes via S149to the end S124of the routine.

If the response in S146is No, the program goes to S150, where any desired program steps “CALC” can be executed. For example, the digital value calculated in S144can be converted, using a table, into a different value corresponding to a desired motor rotation speed, and a moving average can be calculated from multiple measurements.

In S152the pointer is then once again reset to Phase=0 so that at the next pass through the routine ofFIG. 3, measurement begins again at S120.

FIG. 4explains a preferred application of the invention in the context of an electronically commutated motor (ECM)156having two stator winding phases158,160and a permanent-magnet rotor162, which here is depicted with four poles and in whose vicinity is arranged a Hall generator164that, during operation, generates at its output166a square-wave HALL signal whose edges are labeled, by way of example, 1, 2, 3, 4. A Hall interrupt (FIG. 8) is generated at each of these edges, and the edges are continuously counted in a ring counter HALL_CTR168.

Motor156has an EMI filter170and a filter capacitor172to supply it with a DC voltage U8. A transistor174that serves as a first output stage (PS1) is in series with phase158, and a transistor176that serves as a second output stage (PS2) is in series with phase160. When transistor174is switched on, phase158receives current. When transistor176is switched on, phase160receives current.

Microcontroller (μC) 20 serves to control transistors174,176. A number of modules are depicted symbolically within it, including a module COMM180for commutation of motor156; a ROM182(within or outside μC20) to store the program for motor156; a module n_CTL184for rotation speed control, which regulates the rotation speed of motor156via module180; and also a module SW_CALC190for calculating target value SW that is delivered to rotation speed controller184. The present value of the rotation speed, i.e. instantaneous or actual value IW, is conveyed in the form of the HALL signal to controller184, and also to modules180and168. μC20also contains a timer192that can be conceived of here as a clock that, at any desired point in time, supplies a so-called baseline time. Timer192coacts with modules168,184, and190.

A voltage for calculating target value SW is delivered to module190via impedance converter66. Its positive input72receives the signal from node62of a voltage divider52,58,60,64, which is described in detail inFIG. 1(cf. description therein).

The signal at output68of impedance converter66is converted in module190, in accordance withFIGS. 1 through 3, into a target value, i.e. into a desired rotation speed. For example, motor156might run at 1500 rpm when the temperature at resistor52is 20° C., and at 3500 rpm when that temperature is 60° C. A target value in the form of a voltage can also be conveyed to node56from outside, via input205.

FIG. 5shows how the individual functions interact with one another in a motor of this kind.

At214, a signal is generated at NTC (Negative Temperature Coefficient) resistor52and is processed in module190to yield the target or “should be” value SW.

At216, ON/OFF signals for switching motor156on or off are delivered, and they also pass through module190.

At218, operating voltage U8is delivered; this can be taken into account, for example, in such a way that if the operating voltage is too low, the motor is shut off, or if the operating voltage is too high, certain changes are made in the program.

Block164depicts Hall IC164that generates the HALL signal, which is processed in a processing module220and supplies information about the instantaneous position and rotation speed of rotor162.

FIG. 5shows that interactions exist between the individual modules that may need to be taken into account in the configuration of the program if the latter is used in an ECM156.

FIG. 6shows the typical basic structure of a program that is preferably used to control the various functions of motor156.

In step S230, an initialization occurs upon startup; during this, various parameters are set to initial values. In step S232, watchdog WD of computer20is reset, and in step S234a reinitialization of certain values occurs at each pass in order to prevent μC20from crashing. At S236, commutation is controlled. In step S238, a Flag_DoFcts is tested; if it has a value of 0, the program proceeds via a short loop240back to S232. If the flag has a value of 1, it is reset to 0 in step S242. This flag (S238) is set to1at each Hall interrupt (FIG.8), i.e. inFIG. 4at points 1, 2, 3, 4 of the HALL signal.

In the next step S244, bit2of HALL_CTR168is tested.

As depicted inFIG. 7, the two rightmost bits of this binary ring counter follow the numerical sequence 00-01-10-11-00 etc. If bit2has a value of 1, the program branches to the left into a branch246. If it has a value of 0, it branches to the right. Next in left branch246, at S248, is one of the target value identification phases as described inFIGS. 1 through 3, and at S250Flag_IW_Done is set to 0. The program then goes back to step S232.

If the response in S244is No, the program then goes to step S252where it checks the value or Flag_IW_Done. If the latter has a value of 1, the program goes to loop254where it executes, in a step S256, one of the target value identification phases SW_CALC described inFIGS. 1 through 3, and then goes back to S232.

If the value of Flag_IW_Done in S252is 0, the program enters the right-hand loop258. Instantaneous value identification IW_CALC is performed there in step S260, i.e. the instantaneous rotation speed of motor156is acquired as a digital value.

Then, in step S262, rotation speed control n_CTL is performed on the basis of the acquired instantaneous value and acquired target value; then Flag_IW_Done is set to 1 in S264, and the program goes back to S232.

When motor156is running, one of the three long loops246,254, or258is executed once at each change in the HALL signal. Subsequently, until the next change in HALL, only the short loop240is repeated at frequent time intervals, e.g. every 100 μs.

Since identification and calculation of the target value, as described inFIGS. 1 through 3, takes a long time, it has advantageously been divided between loops246and254. AsFIG. 7shows, branch246is run through twice for each complete revolution of four-pole rotor162, branch254once, and branch258also only once. For each revolution, therefore, one of the target value calculation phases SW_CALC is executed at three of the changes of the HALL signal, and an instantaneous value identification IW_CALC is performed at one change of the HALL signal. It is advantageous, in this context, that identification of the instantaneous value can be accomplished using the values of one complete rotor revolution, which is substantially more accurate than identification over only one-quarter of a revolution.

The three branches246,254, and258are preferably designed so that they each take approximately the same time to execute.

It should be noted that in steps S248, S256ofFIG. 6, the target value identification phase executed in each case is the one indicated at that moment by the phase counter described above. It may happen, for example, that in step S256Phase=0 is executed at one pass, Phase=3 at the next pass, Phase=Sensor Break at the next pass, etc. Complete identification of the target value is thus distributed over approximately two rotor revolutions, which is sufficiently accurate because there is little change in the target value during this short period. Calculation of the target value takes a fairly long time, but because of this distribution over two revolutions it can be broken down into several small pieces, and then does not interfere with the commutation of motor156.

FIG. 8shows a routine S200that is executed subsequent to interrupts that interrupt program execution.

FIG. 4shows the HALL signal, four edges1,2,3,4of which are depicted. Interrupt routine S200ofFIG. 8is called at each of these edges so that TIMER192(FIG. 4) can accurately measure the point in time at which the relevant edge has occurred.

For example, if edge 1 has occurred at t1=64,327 μs, and edge2at t2=65,400 μs., the time required by rotor162to rotate between edge1and edge2, i.e. one-quarter of a revolution, was therefore
t2−t1=65,400−64,327=1073 μs   (2)

Rotor162therefore requires
4*1073=4292 μs=0.004292 second for one complete revolution.

This yields a rotation speed of
1/0.004292=232.99 rps=60*232.99=13,979.5 rpm   (3)

Instantaneous value IW of the rotation speed can therefore be calculated very accurately in this fashion. A prerequisite, however, is that times t1, t2, . . . be measured very accurately. These times are also needed for precise commutation control.

When an interrupt occurs, the program first checks in S202whether a Hall interrupt, i.e. one of the edges of the HALL signal, is present. This Hall interrupt has the highest priority, and interrupts all other program sequences. If Yes, the program goes to S204, where it calculates the actual or instantaneous value IW of the rotation speed, usually in accordance with the aforementioned equation (2), i.e. as the time instantaneously required by rotor162to rotate through a defined rotation angle.

In S206“CALC COMM,” calculations are then performed to control commutation; and Flag_DoFcts, which controls the calculation operations in steps S238, S242ofFIG. 6, is set to1, so that one of the lower loops246,254, or258ofFIG. 6is run through once at each Hall interrupt. Optionally, a second or even a third condition can be tested in S238(FIG. 6) so that lower loops246,254, or258can be executed at a desired point in the rotor revolution, as described in the commonly assigned German patent application 101 616 88.0 of Dec. 15, 2001 (German attorney docket no. 254; Assignee docket no. 3069).

In S208, Hall counter HALL_CTR168(FIG. 4) is then incremented by 1 as described in FIG.7. The routine then goes to S210Return.

If the response in S202is No, the program then goes to S212, determines which other interrupt is present, executes it, and then once again goes to S210Return.

Interrupt routine S200ofFIG. 8thus serves principally to measure very exactly the times of edges1,2,3,4, . . . of the HALL signal (FIG.4), since an exact measurement of this kind is a prerequisite for smooth operation of motor156at the desired rotation speed. At the same time, the setting of Flag_DoFcts in S206and the incrementing of the Hall counter in S208determine which one of loops246,254, or258ofFIG. 6will be executed next; as a result, the calculation tasks to be performed can be fitted optimally into the available calculation time and performed at the correct rotational position of rotor162.

As an aid to understanding, the flow diagram ofFIG. 6can be explained as follows:

The test in S238is like a first “traffic lights.” Controlled by the rotational position of rotor162, it is “green” four times during each rotor revolution (e.g., in the exemplary embodiment, at those points where an edge of the HALL signal occurs) and in that case steps S242and S244are accessed. The rest of the time the S238light is “red,” so that loop240is run through at very frequent intervals.

The next traffic light is S244. It is controlled by the second bit of Hall counter168, as depicted in FIG.7. The result is as if this light were controlled by the rotor rotation through a reduction gear drive.

If this traffic light is green (YES), then loop246is executed (cf. FIG.7). If it is red (NO), the routine then goes to S252, where the program branches either to loop254or to loop258.

After each of loops246,254, or258, the program goes back to S232.

At defined rotational positions of rotor162, it is thus possible to execute specific program steps that are required there, e.g. steps S232,234,236for commutation, which must be performed with fairly high accuracy within the time ranges in which a commutation action is expected. As regards the steps necessary in order to control rotation speed (S262) or to calculate parameters for the rotation speed control system (S248, S256, S260), it is sufficient to execute them once every rotor revolution or once every two rotor revolutions, since the rotation speed changes little during that time period.

Many variations and modifications are of course possible within the scope of the present invention. For example, the measurement could also be performed in such a way that the two time intervals T1and T2are measured not upon charging of capacitor80, but upon discharging. In this instance as well, the size of capacitor80has no influence on measurement accuracy, so capacitor manufacturing variations are not critical or troublesome. Thus, the invention is not limited to the specific embodiments shown and described, but rather is defined by the following claims.