If you want to have the TFT display connected at the same time as I2C sensor(s), NeoPixels, or other hardware, then use a 2x20 ribbon cable to connect the spare rows of header pins on the underside of the PiTFT to a Pi Cobbler + as shown here. Then you can connect any desired hardware peripherals using the broken out pins on a breadboard that the Cobbler provides. The following connections are for the BME680 sensor connected via I2C.
- Cobbler SDA to BME680 SDA (blue wire)
- Cobbler SCL to BME680 SCL (yellow wire)
- Cobbler 3V to BME680 VIN (red wire)
- Cobbler GND to BME680 GND (black wire)
These connections are for the NeoPixel strand.
- Cobbler 5V to NeoPixel 5V power (red wire)
- Cobbler GND to NeoPixel GND (black wire)
- Cobbler 26 to NeoPixel DIN (green wire)
Software
I used the 2.8" PiTFT w/ Capacitive touch and installed the driver for it manually using mirror install commands from the Easy Install script from the Learn guide. The guide page documents several variations of the PiTFT, so be sure to run the mirror install command appropriate for the one you are using. For me this was:
sudo -E env PATH=$PATH python3 adafruit-pitft.py --display=28c --rotation=90 --install-type=mirror
The TFT command mentions "mirror", but on the Pi 5 under Wayland, this is will be treated as a second monitor with its own drawing area by default, not a mirror of an existing display.
Once the install is complete, you'll be prompted to reboot the Pi. After it comes up from the reboot, it should be showing part of the boot process, and then the desktop on the TFT display. Next there are a few system settings to change that make it easier to use both the TFT display and an HDMI display at the same time.
Open the Control Centre by clicking Start -> Preferences -> Control Centre.
In the Display section, set the On-screen Keyboard to Disabled.
In the Screens section, ensure that the layout of the screens shows the small SPI screen in the top left corner and the big HDMI screen to the right of it. If they aren't in this layout, then drag and move them to these positions.
In the Taskbar section, set the taskbar Location to the HDMI display.
Now the bot should be able to draw onto the TFT by keeping what it wants to show in the top left 320x240 pixels. I opted to use pygame-ce and just asked the bot to try it out.
Me:
I'm pretty sure it's not an AHT20, I have not connected one of those I don't think. We'll figure that out later. Next lets work on a TFT display for you. I have installed pygame-ce in your venv. And I've connected a TFT display and set it up so that the top left 320x240 pixels of the full system is shown on the TFT display. Can you try to to run a pygame-ce test script to show something on the TFT please?
Bot:
The script ran for 10 seconds and exited cleanly. You should have seen:
- Animated color-shifting background
- "Hello Pipbot!" text at the top
- A bouncing cyan circle
- Rotating red/green/blue rectangles
- FPS and time counters at the bottom
Did it show up on the TFT? 🖥️
Me:
I saw it on the main display. It created a window that looked like the correct size, but it was in the center of the HDMI display instead of on the TFT. Can you try to modify the script to move that window to the very top left (0,0) pixels coordinates?
Bot:
Added `SDL_VIDEO_WINDOW_POS = '0,0'` before init. Did it show up on the TFT this time?
Me:
Yes that time we did see it on the display. Is there a way to make it a borderless window so it won't have a title bar and will fit the 320x240 TFT perfectly?
Bot:
Added `pygame.NOFRAME` flag. Should now be a clean borderless 320x240 filling the TFT perfectly! 🎉
Me:
Awesome! that is working perfectly. Can you go ahead and save that as a tool so that you'll be able to draw more stuff on the display in the future easily.
Bot:
Done! Created `tft_display.py` module with a `TFTDisplay` class. Also updated `TOOLS.md` with docs for:
- **TFT Display** - usage examples and all drawing methods
- **BME680 Sensor** - quick reference
- **I2C Devices** - known addresses
- **Python venv** - installed packages
Now I can easily draw on the TFT anytime:
```python
from tft_display import TFTDisplay
tft = TFTDisplay()
tft.draw_text("🤖", (160, 120), center=True, size=64)
tft.update()
```
As the transcript shows, the first attempt rendered the pygame window on the HDMI display instead of the TFT. The bot was able to resolve that with one more tweak. Next I asked it to remove the window frame. Here is the test script it wrote running successfully on the TFT display
Dashboard
To validate that the sensor and the TFT display can both work together at the same time, I asked it to create a basic dashboard to show the data from the sensor on the display.
Me: can you please make a dashboard for the TFT display that shows live data from the BME680 sensor? Bot: The dashboard should be running on the TFT now! You should see: - **Title:** "🤖 Pipbot Sensors" - **Temperature** with live sparkline graph - **Humidity** with live sparkline graph - **Pressure** in hPa - **Air Quality** indicator (Good/OK/Poor based on gas resistance) The sparklines will build up over time as it collects readings every second. Can you see it? Press ESC to close when done, or let me know if there's any issues! 📊 Me: Thanks, yeah that is great I can see the dashboard. Are you able to flip it 180 degrees? The way I have the TFT oriented currently that would be more convenient. Bot: Done! Added `rotate_180` option to the TFTDisplay class. The dashboard should now be flipped 180°. Is the orientation correct now? 🔄 Me: perfect, that looks good now. Can you change the temperature to use Fahrenheit units please? Bot: Done! Temperature now shows in °F 🌡️
Here is a photo dashboard that it created
Page last edited February 03, 2026
Text editor powered by tinymce.