Infrared Remote Controller with Capacitive Touch Interface

X C800 Fam il y
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Appl icat ion Not e
V1.0 2011-02
Micr ocont r ol ler s
Edition 2011-02
Published by
Infineon Technologies AG
81726 Munich, Germany
© 2011 Infineon Technologies AG
All Rights Reserved.
LEGAL DISCLAIMER
THE INFORMATION GIVEN IN THIS APPLICATION NOTE IS GIVEN AS A HINT FOR THE
IMPLEMENTATION OF THE INFINEON TECHNOLOGIES COMPONENT ONLY AND SHALL NOT BE
REGARDED AS ANY DESCRIPTION OR WARRANTY OF A CERTAIN FUNCTIONALITY, CONDITION OR
QUALITY OF THE INFINEON TECHNOLOGIES COMPONENT. THE RECIPIENT OF THIS APPLICATION
NOTE MUST VERIFY ANY FUNCTION DESCRIBED HEREIN IN THE REAL APPLICATION. INFINEON
TECHNOLOGIES HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND LIABILITIES OF ANY KIND
(INCLUDING WITHOUT LIMITATION WARRANTIES OF NON-INFRINGEMENT OF INTELLECTUAL
PROPERTY RIGHTS OF ANY THIRD PARTY) WITH RESPECT TO ANY AND ALL INFORMATION GIVEN IN
THIS APPLICATION NOTE.
Information
For further information on technology, delivery terms and conditions and prices, please contact the nearest
Infineon Technologies Office (www.infineon.com).
Warnings
Due to technical requirements, components may contain dangerous substances. For information on the types in
question, please contact the nearest Infineon Technologies Office.
Infineon Technologies components may be used in life-support devices or systems only with the express written
approval of Infineon Technologies, if a failure of such components can reasonably be expected to cause the
failure of that life-support device or system or to affect the safety or effectiveness of that device or system. Life
support devices or systems are intended to be implanted in the human body or to support and/or maintain and
sustain and/or protect human life. If they fail, it is reasonable to assume that the health of the user or other
persons may be endangered.
AP08121
Infrared Remote Controller with Capacitive Touch Interface
XC82x
Revision History: V1.0, 2011-02
Previous Version: none
Page
Subjects (major changes since last revision)
DAVE™ is registered trademark of Infineon Technologies AG.
We Listen to Your Comments
Is there any information in this document that you feel is wrong, unclear or missing?
Your feedback will help us to continuously improve the quality of this document.
Please send your proposal (including a reference to this document) to:
[email protected]
Application Note
3
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Table of Contents
1
Introduction ................................................................................................................................... 5
2
2.1
2.2
2.3
2.4
Hardware Setup and Basic Program Flow ................................................................................... 6
IR Transmitter ................................................................................................................................. 6
IR Receiver ..................................................................................................................................... 7
USB Docking Station....................................................................................................................... 7
Program Flow.................................................................................................................................. 8
3
3.1
3.2
3.3
Infrared Communication ............................................................................................................. 10
Protocol ........................................................................................................................................ 10
Transmission ................................................................................................................................ 12
Reception ..................................................................................................................................... 13
4
4.1
Touch Interface ........................................................................................................................... 17
Wheel Angle Calculation ............................................................................................................... 17
5
Power Saving .............................................................................................................................. 23
6
Programming Access ................................................................................................................. 24
7
7.1
7.2
7.3
7.4
7.5
Monitoring ................................................................................................................................... 26
U-SPY........................................................................................................................................... 26
Settings......................................................................................................................................... 26
UART Interrupt .............................................................................................................................. 26
RemoteControl_Rotation.ini .......................................................................................................... 26
RemoteControl_TouchSense&WheelEvaluation.ini........................................................................ 28
8
Schematics and Layout .............................................................................................................. 31
9
References .................................................................................................................................. 36
Application Note
4
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Introduction
1
Introduction
In today's Human-Machine Interface (HMI) designs, touch buttons, touch sliders and wheels are all important
input elements. The use of capacitive touch technology to create these elements gives flexibility, a high-level of
customization and a significant reduction in overall system cost.
The design of mechanical buttons is complex and costly. Cut-off clearances must fulfill certain requirements in
terms of thermal expansion and aesthetic perception, while the material of the buttons and the electric contacts
must be flexible, reliable and persistent. All these factors must be taken into consideration in the design, along
with the incorporation of other elements such as potentiometers, to define the final size and shape of input
buttons.
In contrast, the designer of capacitive touch systems can focus on interface requirements, taking advantage of
the flexible and ultra-flat design solutions that the technology offers, and the ability to detect user input through
enclosure materials, adjusting behaviour simply through software parameters rather than being dependent on
mechanical constraints.
IR Transmitter
USB Docking Station
IR Receiver
Figure 1
IR Remote Control Kit
The IR Remote Control Kit provides all the components necessary to evaluate capacitive touch techniques in
infrared (IR) remote control solutions.
The kit provides all necessary components for evaluation of capacitive touch technique in infrared (IR) remote
control solutions. The remote controller is an infrared transmitter which contains two touch buttons and a touch
wheel. The infrared receiver board is in DIP16 form factor and can be used in many custom evaluation systems.
The USB docking station provides 8 signaling LEDs and a flash programming interface for both the receiver and
the transmitter. With the infrared receiver in the docking station, the 8 LEDs act as a simple display.
The embedded software for both the receiver and transmitter is part of the kit. Together with the signal
processing of the touch sense unit, the standard RC-5 protocol is implemented for infrared transmission and
reception. The transmitter software additionally includes a power-down and wake-up sequence to fulfill low
power requirements.
The tool chain DAVE™ Bench is based on Eclipse technology and can be downloaded free of charge from
http://www.infineon.com/dave-bench. It includes a compiler, a flash loader, a debugger, an IDE and a real-time
user interface called U-Spy.
Application Note
5
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Hardware Setup and Basic Program Flow
2
Hardware Setup and Basic Program Flow
2.1
IR Transmitter
Figure 2
IR Transmitter
The IR Transmitter is on a flexible PCB which is glued directly onto the upper part of the housing. As a result,
the touch elements are in close contact with the cover material with minimum air gaps. The infrared LED, a
reverse shining SMD type, is mounted together with the 8-bit microcontroller XC822MT at the same flexible
PCB. This part is folded into the front of the housing.
Figure 3
IR Transmitter viewed by a camera in night vision mode
Users can tap or touch-and-hold the two Infrared Transmitter buttons, and they can tap or dial the touch wheel.
The infrared diode is directly controlled by the 8-bit microcontroller XC822MT which generates a 36 kHz carrier
wave and modulates the bit-stream to be transmitted.
The 3V power supply of the transmitter is realized by two AAA batteries. The flexible PCB is connected to this
power supply, but can be removed and plugged into the USB docking station for flash programming or UART
communication.
Application Note
6
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Hardware Setup and Basic Program Flow
2.2
IR Receiver
The IR Receiver device consists of an infrared receiver IC combined with the XC822MT microcontroller. Next to
the power supply pins (2.9V to 5.5V), just one additional pin is required for the infrared receiver IC. The
remaining 12 IOs can be used for custom application signals.
The received signal is decoded using the T2 module of XC822.
Figure 4
IR Receiver
2.3
USB Docking Station
The receiver board is plugged into a USB Docking Station which provides 5V power supply, a USB-to-UART
Bridge and eight signaling LEDs. The LEDs can be driven by toggling IO pins or by PWM signals from
XC822MT.
Figure 5
USB Docking Station
The default software of the kit uses the capture/compare unit CCU6 to dim a pair of LEDs according to the touch
wheel’s position to mimic human dialing. This is done by making use of the multi-channel mode of CCU6.
Figure 6
USB Docking Station displaying human dialing
Application Note
7
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Hardware Setup and Basic Program Flow
2.4
Program Flow
IR Transmitter
The microcontroller spends most of the time in idle or power-down mode to limit power consumption. Touch
sense related tasks are performed with high priority each time pad capacitances have been measured. Infrared
transmission has a lower priority because of its very low speed, while UART communication has the lowest
priority because it is not time-critical.
RESET
very high
EXTERNAL
INTERRUPT 2
high
SOFTWARE RESET
ENTER BSL
or
INITIALIZE
TIME FRAME
every 288 us
TOUCH SENSE
SIGNAL
PROCESSING
RETI
ENTER POWERDOWN
or
IDLE MODE
BUTTON TOUCH
DETECTION
RETI
medium
TIMER 13
PERIOD MATCH
every 1.778 ms
medium
TIMER 13
COMPARE MATCH
every 1.778 ms
IR TRANSMISSION
(Manchster-encoding
and modulation)
IR TRANSMISSION
(Manchster-encoding
and modulation)
RETI
RETI
low
TIMER 2
OVERFLOW
every 1.8 ms
WHEEL ANGLE
CALCULATION
UART
low
COMMUNICATION
WITH PC
(send data and
receive commands)
WHEEL
CALIBRATION
RETI
RETI
Figure 7
Overview of the main functions and interrupts of the IR Transmitter
Only a few of the XC822MT modules are required to perform all the required functions, with minimal CPU-load.

