Let There Be Cats
The problem with shopping at Adafruit is that you go there to buy a battery and three days later when the box full of your impulse purchases arrives, you realise that you forgot to buy a battery. Haha, whoops! But such good impulse purchases they were! The best was this 2.8” PiTFT capacitive touch screen, which I’ve been having a lot of fun with this morning.
It plugs into the GPIO, the pins for attaching external hardware. I ordered a neat case at the same time, and it all fits nicely together. The case lid doesn’t fit on when the display’s there, but it still feels sturdy enough.
The PiTFT needs kernel support, which isn’t in by default. The Adafruit site has extremely straightforward instructions for how to expand the filesystem, install a new kernel and configure the PiTFT. I took the opportunity to move to a bigger SD card and grabbed the easy install image, thanking past-me for documenting how to put an image on an sd card because it’s been a while.
So then I had a Raspberry Pi with a tiny little X server and no keyboard. That’s… not that useful, it turns out. I had no idea what I wanted to do with this thing, so I defaulted to the primary purpose of the internet, displaying pictures of cats.
Google Photos has this feature where you can say “show me all of my pictures that are of cats”, which is kind of witchcraft, I think, but very useful in this kind of urgent cat-requiring situation. I copied a bunch to a ‘cats’ directory, and then used the frame buffer image viewer to display them.
pi@raspberrypi:~ $ sudo apt-get install fbi [...] pi@raspberrypi:~ $ sudo fbi -d /dev/fb1 -T 1 -a -noverbose -t 10 cats/*.jpg
What’s going on there:
- -d /dev/fb1: use this frame buffer device. /dev/fb0 is the HDMI port, if you have a monitor there, and and /dev/fbi is the display attached to the GPIO.
- -T 1: use this tty. Virtual terminals are on tty[1-6].
- -a: autozoom. Make the pictures fit.
- -noverbose: don’t display the name of the file under the picture
- -t 10: change the picture every 10s
- *.jpg: all of the cat pictures :-D
This cycles through all of the pictures in the cats folder, displaying each one for ten seconds. Which is… almost useful?
Btw, I didn’t know the difference between capacitive and resistive screens and maybe other people also don’t know, so here it is: resistive screens are made up of two layers. They register a touch when there’s enough pressure on the screen to make those two layers touch each other, passing a voltage through.
Capacitive screens are made of one layer, coated with a transparent conductive material, which registers a change in its electrical field when another conductive thing (like a human finger!) touches it. Capacitive screens are more sensitive, sharper and can do multi-touch, but you can only use them with a conductive thing, i.e., no styluses!