When I found a touchscreen the same size as the Raspberry Pi I thought it was a great find. Having the screen the same size as the board was perfect for touch keypads and other man/machine interfaces. I knew it would be a challenge to get it fully functional but it was nearly impossible. Lucky for you the hard work is done and I have documented my steps here.

Update: I published some hints in this post. Check that out too.

I ordered my screen directly from China from AliExpress. I ordered this exact board. I took about 4 weeks to arrive. Even though there wasn’t much packaging material, the board was fine. It came with a little stylus but no instructions are included. The screen has a nice connector that is exactly the right height. When attaching, make sure the pins are aligned correctly. I went back through the reviews and saw some different suggestions for getting the screen to work. I finally landed on the right combination of settings.



Displaying the console

First the good news – Raspian Jessie and Stretch include the needed drivers to make the screen and touch panel work! There is no need download or activate special modules or overlays. You just need the right configuration settings. My first goal was to get the screen to show anything. To do that I modified the /boot/cmdline.txt and /boot/config.txt files. These changes should make the boot console display. Add fbcon=map:10 to the END of the cmdline.txt line. Add dtoverlay=piscreen,speed=22000000,rotate=270 to the end of the config.txt file. Note the rotate portion of config.txt . This allows changing the position of top of the screen. On my workbench the power connector is on the top and the rotate=270 positions the top of the screen similarly. After you edit the files, reboot. The boot process will be displayed on the little screen.

Displaying Xwindows

OK step one is done – the screen works for the console. Next step is to get it working with X11 and my default window manager, Xfce. To do that only one simple edit was required. In /usr/share/X11/xorg.conf.d/99-fbdev.conf (Stretch) or /usr/share/X11/xorg.conf.d/99-fbturbo.conf (Jessie) there should be a line similiar to Option "fbdev" "/dev/fb1" . That tells Xwindows to use the default Raspi HDMI screen. The touchscreen should be fb1 so just change /dev/fb0 to /dev/fb1 . My basic Jessie install has a fbturbo.conf file but Stretch did not have any files. I created a new 99-fbdev.conf file and added all these lines.



Section "Device"

Identifier "myfb"

Driver "fbdev"

Option "fbdev" "/dev/fb1"

EndSection



Reboot and start Xwindows. All should work. Note: this will disable the HDMI display. If you need both displays at the same time, it is beyond the scope of this blog post but Google has the answer.

Getting the touchscreen working