I recently picked up a new case for my raspberry pi from Banggood.
The case is machined aluminium and very well made. It came with a pitft compatible 2.2 inch screen which plugs directly into the GPIO port. It also provides six buttons connected to GPIO pins, an infrared receiver and a I2C port. There is a clear plastic screen protector and all spacers and screws provided, including an allen key. I expect the case works with the Raspberry Pi 2 and 3 (which I am using).
Setting with a Raspberry Pi 3
Mechanically, assembly is simple enough. The only tricky bit might be getting all the buttons in place as they are not retained in any way until everything is brought together. Remember to take the protective film off both the screen and the clear plastic screen protector.
The software setup process isn’t immediately obvious on the banggood page, but someone has asked a question and received a couple of answers which help. There are various links to pre-made images which I was unable to download due to permissions and / or dead links (random third party images aren’t my preferred source of OS images anyway) the manual instructions are usable for the most part though and I was able to get the screen running following these instructions.
I will repeat them here just in case the other website goes down – the following is confirmed to work on a Raspberry Pi 3 running Jessie, although it did not prove possible to rotate the display by changing the angle in config.txt. I already had a newer version of the GPIO software and so didn’t bother installing their recommended version.
Update the OS.
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade
Make sure required software is installed. Ensure that the GPIO software is newer than their suggested version (0.5.11).
First run apt-get to install gcc, pygame and python-dev. I suspect these will already be installed. If they are, there is nothing to worry about, apt-get will just pass over them.
sudo apt-get install gcc python-pygame python-dev
Next, lets find what version of the GPIO software we have:
find /usr | grep -i gpio
This will list installed software in the /usr folder containing the text “gpio” and should give a clue to the version. Running on one of my Pis, the following are the first few lines of output :
/usr/lib/python2.6/dist-packages/RPi.GPIO-0.6.2.egg-info /usr/lib/python2.6/dist-packages/RPi/_GPIO.so /usr/lib/python2.6/dist-packages/RPi/GPIO
This tells me that I have version 0.6.2 installed – newer enough I think!
Next, make sure that SPI and I2C are both enabled. To do this, I will use the raspi-config tool rather than directly editing the settings file as they do in the original instructions :
On the following screen, select option 8, “Advanced Options”.
In the Advanced Options menu, select option A6, “SPI”.
Do the same for I2C by selecting Option 8 again, then option A7 (instead of A6) and selecting “Yes” to enable I2C.
Press the right arrow key on the home menu to select “Finish” and exit the program. You might be asked to restart the machine, I wouldn’t bother for now although it isn’t an issue if you do.
Enter the following command to open the file config.txt in the text editor nano.
sudo nano /boot/config.txt
Once the file is open, scroll to the end and append “dtoverlay=pitft28-resistive, rotate=270 speed=48000000 fps=30” excluding quotes (and all on one line). I have tried adjusting rotate=270 to other values, but it hasn’t changed the console display. I haven’t tried this while running the GUI, where it might make a difference.
To make the console appear on the display it is necessary to edit the file cmdline.txt. We also take this chance to change the font to make it more visible on the small screen.
sudo nano /boot/cmdline.txt
With this file open, we add the text “fbcon=map:10 fbcon=font:VGA8x8 ” (excluding quotes) just before the word “rootwait”. It might be necessary to scroll to the right with the right arrow key to find the text.
Reboot (sudo reboot) and it should all work.
Other things to discuss at some point…
Setting Up the GUI
Working with the Buttons
Not Used IR Yet
Screen faults, new screen, smaller buttons.
Shutdown and restart python. False triggering.
Reduced wifi range. Access to GPIO – possibly counter with I2C.
Screen and splitscreen. Run at boot.