Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Raspberry Pi Zero 2 W #2829

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

jawsper
Copy link
Collaborator

@jawsper jawsper commented Oct 30, 2021

  • Updates for: kernel, rpi-firmware, rpi-wifi-firmware, v4l2loopback (needed for kernel 5.7+)

* Updates for: kernel, rpi-firmware, rpi-wifi-firmware, v4l2loopback (needed for kernel 5.7+)
@vleeuwenmenno
Copy link

I would like to use this with my Zero 2 W, is there a way I can compile a image myself.
Or can someone just approve this PR and make a new release 🙃

@starbasessd
Copy link

@vleeuwenmenno
https://github.com/ccrisan/motioneyeos/wiki/Building-From-Source
Issue: the version of buildroot in the source is 2 years old, and doesn't know about PiZero2W
#2827 (comment)
seems to mostly work, but not 100% tested. YMMV

@FriendlyNGeeks
Copy link

FriendlyNGeeks commented Dec 8, 2021

I downloaded @jawsper image make sure you name wifi config ".conf" most important part. any word on when this merge will happen?

@MarkJC67
Copy link

MarkJC67 commented Dec 10, 2021

I successfully installed your img and it successfully booted my Pi Zero 2W into motioneyeOS (eventually after I creating the wpa_supplicant.conf file and ssh correctly!) However I stupidly click the "Check For Updates" and of course it downloaded and overwrote your setup installation and would not boot up afterwards! I can easily re-install but I guess we need this fix checked out and updated to the main repository soon. Thanks for your work. :-) Oh after rebooting and changing too a static IP - I lost the date and time from the NTP. This might be due to my setup but it was working under DHCP.

@starbasessd
Copy link

