You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Equipment monitoring using Pi Zero 2 W cameras #11
Need to order tripod, pi zero case, and tripod nut.
Add documentation page to devices dir (aside: need to expose device pages)
Possible setups:
YT live streaming
MQTT "point and shoot"
other streaming/camera feed/API access (Kafka?)
Possible demo extensions:
HeinSight
observing linear actuator (picture OK), fan (livestream, zoomed in), MyCobot 280, capper/decapper (picture or video OK), Jubilee system, OT-2, microscopes
For the setup, also important to have a micro USB to female USB-A cable (comes in the pi zero 2 W kits), and a keyboard/mouse combo (however in this case maybe you need two USB ports or a USB splitter)
For the camera mount, a small Phillips screwdriver works
I have the hardware setup but I think we need a smaller nut to connect to the tripod or PrimeCables mount. The current one is too thick so the standoffs can't sit flush on the case.
On the software side of things, I believe we'll building using picamera2. What sort of MWE/system would you like me to build?
Nice! Ok, can you identify a nut (maybe on Amazon) that you think will work OK? For the software, it would be great if you could try to get a YouTube livestream set up with it. I'll send credentials for an "AC hardware stream" account, or you can use a personal account for testing.
Before that, following a tutorial to get the video feed displaying on the desktop of the Pi Zero 2W would be a good start (and a really short video demo of it from your phone would be nice, too)
EDIT: and make sure to invert the camera feed with the software (specific to this camera mount)
Sounds good, I'll look into that. Regarding the video feed displaying on the desktop of the Pi Zero 2W, I was wondering if there was something specific you wanted differently than the attached video above. Thanks!
Oh, sorry! Somehow I missed that. That looks great. I'm also seeing that the PDF you linked to is very comprehensive. Anything in particular you'd want to note about following that guide? E.g., certain install commands you used. It would be great if you could also include the code you ran to produce the preview.
Past that, I'd say you're good to move onto setting up a livestream as well some of the other camera modules (the latter of which I imagine will be straightforward).
Stream is now back up with "excellent". Might be worth tracking onboard temperature or some other indication of what might be going wrong. I'm guessing it probably would have restored the stream with the 8-hr restart.
@pranshu-ui was running into issues with setting up a new picam for equipment monitoring and I tried to do it as well. We both ran into the same issues. when manually starting the script, it returns a 200 error:
is there something with the aws/youtube connection that changed? i can see it created a playlist and is trying to connect, but the stream doesnt start. is this a hint at what may be the issue?
I set up a fresh device with @ZeqingBao and we ran into the following error at the end. I saw the broadcast on YT but the stream hadn't started. Will need to debug later
python3[7075]: Stream #1:0: Subtitle: text
python3[7075]: Codec AVOption preset (Encoding preset) specified for output file #0 (rtmp://a.rtmp.youtube.com/live2/XXXX-XXXX-XXXX-XXXX-XXXX) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
python3[7075]: Stream mapping:
python3[7075]: Stream #0:0 -> #0:0 (pcm_u8 (native) -> aac (native))
python3[7075]: Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/XXXX-XXXX-XXXX-XXXX-XXXX':
python3[7075]: Metadata:
python3[7075]: encoder : Lavf59.27.100
python3[7075]: Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s
python3[7075]: Metadata:
python3[7075]: encoder : Lavc59.37.100 aac
python3[7075]: [flv @ 0x558d3fd140] Failed to update header with correct duration.
python3[7075]: [flv @ 0x558d3fd140] Failed to update header with correct filesize.
python3[7075]: Error writing trailer of rtmp://a.rtmp.youtube.com/live2/XXXX-XXXX-XXXX-XXXX-XXXX: Broken pipe
python3[7075]: size= 10kB time=00:00:10.54 bitrate= 8.1kbits/s speed=13.6x
python3[7075]: video:0kB audio:3kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 286.143280%
python3[7075]: Error closing file rtmp://a.rtmp.youtube.com/live2/XXXX-XXXX-XXXX-XXXX-XXXX: Broken pipe
python3[7075]: [aac @ 0x558d3fd9c0] Qavg: 65536.000
python3[7075]: Conversion failed!
Status update: PiCam setup blocked by OS/firmware shift (Bookworm → Trixie)
TL;DR:
Our current PiCam setup guide no longer works out-of-the-box. Recent Raspberry Pi OS/firmware changes associated with the Trixie transition (and what the Imager now surfaces by default) have changed key compatibilities. As a result, freshly imaged systems often boot but do not detect the camera module or provide libcamera tools as expected. We need to rebuild the step-by-step setup to account for these changes.
What changed:
Raspberry Pi Imager now prominently offers Debian Trixie/testing and Bookworm as “Legacy” images.
So, it’s easy to end up with:
Plain Debian (Trixie or Bookworm) that lacks Raspberry Pi’s kernel/firmware plumbing for camera module
Legacy builds whose compatibility differs from our guide.
As a result, even though the OS shows “Bookworm” (Debian 12), the kernel/firmware stack isn’t the Raspberry Pi one we rely on. That breaks camera detection and libcamera tooling used in our instructions.
Current Behaviour
Flash a fresh image following the old guide (using what Imager currently suggests).
Boot a Pi Zero 2 W.
Observe
libcamera-hello missing or unavailable until extra repos are added.
Even with libcamera installed, no cameras listed:
libcamera-hello` --list-cameras # → empty
Kernel shows generic Debian instead of Raspberry Pi’s downstream build:
uname -a # shows no "+rpi" suffix
ls -l /dev/video* # video10/11/12 only; no /dev/video0 (video0 means cam is connected)
dmesg | grep -i unicam # empty (driver never bound)
Why this blocks us
Our pipeline assumes:
Raspberry Pi OS Lite kernel 64 bit with +rpi patches
Raspberry Pi firmware for the CSI (unicam) stack
libcamera-apps available in the Raspberry Pi repos
predictable behavior of the camera overlay/driver.
With the Trixie-era shift surfaced by Imager, those assumptions are no longer guaranteed, so the camera never turns on and the guide fails at the first mile.
Next step (what we will do)
We need to rewrite the step-by-step setup to be Legacy-aware and robust to the new Imager catalogue to this version specifically:
Run libcamera-hello --list-cameras and capture the detected sensor.
libcamera installed but no cameras listed → check ribbon orientation, connector, and dmesg | grep -i unicam.
Only /dev/video10/11/12 present → ISP nodes only; sensor not detected.
Bottom line: This is a breaking change induced by the Bookworm → Trixie era update path and what Raspberry Pi Imager now presents by default. Our current guide assumes compatibilities that no longer hold. We’ll rebuild the setup instructions so new devices follow the correct OS/firmware path and pass automated pre-flight checks before proceeding.[DIR] raspios_lite_arm64-2024-03-15/ 2024-03-15 16:13
Thank you for documenting! In meantime, we'll use bookworm for #340 until we can implement the changes and leave enough time to check that it's stable (the original system now has cameras that have been streaming with high uptime for months). Could you include a quick video recording for how to install the legacy bookworm using the latest version of imager?
I set up a pi with trixie from scratch. There was a library rename, that I added logic for in device.py (merged to main), so should be OK now. All other installation steps were the same.
Activity
sgbaird commentedon Sep 5, 2024
Also, setting up the tripod and case.
There's a second case type, with no tripod attachment
sgbaird commentedon Sep 16, 2024
I ordered ball bearing attachments for the prime cables clamp tripods.
The additional four should be set up in a similar manner. There's one extra in the cabinet (might move).
sgbaird commentedon Sep 20, 2024
For the setup, also important to have a micro USB to female USB-A cable (comes in the pi zero 2 W kits), and a keyboard/mouse combo (however in this case maybe you need two USB ports or a USB splitter)
For the camera mount, a small Phillips screwdriver works
Mount item and instructions:
https://www.pishop.ca/product/pro-mini-camera-mount-for-raspberry-pi-zero/
https://thepihut.com/blogs/raspberry-pi-tutorials/pro-mini-camera-mount-assembly-guide
sgbaird commentedon Sep 30, 2024
@Jonathan-Woo any updates?
Jonathan-Woo commentedon Oct 3, 2024
IMG_3038.MOV
I have the hardware setup but I think we need a smaller nut to connect to the tripod or PrimeCables mount. The current one is too thick so the standoffs can't sit flush on the case.
On the software side of things, I believe we'll building using picamera2. What sort of MWE/system would you like me to build?
sgbaird commentedon Oct 3, 2024
Nice! Ok, can you identify a nut (maybe on Amazon) that you think will work OK? For the software, it would be great if you could try to get a YouTube livestream set up with it. I'll send credentials for an "AC hardware stream" account, or you can use a personal account for testing.
Before that, following a tutorial to get the video feed displaying on the desktop of the Pi Zero 2W would be a good start (and a really short video demo of it from your phone would be nice, too)
EDIT: and make sure to invert the camera feed with the software (specific to this camera mount)
Jonathan-Woo commentedon Oct 4, 2024
Sounds good, I'll look into that. Regarding the video feed displaying on the desktop of the Pi Zero 2W, I was wondering if there was something specific you wanted differently than the attached video above. Thanks!
sgbaird commentedon Oct 4, 2024
Oh, sorry! Somehow I missed that. That looks great. I'm also seeing that the PDF you linked to is very comprehensive. Anything in particular you'd want to note about following that guide? E.g., certain install commands you used. It would be great if you could also include the code you ran to produce the preview.
Past that, I'd say you're good to move onto setting up a livestream as well some of the other camera modules (the latter of which I imagine will be straightforward).
Thanks for working on this.
sgbaird commentedon Oct 4, 2024
Sent you a stream key and the stream URL attached to https://www.youtube.com/@ac-hardware-streams channel.
sgbaird commentedon Oct 4, 2024
How is https://www.amazon.ca/Stainless-Small-Pattern-Machine-Finish/dp/B009EEZYE0/ ?
Jonathan-Woo commentedon Oct 4, 2024
Yeah that looks good, 1/4"
sgbaird commentedon Oct 8, 2024
The item arrived from amazon
sgbaird commentedon Oct 10, 2024
Accidentally got something that was 1/4" outside dimensions.. planning to order a new part.
49 remaining items
Update systemd service configuration for device.py
sgbaird commentedon Jul 3, 2025
Trying out a longer cable setup, courtesy of @kelvinchow23
PXL_20250703_201833944.mp4
Also trying with it plugged into a standard USB port instead of an outlet
This is
mfu2EDIT: says "excellent" connection, so seems like the longer cable and the lower power isn't an issue (?)
[-]Pi Zero 2 W camera for equipment monitoring[/-][+]Equipment monitoring using Pi Zero 2 W cameras[/+]sgbaird commentedon Jul 4, 2025
No data and disconnected from tailscale:
4ehl(SDL2)pd5d(SDL6)It would be good to check whether these are plugged in.
No data, but connected on tailscale:
zagr(SDL4)ac@rpi-zero2w-stream-cam-zagr:~ $ sudo journalctl -u device.service -f Jul 04 16:32:54 rpi-zero2w-stream-cam-zagr python3[692]: [48.0K blob data] Jul 04 16:37:02 rpi-zero2w-stream-cam-zagr python3[692]: [48.0K blob data] Jul 04 16:41:11 rpi-zero2w-stream-cam-zagr python3[692]: [47.9K blob data] Jul 04 16:45:19 rpi-zero2w-stream-cam-zagr python3[692]: [47.9K blob data] Jul 04 16:49:27 rpi-zero2w-stream-cam-zagr python3[692]: [48.0K blob data] Jul 04 16:53:35 rpi-zero2w-stream-cam-zagr python3[692]: [47.9K blob data] Jul 04 16:57:44 rpi-zero2w-stream-cam-zagr python3[692]: [48.0K blob data] Jul 04 17:01:52 rpi-zero2w-stream-cam-zagr python3[692]: [48.0K blob data] Jul 04 17:06:00 rpi-zero2w-stream-cam-zagr python3[692]: [48.0K blob data] Jul 04 17:10:08 rpi-zero2w-stream-cam-zagr python3[692]: [48.0K blob data]Restarting the service manually (note-to-self, make sure to redact stream key):
Stream is now back up with "excellent". Might be worth tracking onboard temperature or some other indication of what might be going wrong. I'm guessing it probably would have restored the stream with the 8-hr restart.
sgbaird commentedon Jul 10, 2025
Ilya is looking into some other mounting options to explore (e.g., suction cup). Self-reminder for adding links and pictures here.
kelvinchow23 commentedon Sep 17, 2025
@pranshu-ui was running into issues with setting up a new picam for equipment monitoring and I tried to do it as well. We both ran into the same issues. when manually starting the script, it returns a 200 error:
is there something with the aws/youtube connection that changed? i can see it created a playlist and is trying to connect, but the stream doesnt start. is this a hint at what may be the issue?
sgbaird commentedon Sep 17, 2025
I think it's the wrong Lambda URL, my bad - this had been changed and I forgot to tell you. I'll DM it to you.
EDIT: Confirming that was the issue. Could probably benefit from a more useful error message. I also deleted the other "upcoming videos"
sgbaird commentedon Sep 25, 2025
I set up a fresh device with @ZeqingBao and we ran into the following error at the end. I saw the broadcast on YT but the stream hadn't started. Will need to debug later
pranshu-ui commentedon Oct 8, 2025
Status update: PiCam setup blocked by OS/firmware shift (Bookworm → Trixie)
TL;DR:
Our current PiCam setup guide no longer works out-of-the-box. Recent Raspberry Pi OS/firmware changes associated with the Trixie transition (and what the Imager now surfaces by default) have changed key compatibilities. As a result, freshly imaged systems often boot but do not detect the camera module or provide libcamera tools as expected. We need to rebuild the step-by-step setup to account for these changes.
What changed:
Raspberry Pi Imager now prominently offers Debian Trixie/testing and Bookworm as “Legacy” images.
So, it’s easy to end up with:
As a result, even though the OS shows “Bookworm” (Debian 12), the kernel/firmware stack isn’t the Raspberry Pi one we rely on. That breaks camera detection and libcamera tooling used in our instructions.
Current Behaviour
Observe
Why this blocks us
Our pipeline assumes:
With the Trixie-era shift surfaced by Imager, those assumptions are no longer guaranteed, so the camera never turns on and the guide fails at the first mile.
Next step (what we will do)
| raspios_lite_arm64-2024-03-15/ | 2024-03-15 16:13 |
thru
https://downloads.raspberrypi.com/raspios_lite_arm64/images/
Bottom line: This is a breaking change induced by the Bookworm → Trixie era update path and what Raspberry Pi Imager now presents by default. Our current guide assumes compatibilities that no longer hold. We’ll rebuild the setup instructions so new devices follow the correct OS/firmware path and pass automated pre-flight checks before proceeding.[DIR] raspios_lite_arm64-2024-03-15/ 2024-03-15 16:13
sgbaird commentedon Oct 8, 2025
Thank you for documenting! In meantime, we'll use bookworm for #340 until we can implement the changes and leave enough time to check that it's stable (the original system now has cameras that have been streaming with high uptime for months). Could you include a quick video recording for how to install the legacy bookworm using the latest version of imager?
pranshu-ui commentedon Oct 8, 2025
Recording.2025-10-08.163844.mp4
The version of legacy OS was installed here:
https://downloads.raspberrypi.com/raspios_lite_arm64/images/
sgbaird commentedon Oct 14, 2025
Seems it can also be downloaded via imager
20251014-1741-37.5379464.mp4
sgbaird commentedon Oct 17, 2025
I set up a pi with trixie from scratch. There was a library rename, that I added logic for in device.py (merged to main), so should be OK now. All other installation steps were the same.