Cheap Pi Screen

LCD[6]I have a Raspberry Pi 3 and recently bought a 5” screen from here at sub-£20:

While the instructions on Ebay totally miss talking about the touch screen which does not work by default, this blog entry - https://blog.ask-a.ninja/?p=48  is absolutely bang on – the screen instructions are more precise than the Ebay ones AND you get the touch screen working – note the calibration information.

Here is the setup.. in boot/config.txt. I didn't bother uncommenting the existing ones - I just added this lot in - then rebooted.

gpu_mem=32
framebuffer_ignore_alpha=1
framebuffer_swap=1
disable_overscan=1
init_uart_clock=16000000
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
For touch, add the below additional lines to the configuration file (in /boot/config.txt when Raspbian is running):
dtparam=spi=on
dtoverlay=ads7846,penirq=25,speed=10000,penirq_pull=2,xohms=150
The writer goes on to say... It is worth noting that the values in the sample suggested file are approximate – your pen will NOT be accurate – when you run the calibration program (in a terminal – which then triggers a graphical desktop program) you will see as a result in the terminal – the correct values – you have to update that file by hand otherwise next time you power up you’re back to square one.
So when you plug the screen into the Pi, it works – but the screen size is not right – the Ebay article gives you some of the picture – the blog entry gives you more.  Then you need SPI turned on on the Pi and the rest of that blog gets you up and running with the touch screen. You do NOT need a USB lead in the display. Just the HDMI adaptor and of course the display plugged into the Pi.
The calibration instructions gave me some grief (and there are other instructions out there that are just WRONG) until I realised the so called file “99-calibration” is actually “99-calibration.conf” – and make sure there are no special characters in there (backwards quotes etc).

Once I got that far and rebooted – the screen registration was SPOT ON. The TERMINAL I found too large but you can resize that – there’s a lot of stuff out there about changing it’s size in the config file – well, alI can say is that in RPI3 at least it does not make a bit of difference.  I think it’s fair to say that 480px is a little on the low side so I don’t think that detracts too much from the value. A solution turned out to be simple – in the /boot/config.txt file

# uncomment to force a console size. By default it will be display's size minus
# overscan.
framebuffer_width=1024
framebuffer_height=600

This made for a rather small font but solved the problem. I’m sure a little tweaking would make it even better.

Facebooktwittergoogle_pluspinterestlinkedin