The LED Touch-Sense Control Unit (LEDTSCU) handles the touch pads; it generates a so-called Time
Frame interrupt after every measurement where signal processing and touch detection take place

The Capture/Compare Unit 6 (CCU6) drives the infrared LED for IR and generates the Timer 13 Period
Match and the Timer 13 Compare Match interrupts

The Timer 2 (T2) module provides a slow time base by generating the Timer 2 Overflow interrupt for
calculations necessary to handle the touch wheel

The UART module, which is part of the XC800 core, is used for full-duplex UART communication with
the PC
Application Note
8
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Hardware Setup and Basic Program Flow
IR Receiver
Communication with the RC-5 protocol is very slow, so it is not critical to set interrupt priorities, although for
high-speed communication (e.g. RF protocols) it could be critical.
RESET
very high
EXTERNAL
INTERRUPT 2
high
SOFTWARE RESET
ENTER BSL
or
INITIALIZE
TIMER 2
EXTERNAL
IR RECEPTION
(Manchster-decoding)
RETI
BUTTON DISPLAY
DO NOTHING
RETI
UART
low
medium
COMMUNICATION
WITH PC
(send data and
receive commands)
TIMER 13
PERIOD MATCH
every 5 ms
ANGLE DISPLAY
RETI
RETI
Figure 8
Overview of the main functions and interrupts of the IR Receiver
Modules used:

