Hall switch with adaptive threshold

An electronic device incorporating a magnet and a Hall-effect sensor to determine a location of a portion of the electronic device. The electronic device comprises a magnet mechanically coupled to a first portion of the electronic device and a Hall-effect sensor coupled to a second portion of the electronic device where the first portion and the second portion are moveable with reference to each other and where the Hall-effect sensor receives a magnetic field of the magnet. The device further comprises an electronic stage that outputs a comparison threshold signal based on peak detecting an output of the Hall-effect sensor using a long term adjustment and resetting the long term adjustment to a current output of the Hall-effect sensor in response to a short term adjustment and a switch electronic stage that switches in response to the output of the Hall-effect sensor exceeding the comparison threshold output.

CROSS-REFERENCE TO RELATED APPLICATIONS

Not applicable.

REFERENCE TO A MICROFICHE APPENDIX

Not applicable.

BACKGROUND

Position sensors are used in many items of technology. Sometimes Hall-effect sensors are used to sense a magnetic field that changes in intensity based on a relative position of the Hall-effect sensor and some other item of interest. For example, a permanent magnet may be located in an edge of a display of a laptop computer, and a Hall-effect sensor may be located in a base of the laptop such that when the display is closed, the magnet and Hall-effect sensor are close to each other. The Hall-effect sensor thus can detect when the magnet is close (when the laptop is closed) and output a corresponding signal that can be used by the laptop to trigger turning off the display and possibly triggering other power saving activities.

SUMMARY

In an embodiment, a position sensor is disclosed. The sensor comprises a Hall-effect sensor and an adaptation electronic stage coupled to the Hall-effect sensor that outputs a comparison threshold signal based on peak detecting an output of the Hall-effect sensor using a long term adjustment and resetting the long term adjustment to a current output of the Hall-effect sensor in response to a short term adjustment. The sensor further comprises a switch electronic stage coupled to the Hall-effect sensor and to the adaptation electronic stage that switches to output a logic active value in response to the output of the Hall-effect sensor exceeding the comparison threshold output.

In another embodiment, a method of determining a position of a device using a Hall-effect sensor is disclosed. The method comprises receiving a magnetic input by a Hall-effect sensor, outputting a signal by the Hall-effect sensor that represents the magnetic input, receiving the signal output by the Hall-effect sensor by an adaptation component, and storing a peak value of the received signal by the adaptation component. The method further comprises detecting a reset pattern in the received signal by the adaptation component, resetting the peak value stored by the adaptation component in response to detection of the reset pattern by the adaptation component, outputting the stored peak value by the adaptation component, and generating a threshold output that is less than but proportional to the stored peak value output by the adaptation component. The method further comprises receiving the threshold output by a switch component, receiving the signal output by the Hall-effect sensor by the switch component, and switching to output a logic active value by the switch component on the event of the received signal output by the Hall-effect sensor exceeding the received threshold output.

In yet another embodiment, an electronic device incorporating a magnet and a Hall-effect sensor to determine a location of a portion of the electronic device is disclosed. The device comprises a permanent magnet mechanically coupled to a first portion of the electronic device and a Hall-effect sensor coupled to a second portion of the electronic device where the first portion and the second portion are moveable with reference to each other and where Hall-effect sensor receives a magnetic field of the permanent magnet in at least some working configurations of the electronic device. The device further comprises an adaptation electronic stage coupled to the Hall-effect sensor that outputs a comparison threshold signal based on peak detecting an output of the Hall-effect sensor using a long term adjustment and resetting the long term adjustment to a current output of the Hall-effect sensor in response to a short term adjustment and a switch electronic stage coupled to the Hall-effect sensor and to the adaptation electronic stage that switches to output a logic active value in response to the output of the Hall-effect sensor exceeding the comparison threshold output.

These and other features will be more dearly understood from the following detailed description taken in conjunction with the accompanying drawings and claims.

DETAILED DESCRIPTION

