Getting a PiTFT working

Hi everyone,

I’m pretty new to resin io and I’m enjoying it so far. I’m trying to get a PiTFT working. I don’t need touchscreen events, I just want to show some content from Python with it. I have looked at a few things in the playground, mainly this node clock and this fullscreen browser.

Here’s my starting shell script:

udevd --daemon
udevadm trigger

echo "Running start shell script..."

if [ ! -c /dev/fb1 ]; then
    echo "loading piTFT kernel module"
    modprobe spi-bcm2835
    modprobe fbtft_device name=pitft verbose=0 rotate=270

    sleep 1

    mknod /dev/fb1 c $(cat /sys/class/graphics/fb1/dev | tr ':' ' ')
fi

modprobe v4l2_common && python demo.py &
cd /data
python -m SimpleHTTPServer 80

The PiTFT goes black, but it doesn’t show anything. Here’s the log output:

Systemd init system enabled.
17.10.17 11:32:04 (+0100) systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
17.10.17 11:32:04 (+0100) Detected virtualization 'other'.
17.10.17 11:32:04 (+0100) Detected architecture 'arm'.
17.10.17 11:32:04 (+0100) Set hostname to <30f7d8b>.
17.10.17 11:32:08 (+0100) Running start shell script...
17.10.17 11:32:08 (+0100) loading piTFT kernel module
17.10.17 11:32:10 (+0100) cat: /sys/class/graphics/fb1/dev: No such file or directory
17.10.17 11:32:10 (+0100) mknod: missing operand after ‘c’
17.10.17 11:32:10 (+0100) Special files require major and minor device numbers.
17.10.17 11:32:10 (+0100) Try 'mknod --help' for more information.
17.10.17 11:32:12 (+0100) Serving HTTP on 0.0.0.0 port 80 ...
17.10.17 11:32:19 (+0100) Application is already running 'registry2.resin.io/gifbooth/4f9813ac4ae91638f1ddbc9328c09781798a0fb8'

Does anyone have some steps to getting the PiTFT working? What modules do I need to install to get this working? I’m assuming there might also be some frame buffer copying involved, ala Adafruit?

Any help is much appreciated.

Hi @mikevanis,

The projects in the resin-io-playground are likely to be outdated, I think you will find useful resources in

These projects should have more up-to-date information on how to set up the piTFT screen, please let us know if that helped.

Best, Kostas

The beast one is probably one to start with, we use that quite a bit, when needing some quick demos at talks and other events :slight_smile: Looks like it was just updated very recently as well, so should likely work…

1 Like

@mikevanis Did you make any progress on this? Let us know if you need any more help!

Hi @pimterry, apologies for the radio silence! I’m back on my desk on Thursday, so I will report back. Once I get the piTFT stuff working, my next step is to start understanding how I can implement OpenCV python bindings with the resin.io toolchains for a project we’re working on. Will open another topic if I have trouble with that though!

Thanks again for all your help, will keep you posted!

Regarding that next step with openCV, I think there were people experimenting with it. It’s seems to be an old project, but might have some clue to get things running https://github.com/Mobile-CHAP/resin-opencv There’s also https://docs.resin.io/examples/projects/#smartbin (though it might be even older). At our spring hackathon there were people working with OpenCV, so definitley experience recently as well, though can’t seem to find any code uploaded somewhere so it’s more anecdotal…

Looking forward hearing what you build!