Add-ons

[Tutorial] 7 inch touch display

10 10851
Hi people !
I managed to make my 7" 800x480 touchdisplay work very well on the BPi.
Calibrated touchpanel, display resolution, virtual keyboard, right click emulation, everything works.



Change resolution
The display is HDMI, so it should work without an issue. However the resolution needs to be changed (defaults to 1280x720). There are a few known methods, but only this one works for me :

1- install sunxi-tools
  1. cd ~/downloads
  2. git clone https://github.com/linux-sunxi/sunxi-tools
  3. cd sunxi-tools
  4. make
Copy the Code
2- modify script.bin
  1. sudo ./bin2fex /boot/bananapi/script.bin /boot/bananapi/script.fex
  2. sudo nano /boot/bananapi/script.fex
Copy the Code
in [disp_init] section, replace these lines :
  1. disp_init_enable = 1
  2. disp_mode = 0
  3. screen0_output_type = 3
  4. screen0_output_mode = 2
Copy the Code
You should note the screen0_output_mode variable doesn't match what is written on http://linux-sunxi.org/Fex_Guide#disp_init_configuration page. I had to test differents variables to find the right one (and it's not exactly 800x480 but it's ok).
Save, exit, recompile script.bin and reboot :
  1. sudo ./fex2bin /boot/bananapi/script.fex /boot/bananapi/script.bin
  2. sudo reboot
Copy the Code
Touch panel
3- install calibration software :
  1. sudo apt-get update
  2. sudo apt-get install libx11-dev libxext-dev libxi-dev x11proto-input-dev
  3. wget http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz
  4. tar -zxf xinput_calibrator-0.7.5.tar.gz
  5. cd xinput_calibrator-0.7.5
  6. ./configure
  7. make
  8. sudo make install
Copy the Code
4- launch calibration software and calibrate the panel
Launch X window, open the terminal
  1. xinput_calibrator
Copy the Code
Click on the 4 crosses.  

5- make it persistant
The touchpanel is now calibrated but it won't keep the settings across the reboot. Here is how to fix it :
The software should indicate you some details in the console window. You should see a part like this one :
  1. Section "InputClass"
  2.     Identifier    "calibration"
  3.     MatchProduct    "eGalax Inc. USB TouchController"
  4.     Option    "Calibration"    "121 1917 317 1741"
  5. EndSection
Copy the Code
Create a 01-input.conf file :
  1. sudo nano /usr/share/X11/xorg.conf.d/01-input.conf
Copy the Code
Copy paste the previous settings in the file, save and exit.
Your panel should remain calibrated across reboots.

6- Right click emulation
Touch panel only has a single click (obviously), so we have to emulate the right click with a long pressure.
Open the previously created file :
  1. sudo nano /usr/share/X11/xorg.conf.d/01-input.conf
Copy the Code
Copy paste these settings somewhere between Section "InputClass" and EndSection :
  1. Option "EmulateThirdButton" "1"
  2. Option "EmulateThirdButtonTimeout" "750"
  3. Option "EmulateThirdButtonThreshold" "30"
Copy the Code
You could adjust the variables to your liking.

Virtual keyboard
We don't have a keyboard anymore, so we'll have to use a virtual one, like on Android.

7- install software
sudo apt-get install florence
There are a few Virtual keyboard software projects, you are free to test a different one.
  1. sudo apt-get install florence
Copy the Code
8- Virtual keyboard layout
If you want to change the virtual keyboard layout, here is how :
  1. setxkbmap fr
Copy the Code
With "fr" being a country code (uk, ru, us, cn...).


I think everything should work

In the youtube video, you could see I only use one cable to power both BPi and controller board. I made a special USB-to-barrel, so I could power the controller board from the BPi usb. However I don't recommend it.
You could also power the controller board using the SATA power connector. It works well, but will stop while running on battery (this is another topic ^^)
You could also power everything the other way, BPi getting power FROM the controller board. The trick is to use the 12v 4 way connector on the controller board : when powered with 5v, this 12v connector actually provides 5v. You will have to make a special cable for this.

I think it is possible to remove the display keypad and setup the display using GPIO, direclty from the BPi. I'll let you know.

