There's two ways you can use the 1.54" 240x240 display on the BrainCraft HAT. For machine learning purposes, the advanced method is the way to go, so that's what we'll be covering in this guide.
The easy way is to use 'pure Python 3' and Pillow library to draw to the display from within Python. This is great for showing text, stats, images etc that you design yourself. If you want to do that, the BrainCraft HAT has a pretty close layout to the Adafruit 1.3" Color TFT Bonnet including the same type of display and a joystick, though the pinouts are slightly different. If you choose this option, You can skip this page and view the Python Setup page for instruction for that display.
The advanced way is to install a kernel module to add support for the TFT display that will make the console appear on the display. This is cute because you can have any program print text or draw to the framebuffer (or, say, with pygame) and Linux will take care of displaying it for you. If you don't need the console or direct framebuffer access, please consider using the 'pure Python' technique instead as it is not as delicate.
If you plan on using the Pi Camera for vision projects, you will need to go with the advanced route!
Installing The 1.54" Kernel Module
We have tried to make this as easy as possible for you by providing a script that takes care of everything. There's only a couple of dependencies needed. To get everything setup, just run the following at the terminal:
cd ~ sudo pip3 install --upgrade adafruit-python-shell click sudo apt-get install -y git git clone https://github.com/adafruit/Raspberry-Pi-Installer-Scripts.git cd Raspberry-Pi-Installer-Scripts sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=st7789v_bonnet_240x240 --rotation=0 --install-type=mirror
When you get asked to reboot, reboot!
That's it! You will now have the BrainCraft HAT with a console display on it
Text editor powered by tinymce.