Use Capacitive And Proximity Sensing In Your Digital Photo Frames

Aug. 27, 2009
Digital photo frames (DPFs) are fast replacing traditional photo albums and frames. Here's how to add capacitive and proximity sensing to DPFs, making them easier to use than with hard-to-use or esthetically ruinous mechanical switches.

Digital photo frames (DPFs) are starting to appear in many places where traditional photo albums and frames have been used for decades. The growth and proliferation of digital cameras has rendered hard-copy photos from analog cameras all but obsolete. On top of displaying the photos, DPFs can transfer them to printers and other devices, play videos, and offer remote control over all these functions without a computer.

The basic DPF uses a multimedia chipset to handle image storage and conversion. The frames often provide video and audio output with flash memory storage for the images and files. They also have an LCD, usually integrated in a modular form, to display all images (see the figure). As DPFs get more complex, their user interfaces are growing more complicated as well.

Users need a simple way to control the frame and access all of its features. Mechanical buttons present problems, though. When they’re on the back of the frame, they can be hard to access, especially if the frame is hanging on the wall. Buttons on the front likely will harm the aesthetic appeal of the frame, which is often made to be as attractive as possible. Now, designers can eschew mechanical buttons in favor of capacitive buttons and proximity sensing.

Capacitive buttons work very well for digital photo frames for a variety of reasons. First, they generally bring a significant cool-factor to any product. Second, they can be placed on the front of the frame for easy access without ruining the aesthetics. And, capacitive buttons can decrease some system costs by eliminating the mechanical buttons and simplifying some manufacturing processes.

Using capacitive buttons for the user interface of a digital photo frame does not solve all problems. One issue that still remains is that capacitive buttons that are “invisible” can be somewhat unintuitive. This is where proximity sensing is desirable. Proximity sensing can be used to bring up a menu on the screen and light LEDs to show where the capsense buttons are located.

Adding capacitive and proximity sensing to a digital photo frame will increase its consumer appeal and avoid the wear and tear of the mechanical buttons. Fortunately, there is a simple method for adding capacitive and proximity sensing to a digital photo frame, as adding one device to the existing circuit will make it happen.

CAPACITIVE SENSING Adding capacitive sensing to a digital photo frame or other display involves embedding a printed-circuit board (PCB) behind or within the frame. Capacitive elements are laid out on the PCB in the form of copper pads. There is a very small capacitance between these pads and a grounded mesh on the PCB that surrounds them.

When a user “pushes” these capacitive pads, or buttons, there is an increase in the capacitance between the copper pad and ground. This is due to the electrically conductive nature of a human finger. Therefore, detecting these capacitive button presses becomes an exercise in detecting small changes in small capacitances.

There is a variety of ways to accomplish this. Noise immunity, resolution, accuracy, and measurement time are important factors in choosing a capacitive sensing method. It is also very beneficial to choose a method and device that permit a great degree of flexibility. For example, being able to dynamically trade off resolution for measurement speed (and vice versa) is quite useful. It is often best to choose an IC that has all of the necessary hardware on-chip to do capacitive sensing. This is a much simpler approach than designing a unique circuit from the ground up.

A digital photo frame typically requires at least five buttons to implement the user interface. These buttons may include an on/ off switch and several navigation buttons. However, another advantage of using capacitive buttons is that it is not difficult to add more once the first few have been added.

If five capacitive buttons have been added to the frame, there is no reason not to have 10 buttons on the frame. There is very little added cost to adding more capacitive buttons. This is not the case with mechanical buttons. Therefore, a typical digital photo frame with capacitive buttons may have five to seven buttons and a “slider” control created out of five to seven more capacitive elements. This makes a total of about 12 to 15 capacitive elements.

Additionally, it is important to ensure that the device that measures these elements can scan each element and process the data within about 15 ms. This corresponds to an update rate of about 60 Hz and allows for an acceptable latency between button pushes and the execution of their corresponding functionality.

Continue on Page 2

An important consideration when adding capacitive buttons to a digital photo frame is the overlay added on top of the PCB with the capacitive buttons. This overlay is the actual frame that the user sees. Therefore, it must be as aesthetically pleasing as possible. When determining the design of the frame, two key factors must be kept in mind: the material that the frame is made out of and the thickness of the frame on top of the PCB with the capacitive elements.