Thanks for watching !
Many thanks. I will try it

gexle  
Post Last Edited by gexle at 2014-9-7 10:16

Hello

I would like to change the resolution of the Banana does not take me this ??


[disp_init]
disp_init_enable = 1
screen0_output_mode = 4
screen1_output_type = 4
screen1_output_mode = 4
fb0_framebuffer_num = 2
fb0_format = 10
fb0_pixel_sequence = 0
fb0_scaler_mode_enable = 1
fb1_framebuffer_num = 2
fb1_format = 10
fb1_pixel_sequence = 0
fb1_scaler_mode_enable = 0
lcd0_backlight = 197
lcd1_backlight = 197
lcd0_bright = 50
lcd0_contrast = 50
lcd0_saturation = 57
lcd0_hue = 50
lcd1_bright = 50
lcd1_contrast = 50
lcd1_saturation = 57

Thanks

bananapi@BananaPi ~/sunxi-tools $ cd
bananapi@BananaPi ~ $ cd ~/downloads
-bash: cd: /home/bananapi/downloads: Datei oder Verzeichnis nicht gefunden
bananapi@BananaPi ~ $ cd /downloads
bananapi@BananaPi /downloads $ git clone https://github.com/linux-sunxi/sunxi-tools
fatal: destination path 'sunxi-tools' already exists and is not an empty directory.
bananapi@BananaPi /downloads $ cd sunxi-tools
bananapi@BananaPi /downloads/sunxi-tools $ make
gcc -g -O0 -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/ `pkg-config --cflags libusb-1.0`  -o fel fel.c  `pkg-config --libs libusb-1.0`
Package libusb-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusb-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libusb-1.0' found
Package libusb-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusb-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libusb-1.0' found
fel.c:22:20: fatal error: libusb.h: Datei oder Verzeichnis nicht gefunden
compilation terminated.
Makefile:56: recipe for target 'fel' failed
make: *** [fel] Error 1

alien  
  1. sudo apt-get install libusb-1.0-0-dev
Copy the Code

gexle  
Post Last Edited by gexle at 2014-9-7 11:12

Post Last Edited by gexle at 2014-9-7 11:10

Post Last Edited by gexle at 2014-9-7 10:58

Post Last Edited by gexle at 2014-9-7 10:55

Post Last Edited by gexle at 2014-9-7 10:51

thank you thats it

But the 1024x768 resolution will not yet adopt me this always ??

Display is 7" and HDMI

[disp_init]
disp_init_enable = 1
disp_mode = 0
screen0_output_type = 3
screen0_output_mode = 2
screen1_output_type = 2
screen1_output_mode = 4
fb0_framebuffer_num = 2
fb0_format = 10
fb0_pixel_sequence = 0
fb0_scaler_mode_enable = 1
fb1_framebuffer_num = 2
fb1_format = 10
fb1_pixel_sequence = 0
fb1_scaler_mode_enable = 0
lcd0_backlight = 197
lcd1_backlight = 197
lcd0_bright = 50
lcd0_contrast = 50


it is still or still 1280x720p60 is inside

looking not what I forgot ....

Thanks

Edited by jorricks at Fri Feb 6, 2015 14:21

So I have tried this for as well on Raspbian as on Lubuntu..
For both images I get the following:
Unable to connect to X server
I am trying to do this as we have an Odroid-vu but I can't seem to get the touch working
Could someone please help???

jorricks replied at Fri Feb 6, 2015 14:20
So I have tried this for as well on Raspbian as on Lubuntu..
For both images I get the following:
Un ...

Same error here. BPro - Raspbian - Waveshare - 5" hdmi/touch

Curious, Have you noticed Touch screen not working maybe 1 out of 5 reboots? I'm trying to find the cause and have a backup plan when it fails to load.

Same problem for me... Touch screen doesn't work every time I boot. It's REALLY a problem !

Edited by DanielArn at Sep 13, 2016 14:45

Hi..i am new user here. In my case I have tried this for as well on Raspbian as on Lubuntu.or both images I get the following:Unable to connect to X server.I am trying to do this as we have an Odroid-vu but I can't seem to get the touch working.
pcb assemblies

You have to log in before you can reply Login | Sign Up

Points Rules