The present disclosure teaches a Hall-effect position sensor that features an adaptive threshold. As a magnet approaches the Hall-effect sensor, the Hall-effect sensor output increases in amplitude. As the Hall-effect sensor exceeds a threshold, a switch that receives an output of the Hall-effect sensor transitions from a logic inactive state to a logic active state. This logic active state may be used by other processing as a signal that an object containing the magnet is close to the Hall-effect sensor. In an embodiment, the logic active signal could mean that a laptop is closed. In an embodiment, the logic active signal could mean that a battery door is closed. The threshold may be set initially for a first magnetic field strength. Later, the magnetic field strength sensed by the Hall-effect sensor may change, even when the object to which the magnet is coupled approaches just as close to the Hall-effect sensor. The location or position of the magnet may have been moved due to a collision of the system the magnet is coupled to, the magnetic field emitted by the magnet may change due to temperature changes or due to a mechanical shock the magnet may have received. As an alternative example, the magnetic field strength sensed by the Hall-effect sensor may vary across individual units of mass-produced products due to manufacturing tolerances and assembly variations and/or due to variations in the magnets provided by suppliers. The present disclosure teaches detecting the peak output of the Hall-effect sensor and adapting the threshold based on that peak to compensate for variations in the interactions between the Hall-effect sensor and the magnet. More particularly, the threshold is adapted slowly as the peak output of the Hall-effect sensor changes gradually over many cycles of position sensing and is adapted rapidly in response to the peak output of the Hall-effect sensor exhibiting a jump in value.

Turning now toFIG. 1, a system100is described. In an embodiment, the system100comprises a magnet102and a position sensor104. In embodiment, the magnet102may be a permanent magnet or it may be another kind of magnet such as an electromagnet stimulated by an oscillating current in a coil of wire. The position sensor104comprises a Hall-effect sensor106, a threshold adaptation electronic stage108, a coupling stage110, and a switch stage112. The Hall-effect sensor106interacts with the magnet102and outputs an electrical signal that is representative of or an analog of the magnetic field strength incident upon it. For example, as the magnet102comes close to the Hall-effect sensor106, the magnetic field of the magnet102that is incident on the Hall-effect sensor106becomes more intense, and the amplitude of the electrical signal output by the Hall-effect sensor106likewise increases. The output of the Hall-effect sensor106is fed into the switch stage112. The threshold adaptation108receives the output of the Hall-effect sensor106and generates a threshold signal based on that output of the Hall-effect sensor106. The threshold signal is coupled by a coupling stage110to the switch stage112. The output of the coupling stage110may be referred to as a coupled threshold signal or as a threshold reference signal. In an embodiment, the coupled threshold signal may be less than and proportional to the threshold signal output by the threshold adaptation electronic stage108.

When the output of the Hall-effect sensor106is greater than the coupled threshold signal, the switch stage112outputs a logic active signal, for example a logic HI value. When the output of the Hall-effect sensor106drops sufficiently below the coupled threshold signal (in an embodiment, the switch stage112introduces a switching hysteresis), the switch stage112outputs a logic inactive signal, for example a logic LO value. It is understood that in a different embodiment, the polarity of active versus inactive logic may be reversed, so a logic active signal may correspond to a logic LO value and a logic inactive signal may correspond to a logic HI value.

The threshold adaptation108is configured to detect and hold the peak value of the output of the Hall-effect sensor106. The threshold adaptation108slowly decreases its output over time to continue to track the peak value of the output of the Hall-effect sensor106if that peak value decreases slowly. On the other hand, the threshold adaptation108rapidly follows any increase in the peak value (this is what is meant by “tracking and holding” the peak). This may be referred to as long-term adjustment or long-term adaptation of the threshold adaptation stage108. The threshold adaptation108is further configured to detect when the peak value of the output of the Hall-effect sensor106decreases significantly over a relatively short period of time, for example over two minimum-to-peak-to-minimum cycles, over five minimum-to-peak-to-minimum cycles, over eight minimum-to-peak-to-minimum cycles, or some other number of cycles. It is observed that in this example, the term “relatively short period of time” is expressed not in clock time but in terms of minimum-to-peak cycles. The criteria for what is a significant decrease in the peak may be a predefined value. As an example, a peak value that is less than about 66% of the established peak may be the criteria for significant decrease in the peak, a peak value that is less than about 50% of the established peak may be the criteria for significant decrease in the peak, a peak value that is less than about 33% of the established peak may be the criteria for significant decrease in the peak, a peak value that is less than about 25% of the established peak may be the criteria for significant decrease in the peak, or a different criteria may be predefined. When the threshold adaptation108detects a significant change in the peak output of the Hall-effect sensor106over a relatively short period of time, the threshold adaptation108resets its peak hold value (for example, sets the peak hold value to 0 or to a current value of the output of the Hall-effect sensor106) and sets a new peak value based on the next peak cycle of the output of the Hall-effect sensor106. This feature can quickly adjust to a change in the function of the position sensor104, for example, if the magnet102has been moved due to damage to the system100or if the field strength of the magnet102has been altered due to a mechanical shock to the magnet102.

