Last active
April 13, 2018 15:01
-
-
Save eendeego/7fa29ddc33aa7b07f9444388bdcb5a97 to your computer and use it in GitHub Desktop.
Random Raspberry Pi TFT Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------- | |
2014-07-27 - Texy / Adafruit - 1.8" SPI TFT display, 160x128 18-bit color - ST7735R driver (LCD/TFT) | |
# http://www.adafruit.com/products/618 | |
# http://www.adafruit.com/products/358 | |
# http://www.raspberrypi.org/forums/viewtopic.php?f=64&t=40677 - 1.8 TFT LCD add-on shield board | |
# http://www.raspberrypi.org/forums/viewtopic.php?f=59&t=43286 - 1.8" TFT LCD Shield board v2 | |
# http://www.raspberrypi.org/forums/viewtopic.php?f=93&t=43286&p=396430#p396430 - "switching the backlight on and off works!" | |
"I removed the connectors of pins 15 and 16 between the TFT board and the shield board, rewired pin 15 to the 3.3V rail, and pin 16 to collector in a standard NPN transistor. Base of this transistor is connected to a free GPIO out and emitter goes to GND." | |
# http://minhdanh2002.blogspot.pt/2013/11/experimenting-with-st7735-18-128x160.html - LCD board pinout | |
# http://www.raspberrypi.org/forums/viewtopic.php?t=40677 - Este tem os botões !! | |
# http://www.raspberrypi.org/forums/viewtopic.php?f=59&t=40674#p340540 V2 pictures | |
# http://www.whence.com/rpi/ | |
# https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/software-installation | |
Original: | |
LCD Pin 6 (LCD RESET) => GPIO Pin 22 - GPIO 7 - SPI0_CE1_N | |
LCD Pin 7 (LCD A0 (R/S)) => GPIO Pin 18 - GPIO 24 | |
LCD Pin 8 (LCD SDA) => GPIO Pin 19 - GPIO 10 - SPI0_MOSI | |
LCD Pin 9 (LCD SCK) => GPIO Pin 23 - GPIO 11 - SPI0_CLK | |
LCD Pin 10 (LCD CS) => GPIO Pin 24 - GPIO 8 - SPI0_CE0_N | |
LCD Pin 15 (LED +) => GPIO Pin 2 (5V) | |
LCD Pin 16 (LED -) => GPIO Pin 6 (GND) | |
gpio pin 21 = UP | |
gpio pin 13 = DOWN | |
gpio pin 26 = SELECT | |
Modified | |
LCD Pin 15 => 1 (3.3V) | |
LCD Pin 16 => BC547 C | |
GPIO Pin 6 => BC547 E | |
GPIO Pin ? => BC547 B | |
mkdir -p ~/work/share/lcd/adafruit-pitft-2.8 | |
cd ~/work/share/lcd/adafruit-pitft-2.8 | |
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-bin-adafruit.deb | |
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-dev-adafruit.deb | |
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-doc-adafruit.deb | |
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi0-adafruit.deb | |
wget http://adafruit-download.s3.amazonaws.com/raspberrypi-bootloader-adafruit-20140724-1.deb | |
sudo dpkg -i -B *.deb | |
sudo reboot | |
sudo modprobe spi-bcm2708 | |
sudo modprobe fbtft_device name=sainsmart18 speed=32000000 fps=50 rotate=270 | |
sudo apt-get install fbi | |
cd ~/work/share/lcd/adafruit-pitft-2.8 | |
wget http://adafruit-download.s3.amazonaws.com/adapiluv320x240.jpg | |
sudo fbi -T 2 -d /dev/fb1 -noverbose -a adapiluv320x240.jpg | |
sudo sh -c 'echo spi-bcm2708 >> /etc/modules' | |
sudo sh -c 'echo fbtft_device >> /etc/modules' | |
sudo sh -c 'echo options fbtft_device name=sainsmart18 speed=32000000 fps=50 rotate=270 gpios=reset:25,dc:24,led:23>> /etc/modprobe.d/sainsmart18.conf' | |
sudo dpkg-reconfigure console-setup | |
# ... and go thru to select Terminus 6x12 | |
sudo vi /boot/cmdline.txt | |
# Add fbcon=map:10 fbcon=font:VGA8x8 | |
# tests | |
mkdir -p ~/work/share/lcd/texy | |
cd ~/work/share/lcd/texy | |
sudo apt-get update | |
sudo apt-get install -y python-dev python-pip | |
sudo pip install wiringpi2 | |
unset DISPLAY | |
sudo test.py | |
# Turning the display on/off | |
sudo sh -c "echo 23 > /sys/class/gpio/export" | |
ls -l /sys/class/gpio | |
sudo sh -c "echo 'out' > /sys/class/gpio/gpio23/direction" | |
sudo sh -c "echo '1' > /sys/class/gpio/gpio23/value" | |
sudo sh -c "echo '0' > /sys/class/gpio/gpio23/value" | |
sudo -E sh -c 'cat <<EOF >/etc/init.d/backlight | |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: backlight | |
# Required-Start: | |
# Required-Stop: | |
# Default-Start: S 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Backlight control | |
# Description: Backlight via GPIO for Sainsmart 1.8" display | |
### END INIT INFO | |
set -e | |
GPIO=23 | |
case "\$1" in | |
start) | |
[[ -f /sys/class/gpio/gpio\$GPIO ]] || echo \$GPIO > /sys/class/gpio/export | |
echo 'out' > /sys/class/gpio/gpio\$GPIO/direction | |
echo '1' > /sys/class/gpio/gpio\$GPIO/value | |
;; | |
stop) | |
echo '0' > /sys/class/gpio/gpio\$GPIO/value | |
echo \$GPIO > /sys/class/gpio/unexport | |
;; | |
*) | |
log_action_msg "Usage: /etc/init.d/backlight {start|stop}" || true | |
exit 1 | |
esac | |
exit 0 | |
EOF' | |
sudo chmod 755 /etc/init.d/backlight | |
--------------------------------------------- | |
2014-07-27 - Adafruit PiTFT - 2.8" Touchscreen Display for Raspberry Pi (LCD/TFT) | |
# https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/software-installation | |
mkdir -p ~/work/share/adafruit-pitft-2.8 | |
cd ~/work/share/adafruit-pitft-2.8 | |
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-bin-adafruit.deb | |
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-dev-adafruit.deb | |
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-doc-adafruit.deb | |
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi0-adafruit.deb | |
wget http://adafruit-download.s3.amazonaws.com/raspberrypi-bootloader-adafruit-20140724-1.deb | |
sudo dpkg -i -B *.deb | |
## The rest of the module was already installed :( | |
sudo sh -c 'echo "options fbtft_device name=adafruitts rotate=90 frequency=32000000" >> /etc/modprobe.d/adafruit.conf' | |
sudo vi /etc/modprobe.d/adafruit.conf | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment