Close

Sensing Hand Location/CTMU Overview (Old but useful)

A project log for Air Gesture AC Dimmer/Switch

A Touchless Gesture Mains AC Dimming Switch

johnnyJohnny 07/17/2014 at 06:310 Comments

To electronics, a person's body looks a lot like a capacitor. The iron in our blood act as little capacitors in parallel. All the small capacitances add up to a capacitance that can be sensed by electronic circuits. By knowing what capacitance should be seen by a particular circuit when no hand is present and measuring the change in capacitance when a person's hand moves closer, the 'Proximity' of the hand can be sensed.

Charge Time Measurement Unit

To sense the presence of a user's hand, a change in capacitance needs to be measured. I will be using a PIC microcontroller's CTMU peripheral to do this, as the microcontroller will have all that is required to measure this change in capacitance (no need for external resistors like other methods).

The CTMU contrains a precision current source and MOS transistors (Charge SW & Discharge SW) to charge and discharge the capacitance

Ccir, where Ccir is the total circuit capacitance (without hand capacitance Ch). Cir = internal capacitance Ci (ADC & switches, etc) + external capacitance Ce (antenna). Which equals roughly 30pF, but Ce will depend on your capacitive antenna design. Ch equals the hands's capacitance, which when touching is anywhere from 7pF - 20pF.

Before taking a reading, we first discharge the capacitance by setting the IDISSEN bit (Discharge SW) in the CTMUCONH register. Next we set a timer to overflow and interrupt at a particular period of time to allow the capactiance to discharge. After such a time, we reset the IDISSEN bit and start the current source. This is done by the setting the EDG1STAT bit (Charge SW) in the CTMUCONL register. This current is trimable by adjusting the ITRIM bits in the CTMUICON register. The timer is again set and we wait for the capacitance to charge for that same time period as before. Then we turn off the current source (EDG1STAT = 0), take an ADC reading, and the cycle begins again.

If we know the current and the time that we are charging the capacitance for, we can determine the capacitance at the input by recording the voltage seen by the ADC and using the Current-Voltage relationship formula seen below.

Because I is constant and we are only interested in charging from 0V ( V(to) ), the equation simplifies to:

If the current source is 5.5uA and we are charging for 10uS, when no finger is touching the ADC would measure:

And when you finger is touching;

Because we know the voltage/capacitance when no hand is near, we can also measure the capacitance added by a hand getting near.

or

Hand Location

If four capacitive antennas are placed in a rectangle arrangement, one can determine the approximate location of the hand by comparing the sensed capacitance/voltage of each antenna.

Discussions