Turning now toFIG. 2AandFIG. 2B, a use case for the position sensor104is described. A laptop computer140is shown having a display panel142and a base144. It will be appreciated that the display panel142may comprise a housing or enclosure that retains a graphical display and various electronics. The display panel142may be coupled to the base144mechanically by hinges and communicatively by wires, a ribbon cable, and/or by wireless communication links. The base144may comprise a housing or enclosure that retains a keyboard and/or touch panel, switches, interface ports, disk drives, a battery, and a circuit board retaining various electronic components such as memory chips, microprocessor chips, digital signal processor chips, graphics processing chips, and the like. In an embodiment, the display panel142comprises the magnet102, and the base144comprises the position sensor104. The locations of the magnet102and the position sensor104may be such that when the display panel142is closed on the base144, the magnet102approaches close to the position sensor104. It is understood that in a different embodiment, the magnet102may be located in the base144, and the position sensor104may be located in the display panel142.

When the display panel142is closed on the base144(when the “lid” of the laptop is closed), the position sensor104may determine that a peak of the magnetic field emitted by the magnet102is sensed by the Hall-effect sensor106and generate a logic active output, as described above. This logic active output can be used by processing in the base144, for example by a program being executed by a microprocessor of the base144, to remove power from the graphics display, thereby conserving battery power. The program may take further actions in response to the transition to a logic active output of the position sensor104.

It is understood that the position sensor104may be used in different use cases and in different applications. For example, the position sensor104and magnet102may be disposed on a battery cover and the base144of the laptop140such that when the battery cover is removed, the sensor104outputs a logic active signal (in this case the logic polarity may be reversed). This battery cover removed logic active output may be used by processing to save current state of the laptop140and perform a controlled shutdown in anticipation of electrical power being abruptly removed from the laptop140. The position sensor104may be used in yet other use cases.

Turning now toFIG. 3, a method200is described. At block202, a magnetic input is received by a Hall-effect sensor. For example, the Hall-effect sensor106responds to a magnetic field emitted by the magnet102. As the magnet102position changes (e.g., as the display panel142is rotated on the hinge to close the laptop140), the magnetic field received by the Hall-effect sensor106changes. At block204, a signal by the Hall-effect sensor is output that represents the magnetic input. Because the magnetic input varies with the position of the magnet102, the output of the Hall-effect sensor106varies with the position of the magnet102and/or with the position of the display panel142. At block206, the signal output is received by the Hall-effect sensor by an adaptation component. For example, the output of the Hall-effect sensor106is received as an input by the threshold adaptation electronic stage108.

At block208, a peak value of the received signal is stored by the adaptation component. For example, the adaptation component108detects or samples and holds the peak value of the received signal. At block210, a reset pattern is detected in the received signal by the adaptation component. For example, the adaptation component108detects a pattern that comprises a plurality of minimum-to-maximum-to-minimum cycles of the output of the Hall-effect sensor106where the peak value of the output of the Hall-effect sensor106is further determined to be significantly less than the tracked and hold peak value stored by the adaptation component108. This pattern is consistent with a condition where the peak of the Hall-effect sensor106has shifted significantly lower, and in this circumstance, the threshold coupling output of the coupling110ought to be reset to reflect this shifted peak level rather than waiting for the slow adaptation function to ramp this down over an extended period of time.

At block212, the peak value stored by the adaptation component is reset in response to detection of the reset pattern by the adaptation component. For example, the adaptation component108resets the peak value of the output of the Hall-effect sensor106that it is holding and recaptures the current value and/or peak. At block214, the stored peak value is output by the adaptation component (this may be the reset value of the stored peak). At block216, a threshold output that is less than but proportional to the stored peak value output is generated by the adaptation component. At block218, the threshold output is received by a switch component, for example by the switch stage112. At block220, the signal output is received by the Hall-effect sensor by the switch component, for example by the switch stage112. At block222, a logic active value is switched to output by the switch component on the event of the received signal output by the Half-effect sensor exceeding the received threshold output.

