Jul 19, 2014

Setting up PiTFT: Raspberry Pi drive recorder with GPS logger

Since we are done installing RaspiCam, now we are going to attach PiTFT and install required software. Before setting up PiTFT you should read through the complete document because it covers pretty much everything. What we need to do is to solder hardware and install some software packages.


When you open the PiTFT package you'll find extra 2x13 IDC socket for additional cobbler cable. PiFTF's female header covers Pi's all 26 GPIO header pins, but it actually uses 3 of them so it seems a good idea to connect cobbler cable to utilize the rest of 23 pins.
Cobbler breakout and cable package includes parts as shown below. You can stick the pins right to your breadboard so its really easy to add and test other modules like GPS and microphone amplifier module.

If you solder IDC socket, don't solder it on top of it. Do it on the reverse side.

And you make sure the white code, pin 1 indicator, goes right next to the female header.

When you solder female header and optional IDC socket, hardware part is done. Set the female header to your Pi's GPIO header pins.


Software part needs a bit more work than RaspiCam. You'll need to get 5 packages as described on the document:
  • http://adafruit-download.s3.amazonaws.com/libraspberrypi-bin-adafruit.deb
  • http://adafruit-download.s3.amazonaws.com/libraspberrypi-dev-adafruit.deb
  • http://adafruit-download.s3.amazonaws.com/libraspberrypi-doc-adafruit.deb
  • http://adafruit-download.s3.amazonaws.com/libraspberrypi0-adafruit.deb
  • http://adafruit-download.s3.amazonaws.com/raspberrypi-bootloader-adafruit-112613.deb
And then use dpkg to install them. The install log is shown below. You need to reboot your Pi to activate this change.


After rebooting your Pi, you need to let your Pi install screen driver. Commands are below. This modprobe command lets you load kernel modules. In this case we load spi-bcm2708 and fbtft_device.
If it goes O.K., the desktop shows up.

From next boot, we want Pi to load those kernel modules automatically so we add some modifications to /etc/modules. The modules listed in /etc/modules are loaded on boot so we don't have to repeat the previous step to load them.
And add new file: /etc/modprobe.d/adafruit.conf. rotate value indicate the rotation angle while frequency tells how fast it should drive the display. If the display acts weird document suggests you to drop this frequency value to 16000000.
Reboot and add some calibration setting.
Add some setting to .profile for later convinience.
Then run `startx` and desktop will show up.

Display STDOUT on PiTFT

If you wish to output standard output to PITFT on boot, make some change to /boot/cmdline.txt like below.

Then hit some commands and PiTFT will display standard output.
When you want to turn it off you simply write 0 to /sys/class/gpio/gpio252/value.

We are going to setup and calibrate touchscreen, now.