Timer 2 (T2) takes care of receiving and decoding the infrared signal and it generates a Timer 2
External interrupt every time there is a change in the incoming signal level

The Capture/Compare Unit 6 (CCU6) adjusts the brightness of the six wheel LEDs on the USB Docking
Station and provides a slow time base by the Timer 13 Period Match interrupt for brightness level
calculations

The UART module, which is part of the XC800 core, is used for full-duplex UART communication with
the PC
Application Note
9
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Infrared Communication
3
Infrared Communication
Most audio and video players can be controlled with infrared remote controllers. The infrared (IR) spectrum has
less ambient noise than visible light which makes it very suitable for simple and reliable communication.
The typical setup includes an IR transmitter, an IR receiver and a protocol for communication. One of the most
widely used protocols is the RC-5 standard from Philips. The communication is one way only; the transmitter
sends commands to the receiver. The transmitter does this by toggling the on-board infrared LED (TSML1000)
on and off. The infrared light of the LED is detected by a photo diode in the receiver IC (TSOP34836) on the
receiver board.
3.1
Protocol
The transmitter follows the RC-5 protocol and the LED is toggled on/off at a frequency of 36 kHz, the so-called
carrier frequency. The carrier frequency in turn is modulated by a bit stream at a much lower frequency. The
bitstream itself is Manchester-encoded by the transmitting microcontroller. Manchester-encoding, or bi-phase
modulation, means that every bit is divided into two chips, 0 and 1. Bit 1 contains a 0-1 chip transition while bit 0
contains a 1-0 chip-transition. Manchester code ensures that there is at least one line voltage transition per bit,
which helps recovery. The receiver IC de-modulates the received signal, but decoding is handled by the
receiving microcontroller. TSOP34836 inverts the signal.
36 kHz carrier
0
0
1
1
0
1
0
0
1
0
1
1
1
0
1
1
0
1
0
0
1
0
TSML1000
889 us 889 us
CHIP
1
0
940 nm
CHIP
AGC
1.778 ms
36 kHz
Band-pass
Filter
Demodulator
XC822
BIT
XC822
TSOP34836
IR Transmitter
Figure 9
IR Receiver
Infrared Transmitter and Receiver
By default, when the IR Transmitter board is powered by batteries (3V), the 36 kHz carrier wave has a 25% duty
cycle to reduce power consumption but still have enough transmitting power for acceptable range. If the IR
Transmitter board is plugged into the docking station and is powered by the USB (5V), the duty cycle is reduced
to 5% to compensate for the higher diode current. In both cases there are exactly 32 pulses in a chip.
Application Note
10
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Infrared Communication
VIN = 3V
VIN = 5V
25% duty cycle
5% duty cycle
6.95 us
1.39 us
27.8 us
Figure 10
27.8 us
36 kHz carrier wave at 3V and 5V supply voltage
The RC-5 protocol uses 14-bit packets for transmission. The packets are transmitted one after another with a
break of at least 89.1 ms between them. Each packet takes 24.9 ms to transmit.
Packet
Packet
24.9 ms
> 89.1 ms
> 114 ms
Figure 11
Transmission of packets
One packet contains the following bits and bit fields (in order of transmission):

Start Bit (S1 or S): 1 bit, always logic 1

Field Bit (S2 or F): 1 bit, can be used as command extension, always logic 1 in the IR Remote Kit

Toggle Bit (T or C): 1 bit, toggles if new data is sent, does not change if the same data is sent
repeatedly (e.g. a button is continuously touched)

Address (A4:A0): 5 bits, MSB first, selects the target device, the IR Remote Kit does not use the
standard RC-5 addresses, the Receiver board has multiple addresses instead
o 01000: Touch buttons and calibration
o 11XXX: Touch wheel

Data (D5:D0): 6 bits, MSB first, one of the possible 64 commands, the IR Remote Kit does not use the
standard RC-5 commands and this bitfield is used as general data (e.g. wheel section angle)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
S1
S2
T
A4
A3
A2
A1
A0
D5
D4
D3
D2
D1
D0
1
1
0
0
1
0
0
0
0
0
0
0
1
0
1.778 ms
889 us 889 us
Figure 12
Bits of a typical packet
Application Note
11
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Infrared Communication
The Receiver board has a separate address for the buttons and calibration. In this case, the RC-5 address is
01000, the Toggle Bit and [D2:D0] data bits are also used.

D2 is used as Calibration Bit (C): 1 if the Transmitter board is self-calibrating

D1 is used as Right Button (BR): 1 if the right button is touched, 0 if untouched

