Easy Way to Use 35 Rpi Display

Dear everybody,

after a "hard struggle" I found the solution for making a 3.5 touch screen, a XPT2046 Touch Controller, to work on Raspberry!
I read it's compatible with ADS7846, so I suppose it's the same procedure.

These guidelines are based on Raspbian, I don't know how much is the same for other operating systems.
My Raspberry is the Pi B+ model.

The touch screen should be connected to the Raspberry via GPIO.

This procedure is based on this:
http://ozzmaker.com/piscreen-driver-ins ... uctions-2/

Let's go!

Connect the touch screen to the Raspberry hardware through the GPIO and then switch your Raspberry on.
Use a HDMI with an external monitor, USB keyboard and mouse.
A Wi-Fi or cable internet connection is required.

First of all enable SPI by using the terminal command:
raspi-config
Navigate to 'Advanced options' and then enable both SPI and SSH.

Reboot if needed through the command in the terminal:
sudo reboot

The touch screen should turn on and be white colored.

Give the following commands for Raspbian updating:
sudo rpi-update
sudo reboot

Then after restart:
sudo apt-get update
sudo apt-get upgrade
sudo reboot

At this point let's set-up an ethernet connection for controlling remotely the RPi through a PC running Linux (or Windows).

In the terminal of RPi:
sudo nano /etc/network/interfaces
then comment the line
# iface eth0 inet dhcp
and add
iface eth0 inet static
address 10.42.0.10
netmask 255.255.255.0
gateway 10.42.0.1
broadcast 10.42.0.255

then give Ctrl+X, save and exit.

Give
sudo reboot

At the end of rebooting process check the parameters by giving:
ifconfig eth0
you should read the parameters just added in the interfaces file.

Now configure a new connection on the PC:
with graphical linux go to "Connections.." and add a new Ethernet connection.
Give the name 'Raspberry connection', go to IPv4 settings and select 'shared with other computers'. Save, close and connect an ethernet cable between the RPi and the PC.
On the PC select among the available connections the last created one and connect it.
For Windows PC should be the same.

Check with "Connections informations" on the PC that the parameter are the same of RPi, otherwise reboot both the PC and RPi.
If the parameters are still different make the interfaces ones match the PC ones.

On the Linux PC install two softwares: PUTTY and REMMINA.
For Windows look for equivalents.

Launch PuTTY on the PC.
On the left of the PuTTY configuration window expand 'Connection' and 'SSH' and select 'X11', then enable X11 forwarding.
Go to 'Session' then and in the Host Name put
10.42.0.10
then select
SSH
put the name 'Raspberry Pi SSH'
then "Save" and "Open".

You should see "login as:".
Put your RPi login, usually pi, then the password, usually raspberry.
Ok, now you have a terminal for the RPi.

For a graphical session launch Remmina on the PC.
Then create a new connection.
Put the name 'Raspberry RDP'
Protocol: RDP - Remote desktop
Server: 10.42.0.10
Login: pi (or a different login)
Password: raspberry (or different)

Save and connect.
You should see your Raspberry desktop if a graphical session is running.
Otherwise with PuTTY give the terminal command:
startx
then run again Remmina and connect again.

Ok, now we can go without problems.

Open on PuTTY or Remmina a terminal and give the command:
sudo nano /boot/config.txt
then add this line to the bottom
dtoverlay=piscreen,speed=16000000,rotate=90
give Ctrl+X then save and exit.

Give the command:
sudo reboot

Now the touch screen should be abled, so let's tell RPi to use it.

WARNING: after next commands you will not see the Raspberry on the HDMI monitor, so if PuTTY or Remmina are not working you will not be able to see the terminal or desktop of your Raspberry.
So check that PuTTY or Remmina are correctly working after some reboots.

Connect again with PuTTY or Remmina and give the command:
sudo apt-get install fbi
then
sudo reboot

After reboot give:
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf
change the line in the file:
Option "fbdev" "/dev/fb0"
to
Option "fbdev" "/dev/fb1"
Give Ctrl+X, save, exit and reboot with sudo reboot .

Now you should see the screen working, thus not the touch.

To complete the installation create a script for touch axes:
sudo nano /etc/xdg/lxsession/LXDE/touchscreen.sh
then add these lines to the file:
DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axes Swap' 0
DISPLAY=:0 xinput --set-prop 'ADS7846 Touchscreen' 'Evdev Axis Inversion' 1 0

give Ctrl+X, save and exit.
Then make the file executable:
sudo chmod +x /etc/xdg/lxsession/LXDE/touchscreen.sh

Now let's run this script at startup:
sudo nano /etc/xdg/lxsession/LXDE/autostart
then before the line
@xscreensaver -no-splash
add
@lxterminal --command "/etc/xdg/lxsession/LXDE/touchscreen.sh"
give Ctrl+X, save, exit and reboot your RPi.
(Before 'command' there are two --, not one -)

You should have both the screen and the touch working!

Please let me know for eventual problems or not clear passages.
I could have made some mistakes in reporting the correct procedure.

Simone ;)

phillipsskillart.blogspot.com

Source: https://forums.raspberrypi.com/viewtopic.php?t=178443

0 Response to "Easy Way to Use 35 Rpi Display"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel