This page contains a Flash digital edition of a book.
CIE SEPT09 Pg24-25:CIE JUL-AUG09 Pg38 07/09/2009 13:21 Page 24
ICs & Semiconductors
Getting
touchy
Figure 2. Using 8 channels to form 2 keys, a rotor and a slider. In this
Thanks to a new software library from Atmel capacitive example, the Atmel Touch Library and the host application are running on
touch sensing functionality can now easily be added to
an ATmega88
a microcontroller, as Ben Clarke explains
threshold has some hysteresis of 2 to 4 when no touch is registered. These
counts to avoid oscillating in and out factors need to be tracked and
D
esigners wanting to add Basic concepts
of detect mode. These parameters are compensated for by altering the
capacitive touch sensing to an The library can support up to 8
shown in Figure 3. reference level. The reference level
application have a choice channels. Each channel supplies a
To filter out noisy measurements drifts by +/- 1 count to track consistent
between using a standard touch signal value which is a number
and avoid false detections, usually 3 or signal offsets. Drift is halted whilst a
sensing IC and integrating touch representing its capacitance. A change
4 consecutive measurements above the touch is detected by any sensor in the
sensing functionality onto an existing in this value indicates the presence of
detect threshold are needed to register system to avoid de-sensitising
microcontroller. In medium to high the user’s finger, the ‘touch’. Channels
a touch. Several measurements below neighbouring sensors. When the end
volume applications, integrating it into are combined to form sensors such as
the detect threshold are also needed to of a touch is registered, drift is not
the existing microcontroller to develop keys, sliders and rotors.
register the end of the touch. This switched on again for a short time (the
a single chip solution may be the A key is a simple on/off digital
gives the system better noise ‘drift hold time’, around 2 to 4
preferred option. A single chip solution control such as an MP3 player
immunity. seconds) in case the user’s finger is still
avoids using an additional device play/pause control. In a key, a single
in proximity to the sensor.
dedicated to touch sensing, reducing channel measurement is converted to
Calibration and recalibration
cost, complexity and board space. an on/off signal. A slider is an
The calibration process is initiated AKS (adjacent key suppression)
There may also be a requirement for analogue control laid out in a strip
when the system is switched on and A feature called adjacent key
the use of custom communications that the user slides their finger along
sets the reference levels for each suppression allows the system to
protocols or other specific functionality from left to right. A slider requires at
channel. This is done by making distinguish between touches on
which would prohibit the use of a least three channels. Similar to the
multiple consecutive measurements in different sensors. This allows keys to
standard touch sensing IC solution. slider is the rotor seen on popular MP3
a short time and averaging to set the be situated very close to each other for
reference level. Problems can arise if applications such as keypads. The first
the device is powered on whilst a sensor to register a touch is then ‘on’
finger is near to any of the channels. while responses from the other keys in
When the finger is removed, the the system are suppressed. It is
channel signal will go up and the delta possible to configure AKS groups,
will go negative. Further touches will where a touch to one key suppresses
then return the delta to zero and no the other keys in that group only.
successive touches will be registered; In summary, it’s now possible to
this situation is called a ‘deaf’ channel. easily and quickly add industry-
If this situation persists, the library will leading capacitive touch capabilities to
automatically recalibrate the channel. a standard AVR microcontroller using
Figure 1. The Atmel Touch Library links to the host application
Another common error condition is a free software library called the Atmel
This article describes a solution from players, which also requires three or
when a channel is ‘stuck-on’, perhaps Touch Library. This is particularly
Atmel, the Atmel Touch Library, a more channels. In more complex
because an object has been placed suited to medium to high volume
royalty free software library for sensors like rotors and sliders, multiple
onto the sensor or the device has been applications which require a single
developing touch applications on channel measurements are combined
put into the user’s pocket. It is possible chip solution for cost or space reasons.
standard Atmel AVR microcontrollers. into an analogue value which
to set a ‘max on duration’ after which This proven solution allows very fast
The library can be linked into existing represents the slider position or rotor
time the sensor will assume an error implementation and can result in
firmware in order to provide touch angle.
has occurred and recalibrate. A typical quicker time to market.
sensing capability. The Atmel Touch
value for max on duration might be in
Library is added to an application by Touch detection principles
the range 30 to 60 seconds, but this is Nu Horizons Electronics
linking in the library file, including The ‘signal’ is the raw measurement
very application-specific. | www.uk.nuhorizons.com
the library header file, and calling the from each channel. Its value decreases
Environmental changes such as Atmel | www.atmel.com
functions defined in the application with increasing capacitance, ie a touch.
voltage, temperature and humidity
programming interface (API), see The ‘reference’ is a long term average
can cause changes in the signal level
The Atmel Touch Library only runs measurement on a channel, ie it is
when called from the host application. equal to the signal level when there is
It uses no timers, interrupts, or other no touch. We wish to calculate the
chip resources apart from ROM, RAM, ‘delta’ which is simply the reference
some register variables, and GPIO. It minus the signal. The delta will
only supports touch sensing; the host normally be zero, and if it increases
application must provide any other significantly this may mean a touch
functionality required, such as reading has been detected. How much of an
switches, driving LEDs, increase in delta is required to register a
communicating with other processors, touch is defined by a parameter called
etc. Figure 2 shows the Atmel Touch the detection threshold. In case a
Library alongside the host application channel measures a delta that is
Figure 3. (a) showing the signal and reference, (b) showing the delta and
on an ATmega88. exactly on the detection threshold, the
detection threshold. Both graphs show the value from the sensor against time
24 September 2009 Components in Electronics www.cieonline.co.uk
Page 1  |  Page 2  |  Page 3  |  Page 4  |  Page 5  |  Page 6  |  Page 7  |  Page 8  |  Page 9  |  Page 10  |  Page 11  |  Page 12  |  Page 13  |  Page 14  |  Page 15  |  Page 16  |  Page 17  |  Page 18  |  Page 19  |  Page 20  |  Page 21  |  Page 22  |  Page 23  |  Page 24  |  Page 25  |  Page 26  |  Page 27  |  Page 28  |  Page 29  |  Page 30  |  Page 31  |  Page 32  |  Page 33  |  Page 34  |  Page 35  |  Page 36  |  Page 37  |  Page 38  |  Page 39  |  Page 40  |  Page 41  |  Page 42  |  Page 43  |  Page 44
Produced with Yudu - www.yudu.com