How to Control your Raspberry Pi Camera using a web UI (Updated)

Picamera2 Web UI
(Image credit: Tom's Hardware)

Update 9/2

We've updated the how to so that it now includes extra steps to auto-start the camera when the Raspberry Pi boots. We needed a quick microscope build to take pictures of the new Raspberry Pi Pico 2's RP2350 SoC, and so we used a microscope lens and stand, along with a Raspberry Pi Zero 2 W and a light right to fashion our own Wi-Fi enabled microscope using Mitchell's software.

Latest Videos FromTom's Hardware
Les Pounder
Associate Editor

Les Pounder is an associate editor at Tom's Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program "Picademy".

  • rpasto2
    Thanks for the write-up. Ran into the following issue when I got to running the "python app.py" command:

    INFO Camera camera.cpp:1033 configuring streams: (0) 640x480-XBGR8888 (1) 4056x3040-SBGGR12_CSI2P
    INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 4056x3040-SBGGR12_1X12 - Selected unicam format: 4056x3040-pBCC
    Traceback (most recent call last):
    File "/home/rpasto2/picamera2-WebUI-Lite-main/app.py", line 44, in <module>
    video_config = picam2.create_video_configuration(main={'size':resolution}, sensor={'output_size': mode, 'bit_depth': mode})
    TypeError: create_video_configuration() got an unexpected keyword argument 'sensor'

    I'm able to run "libcamera-hello -t 0" so I know the camera is there and working. Not sure where the WebUI Lite may be going wrong. I running this on a Raspberry Pi Zero W v1. I know WebUI Lite is untested on v1 so may not be supported. Any help would be appreciated.
    Reply
  • rpasto2
    rpasto2 said:
    Thanks for the write-up. Ran into the following issue when I got to running the "python app.py" command:

    INFO Camera camera.cpp:1033 configuring streams: (0) 640x480-XBGR8888 (1) 4056x3040-SBGGR12_CSI2P
    INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 4056x3040-SBGGR12_1X12 - Selected unicam format: 4056x3040-pBCC
    Traceback (most recent call last):
    File "/home/rpasto2/picamera2-WebUI-Lite-main/app.py", line 44, in <module>
    video_config = picam2.create_video_configuration(main={'size':resolution}, sensor={'output_size': mode, 'bit_depth': mode})
    TypeError: create_video_configuration() got an unexpected keyword argument 'sensor'

    I'm able to run "libcamera-hello -t 0" so I know the camera is there and working. Not sure where the WebUI Lite may be going wrong. I running this on a Raspberry Pi Zero W v1. I know WebUI Lite is untested on v1 so may not be supported. Any help would be appreciated.
    Looks like it's due to outdated OS (running on Bullseye).

    https://github.com/monkeymademe/picamera2-WebUI-Lite/issues/15
    Reply
  • codemonkey2k5
    Thank you for this, is there any way to get this service to start on boot? (instructions for a noob please)
    Currently, I have to ssh in to run the start command but it stops the second I disconnect Putty.
    I'm running this headless as a 3D printer camera.

    Thank you!
    Reply