The sensitivity of a capacitive element decreases as the thickedness of the overlay increases. This is because the greater distance between the finger and the element decreases the amount of capacitance that the finger can add. The overlay material also has an effect on the capacitive coupling of the finger. Materials with higher permittivity enable the capacitive elements to be more sensitive to finger presses.

A good device to use for capacitive sensing in a digital photo frame application is the CY8C21434 PSoC mixed-signal array. It’s very similar to a standard 8-bit microcontroller in that it has a CPU, flash, RAM, general-purpose I/O (GPIO), an analog-to-digital converter (ADC), and standard digital and communication peripherals.

Along with these resources, this device has specialized analog hardware specifically designed for capacitive sensing. Also, its useful analog input muxing architecture permits any GPIO pin to function as an analog input, letting this PSoC device measure up to 24 capacitive sensors.

The CY8C21434’s capacitive sensing technique employs switched capacitor and sigma-delta techniques (Fig. 2). The sensor (CX) is used as a switched capacitor. It is rapidly switched between being connected to VDD and to the input, which is roughly equal to VREF. The average current being sourced on to CMOD is proportional to the capacitance of the sensor, the switching frequency, and the voltage difference between VDD and VREF. The switching frequency and the voltage difference remain constant. Therefore, the sourced current depends primarily on the capacitance of the sensor.

The circuit is designed so the voltage on the capacitive sensors remains close to VREF. This is accomplished by the negative feedback provided by the resistor, RB. Whenever the voltage on CMOD increases above VREF, the comparator trips and causes RB to sink current off of CMOD, which causes the voltage on CMOD to decrease until the comparator trips again, which tri-states the feedback resistor, RB. This circuit effectively converts capacitive changes in the sensor into digital duty cycle changes at the output of the comparator. The comparator output is then integrated over a time period to provide a digital value output. This value is the “counts” measured on the sensor.

This hardware circuit is advantageous for two reasons. First, there is a relatively low impedance path from the input to ground. This greatly reduces the noise in the measurements. Second, the switched capacitor circuit employs pseudorandom switching. The average switching frequency is controlled, but instantaneous switching frequency is variable. This reduces the peak radiated electromagnetic interference (EMI) from the capacitive sensing circuit by spreading the radiated frequencies over a larger band.

Today’s capacitive sensing devices are designed to be reconfigured with the programming integrated development environment as well as to simplify the matching of GPIOs to capacitive sensors on the board. Additionally, the use of software modules for the entire capacitive sensing system simplifies system tuning as well, including resolution, switching frequency, measurement period, and reference voltage. Such reconfigurability at the development level enables users to adjust the settings to best measure the capacitive sensors for a particular PCB.

Once capacitive user controls (buttons and sliders) have been added to a digital photo frame design, the consumer appeal is increased by taking out the mechanical buttons. But an inconvenience is introduced into the user interface. The “invisible” buttons are now no longer very intuitive. When users simply look at the frame, it may be difficult to guess how to interact with it, since no user controls are visible. Users may guess that they are supposed to touch the frame somewhere, but even then they may touch the wrong location on the frame where there are no capacitive elements.

The proposed design solution for this quandary is to add capacitive proximity sensing to the same application. The beauty of this is that all of the necessary hardware to do this is already in the design. All that is needed is just one more GPIO on the CY8C21434 device.

PROXIMITY SENSING The proximity sense in a digital photo frame can be used to pop up a menu on the LCD and light up LEDs when a user’s hand is close to the frame. This makes the buttons clearly visible in a way that is intuitive to the user. The distance at which the proximity gets activated can be set by either extensive calculations of electrical field lines or by close approximation using the output signals obtained.

The approximation method also requires an understanding of how the sensitivity of the sensor changes with different conditions. The sensitivity of the proximity sensor in a digital photo frame mainly depends on the type of proximity sensor, the presence of metal, the scan speed, and noise levels.

Continue on Page 3