16 thoughts on “Cheap Pi Screen

  1. I have had a problem downloading the drivers to my Raspberry pi 3 B 5inch touchscreen and I have gone through your instructions above and is working fine, but I am unable to understand how you solved the calibration problem. I am not computer savvy. Could you please explain in more detail a bit more on how you solved this please.
    Waiting patiently for your reply.

    Ray

        1. Hi The calibration is as specified in the web page referenced in the 2nd para of the main article. I set up by those instructions without a problem or are you saying it has now changed? BTW the sites security certificate has now expired so some browsers will try to stop you going there.

  2. Hi Steve
    Thanks for replying. The problem is how did he colin do his calibration he did explain how. Only said he had a problem to calibrate till he realised the so called file 99-calibrator is actually 99-calibrator.conf. no saying what he did with it or how.
    I am not computer savy, so need instructions in more detail.
    Ray

    1. I am not sure I can put it any more simply than in the original article with the relevant part being
      ----------------------------------
      The next part will require a small amount of ingenuity on your part. You’ll need to get the file “5inch_HDMI_LCD.tar.gz” from somewhere. If you search with Google, you should be able to find it easily enough. With this file, you can extract the archive file “xinput-calibrator_0.7.5-1_armhf.deb”. Install it with “dpkg -i xinput-calibrator_0.7.5-1_armhf.deb“.
      This installs the graphical touch screen calibration tool for the 5″ LCD. Since we want to provide at least a baseline calibration, we add a directory at /etc/X11/xorg.conf.d and create a file named 99-calibration.conf in that directory. The contents (as an example) would be:
      Section “InputClass”
      Identifier “calibration”
      MatchProduct “ADS7846 Touchscreen”
      Option “Calibration” “129 3955 191 3946”
      EndSection
      If you want to calibrate your display manually, you can simply log into the Raspberry Pi 2 on the console and issue the normal startx command. Then SSH into the Raspberry Pi 2, and run the command “DISPLAY=:0 xinput_calibrator”. You should get a screen that tells you to press the stylus to the crosshair. Once you’ve hit all four crosshairs, you are presented with a chunk of text that looks strikingly like the above 99-calibration file contents. Replace the /etc/X11/xorg.conf.d/99-calibration.conf file’s contents with the output of the xinput_calibrator command and you should be in good shape.

      ----------------------------------------------
      I have edited this to reflect the correct file name which Peter referenced in the article above. I'm not sure who Colin is that you refer to? Sorry if I have misunderstood the problem you are having.

      1. Hi Steve
        I am having no success with this. I have down loaded the Xinput-calibrator and extracted it in downloads. Then gone in Terminal I then put in
        sudo dpkg -i xinput-calibrator_0.7.5-1_armhf.deb it come with.

        (Reading database ... 123737 files and directories currently installed.)
        Preparing to unpack xinput-calibrator _0.7.5-1_armhf.deb ...
        Unpacking xinput-calibrator (0.7.5-1) over (0.7.5-1) ...
        Setting up xinput-calibrator (0.7.5-1) ...
        Processing triggers for gnomes menus (3.13.3-6) ...
        Processing triggers for desktop-file-utils (0.22-1) ...
        Processing triggers for mime-support (3.58) ...
        Processing triggers for man-db (2.7.0.2-5)

        Closed Terminal
        Them went into Menu/Preferences/calibrate Touchscreen.
        I got the Terminal up and in it was.

        X input extension not available.
        Closed that.

        Open terminal and put in

        sudo nano /etc/X11/xorg.conf.d/99-calibration.conf

        I got nothing. just went back to command promt.

        So what has gone wrong.
        Cheers
        Ray

        1. Hi
          HELP ME PLEASE
          I'm not getting a reply from Steve on this problem, is there anyone else out there can help me with this as I am at a lose on what else to do.
          Please can someone.

          HELP PLEASE.

          1. Hi - Apologies for no responding but I was out f the loop for a while. Anyway I just built latest release of raspbian on a new Pi3. Followed the instructions as above. When I run DISPLAY=:0 xinput_calibrator in an SSH session and tapping the four cross hairs on the touch screen I get the this response in the SSH section

            --------------------------------------------
            Calibrating standard Xorg driver "ADS7846 Touchscreen"
            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 "ADS7846 Touchscreen"
            Option "MinX" "2771"
            Option "MaxX" "62517"
            Option "MinY" "2116"
            Option "MaxY" "64374"
            EndSection
            -----------------------------------
            copy those into the conf file and calibration appears to be corrected.

            This can also be run from the GUI screen under preferences/calibrate touch screen and gives the same output

            I did have a couple of issues but I don't think these would have caused the problems seen. First in cutting and pasting from windows into the conf file this threw up errors that were down to the quote marks used. Also if you follow the waveshare site instructions they refer to the conf file sitting under ect rather than etc.

            One issue I still have is that it seems reluctant to map to the edge of the screen. Other than that it seems to give reasonably accurate calibration.

  3. This won't make you feel any better... I had to put a new operating system on that Pi3 board and so I started again.

    This time I cannot get anything to change the calibration. I grabbed the calibration file, I created the xorg.conf.d directory - created the file 99-calibration.conf - put in the info as before... but even putting in random values into the conf file makes no difference at all.

    1. Not only that but I grabbed my /boot/config.txt and the xorg.conf.d directory form my original working system - and over-wrote the new ones.... rebooted - STILL no difference....

      1. Peter - On further investigation you are correct in that it is ignoring that section of the conf file. It does read it because it will throw errors if it is incorrectly formatted but when you rerun calibration it states that existing values are always 0,65535,0,65535. Not sure if this was the case before because I primarily used a mouse and calibration for the stylus seemed OK. Just cant get it to go the screen edges with the stylus.

        1. Mine was always accurate until about half inch off the edge of the screen before calibration. But on my last install ages ago it became 100% accurate , now it appears to be taking no notice of the calibration.

          1. but all posts are quite recent... so better report there, hoping for solution...
            MORE sadly, my 5" lcd dropped on the floor while i was going to do the tests i told you on skype, and took the Dave Jones motto (don't turn them on, tear them apart!) quite literally... 🙁

Leave a Reply

Your email address will not be published. Required fields are marked *