|
CLASS DOCUMENTS
REPORTS & ASSIGNMENTS
CLASS CONTENT
USING THIS SITE
registered authors login here You are: (logout) For more on PMWiki, see pmwiki.org |
Q T411-ISSGQSlide Touch Slider IC ReportInitial preliminary report by Roy Vanegas, 22 May 2007. A thorough and definitive report will appear here during summer 2007, as I work more extensively with the QT411 and SPI. ![]() The QT411-ISSG is a linear touch sensor in a 14-pin TSSOP (Thin-Shrink Small Outline Package) casing. It outputs data as a ``7-bit binary number (0...127) indicating angular position,'' per the datasheet. It can be used to replace items such as slider elements, faders, volume controls, and just about anything else that employs a potentiometer to control an electronic device. Index
SPI Register Description of the ArduinoSerial Peripheral Interface (SPI)The Serial Peripheral Interface (SPI) bus is a full duplex, synchronous, data communications link. According to Motorola, SPI's originators, the SPI bus is made of four signals: Master in/slave out (MISO), Master out/slave in (MOSI), Serial clock (SCK), and Slave select (SS), which appears in some datasheets with an overbar above both ``S'' characters, or with a forward slash before the first S. Both the Arduino Mini and the QT411 QSlide Touch Slider observe the SPI serial interface. Alas, SPI is not standardized, in either hardware or protocol. Instead, a widely agreed upon definition is recognized. This leads to variation in the implementation and programming of SPI that requires special handling of each device. QT411 SPI CommandsThese are the commands that are sent from the Arduino Mini to the QT411. Except for the
SPI-Related AcronymsYou'll encounter the following acronyms throughout the datasheets relating to SPI:
The QT411DimensionsThe dimensions of the QT411 are 4mm x 5mm, ~.15 x ~.20, respectively. Sensing ElementThe sensing element used for this example is a 22-gauge piece of wire. It was stripped of its insulation and soldered at the 33% and 66% points, per p2 of the QT411 datasheet marked ``RESISTIVE SLIDER ELEMENT.'' See the image below. ![]() ![]() Pinouts
PIN NAME TYPE DESCRIPTION
1 VDD Power Positive power pin (+2.5 .. + 5V)
2 MISO Output Serial data output
3 /SS Input Slave Select pin. This is an active low input
that enables serial communications
4 SCLK Input Serial clock input. Clock idles high
5 SNS3B I/O Sense pin; connects to both slider ends, each
via separate additional resistors
6 SNS3A I/O Sense pin
7 SNS2B I/O Sense pin; connects to 66% point (from left) of
slider
8 SNS2A I/O Sense pin
9 SNS1B I/O Sense pin; connects to 33% point (from left) of
slider
10 SNS1A I/O Sense pin
11 MOSI Input Serial data input
12 DETECT Output Active high touch detected. May be left
unconnected. (Pin floats ~400us after wake
from Sleep mode.)
13 DRDY Output Data ready output. Goes high to indicate it
is possible to communicate with the QT411.
(Pin floats ~400us after wake from Sleep mode.)
14 VSS Ground Negative power pin.
Arduino ConnectionsPage 2 of the QT411's datasheet contains a layout of how the QT411 should be connected to a microcontroller. I used an Arduino Mini microcontroller and copied the pin configurations exactly as stated on the datasheet. I wired the DETECT line and the SPI bus of the QT411 to the SPI bus of the Arduino Mini, as follows. (See page 161 of the Atmel ATmega 8 datasheet, in the ``Links'' section, for more.)
QT411 Arduino Mini
-------------------------------
(DRDY) 13 --> 8
(DETECT) 12 --> 9
(/SS) 3 --> 10
(SDI/MOSI) 11 --> 11
(SDO/MISO) 2 --> 12
(SCLK) 4 --> 13
Note that the pin mappings above aren't all direct. For example, /SS is connected via a 1k resistor. See the image below. (SDI is not shown in image.) ![]() Breakout BoardThe breakout board fits inline with the Arduino Mini. Its pins are spaced at a 2.5mm (~0.01'') pitch, and its dimensions are about 20mm x 20mm, ~0.78 x ~0.78, respectively. Since the QT411 is a tiny SMD chip (see the Dimensions section), I had
to build a breakout board so I could mount the QT411 onto a
breadboard. To build the breakout board, I had to draw up an EAGLE
design. I zipped that design file along with its PS
and PDF equivalents into one
![]() ![]() CodeSample CodeWorking sample code is forthcoming. Debugging CodeTo help me to understand the Arduino Mini's SPI bus, I wrote a few small programs to view the behavior of each in big endian format (MSB --> LSB). Each program displays information in three second intervals. The Arduino pins: The SPSR (Serial Peripheral Status Register) register:
#define BAUD_RATE 9600
#define SECONDS 3000
void setup()
{
Serial.begin( BAUD_RATE );
}
void loop()
{
static int i;
static int step = 0;
Serial.print( "SPSR: " );
for( i = 7; i >= 0; i-- )
{
Serial.print( (SPSR & (128 >> step)), DEC );
Serial.print( " " );
step++;
}
step = 0;
Serial.println( "\n" );
delay( SECONDS );
return;
}
The SPCR (Serial Peripheral Control Register) register:
#define BAUD_RATE 9600
#define SECONDS 3000
void setup()
{
Serial.begin( BAUD_RATE );
}
void loop()
{
static int i;
static int step = 0;
Serial.print( "SPCR: " );
for( i = 7; i >= 0; i-- )
{
Serial.print( (SPCR & (128 >> step)), DEC );
Serial.print( " " );
step++;
}
step = 0;
Serial.println( "\n" );
delay( SECONDS );
return;
}
The SPDR (Serial Peripheral Data Register) register:
#define BAUD_RATE 9600
#define SECONDS 3000
void setup()
{
Serial.begin( BAUD_RATE );
}
void loop()
{
static int i;
static int step = 0;
Serial.print( "SPDR: " );
for( i = 7; i >= 0; i-- )
{
Serial.print( (SPDR & (128 >> step)), DEC );
Serial.print( " " );
step++;
}
step = 0;
Serial.println( "\n" );
delay( SECONDS );
return;
}
All three of the above registers in one program: Links (datasheets, SPI references, etc.)
I purchased the QT411 in the spring of 2007 for $3.45 from Saelig, sans shipping. DigiKey sold it for about $3.51, while Farnell in Europe sold it for a whopping $9.30 (after rate conversion from British Pounds). |