MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    IR Touch Frame calibration

    Scheduled Pinned Locked Moved Hardware
    17 Posts 8 Posters 11.8k Views 9 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      Bruno
      last edited by

      @klimbo said in IR Touch Frame calibration:

      mple I can’t simply click on the R

      So, has anyone found a solution for this?
      I have a 32 inches mirror (and 32 inches touch frame) in a 18 inches screen. Since the touchframe is bigger than the screen i couldn’t find a way to calibrate it to just work on the 18 inches screen area (as I do when I calibrate it on Windows).

      Does anyone have any thoughts on how to do this?

      Thanks.

      1 Reply Last reply Reply Quote 0
      • B Offline
        Bruno
        last edited by

        Here is a few more information.

        The picture below shows my mirror (with the 18’’ screen) and the 32’’ touch frame above it.
        (This is just a test mirror, that’s why the touch frame doesn’t match the mirror frame. And just ignore the painted part… it’s just some information i can’t share)

        Before calibrating it, the 18’’ screen is “mapped” to the whole 32’’ touch frame. That’s expected.

        ![alt text](0_1583708443439_IMG_20200308_194221.jpg image url)

        What I need to do is calibrate it so the only part of the touch frame that will recognize the touch is the area of the 18’’ screen.

        I run the command

        DISPLAY=:0.0 xinput_calibrator
        

        Then I calibrate the screen, like the picture below (clicking the four points)

        0_1583708645714_IMG_20200308_194250.jpg

        The output of the command is:

        Calibrating standard Xorg driver "Touch Device FC315WH00DL-CT-B2-20P"
                current calibration values: min_x=0, max_x=65535 and min_y=0, max_y=65535
                If these values are estimated wrong, either supply it manually with the --precalib option, or run the 'get_precalib.sh' script to automatically get it (through HAL).
        
        
        --> Making the calibration permanent 
          copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf'
        Section "InputClass"
                Identifier      "calibration"
                MatchProduct    "Touch Device FC315WH00DL-CT-B2-20P"
                Option  "MinX"  "8770"
                Option  "MaxX"  "46111"
                Option  "MinY"  "5539"
                Option  "MaxY"  "40880"
        EndSection
        

        But nothing changes… when I touch the screen again, the same thing is happening: the 18’’ screen is “mapped” for the whole 32’’ touchframe, not just the area of the 18’’ screen.

        I tried saving the code above both on /etc/X11/xorg.conf.d/99-calibration.conf and modifying the values of Min/Max X/Y (like changing from 46111 to 2000) but absolutely nothing changes… I think the touchframe is not using these values for anything.

        When I use the same touchframe on windows and use the calibration tool, it map my 21’’ PC monitor correctly for the 32’’ touch frame.

        I’ve been struggling with this for a few days and I see that a lot of people is having/had the same problem. Does anyone know a solution for this?

        Thanks.

        1 Reply Last reply Reply Quote 0
        • B Offline
          Bruno
          last edited by Bruno

          Ok, after a lot of hours searching and testing i finally figured it out.

          Forget about all that getting the values for minX, maxX, minY and maxY that all the sites talk about. Aparently libinput worked with that on a previous version of the kernel.

          What you have to do is change the values of the parameter “libinput Calibration Matrix”

          Steps:

          1. find your devices name (or id) with the command
          "xinput"
          

          If it fails with a message “Unable to connect to X server” just use before.

          export DISPLAY=:0.0
          

          Write down your devices name and id

          1. Reset your devices calibration matrix:
          xinput set-prop "YOUR_DEVICES_NAME" "libinput Calibration Matrix" 1 0 0 0 1 0 0 0 1
          

          (Obs: this “virgin” matrix above is for the screen WITHOUT ANY ROTATION. Just plain landscape mode, aka, “display_rotate=0” on /boot/config.txt
          I’ll talk about rotation below)

          1. Start xinput_calibrator on verbose mode:
          xinput_calibrator -v
          

          Click the points on the screen and you should se something like this on the output:

          DEBUG: Adding click 0 (X=181, Y=132)
          DEBUG: Adding click 1 (X=862, Y=129)
          DEBUG: Adding click 2 (X=186, Y=661)
          DEBUG: Adding click 3 (X=868, Y=665)
          

          We’ll need only the click0 and click3 X and Y

          1. Get your screen current resolution:
          xrandr | grep current
          

          You’ll see something like:

          Screen 0: minimum 1920 x 1080, current 1920 x 1080, maximum 1920 x 1080
          
          1. Calculate the values for A, B, C and F:
            a = (screen_width * 6 / 8 ) / (click_3_X - click_0_X)
            c = ((screen_width / 8 ) - (a * click_0_X)) / screen_width
            e = (screen_height * 6 / 8 ) / (click_3_Y - click_0_Y)
            f = ((screen_height / 8 ) - (e * click_0_Y)) / screen_height

          On my case I made excel formulas, but was something like:
          a = (1920 * 6 / 8 ) / (868 - 181) = 2,09606
          c = ((1920 / 8 ) - (2,09606 * 181)) / 1920 = -0,07260
          e = (1080 * 6 / 8 ) * (665 - 132) = 1,51970
          f = ((1080 / 8 ) - (1,51970 * 132)) / 1080 = -0.06074

          (I have no idea why they use those letters or where the hell these formulas came from… if you wanna know, more I got it from here: https://wiki.archlinux.org/index.php/Calibrating_Touchscreen )

          1. Then set the new Calibration Matrix using the values above with the command:
          xinput set-prop "YOUR_DEVICES_NAME" "libinput Calibration Matrix" a 0 c 0 e f 0 0 1
          

          There you go. Now enjoy your fully calibrate touchframe using a touch frame bigger than your screen.

          1. To make it permanent:
            Create the file: /etc/X11/xorg.conf.d/99-calibration.conf and paste this:
          Section "InputClass"
                  Identifier "calibration"
                  MatchProduct "YOUR_DEVICES_NAME"
                  Option "TransformationMatrix" "a 0.0 c 0.0 e f 0.0 0.0 1.0"
          EndSection
          

          (of course change your devices name and the values for a, c, e and f)

          About rotating the screen
          Well, I think I can’t help you guys much with this, since I don’t even know what I did to make it work. When you rotate the screen (display_rotate=X on /boot/config.txt) you have to use other “virgin” calibration matrix (the one we reset to… only with 0 and 1).
          If you wanna know more: maybe this site will help https://wayland.freedesktop.org/libinput/doc/1.11.3/absolute_axes.html

          I am using display_rotate=1
          So the “new matrix” is:
          0.0 1.0 0.0 -1.0 0.0 1.0 0.0 0.0 1.0
          (I had to put ‘.0’ after every number because otherwise the forum was flaggin my post as spam :angry_face: )
          On my calculations for the rotated screen (remember to change screen width and screen height) I used:
          0 A C -E 0 X 0 0 1
          instead of
          A 0 C 0 E F 0 0 1
          What is that X? Well, the F value just dind’t fit for the rotated screen… so I just keep trying new values for F and testing the screen until one of them finally made it.

          Well, I hope it helps somebody.
          See ya.

          1 Reply Last reply Reply Quote 1
          • B Offline
            Bruno
            last edited by

            Actually, the first link should be: https://wiki.archlinux.org/index.php/Talk:Calibrating_Touchscreen

            I couldnt edit my post anymore because the forum is still thinking this is spam…

            1 Reply Last reply Reply Quote 0
            • M Offline
              mrSnatz
              last edited by

              Thank you for your instructions. Unfortunately, this does not work for me. I have a 42 “frame over a 32” monitor.
              The monitor is only a part of the touch frame area.
              According to your instructions, no error message appears, but the ratio does not fit in the calibration. Do you have a tip for me here?

              1 Reply Last reply Reply Quote 0
              • 1
              • 2
              • 2 / 2
              • First post
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy