Osoyoo HDMI touchscreen and PiCam V2 setup guide

This setup has taken me quite some time to get functioning, so I'm posting this here to help anybody else who might be struggling to get a functioning setup.

I've used OctoPrint on a Pi4 for a while, but have always wanted the ability to control the printer, from the printer, rather than having to log on to a computer/phone to control things.

My first attempt was with a GPIO screen, but I finally gave up trying to get a GPIO screen to function (despite trying a few different guides, I could never get the screen to even display text), so bought an Osoyoo 3.5" HDMI touchscreen from Amazon in the UK - https://www.amazon.co.uk/OSOYOO-Touchscreen-LCD-Monitor-TFT-Audioausgang-Anleitung/dp/B086JPTKYV (currently out of stock, but they have the same model with a case - https://www.amazon.co.uk/gp/product/B0936SQ4W3/ )

The display worked immediately, but I still struggled to get the touchscreen functionality to work.

So after following several guides, I finally found a magic combination that works.

  1. Install Ocotpi (via raspberry pi imager)
  2. Install TouchUI (via Octoprint)
  3. Install touchscreen drivers as per the guide for online installtion - Raspberry Pi 3.5β€³ HDMI Touch Screen Installation for Raspberry Pi OS Β« osoyoo.com
  4. Install TouchUI via SSH - https://github.com/BillyBlaze/OctoPrint-TouchUI/wiki/Setup:-Boot-to-Browser

This should then give you a functional touchscreen, and be able to control the printer via TouchUI.

The next problem I then had was getting a PiCam V2.1 to work.
Using a vanilla install of Ocotpi, the cam would work without issue, but with the touch screen working as above, the PiCam didn't even show as being connected to the Pi4.

After some digging, and trying various config options, the solution was simple. The camera just needed activated in the Pi Config.
Log into SSH, then run-
sudo raspi-config
Once in the configuration screen, select Interface Options, then activate the camera.
Then reboot the Pi, and the camera works in OctoPrint.

At some point during the touchscreen installation, the camera operation must get disabled.

I hope this guide is useful to somebody, as it's taken me quite a few hours over the past few months to get this fully functional.