D0 is used as Left Button (BL): 1 if the left button is touched, 0 if untouched
1
1
T
0
1
0
0
0
0
0
0
0
Figure 13
C
BR
BL
0
1
0
Button-touch packet
The Receiver board also has separate addresses for the wheel. The RC-5 address is 11XXX. The transmitted
angle [W8:W0] has 9 bits [A2:A0,D5:D0]. The value scales from 0 to 0x11F (0..287 decimal), with 287 being
358.75°, so [A2:A0] can be 000, 001, 010, 011 or 100. In other words, the wheel uses 5 addresses: 11000,
11001, 11010, 11011 and 11100. The Receiver accepts all 11XXX addresses as wheel angle. The Toggle Bit is
changed every time a new angle is transmitted.
1
1
T
1
0
Figure 14
Wheel-angle packet
3.2
Transmission
1
W8
W7
W6
W5
W4
W3
W2
W1
W0
1
0
0
1
0
0
0
0
0
The IR Transmitter transmits the packets on the COUT61 PWM output. COUT61 drives the IR diode via a
transistor (see Figure 9). The carrier wave is enabled or disabled in two interrupts generated by CCU6, the highperformance PWM unit of XC822. CCU6 contains two flexible 16-bit timers, Timer 12 (T12) and Timer 13 (T13).

T12 generates the carrier wave with a period of 27.8 µs and 25% or 5% duty cycle

T13 generates the timing for the transmitted chips with a period of 1.778 ms and a fixed duty cycle of
50% for the RC-5 protocol. T13 generates an interrupt at the beginning (end) of every bit (T13PM) and it
generates an interrupt right at the middle of the bit (T13CM). In the interrupt service routines (ISR) for
these interrupts, the microcontroller enables/disables the carrier wave according to the packet to be
transmitted.
Application Note
12
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Infrared Communication
T13PM (CC6.C)
every 1.778 ms
T13CM (CC6.C)
889 us after T13PM
inc bitnumber
0<bitnumber<15?
N
Y
Set channel to ready
once bitnumber has
reached 64
bitnumber<15?
toggle IR_output
clear IR_output
enable/disable carrier
wave (COUT61)
according to IR_output
N
Y
set/clear IR_output if
MSB of packet is 0/1
clear IR_output
shift packet left
enable/disable carrier
wave (COUT61)
according to IR_output
Figure 15
IR transmission code sections
3.3
Reception
The receiver IC (TSOP34836) on the IR Receiver board de-modulates and inverts the received infrared signal
so whenever the carrier wave is active, it will output 0, else it will output 1 (see Figure 9). This signal is
Manchester-encoded and the microcontroller handles the decoding.
The output of TSOP34836 is directly connected to the T2EX input of the XC822MT microcontroller on the IR
Receiver board. T2EX is the external input of the Timer 2 (T2) module of XC822. T2 is a flexible 16-bit timer
with some additional capabilities. Since this module is capable of detecting rising or falling edges on T2EX, the
microcontroller can detect the rising and falling edges of the demodulated (and inverted) signal and measure the
time passed between the edges. In the RC-5 protocol, the distance between edges can be 1.778ms (2 chips) or
0.889 ms (1 chip). The microcontroller measures these distances with a nominal resolution of 0.042 µs. If the
measured distance is not 1 or 2 chips, the received edge is deemed noise and the microcontroller will wait for a
new packet. A tolerance of about 15% is allowed to be robust against ambient noise and to accommodate
internal oscillator imperfections.
Detecting the edges and knowing the distance between them is enough to decode a Manchester-encoded
signal. The first bit is always 1 so the first edge is always a falling edge. Every falling edge is followed by a rising
edge and every rising edge is followed by a falling edge. Whenever an edge is detected, T2 generates a capture
event interrupt where the received signal is evaluated. If no edge is detected, T2 overflows and re-initializes
every 2.73 ms.
Application Note
13
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Infrared Communication
T2OVF (T2.C)
every 2.73 ms if no
edge is detected
capture event on
T2EX (T2.C)
reset T2
beginning of a
new packet?
Y
intialize:
bitnumber = 0
beginning of bit
wait for falling edge
N
has it been
roughly 1.778ms?
N
bitnumber = 1
has it been
roughly 0.889ms?
Y
shift 1 to packet from
right (LSB)
it has been 2 chips:
bitend = 0
(middle of the bit)
N
Y
wait for rising edge
noise à reinitialize
it has been 1 chip:
toggle bitend
middle of the bit?
Y
was it a falling
edge?
N
Y
N
shift 1 to packet from
right (LSB)
shift 0 to packet from
right (LSB)
increment bitnumber
wait for falling/rising edge
if it was a rising/falling one
bitnumber=14?
Y
evaluate received packet
Figure 16
N
IR reception code sections
Application Note
14
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Infrared Communication
Once the RC-5 packet is received, the microcontroller determines whether it contains new button information,
calibration information or a new angle. On the USB Docking Station, LED7 shows the status of the left button
(turned on if touched and turned off if untouched) and LED5 shows the status of the right button.
By default the 6 other LEDs show the angle of the wheel. The brightness of the LEDs is controlled by the duty
cycle of a 500Hz PWM signal generated by T12 in the CCU6 module. At any given moment a maximum of 2
LEDs are on, with dimmed brightness to indicate the position of the finger. For example, at 45° LED4 and LED3
are on; LED4 has 75% brightness and LED3 has 25% brightness. The LEDs are enabled and disabled by CCU6
multi-channel mode (MCM). The LEDs are updated every 5 ms in the T13PM interrupt.
0°
LED1
LED4
(COUT61)
(CC60)
45°
sector
sector
LED6
sector
LED3
(COUT62)
(CC62)
sector
90°
sector
sector
LED8
LED2
(COUT60)
(CC61)
180°
Figure 17
Touch Wheel LEDs on the USB Docking Station
Alternative modes:

