pi-webcam
pi-webcam copied to clipboard
Webcam use on new Raspberry Pi Zero 2 W?
This issue is open to investigate whether this project works correctly on the Raspberry Pi Zero 2 W. I should've tested this earlier, but I completely forgot to do it! Has anyone else tested on one?
Yes, I have one here and I installed it but it's not working. What kind of input can I give you in order to help make this work?
For me it works, but unfortunately only on Windows. On macOS nothing happens. I haven't tried Linux yet.
I have revise my statement. After switching some USB cables it's now working wonderfully. My OS is Fedora 34.
For the latest macOS, see also this bug tracked on the showmewebcam repo: https://github.com/showmewebcam/showmewebcam/issues/164
(And consider giving showmewebcam a spin, too—it's quite nice!)
I'm running OSX 12.0.1 now but I was running the previous version when I originally posted.
I tried running with the known good 2020 - Zero 2 W did not boot (assume firmware not included for that hardware) With the latest RPi OS, my issue was no detection and a single maxed-out RPi CPU Core running the camera.
I'll burn the image again and run the setup script, try it out with my windows 10 box. see if it's a OSX thing aka https://github.com/showmewebcam/showmewebcam/issues/164 or a Pi Zero 2 W thing
Thanks Jeff for the nice words! I'm trying to get the image to work on Pi Zero 2W, but so far it has been quite fruitless for a different reason: I can't get the image to boot.
I have put the right dtb to the right place, and uprevved the kernel, but I have been stuck with the rainbow screen.
https://github.com/showmewebcam/showmewebcam/issues/168
I have my changes pushed to the PR there as you can see, and I would appreciate a second pair of eyes to help me understand why my PR did not resulting in a booting image.
I see the service in a failed state so can't connect at all. New to troubleshooting Linux services but I'm pulling logs using journalctl -u piwebcam.service:
Nov 08 20:38:13 Pi2 systemd[1]: Started Pi webcam. Nov 08 20:38:14 Pi2 sudo[362]: pi : PWD=/home/pi/uvc-gadget ; USER=root ; COMMAND=/home/pi/uvc-gadget/multi-gadge> Nov 08 20:38:14 Pi2 sudo[362]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000) Nov 08 20:38:14 Pi2 sudo[362]: pam_unix(sudo:session): session closed for user root Nov 08 20:38:14 Pi2 piwebcam[484]: unknown control 'auto_exposure_bias' Nov 08 20:38:14 Pi2 piwebcam[485]: unknown control 'contrast' Nov 08 20:38:14 Pi2 piwebcam[486]: unknown control 'video_bitrate' Nov 08 20:38:15 Pi2 sudo[487]: pi : PWD=/home/pi/uvc-gadget ; USER=root ; COMMAND=/home/pi/uvc-gadget/uvc-gadget > Nov 08 20:38:15 Pi2 sudo[487]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000) Nov 08 20:38:15 Pi2 sudo[487]: pam_unix(sudo:session): session closed for user root Nov 08 20:38:15 Pi2 piwebcam[353]: /home/pi/uvc-gadget/piwebcam: line 13: 487 Segmentation fault sudo /home/pi/u> Nov 08 20:38:15 Pi2 systemd[1]: piwebcam.service: Main process exited, code=exited, status=139/n/a Nov 08 20:38:15 Pi2 systemd[1]: piwebcam.service: Failed with result 'exit-code'.
I am using a more generic 5mp camera, not the official products linked, with a new Zero W 2. OS is Raspbian lite, trying with standard raspbian now.
Same issue, service in a failed state, on a new SD card w/ full Raspbian:
pi@Pi2:~ $ journalctl -u piwebcam.service -- Journal begins at Sat 2021-10-30 04:36:50 PDT, ends at Mon 2021-11-08 23:26:25 PST. -- -- Boot f206d713af0d42a7a84b6949a9c457ca -- Nov 08 23:24:27 Pi2 systemd[1]: Started Pi webcam. Nov 08 23:24:27 Pi2 sudo[369]: pi : PWD=/home/pi/uvc-gadget ; USER=root ; COMMAND=/home/pi/uvc-gadget/multi-gadget.sh Nov 08 23:24:27 Pi2 sudo[369]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000) Nov 08 23:24:28 Pi2 sudo[369]: pam_unix(sudo:session): session closed for user root Nov 08 23:24:28 Pi2 piwebcam[513]: unknown control 'auto_exposure_bias' Nov 08 23:24:28 Pi2 piwebcam[519]: unknown control 'contrast' Nov 08 23:24:29 Pi2 piwebcam[520]: unknown control 'video_bitrate' Nov 08 23:24:29 Pi2 sudo[521]: pi : PWD=/home/pi/uvc-gadget ; USER=root ; COMMAND=/home/pi/uvc-gadget/uvc-gadget -f1 -s1 -r0 -u /dev/video1 -v /dev/video0 Nov 08 23:24:29 Pi2 sudo[521]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000) Nov 08 23:24:29 Pi2 sudo[521]: pam_unix(sudo:session): session closed for user root Nov 08 23:24:29 Pi2 piwebcam[354]: /home/pi/uvc-gadget/piwebcam: line 13: 521 Segmentation fault sudo /home/pi/uvc-gadget/uvc-gadget -f1 -s1 -r0 -u /dev/video1 -v /dev/video0 Nov 08 23:24:29 Pi2 systemd[1]: piwebcam.service: Main process exited, code=exited, status=139/n/a Nov 08 23:24:29 Pi2 systemd[1]: piwebcam.service: Failed with result 'exit-code'.
The segfault seems to be a better lead. You (or someone else) needs to diagnose the crash with a debugger (ala gdb).
The hard part is to catch the crash at the right time. Seems like you could ssh to it, so I think compiling uvc-gadget with -g and then gdb and attach it to the process should theoretically work. But I've got my hand quite full and can't realistically assist with debugging the crash.
I may be able to figure out how to do this over the weekend,
By the way, before you do that, it might be worthwhile to check out Petr Vavrin's repo to see if Petr has fixed it already:
https://github.com/peterbay/uvc-gadget
Just adding to the issue, I noticed from this issue that 64-bit doesn't yet support raspistill, in which it may be the problem?
I do have the issue that @Selicos has, it doesn't run on win/mac/linux because it fail to run piwebcam service.
https://github.com/raspberrypi/firmware/issues/1584
Last edit: raspistill isn't builtin anymore not even into the 32-bit, we need to compile it or use something that fit our needs, please let me know if I missed something.
pi@raspberrypi:~ $ service piwebcam status
● piwebcam.service - Pi webcam
Loaded: loaded (/etc/systemd/system/piwebcam.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-11-11 00:19:16 GMT; 2 days ago
Process: 384 ExecStart=/home/pi/uvc-gadget/piwebcam (code=exited, status=1/FAILURE)
Main PID: 384 (code=exited, status=1/FAILURE)
Nov 11 00:19:16 raspberrypi piwebcam[384]: unknown control 'auto_exposure_bias'
Nov 11 00:19:16 raspberrypi piwebcam[384]: unknown control 'contrast'
Nov 11 00:19:16 raspberrypi piwebcam[384]: unknown control 'video_bitrate'
Nov 11 00:19:16 raspberrypi sudo[517]: pi : TTY=unknown ; PWD=/home/pi/uvc-gadget ; USER=root ; COMMAND=/home/pi/uNov 11 00:19:16 raspberrypi sudo[517]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 11 00:19:16 raspberrypi piwebcam[384]: V4L2: /dev/video0 is no video capture device
Nov 11 00:19:16 raspberrypi piwebcam[384]: UVC: device open failed: No such file or directory (2).
Nov 11 00:19:16 raspberrypi sudo[517]: pam_unix(sudo:session): session closed for user root
Nov 11 00:19:16 raspberrypi systemd[1]: piwebcam.service: Main process exited, code=exited, status=1/FAILURE
Nov 11 00:19:16 raspberrypi systemd[1]: piwebcam.service: Failed with result 'exit-code'.
Same here, doesn't work on bullseye :( Tried to install buster instead, but had some issues installing updates
@gregbiv it worked for me like a charm with this 32-bit.
The only issue is with the 1080p, I wanted to test the limits but no luck with either 64-bit nor the 1080p.
https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2020-12-04/
Can report the same. Since the camera drivers changed, it's probably the best to stick with buster, I've tried the lite version from 28.05.2021, works as expected
Unfortunately, Debian Buster doesn't work on Pi Zero 2 W and piwebcam doesn't work on Bullseye
Can’t be true, it works on mine. At least I didn't encounter any problems, so I assume it should work
Got it work with the mentioned Buster lite version directly on the Pi Zero 2 W. For future projects there is a new kid on the block https://www.raspberrypi.com/documentation/accessories/camera.html
Thank you for sharing @A12BA5E but looks like a lot of work, I would try to make it work in the weekend, if no one would got it working before then.
I just finished replicating this project on a Pi Zero 2 W with a cheap camera bought from AliExpress. Working fine, using the Buster Lite 32bit image. For this case, had to enable legacy camera support to have video output. Only issue is the camera needing to be rotated 90º, but that's for another topic/issue
I just got it working on two Raspberry Pis Zero 2 W . The only issues I ran into were an apparent cable misconnect on one, and on the other I was running the playbook on a different account after already having customized the pi myself. I had to reseat the cable for the former and edit a bunch of files for the latter. I could have also just installed from the pi user for the latter, but I'm stubborn.
Tested as webcams for Win10 and MacOS Big Sur (edit 2: Intel Macbook Pro 2017) through a powered USB hub.
Edit: Actually, I may have had to manually do a pip3 install --upgrade pip and re-run the pip installs. I copy-pasted the setup commands from the readme but they initially failed. The playbook worked fine, though, as long as run as the pi user.
Can confirm it works on RPiZW2 by using the legacy RPi OS Lite image and doing the pip3 install --upgrade pip (as root) before running the ansible part. Without pip upgrade ansible fails pretty quickly complaining about Yaml. Yaml will not get installed with out upgrading pip3 for some reason.
Was able to install using @midnightfreddie's suggestion. I will add that you can install headlessly on the Zero 2 W by adding a configured wpa_supplicant.conf file along with ssh to the boot partition and then connecting over WiFi.
I can also confirm that the legacy Lite build can get this up and working on a Zero 2 W, however it did fail to boot/ provide a USB device error in Windows when I attempted to edit it to display with 1080p video in this link here:
https://github.com/geerlingguy/pi-webcam/issues/4#issuecomment-701675173
Can confirm it is working, at least for 720p, using the older version of linked here in the comments. I split up the app installs and did "sudo pip3 install --upgrade pip" before the last "sudo pip3 install --no-binary pyyaml ansible". My setup is pi zero 2 w, with pi HQ cam and 6mm lens. All working in win 10, haven't tested on my win 11 pc yet.
Not working for me I'm afraid. Pi Zero 2, HQ camera, M1 MacBook Air running 12.1 Monterey. I followed the main install instructions, but running "sudo pip3 install --upgrade pip" as the first thing once I had SSH into the pi. everything seemed to install with no errors, but my Mac doesn't see it as a webcam. Could this be a similar issue as faced by ShowMeWebcam? (https://github.com/geerlingguy/pi-webcam/issues/54#issuecomment-963119085)
Not working for me I'm afraid. Pi Zero 2, HQ camera, M1 MacBook Air running 12.1 Monterey. I followed the main install instructions, but running "sudo pip3 install --upgrade pip" as the first thing once I had SSH into the pi. everything seemed to install with no errors, but my Mac doesn't see it as a webcam. Could this be a similar issue as faced by ShowMeWebcam? (#54 (comment))
For me I had to run "sudo apt update && sudo apt install -y python3-dev python3-pip libyaml-dev libffi-dev git" Then "sudo pip3 install --upgrade pip" Followed by "sudo pip3 install --no-binary pyyaml ansible"
Essentially removing everything after && in the original instructions. Then follow the rest like normal. Personally I am working on tweaking the current v4l2 control settings for 720p for best quality and white balance, since 1080p still locks up the pi0 2 when trying to connect it to a windows pc. I haven't tried leaving both 720 and 1080p options, yet.
That still doesn't work for me.
All the individual commands seem to complete properly but when I reboot the Pi after running the Ansible playbook I can't see it as a new webcam.
Out of interest what is the difference between your commands and what I did? It looks just like the order of the pip upgrade was changed, but why should that matter?
That still doesn't work for me. All the individual commands seem to complete properly but when I reboot the Pi after running the Ansible playbook I can't see it as a new webcam.
Out of interest what is the difference between your commands and what I did? It looks just like the order of the pip upgrade was changed, but why should that matter?
![]()
Looks like the way you installed it should work as well. Has any of the other UVC gadget projects worked on M1 chipset Macs yet? It sounds like the uvc driver isn't working correctly on your mac. I know this current setup and how ansible "installs" everything works for windows 10/11 and most linux OSes, but not sure about M1 macs. I would test on another computer to see if the pi webcam is functioning at all. If it works on another computer I would dig around and check for UVC gadget issues with m1 macs.
The Raspberry Pi Zero 2 W with the Raspberry Pi OS Lite (Legacy) works fine for me. When I tried it for the first time, pyyaml was not installed, so I installed it manually and it worked.