Having a hard time calibrating my xpt2046 to ILI9488

Hi,

I'm working on the settings of calibrating the XPT2046 to ILI9488, I've developed a simple function to toggle a button, but the touch areas aren't inline with the button coordinates.

I'm using TFT_Touch.h by Rowboteer

I've used x and y raw and converted values and tried even to modify the values to trail/error the mapped values, but every time there's a difference the the touch area isn't working as expected even if the mapped values is very near to the button coordinates.

What to do ?

Print out the readings you are getting and see what tolerance and repeatable you are getting.
You might need to use a stylus to get a finer resolution.

Are your expectations too much?

1 Like

I tried that but it really don't get as I expect, there is a huge shift to the coordinate I'm targeting to.

These are the raw x/y I get:

  // x
  _hmin = 150; //  ~120 to 250
  _hmax = 3900; // ~3400 to 4000
  // y
  _vmin = 150; //  ~120 to 250
  _vmax = 3900; // ~3400 to 4000

But I ran by the constructor of TFTeSPI/touch library and there are pre-set calibration values rather than the actual calibration setting, which are:

  // x
  _hmin = 300;
  _hmax = 3600;
  // y
  _vmin = 300;
  _vmax = 3600;

And these values work better than my calibration efforts, and I'm getting near the button I'm targeting to.

So far this is working best for me:

  // x
  _hmin = 400;
  _hmax = 3600;
  // y
  _vmin = 450;
  _vmax = 3550;

Trail and error sometimes works better than expected.

I measure how much offset I'm getting in either x or y direction and change the resolution values in the constructor file :slightly_smiling_face:

Are these values steady? Maybe you need some averaging if they are not.

Yes indeed.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.