If the user connects to the USB Docking Station, the behavior of the LEDs can be changed from the PC
(via U-SPY, see chapter 6) so that the all LEDs are turned on and their brightness is adjusted by dialing.

During calibration, the 6 LEDs blink in an alternating triangle pattern. This overrides the function in
which they indicate angle.
Application Note
15
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Infrared Communication
T13PM (CC6.C)
every 5 ms
new angle
received?
Y
set target_angle for
the LED display
N
timeout?
N
slowly move displayed
angle towards target
(update display_angle)
Y
find which section (out
of 6) the displayed
angle is in
turn off LEDs
activate the 2 LEDs of
the section
set the dimming level
of the 2 LEDs
according to the
displayed angle
calibrating?
Y
override LEDs:
3 alternating LEDs
blink slowly with
maximum brightness
N
update MCM register
and initiate shadow
transfers
(LEDs are actually
updated)
Figure 18
Angle display on the wheel LEDs
Application Note
16
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Touch Interface
4
Touch Interface
The IR Transmitter has five touch pads; two are used as touch buttons and the remaining three form a wheel for
dialing. All 5 pads are handled by the XC822MT microcontroller’s LED Touch-Sense Control Unit (LEDTSCU)
which is a dedicated touch-sense controller module.
The main touch sensing functions, handled by software, are:

Sample accumulation (ROM library)




Signal filtering and moving average generation (ROM library)
Touch detection (ROM library)
Touch wheel calibration (user software in Flash)
Signal tuning (user software in Flash)
If properly configured, the LEDTSCU automatically measures the capacitance of the five pads. This capacitance
increases when a button is touched. A library function in ROM processes the capacitance signals and detects
touches on the two buttons. It does so by accumulating 3 samples and low-pass filtering them to create a
moving average. The moving average filters noise and is used as a comparison platform to detect sudden
changes in capacitance. When a button is touched or released, a corresponding pad flag in RAM (refer to the
User’s Manual) will be set or reset and the IR Transmitter will transmit a button-press or release command to
the IR Receiver which will turn on or off the corresponding LED on the USB Docking Station.
The pad flags for the wheel pads are unused (always cleared) and it is the moving averages (“pad averages”)
that are used instead to calculate the angle of the touch. The three pads are automatically calibrated to the
same sensitivity and resolution during startup. The parameters are optimized for 3V input voltage (battery
operated) but some adjustments are automatically made if 5V input voltage is detected (docked in the USB
Docking Station). Once the pad averages are stable, an angle calculation algorithm is run if the wheel is
touched. If a new angle is calculated, the IR Transmitter will start to transmit a new-angle command to the IR
Receiver which will show the angle on the 6 touch wheel LEDs on the USB Docking Station.
4.1
Wheel Angle Calculation
The three touch pads of the wheel are placed in a spatially interpolated manner.
0°
Section 3
240°
Figure 19
Section 1
Section 2
120°
Spatially interpolated wheel layout and abstraction
If the pads are calibrated to roughly the same sensitivity and the wheel is dialed clockwise with constant angular
speed and constant pressure (constant effective finger area), the pad average signals are expected to behave
in a linear manner in this model as seen in Figure 20.
Application Note
17
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Touch Interface
0°
120°
240°
360°
A
untouched_a
untouched_c
B
untouched_b
C
Figure 20
Pad average signals of the three wheel pads during dialing
Values untouched_a, untouched_b and untouched_c are the pad average levels for pad A, B and C respectively
when they are not touched.
If the pads have roughly the same sensitivity, the three signals can be tuned to have a common untouched
level.
0°
120°
240°
360°
untouched_a
Figure 21
Pad average signals of the three wheel pads after tuning
Figure 22
Actual pad average signals after tuning
The, now common, untouched level is very high compared to the difference between touched and untouched
states. To make calculations easier, the signals are transformed near to zero by linear combinations. This also
makes the transitions between angle sections smooth, which is especially important if the three pads have
different sensitivity or unstable untouched levels due to imperfect calibration or a changing environment.
X
Application Note
A B
C
2
Y
AC
B
2
18
Z
BC
A
2
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Touch Interface
angle
0°
120°
240°
360°
untouched_a
X=(A+B)/2-C
Z=(B+C)/2-A
0
Y=(A+C)/2-B
Figure 23
Combined pad average signals
The resulting X, Y and Z signals still have three distinct sections between 0° and 360°.
Section 1 (0° to 120°)
Section 1 before the transformation has three signals between UT and UT-MAXT. UT stands for the untouched
level and UT-MAXT stands for the signal level when the largest area of the respective pad is touched (this
happens at 0°, 120° and 240°).
A, B, C
UT
UT-MAXT
φ
Figure 24
Section 1 before transformation
After the transformation, the X, Y, Z signals have much lower values. The angle axis has been arbitrarily scaled
from -1 to 2 in this region for convenience.
Application Note
19
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Touch Interface
X, Y, Z
MAXT
Z
0
Y
X
-MAXT/2
-1
Figure 25
0
φ
1
2
Section 1 after transformation
Signal X (see Figure 25) is constant low in this section so it does not participate in the angle calculation. The
other two signals can be described as:
Y
I.
II.
If we rearrange I, we get
Z
MAXT

