Pas Home - Index
This week a play with the PiTFT from Adafruit https://www.adafruit.com/products/1601, also available on newark Product LinkProduct Link
I want use the PiTFT with Pi for made a control panel to install in my kitchen and easily open/close my curtain, view and change heating temperature and control my home ventilation.
Setup
This is the procedure a use to setup my device https://github.com/pascalmartin/ForgetMeNot/tree/master/bundles/pitft
Usefull tips
- To startx to HDMI Display
FRAMEBUFFER=/dev/fb0 startx
- To open a console after start with browser in full screen Press CTRL+ALT+F1 and hit return and enter your login
Pi Installation
More complete documentation on Adafruit
Summary :
Step 1
Prepare Micro SD card:
- Download RASPBIAN Ready to go image with PiTFT ready from Adafruit
- Format SD Card with SDFormatter.exe
- Write Raspbian with win32diskimager-v0.9-binary
Step 2
Pi configuration
- Boot Pi with PiTFT on it, extend file system and configure password, timezone and keyboard reboot
- Configure wifi using WiFi Config utility
Use this command to startx using the hdmi display (Very more usefull for configure WIFI)
FRAMEBUFFER=/dev/fb0 startx
The normal startx command use PiTFT display
- Logout and Reboot
sudo reboot
- Update raspberrypi
sudo apt-get update sudo apt-get upgrade sudo reboot
Step 3
Change Pi hostname for easily identification on your wifi router Details
sudo sed -i 's/raspberrypi/RPi-PiTFT/g' /etc/hosts sudo sed -i 's/raspberrypi/RPi-PiTFT/g' /etc/hostname sudo /etc/init.d/hostname.sh sudo reboot
Step 4
Auto run browser on startup
Some resource :
- http://blogs.wcode.org/2013/09/howto-boot-your-raspberry-pi-into-a-fullscreen-browser-kiosk/
- (Not tested) http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/gui/auto-run-browser-on-startup
Summary:
- Install dependency package
sudo apt-get install matchbox chromium x11-xserver-utils ttf-mscorefonts-installer xwit sqlite3 libnss3 sudo reboot
- Adding the following to /etc/rc.local:
if [ -f /boot/xinitrc ]; then ln -fs /boot/xinitrc /home/pi/.xinitrc; su - pi -c 'startx' & fi
- Create xinitrc file /boot/xinitrc
#!/bin/sh while true; do # Clean up previously running apps, gracefully at first then harshly killall -TERM chromium 2>/dev/null; killall -TERM matchbox-window-manager 2>/dev/null; sleep 2; killall -9 chromium 2>/dev/null; killall -9 matchbox-window-manager 2>/dev/null; # Clean out existing profile information #rm -rf /home/pi/.cache; #rm -rf /home/pi/.config; #rm -rf /home/pi/.pki; # Generate the bare minimum to keep Chromium happy! #mkdir -p /home/pi/.config/chromium/Default #sqlite3 /home/pi/.config/chromium/Default/Web\ Data "CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); INSERT INTO meta VALUES('version','46'); CREATE TABLE keywords (foo INTEGER);"; # Disable DPMS / Screen blanking #xset -dpms # disable DPMS (Energy Star) features. #xset s off # don't activate screensaver # Reset the framebuffer's colour-depth #fbset -depth $( cat /sys/module/*fb*/parameters/fbdepth ); # Hide the cursor (move it to the bottom-right, comment out if you want mouse interaction) #xwit -root -warp $( cat /sys/module/*fb*/parameters/fbwidth ) $( cat /sys/module/*fb*/parameters/fbheight ) # Start the window manager (remove "-use_cursor no" if you actually want mouse interaction) #matchbox-window-manager -use_titlebar no -use_cursor no & matchbox-window-manager -use_titlebar no & # Start the browser (See http://peter.sh/experiments/chromium-command-line-switches/) chromium --app=http://192.168.0.150:8080/openhab.app?sitemap=demo done;
- Reboot
sudo reboot
Step 5
Configure tactile switch as power button From Adafruit
gpio pin from left to right : 23, 22, 21, 18 (I'm not use 23 because is on top of usb connector and the metal short the switch, i need a case)
Summary:
- Add rpi_power_switch to /etc/modules
sudo sed -i '$ a\rpi_power_switch' /etc/modules
- Append options rpi_power_switch gpio_pin=18 mode=0 to /etc/modprobe.d/adafruit.conf
sudo sed -i '$ a\options rpi_power_switch gpio_pin=18 mode=0' /etc/modprobe.d/adafruit.conf
- To make it active immediately run sudo modprobe rpi_power_switch or reboot
sudo modprobe rpi_power_switch