TYPE OF PROXIMITY SENSOR Proximity sensing can be implemented with a wire sensor or a long PCB trace connected instead of a capacitive pad, which was explained above. The sensitivity of such a sensor is much lower than the regular capacitive buttons, and it changes with the distance of the user’s hand. Since the detection of the hand is based on the capacitance change due to change in electric field, any stray capacitance or objects affecting the electrical field around the wire will affect the range of the proximity sensor.

Using a wire sensor is often not an optimal solution for mass production due to manufacturing cost and complexity. In such cases, a long copper trace on the PCB can be used for the proximity sensor. This method facilitates mass production, but it is not as sensitive as a wire sensor.

PRESENSE OF METAL In some DPF designs, there may be metal close to the frame. This metal may be used for magnetically attaching the frame to the LCD, or it may be metal in the LCD module itself. In these cases, the effective range of proximity sensing will decrease due to the presence of the metal.

Reduced sensor sensitivity is due to the interference of the metal with the electric field lines of the sensor, reducing the capacitance added by the hand. A shield electrode can be used to decrease the effect of the metal on the proximity sensor. Although not very useful for DPF devices, the presence of a shield electrode will also prevent false triggering due to the presence of water, ice, or humidity changes.

One method of implementing a shield electrode is to design a double-sided PCB with the proximity and capacitive sensors on the front side and the shielding electrode(s) on the back. A hatched copper pour can be used as a good shield electrode on a multilayer PCB. Large, solid ground fill areas inside the proximity sensor should be avoided, as it decreases the sensitivity.

SCAN SPEED The scan speed, essentially the switching frequency, affects the count output of the sensor. Slower scanning speeds will have the benefits of improved signal-to-noise ratio (SNR) and better immunity to powersupply noise and temperature changes. The CY8C21434 used for this project provides four scanning speed options—Slow, Normal, Fast, and Ultrafast. The sensing circuit has speeds of 3, 6, 12, and 24 MHz, respectively, for the four scanning modes.

Figure 3 shows the “difference counts” obtained for the four scanning modes at distances of 10, 8, 6, 4, and 2 in. The “difference count” is a baseline count value subtracted from the counts measured on the sensor. Each peak in the graph corresponds to the distance of the hand, with the 10-in. distance having the smallest peak and the 2-in. distance the largest. Notice that the Ultrafast scanning speed (24 MHz) is dominated by noise and unwanted spikes, and its reading for 10 in. would thus be unreliable. From the graphs, it is clear that slower scan speeds (switching frequencies) provide more sensitivity at all distances.

For a proximity sensor, the scanning speed should be very slow. But for capacitive buttons, faster scanning speeds are possible. Since both of these functions in the digital photo frame are proposed, the optimal scan speed must be chosen for both types of sensors. Because scan speed is implemented in firmware, changing it to optimal speed is a straightforward process.

The DPF can be placed anywhere in the room, which has metal, electric fields and emissions, or human interference around it. This causes changes in the electrical field lines and thus the capacitance value detected by the sensor. These interference sources cause undesirable count changes in the output, and they form noise. The threshold for the detection of the proximity sense should be higher than the noise counts.

For the hardware implemented, tests checked the noise counts on the proximity sensor with a metal frame around the proximity sensor. There were other electronic items and human movement around the test module, like in the real world.

Figure 4 shows the measurements of the proximity sensor over a period of time. The graph shows six peak-to-peak counts of noise in the system over the measurement window in the graph. A minimum SNR of 5:1 is essential for capacitive sensing applications. Therefore, at least 30 counts or more should be the threshold for detecting the hand. As it can be observed in Figure 3, reliable detection of a hand can be achieved at 8 in. or closer. The 10-in. distance does generate 30 counts or more of signal.

1. Tsui, Ted; AN2408, “Capacitance Sensing—Migrating from CSR to CSD,” Feb. 2007; Cypress Semiconductor Inc.;
2. Kremin, Victor, Andriy Ryshtun, and Vasyl Mandzij; AN42851, “Proximity Detection in the Presence of Metal Objects,” Jan. 2008; Cypress Semiconductor Inc.;
3. Lee, Mark; AN2292, “Capacitance Sensing—Layout Guidelines for PSoC CapSense,” Jan. 2008; Cypress Semiconductor Inc.;

Sponsored Recommendations


To join the conversation, and become an exclusive member of Electronic Design, create an account today!