Tuning now toFIG. 4, an illustrative embodiment of the position sensor104is described. It should be understood that the embodiment described with reference toFIG. 4is one embodiment and that other embodiments of the features and advantages taught by the present disclosure are contemplated. To some extent the features of the embodiment illustrated inFIG. 4, for ease of describing and illustrating the conceptual processing of the features, use separate functional blocks that may be performed in a different implementation by integrated blocks or may be performed digitally by executing logic. The position sensor104comprises the Hall-effect sensor106, an amplifier160, and a peak and hold stage162. A threshold coupling stage may be implemented as a series of resistors comprising a first resistor164, a second resistor166, and a third resistor168. The position sensor104may further comprise a rapid adaptation stage comprising a first comparator170, a counter172, and a reset signal generation stage174. The peak and hold stage162may comprise an analog-to-digital (AD) converter180, a peak hold/decrement register182, and a digital-to-analog (DA) converter184.

Under normal operating conditions (e.g., the peak output value of the Hall-effect sensor106does not change suddenly, abruptly, and/or rapidly), the peak and hold stage162may capture and hold the peak value of an output of the amplifier160. The output of the Hall-effect sensor106may be very low, for example, in the microvolt (μV) range, hence it may be desirable to amplify that low amplitude signal. The output of the amplifier160is tracked and held by the peak and hold stage162. The output of the peak and hold stage162is voltage divided across the threshold coupling stage formed by the resistors164,166,168. A first voltage V1is present at the node between the first resistor164and the second resistor166. This first voltage V1may be referred to as a coupled threshold output and is provided as a comparison threshold to the switch stage112. The output of the amplifier160is also provided to the switch stage112. When the value of the output of the amplifier160sufficiently exceeds the coupled threshold output, the switch stage112switches to output an active logic level. When the value of the output of the amplifier160falls sufficiently below the coupled threshold output (the switch stage112may implement a hysteresis function), the output of the switch stage112switches to output an inactive logic level. In normal operations, the output of the switch stage112reflects the magnet102being close or being distant from the Hall-effect sensor106, for example reflects when the display panel142of the laptop140is closed or when the display panel142of the laptop140is open.

Under an abnormal condition, however, the peak magnetic field amplitude sensed by the Hall-effect sensor106changes abruptly, for example, because the laptop140is dropped and the magnet102is moved or the mechanical shock alters the magnetic properties of the magnet102. In case of abrupt and significant change in the peak of the output of the amplifier160, the first comparator170, the counter172, and the reset signal generation stage174may generate a reset signal that causes the peak hold/decrement register182to immediately reset and capture the current output of the amplifier160as the current peak and track the peak output going forwards. In an embodiment, the function of the first comparator170, the counter172, and/or reset signal generation stage174may be disabled while the output of the switch stage112continues to transition. For example, every transition of the output of the switch stage112may zero the counter172.

When allowed to operate (e.g., the switch stage112is not transitioning), however, the first comparator170may switch at the substantially lower peak output of the amplifier160. The first comparator170receives a threshold signal that is the voltage V2of the node between the second resistor166and the third resistor168. One skilled in the art recognizes that the V1voltage is higher than the V2voltage. In an embodiment, the values of the resistors164,166, and168may be selected so the threshold coupling output provided to the switch stage112is about 75% of the output of the peak hold/decrement register182(the analog conversion of the digital output of the peak hold/decrement register182) and the voltage V2is about 20% of the output of the peak hold/decrement register182. Thus, the first comparator170will switch in response to lowered peak values of the output of the amplifier160. On each switch output of the first comparator170, the counter172increments. As the output of the counter172exceeds a predefined value X, the reset signal generation stage174sends a reset signal to the peak hold/decrement register182, causing it to zero its held peak value and therefore to recapture a new peak value immediately. This way the position sensor104can rapidly adapt to abrupt changes in peak output of the Hall-effect sensor106. In an embodiment where the position sensor104is used in a laptop, a user may simply open and close the laptop140several times to cause the position sensor104to reset and capture a new peak value, in the event of an abrupt change in the interaction between the magnet102and the Hall-effect sensor106.