@MarkJC67 It is always better to have your DHCP server issue a static (reserved) IP address, less chance of 'messing things up'.
As to 'updates', that's a problem on @jawsper 's side. (If it were me, I'd disable it.)
As to Time settings, what are you using? Failure to connect to an internet time source usually indicates a bad gateway setting, bad subnet mask setting, or a bad DNS setting.
It would explain it if you were able to get a time sync with DHCP, that one of the above is bad.
If you insist on setting static ip on the Pi, use the settings here:
https://github.com/ccrisan/thingos/wiki/static_ip.conf
static_ip.conf example:


STATIC_IP="192.168.42.1/24"
STATIC_GW="192.168.42.1"
STATIC_DNS="192.168.42.1"


Change as appropriate for your network
Place in the /boot partition along with wpa_supplicant.conf and ssh or ssh.txt files

@rickblair
Copy link

I downloaded the release image and wifi seems to be missing. WLAN0 interface is missing. I can use a USB network adaptor and boot. The only network interfaces present are lo and eth0.
The boot log looks like this:

---- booting motionEyeOS unknown ----

  • Detecting disk device: /dev/mmcblk0
  • Creating data partition: done
  • Formatting data partition: done
  • Mounting data partition: done
  • Copying data skeleton: done
  • Mounting filesystems: done
  • Mounting overlay filesystems: done
  • Setting empty root password: done
  • Copying version file: done
  • Setting UTC timezone: done
  • Loading kernel modules: done
  • Setting hostname: done
  • Configuring CPU frequency: done
  • Starting syslogd: done
  • Loading device-tree overlays: done
  • Starting throttle watcher: done
  • Starting eudev: done
  • Starting watchdog: done
  • Starting rngd: done
  • Preparing AP interfaces: none
  • Starting wpa_supplicant: no device
  • Configuring wireless network: no device
  • Configuring wired network: no device
    ---- shutting down motionEyeOS unknown ----

there is nothing in dmesg or messages that indicate anything failed.

Any clues as to where to begin?

@starbasessd
Copy link

@rickblair There is a build that works here:
#2827 (comment)
The issue for any 'official release' is that they are pre-release of the PiZeroW2, and buildroot doesn't support the other chips used on it.

@rickblair
Copy link

rickblair commented Dec 31, 2021 via email

@jawsper
Copy link
Collaborator Author

jawsper commented Jan 19, 2022

Created a new release updating rpi-firmware and rpi-wifi-firmware to support Pi Zero 2W revision 2.1 https://github.com/jawsper/motioneyeos/releases/tag/20220119-dev

@starbasessd
Copy link

@herdier0 Did you post then delete your post?

@Herdeir0
Copy link

I did, I was having this exact problems until I realized that my SSID was missing a character... Spent hours trying to understand the problem, to realizing that it was my totally my fault.
Anyways, the 20220119 works! My RPi Zero 2 is revision 3.16

@starbasessd starbasessd mentioned this pull request Feb 2, 2022
@motioneye-project motioneye-project deleted a comment from allpaulval Feb 2, 2022
@Gonioul
Copy link

Gonioul commented Feb 15, 2022

So, how can we properly update to 20220119-dev if update button is wrong?

@starbasessd
Copy link

@Gonioul Unfortunately, since it isn't a part of the Official issues, you need to do a backup, re-image, and restore data.

@jawsper
Copy link
Collaborator Author

jawsper commented Feb 15, 2022

Also, if the older version works on your Zero 2, there is no need to upgrade either

@Rtitude
Copy link

Rtitude commented Mar 25, 2022

I have the same issue as rickblair: #2829 (comment)

New to all this, and no coding background.
I have been able to get motioneyeos working on my 3b and 3b+ by just flashing the image and booting up those.

I have tried both images from jawsper, 2nd last gives the same as rickblair, latest gives this:

*Starting rngd: done
*Preparing AP interfaces: ap0
*Configuring wired network: no device
panic: rebooting in 40 seconds (caused by network)

Anything i can do to make the wifi work on the zero 2 w ?

Thanks in advance!

@starbasessd
Copy link

@Rtitude did you include / add your wpa_supplicant.conf file to the /boot partition to activate wifi before inserting and starting the PiZero2W?

@Rtitude
Copy link

Rtitude commented Mar 26, 2022

@Rtitude did you include / add your wpa_supplicant.conf file to the /boot partition to activate wifi before inserting and starting the PiZero2W?

I was 100% sure i did, turns out with trying different things i forgot, new flash and adding the wpa file it works now.
Thanks for pointing out my obvious mistake!

@MichaIng MichaIng added this to the v0.43.0 milestone Apr 20, 2022
@MichaIng MichaIng removed this from the v0.43.0 milestone Apr 20, 2022
@MichaIng
Copy link
Member

@jawsper
Could you update the commits to use latest stable RPi kernel with Linux 5.15, please?

@tegwin
Copy link

tegwin commented Apr 7, 2024

Looks like its trying to find a WIRED network which there is none.

CleanShot 2024-04-07 at 21 26 40

@tegwin
Copy link

tegwin commented Apr 8, 2024

I have actually found out why this does not work. It would appear that I spelled wpa_supplicant.conf incorrectly. I have now spelled it right and its working

@tegwin
Copy link

tegwin commented Apr 8, 2024

Actually another question, does any one know how to add multiple RPI Zeros to this. What installation do i use and how do I set it up

Thanks
Chris

@jawsper
Copy link
Collaborator Author

jawsper commented Apr 8, 2024

@tegwin You have (at least) two options:

  • Use one of the Raspberry Pis as a "master" and add the other cameras in there
  • Run a separate motioneye on some other machine in your network and add the cameras there

Either way, you can add multiple cameras by opening the menu, and then clicking the dropdown directly next to the menu button, there should be an option to "add camera...". You then select Remote motionEye Camera and enter the URL and credentials for your other camera.

@tegwin
Copy link

tegwin commented Apr 8, 2024

@tegwin You have (at least) two options:

  • Use one of the Raspberry Pis as a "master" and add the other cameras in there
  • Run a separate motioneye on some other machine in your network and add the cameras there

Either way, you can add multiple cameras by opening the menu, and then clicking the dropdown directly next to the menu button, there should be an option to "add camera...". You then select Remote motionEye Camera and enter the URL and credentials for your other camera.

Not sure I understand. When you say Use one as a Master. what do you mean ? Do I need to put any special camera software on this.

What I was hoping is that I could install camera software on a PI and just add it through the interface

@jawsper
Copy link
Collaborator Author

jawsper commented Apr 8, 2024

No extra software needed. Each of the cameras with motioneyeOS will run the motioneye software. You just need to pick one camera, and you can add the other cameras to that interface.

@tegwin
Copy link

tegwin commented Apr 8, 2024

No extra software needed. Each of the cameras with motioneyeOS will run the motioneye software. You just need to pick one camera, and you can add the other cameras to that interface.

Ok thanks. So I can just install MotionEyeOS on any device I want and then I can add them as additional from there. Is there is an option in the UI to do this ?

@martybates
Copy link

Hi folks. I need to set up a Pi Zero W, to act as an AP. I have been asked to set up cctv in out local apiary, and it is remotely located without internet or wifi. I am wondering if anyone had any link to an image of Motioneye, suitable for a PI zero W, that would already have the hostapd, dnsmasq, and the other files necessary for it to function. I have tried to create one myself, but my coding skills are just not up to the task. Both the bees and myself urgently need help. Thanks in advance.

@starbasessd
Copy link

This is for PiZero or Pi1, and has the files needed already. Here is the link to specific instructions.
I just confirmed the instructions are correct.

@zeekblitz
Copy link

Any chance this will get updated to work with the camera module 3?

@starbasessd
Copy link

Eventually, maybe. You could install RaspiOS Buster Lite, and follow the instructions here

@MichaIng
Copy link
Member

MichaIng commented Jul 3, 2024

The wiki is outdated. Here are up-to-date instructions: https://github.com/motioneye-project/motioneye?tab=readme-ov-file#installation

Camera module 3 supports only libcamera, and motion does not support libcamera, both outside of the control of motionEye and motionEyeOS. The only way to get it working is to use libcamerify as wrapper for motionEye: https://github.com/motioneye-project/motioneye/issues?q=is%3Aissue+is%3Aopen+libcamerify
Use Raspberry Pi OS Bookworm, follow the linked install instructions for motionEye, then:

apt install libcamera-tools libcamera-v4l2
sed -i 's|^ExecStart=/usr/local/bin/meyectl|ExecStart=/usr/bin/libcamerify /usr/local/bin/meyectl|' /etc/systemd/system/motioneye.service
systemctl daemon-reload
systemctl restart motioneye

Then you should be able to add the camera module 3 as regular V4L2 camera (not MMAL).

@starbasessd
Copy link

I bow to your superior intellect, sir, and will stop replying to issues here. As 0.43.x is still not complete, I recommend to users how to set up the last known good, but I shan't do so, further. Enjoy. BTW, the links I sent still work, even if a bit outdated.

@MichaIng
Copy link
Member

MichaIng commented Jul 3, 2024

Ah yeah sorry, the idea is not wrong. However, v0.42.1, has much more issues in the meantime then the left open ones in v0.43.y. So even that we did not make a stable release yet, the latest beta is much more stable than v0.42.1. Debian Buster is EOL, Raspbian Buster even more, so it should really not be installed anymore.

@zeekblitz
Copy link

@MichaIng
After following your instructions this is the resulting camera options, and none of them seem to work.

image

For reference I have raspian (bookworm) 64-bit OS installed on my pi zero 2 W, with a camera module V3 wide.

@MichaIng
Copy link
Member

MichaIng commented Jul 4, 2024

@zeekblitz
This looks like libcamerify is not in use. Can you verify it has been added to the effective systemd service?

systemctl cat motioneye
ps ax | grep -E '[m]otion|[l]ibcamerify'

...
ah, wait, the compat package seems to be no dependency (confusingly). Please try again after installing that one as well:

apt install libcamera-v4l2
systemctl restart motioneye

@zeekblitz
Copy link

@MichaIng this is my results

image

and I still am not seeing anything.

@MichaIng
Copy link
Member

MichaIng commented Jul 4, 2024

Ah, my mistake, I assumed the wrong meyectl path, which is /usr/local/bin/meyectl instead of /usr/bin/meyectl:

sed -i 's|^ExecStart=/usr/local/bin/meyectl|ExecStart=/usr/bin/libcamerify /usr/local/bin/meyectl|' /etc/systemd/system/motioneye.service
systemctl daemon-reload
systemctl restart motioneye

@zeekblitz
Copy link

after a long reboot, this seems to have worked. now I need to test on the bookworm lite OS.

@sonofcy
Copy link

sonofcy commented Jul 4, 2024 via email

@MichaIng
Copy link
Member

MichaIng commented Jul 4, 2024

and installed its per instructions on a Pi ZERO 2 (W). Worked forst time and I think it was a Ver 3 camera.

You mean you installed one of the images linked in the wiki, or one from here? The images linked in the wiki can definitely not run on Raspberry Pi Zero 2W, since they do not ship with the needed device tree. If it did boot, then you probably have another RPi model.

And for the camera: Did you add it as MMAL camera or as V4L2 camera? The camera module 3 does not support MMAL, so if that was the case, it was definitely an older version, probably 1.3?

Btw, I missed in between that this is an open PR. Did someone test the latest image from here, so that we can merge this PR? https://github.com/jawsper/motioneyeos/releases
A small update, but worth it to make it a little easier for Zero 2W users with older MMAL-compatible camera modules.

@zeekblitz
Copy link

I wasn't able to test it with an older camera, but it does work on a zero 2 W.

@sonofcy
Copy link

sonofcy commented Jul 5, 2024 via email

@gfmccutc77
Copy link

2 usual causes bad format of wpa_supplicant.conf file bad file name (if created on a Windows box) (ends up with a wpa_supplicant.conf.txt filename) For the first, if using Windows, use NotePad++ to edit it. If Mac, use nano the file format needs to look like:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=US

network={ ssid="SSID" psk="password" key_mgmt=WPA-PSK }

country needs to be yours, in lower case. SSID and Password are case SeNsTive, and need to be yours.

I am currently using a Zero 2 W with this build. I am running into this same "panic: rebooting (caused by network)" issue.

So far I have flashed the version from @jawsper and added the wpa_supplicant.conf file.
I started writing with the Pi Imager, changed to Balena Etcher.
I have also written the wpa_supplicant.conf file in Notepad, Notepad++, and Visual Studio Code, copying this example from @starbasessd

I get the same result every time. It gets to the "Starting wpa_supplicant: failed (brcmfmac) and then starts looping.

Any ideas what I am doing wrong??

@zeekblitz
Copy link

Are making certain to save the file as a .conf instead of a .txt? Another user also had a problem with the file name being spelled wrong, so I would double check that.

@gfmccutc77
Copy link

Are making certain to save the file as a .conf instead of a .txt? Another user also had a problem with the file name being spelled wrong, so I would double check that.

I did double check both of those issues. I have been through this particular issue from top to bottom a couple of times trying to figure out what I was doing wrong before posting anything. I have made sure that the conf file was named and spelled correctly, went through the code, and made sure that everything in there was identical to what @starbasessd had in that post, and I have written that file on 3 different platforms. I keep getting the same thing. I have even tried using different routers in the file to see if it just wasn't connecting to the router I originally had.

So what originally started me down this rabbit hole is I am trying to build an NVR that is Pi Zero 2 W based. All the research that I have done pointed me to motioneyeos for this. Maybe you have a different suggestion?? I am frustrated and at a loss at this point.

@zeekblitz
Copy link

zeekblitz commented Jul 10, 2024 via email

@gfmccutc77
Copy link

My only other thought would be if you have a case on it that might be blocking the wifi.

That wouldn't be it, I have it laying on top of my desk with no case at all. This is what the display is showing that made me change routers.

image

@MichaIng
Copy link
Member

MichaIng commented Jul 11, 2024

Okay, so generally it does work, and there is no reason why it wouldn't, since it is still all original RPi Ltd. kernel/bootloader/firmware, just newer. And it solves the initial update issue. Let's merge this. Whether/how to build new images is another question, as there is at least no workflow here on GitHub which would do so. Probably there is one triggered externally when creating a release tag, or @jawsper or @ccrisan can do those manually, and we can create a GitHub workflow afterwards.

I'd test with a pre-release first. Any last objections?

From the wiki. It was a fairly new Pi Zero 2. Not sure what camera, it is a Model 3 but I don’t remember if it was MMAL or V4L2.
My first computer was 1959. I retired from my Computer consulting company and retired in 2004. I know a Pi Zero 2 when I look at it as it is clearly marked on the back.

That is weird, as it is impossible. Or does the RPi bootloader just pick the RPi 3 device tree (same SoC), so that it does boot, just with some hardware features non-functional? However, in any case, it should work better with a more recent kernel which does contain a native Zero 2W device tree.

@gfmccutc77
Copy link

So update on my end.
I moved to another router, reflashed motioneyeos, and wrote the wpa_supplicant.conf file, powered it up and everything worked great. It may have just been the routers I attempted to connect to the first five times. So now I am down to connecting the cameras and playing with the settings to get good video from them. I have a couple of cameras connected now, but the video is really choppy.

I appreciate everyone chiming in on this and attempting to help figure it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.