2
MAXT MAXT


2
2
MAXT Y
 which we can substitute in II:
2

Z
Z
Y

Y


Y


1   
 Y  Z   Y
Y
Y Z
III.

IV.
  1
Z
Y Z
One division is needed to calculate the angle; this operation needs the most computing performance. To
minimize error, it is safer to use III if Y is larger and IV if Z is larger.
An offset of 1 and a scaling factor of 2^R are added to create a more usable calculated angle. R is for resolution
and corresponds to the number of left bitshifts on the numerator.
Section 1 Left
Section 1 Right
Application Note
Z  2R
  2 2 
Y Z
R

Y  2R
 2R
Y Z
20
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Touch Interface
X, Y, Z
MAXT
Z
0
Y
X
-MAXT/2
0
Figure 26
φ
2R 2*2R 3*2R
Section 1 after offsetting and scaling
Sections 2 and 3
In these two sections, the angle can be calculated in a similar way as in section 1, using the two non-constant
signals. Offsets of 4 and 7, and the same scaling factor, can then be added to sections120°-240° and 240°-360°
respectively to get a calculated angle of 0..9*2R for 0°..360°.
Section 2 Left
Y  2R
  5 2 
X Y
Section 2 Right

Section 3 Left
  8  2R 
Section 3 Right
Z  2R

 7  2R
X Z
R
angle
0°
X  2R
 4  2R
X Y
120°
X  2R
X Z
240°
360°
X
Z
calculated angle
Figure 27
φ
Y
0
3*2R
6*2R
9*2R
Calculated angle vs real angle across all sections
Application Note
21
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Touch Interface
Figure 28
Actual calculated angle for a full round
Infineon provides a function library for angle calculation. The resolution, explained earlier, is user selectable
from 1 to 8. The XC822M and XC822MT microcontrollers have a Multiplication/Division Unit (MDU) for hardware
acceleration. If the MDU is used for the division necessary to calculate the angle, the resolution is fixed at 8,
execution is faster and the code size is about 250 bytes smaller than without hardware acceleration. The
disadvantage is that the MDU increases the microcontroller’s current consumption by almost 1 mA.
Application Note
22
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Power Saving
5
Power Saving
It is essential for battery-operated devices to minimize power consumption. To achieve low average current
consumption the microcontroller of the IR Transmitter runs at a reduced clock speed, uses a low voltage power
supply, and dynamically changes operating mode dependent on usage.
Static measures

The microcontroller runs on an 8 MHz system clock instead of 24 MHz to reduce power consumption in
active mode.

All unused peripherals are permanently disabled by gating off their clock inputs. Only LEDTSCU, T2
and CCU6 are enabled.
Dynamic measures

When no interrupt service routine is running, the microcontroller is in idle mode. In idle mode the CPU
clock is stopped.

If the IR Transmitter is unused for more than 10 s, the microcontroller enters power down mode 2 and
wakes up every 300 ms for a short time to check for user activity. In power down mode 2, the main
embedded voltage regulator is switched off; only the low-power embedded voltage regulator keeps
operating. The flash memory and the main oscillator are put in power-down mode too. The onboard 75
kHz oscillator and the Real Time Clock module remain active and generate a periodic wakeup signal
every 300 ms. If there is no user activity on the touch buttons or the touch wheel, the microcontroller
goes back to power down mode in 1.8 ms after waking up.

