Method and apparatus to measure self-capacitance using a single pin
A method for measuring capacitance in a sensor device using an internal reference circuit element(s), and without implementing additional circuitry and devices external to the sensor device, is described. In some embodiments a method uses an output pin of the sensor device and an internal reference capacitor of the sensor device to identify a touch applied to a touch point or electrode coupled to the touch sensor. The method applies reference voltages to charge the reference capacitor and measure a signal received from an electrode, wherein the touch sensor controls switching within the touch sensor to apply the reference voltages to the reference capacitor.
1. A touch sensor system, comprising:
at least one input port to receive an input signal from at least one electrode, the at least one electrode having a capacitance;
an Analog to Digital Converter (ADC) having an ADC input and an ADC output;
a capacitor coupled to the ADC input;
a multiplexer (MUX) having multiple MUX inputs and a MUX output that is coupled to the ADC input, wherein the at least one input port is coupled to one of the multiple MUX inputs;
a first switch for coupling a first reference voltage to a first input of the multiple MUX inputs;
a second switch for coupling a second reference voltage to the first input of the multiple MUX inputs;
a switch controller operable to:
control the first switch to apply the first reference voltage to the first input of the MUX; and
control the second switch to apply the second reference voltage to the first input of the MUX; and
a sensor controller operable to:
receive a first digital value from the ADC output after application of the first reference voltage;
receive a second digital value from the ADC output after application of the second reference voltage;
determine, based at least upon the first and second digital values, an amount of mains interference;
remove the determined amount of mains interference from the first digital value; and
determine a change in the capacitance of the at least one electrode as a function of the first digital value.
2. The touch sensor system of claim 1 , further comprising:
a MUX controller operable to select the at least one electrode as an input to the ADC input; and
wherein the sensor controller is further operable to determine a change in the capacitance of the at least one electrode as a function of the first digital value and the second digital value.
3. The touch sensor system of claim 1 , wherein the first reference voltage is opposite in polarity to the second reference voltage.
4. The touch sensor system of claim 1 , wherein the sensor controller is further configured to evaluate the first and second digital values against a threshold value to detect a touch at the at least one electrode.
5. A method, comprising:
controlling a first switch to charge a reference capacitor to a first voltage level, the reference capacitor coupled to an input of an Analog to Digital Converter (ADC);
receiving a first analog signal from a touch sensor electrode at the input of the ADC;
converting the first analog signal to a first digital value provided at an output of the ADC;
controlling a second switch to charge the reference capacitor to a second voltage level by applying a second voltage;
receiving a second analog signal from the touch sensor electrode at the input to the ADC;
converting the second analog signal to a second digital value at the output of the ADC;
determining, based at least upon the first and second digital values, an amount of mains interference;
removing the determined amount of mains interference from the first digital value;
detecting a touch to the touch sensor device based on the first digital value.
6. The method of claim 5 , further comprising
controlling a multiplexer (MUX) to select an input to the ADC.
7. The method of claim 5 , wherein the reference capacitor is further coupled to a reference voltage, and the first voltage level is opposite in polarity to the second voltage level with respect to the reference voltage.
8. The method of claim 7 , wherein the reference voltage is a function of the first voltage level.
9. The method of claim 5 , wherein the second voltage level is a ground voltage.
10. The method of claim 5 , wherein detecting a touch further comprises:
calculating a difference between the first digital value and second digital value; and
comparing the difference to a threshold value.
11. The method of claim 5 , wherein controlling the first switch to charge the reference capacitor to the first voltage level comprises closing the first switch and opening the second switch.
12. The method of claim 5 , wherein controlling the second switch to charge the reference capacitor to the second voltage level comprises closing the second switch and opening the first switch.
13. The method of claim 5 , wherein converting the first analog signal to a first digital value at the output of the ADC comprises opening the first and second switches, and wherein converting the second analog signal to a second digital value at the output of the ADC comprises opening the first and second switches.
14. A non-transitory computer-readable medium comprising instructions which, when implemented by one or more machines, cause the one or more machines to:
control a first switch to charge a reference capacitor to a first voltage level, the reference capacitor coupled to an input of an Analog to Digital Converter (ADC);
receive a first analog signal from a touch sensor electrode at the input of the ADC;
convert the first analog signal to a first digital value provided at an output of the ADC;
control a second switch to charge the reference capacitor to a second voltage level;
receive a second analog signal from the touch sensor electrode at the input to the ADC;
convert the second analog signal to a second digital value at the output of the ADC;
determine, based at least upon the first and second digital values, an amount of mains interference;
remove the determined amount of mains interference from the first digital value;
detect a touch to the touch sensor device based on the first and second digital values.
15. The non-transitory computer-readable medium of claim 14 , wherein to detect a touch is further configured to:
calculate a difference between the digital value and second digital value; and
compare the difference to a threshold value.
16. The non-transitory computer-readable medium of claim 14 , wherein:
to convert the first analog voltage to the first digital value at the output of the ADC is further to open the first and second switches; and
to convert the second analog voltage to the second digital value at the output of the ADC is further to open the first and second switches.