Go Down

Topic: Get touchpad absolute position. (Read 131 times) previous topic - next topic

KodzghlyCZ

Hi everybody. I have a touchpad connected to my arduino. The touchpad uses this IC http://www.mouser.com/catalog/specsheets/iqs550.pdf
And I think it uses I2C communication to get the data. I already found a code that shows me the acceleration of this touchpad, but I need it to show me the current position of my finger. In the datasheet I found, that it can hold 5 touches at the time and somehow get their position. But I really donĀ“t know how to pull the data from it.
I would appriceate every response, thank you.

The code I am using right now
Code: [Select]
#include <ps2.h>

/*
 * an arduino sketch to interface with a ps/2 mouse.
 * Also uses serial protocol to talk back to the host
 * and report what it finds.
 */

/*
 * Pin 5 is the mouse data pin, pin 6 is the clock pin
 * Feel free to use whatever pins are convenient.
 */
PS2 mouse(6, 5);

/*
 * initialize the mouse. Reset it, and place it into remote
 * mode, so we can get the encoder data on demand.
 */
void mouse_init()
{
  mouse.write(0xff);  // reset
  mouse.read();  // ack byte
  mouse.read();  // blank */
  mouse.read();  // blank */
  mouse.write(0xf0);  // remote mode
  mouse.read();  // ack
  delayMicroseconds(100);
}

void setup()
{
  Serial.begin(9600);
  mouse_init();
 
}

/*
 * get a reading from the mouse and report it back to the
 * host via the serial line.
 */
void loop()
{
  char mstat;
  char mx;
  char my;

  /* get a reading from the mouse */
  mouse.write(0xeb);  // give me data!
  mouse.read();      // ignore ack
  mstat = mouse.read();
  mx = mouse.read();
  my = mouse.read();

  /* send the data back up */
  //Serial.print(mstat, BIN);
  //Serial.print("\tX=");
  Serial.print(mx, DEC);
  Serial.print("\t");
  Serial.print(my, DEC);
  Serial.println();
//  delay(20);  /* twiddle */

}

pylon

Post a wiring diagram. This IC uses I2C, not PS/2 to communicate with the master. Do you have a trackpad with PS/2 interface or do you communicate directly with the IC? Do you have a trackpad or a touchscreen connected to that controller chip?

KodzghlyCZ

Wiring goes like that:
Vcc on Arduino 5V
GND on Arduino GND
SDA on Arduino pin 5
SCK on Arduino pin 6

The IC is directly connected to the Arduino and there is a touchpad connected to the IC. There are several connections from sides of the touchpad.

pylon

Quote
The IC is directly connected to the Arduino and there is a touchpad connected to the IC. There are several connections from sides of the touchpad.
In this case connect SDA and SCL to the corresponding pins on the UNO and forget that ps2.h library. Use the Wire library to read the values from the chip.

KodzghlyCZ

Ok, thanks. But how can I identify the data I want. Because if I understand correctly, I have to send some bytes first to obtain the data I want.

KodzghlyCZ

Well, i guess I found it. There was another datasheet which I got the addresses from. Hope it will work and thank you for your support :D

Go Up