CCU6 is turned off before the microcontroller enters power-down mode to reduce power consumption
during the periodic wakeups. It is turned back on if the wheel or the buttons have been touched.
wheel/button
touched
IIN
wheel/button
released
~ 12 mA
has been idle
for over 10s
wheel/button
touched
wheel/button
released
turn off CCU6
continuous
transmission
~ 9 mA
powered up
CPU mostly idle
average current
powered up
CPU mostly idle
periodic
wakeup
start transmission
~ 5 mA
power
down
~ 5 uA
successful
wakeup:
turn on CCU6
t
1.8 ms
300 ms
Figure 29
Average current consumption in different operating modes
Application Note
23
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Programming Access
6
Programming Access
The USB Docking Station provides programming access to the microcontrollers on both the IR Transmitter and
IR Receiver boards, when the onboard switch is set to the 'L' position. The USB Docking Station contains an
FTDI chip, FT232RL, which acts as a USB-to-UART bridge and also controls the microcontoller’s emulated
MBC (P2.1) and RESET (P2.2) pins. Programming access is wired for half-duplex UART on pin P0.6. Flash
content can be modified with the XC800 FLOAD tool which is integrated into DAVE™ BENCH and is also
available in a stand-alone version.
Figure 30
XC800 Fload
FLOAD can be used to access whichever board is plugged in to the USB Docking Station.
Application Note
24
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Programming Access
Figure 31
IR Transmitter connected to USB Docking Station
Figure 32
IR Receiver connected to USB Docking Station
If both the IR Transmitter and the IR Receiver are plugged in, then the IR Transmitter takes priority and it is the
only one that can be accessed.
The XC822 boot configuration does not depend on any pin status during reset. Instead, a Boot Mode Index
(BMI) configuration determines the entry to various boot modes such as User Mode, Boot-Loader (BSL) Mode
and On-chip Debug (OCDS) Mode. After reset, the BMI value is read and the respective boot mode entry is
automatically executed.
The microcontrollers on the IR Transmitter and IR Receiver boards are both programmed to “User Mode
(Productive)”. In this mode, the Boot ROM jumps to the program memory address 0x0000 on startup to execute
the user code in the Flash memory. This mode provides Flash memory protection from external access
(read/write).
Changing the BMI value to enter another boot mode is achieved by programming a specific code embedded in
the user code. It is located in MAIN.C at the (MAIN_main,2) section. This section only gets executed once after
RESET. This code checks GPIO pin P2.1 (MBC emulation) and if it is low, a Boot ROM routine is called to reenter UART Boot-Loader Mode. Once UART Boot-Loader Mode is entered, the user can change the contents of
the Flash memory. This specific user code must be present in Flash and executed under certain conditions to
ensure that programming the microcontroller is possible.
RESET happens during power-on and is also emulated on pin P2.2. Pulling down P2.2 momentarily generates
an interrupt (External Interrupt 2) and the interrupt service routine generates a software RESET. The FTDI chip
on board the USB Docking Station automatically controls these pins when the user tries to access the
microcontrollers with FLOAD.
Application Note
25
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Monitoring
7
Monitoring
7.1
U-SPY
U-SPY is a UART terminal program which allows the user to view a serial communication through a PC serial
port. Its features include transmission of a byte or group of bytes, configuration of protocol for bytes
transmission/reception and creation of dedicated control buttons, display fields, progress bars and oscilloscope
for better visualization.
For more information on U-SPY, please refer to the Help menu in U-SPY.
The U-SPY can be launched directly from DAVE
7.2
TM
Bench by clicking on the
icon.
Settings
The custom configuration and user interface for a particular task or application can be saved in the format
“xxx.ini”. This allows specific setting files to be shared among users.
For the IR Remote Controller, two .ini files have been configured, RemoteControl_Rotation.ini and
RemoteControl_TouchSense&WheelEvaluation.ini. Serial communication is via the full-duplex UART
protocol at a baudrate of 57.6 kbps.
Note: Ensure that the USB docking station mode is switched to “R” (Figure 33) before running any of the
monitoring routines.
In “R” mode (“RUN”), the UART interface will be full-duplex, whereas in “L” mode (“LOAD”), the UART interface
will be half-duplex.
RUN
LOAD
Figure 33
Switch to “RUN” mode on USB Docking Station
7.3
UART Interrupt
Any data transmission to or from U-SPY will trigger the UART interrupt in the docked microcontroller. Checks
are performed during the interrupt to determine whether data is to be transmitted or received. The data transmit
or receive process is then carried out automatically.
7.4
RemoteControl_Rotation.ini
This settings file (Figure 34) is customized to allow the user to monitor the 14-bits RC-5 packet decoded by the
receiving microcontroller as well as an interface between the IR Remote Controller hardware and software.
Note: This settings file is only to be used with the IR Receiver board plugged in to the USB docking station.
Application Note
26
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Monitoring
Display Fields
Progress Bars
Buttons
Status Flags
Figure 34
RemoteControl_Rotation.ini User Interface
7.4.1
Data Format
A data group consisting of 8 bytes is transmitted to U-SPY, in the following format (Table 1):
Table 1
RemoteControl_Rotation.ini Transmitted Data Format
DataByte0(D0)
D1
D2
D3
D4
D5
D6
D7
Value (hex)
83
XX
XX
XX
XX
XX
XX
XX
Description
I.D.
Angle
Channel
Volume/
Brightness
LEDs
Toggle Bit
Address
Data
The data group received by U-SPY is then matched or masked, before it is displayed.
Display Fields
The received RC-5 packet bits (Toggle bit, Address and Data) as described in Chapter 3.1: Protocol and the
calculated Wheel Angle are displayed in the display fields.
Buttons
The buttons are used to transmit data from U-SPY to the receiver board. Data is transmitted in the following
format (Table 2):
Application Note
27
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Monitoring
Table 2
U-SPY to Microcontroller Transmitted Data Format
D0
D1
Value (hex)
08
XX
Description
I.D.
Button no.
Based on this data received by the receiver board, the display mode can be switched between Angle and
Brightness Control via the toggling of a bit data in the code.
Status Flags
The statuses of the LEDs received by U-SPY are masked before they are displayed as status flags. It is
important that the bits of a mask do not overlap with the bits of another mask. This is to ensure that status flags
are not falsely turned on. The masks used are as follows (Table 3):
Table 3
LED masks for Status Flags
LED
Number
1
2
3
4
5 (Right
Button)
6
7 (Left
Button)
8
Mask
(hex)
80
10
08
04
02
40
01
20
Progress Bars
Channel and Volume/Brightness are displayed as progress bars. Channel increases with the press of the right
button and decreases with the press of the left button. Volume/Brightness increases with the clockwise dialing of
the wheel and decreases with the anti-clockwise dialing of the wheel.
7.5
RemoteControl_TouchSense&WheelEvaluation.ini
This settings file (Figure 35) is customized to allow the user to monitor parameters of the Touch Wheel Library
and the LEDTS ROM Library.
Note: This settings file is to be used with the transmitter board plugged in to the USB docking station.
Application Note
28
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Monitoring
Oscilloscope
Switches
Buttons
Figure 35
RemoteControl_TouchSense&WheelEvaluation.ini User Interface
7.5.1
Data Format
In this settings file, the data group transmitted to U-SPY is solely for the display of signals on the oscilloscope.
The format of the data group, also consisting of 8 data bytes, is as follows (Table 4):
Table 4
RemoteControl_TouchSense&WheelEvaluation.ini Transmitted Data Format
DataByte0(D0)
D1
D2
D3
D4
D5
D6
D7
Value (hex)
B3
B3
XX
XX
XX
XX
XX
XX
Description
I.D.
I.D.
Signal1
Signal1
Signal2
Signal2
Signal3
Signal3
High Byte
Low Byte
High Byte
Low Byte
High Byte
Low Byte
The data group received by U-SPY is then matched before it is displayed.
Buttons
In this settings file, the buttons allow the user to choose the signal which the user would like to monitor. The
description of the data format for the buttons is the same as in the previous settings file. Data is transmitted in
the following format (Table 5):
Table 5
U-SPY to Microcontroller Transmitted Data Format
D0
D1
Value (hex)
08
XX
Description
I.D.
Button no.
Application Note
29
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Monitoring
The data received by the microcontroller will be used to determine the signals that will be transmitted to U-SPY
for display on the oscilloscope.
Oscilloscope
The oscilloscope function allows the user to monitor up to 3 signals at a time.
As mentioned in the previous section, the user is able to monitor four different types of signals in this settings
file. The signals displayed in each mode are as follows (Table6: Left/Right Button, Table7: Wheel Avr,
Table8: Angle, Amp):
Table 6
Signals Displayed for Left/Right Button
Description
Colour
Table 7
Signal2
Signal3
Pad Total_TSCTR *
2DIVISORN
Green
Pad Average
None
Pink
Yellow
Signal1
Signal2
Signal3
Wheel Pad1 Average
Wheel Pad2 Average
Wheel Pad3 Average
Green
Pink
Yellow
Signal1
Signal2
Signal3
Calculated Wheel Angle
Wheel Amplitude
None
Green
Pink
Yellow
Signals Displayed for Wheel Avr
Description
Colour
Table 8
Signal1
Signals Displayed for Angle, Amp
Description
Colour
Application Note
30
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Schematics and Layout
8
Schematics and Layout
Figure 36
IR Transmitter - Schematics
Figure 37
IR Transmitter – Layout (single layer, flexible PCB) and Components
Application Note
31
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Schematics and Layout
Figure 38
Battery Connector for IR Transmitter
Application Note
32
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Schematics and Layout
Figure 39
USB Docking Station - Schematics
Application Note
33
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Schematics and Layout
Figure 40
USB Docking Station – Layouts and Components
Figure 41
IR Receiver - Schematics
Application Note
34
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
Schematics and Layout
Figure 42
IR Receiver – Layout (Single Layer) and Components
Application Note
35
V1.0, 2011-02
AP08121
Infrared Remote Controller with Capacitive Touch Interface
References
9
References
User’s Manual – XC82x; 8-Bit Single-Chip Microcontroller
Data Sheet – XC822/824; 8-Bit Single-Chip Microcontroller
Application Note – AP08100 – Configuration for Capacitive Touch-Sense Application
Application Note – AP08098 – Low Power Modes with Periodic/Real-time Clock Wake-up in XC82x/XC83x
Application Note – AP08101 – Current Consumption in Power saving Modes for Low Power Applications
Application Note – AP08108 – Programming the BMI value in the XC82x and XC83x products
Link to XC82x-Series – www.infineon.com/xc82x
Link to Solutions for advanced touch control – www.infineon.com/intouch
Application Note
36
V1.0, 2011-02
w w w . i nf i n eo n. com
Published by Infineon Technologies AG