motioneye-project / motioneyeos

A Video Surveillance OS For Single-board Computers
Other
7.88k stars 902 forks source link

Pi Zero 5GHz USB Dongle support #2799

Open d-looper opened 3 years ago

d-looper commented 3 years ago

Preliminary Docs

I confirm that I have read the CONTRIBUTING guide before opening this issue.

I confirm that I have read the FAQ before opening this issue.

motionEyeOS Version

I am running motionEyeOS version: motionEyeOS 20200606

Board Model

I am using the following board/model: Pi Zero W

Camera

I am using the following type of camera: (choose from V4L2, MMAL, Network Camera, Fast Network Camera and Simple MJPEG Camera).

My camera model is: (insert your camera model, e.g. Logitech C290).

Network Connection

My motionEyeOS unit is connected to the network via: Wifi

Peripherals

I am using the following peripherals that I consider relevant to this issue:

Log Files

I consider the following log files relevant to this issue:

Ive been looking through here to find out if a specific USB wifi dongle has drivers natively for MotionEyeOS but i dont see an entry for the Zero: https://github.com/ccrisan/thingos/tree/dev/configs

Im looking specifically for drivers for RTL8811CU. Ive found in testing with 2 Zero Ws, 3b, and 4 that the 5ghz band might be a better option than 2.4 and i want to test that out. Im trying to keep my cameras wireless while still having smooth video as they are monitored throughout the day.

starbasessd commented 3 years ago

If you have motioneyeos on the Pi Zero, the easiest way to test is to 'blacklist' the onboard WiFi, reboot, then see if it comes back up: Place the Pi Zero SDCard in the machine where you did the image add file to /boot partition: modprobe.conf then add: blacklist brcmfmac blacklist brcmutil and save. Insert into the Pi Zero with the USB dongle and test. The Dongle should take over. WARNING: If it doesn't see your USB dongle WiFi, it will throw it into a panic loop. If it does work, and you want the onboard WiFi to resume control just delete the /boot/modprobe.conf file (you need to put back into wherever you did the image and original add file.) If your USB WiFi adapter, is working, (check via ssh session, run command "ip a" and connect to the ip address of wlan1 instead of wlan0), and you can test similarly, while the Pi Zero is up: nano /data/etc/modprobe.conf add: blacklist brcmfmac blacklist brcmutil [ctrl]x y [enter] reboot, and the USB should be up. I do not have your adapter, but I was able to connect a 8192cu (EDIMAX) via USB OTG cable, and connected to ssh on wlan1, and it worked. WARNING: If it doesn't see your USB dongle WiFi, it will throw it into a panic loop.

d-looper commented 3 years ago

Great thanks

d-looper commented 3 years ago

Ok, so i added the modprobe.conf to the boot partition, booted the pi, wireless connected, but "ip a" doesnt show a wlan1. Only wlan0. "lsusb" shows a device connected to usb. Im assuming that means that the drivers do not exist for the RTL8811CU in motioneyeos.

d-looper commented 3 years ago

also on boot, when it does connect to the wireless, it shows (brcmfmac) on that line.

starbasessd commented 3 years ago

With the onboard properly disabled, if it is showing wireless, it should be the USB dongle. Interesting. Let me cogitate a few...

starbasessd commented 3 years ago

BTW, with the dongle installed, but the other disabled, there wouldn't be a wlan1, only a wlan0.

d-looper commented 3 years ago

Also, if i do this after its booted : nano /data/etc/modprobe.conf, it opens up as a new file

starbasessd commented 3 years ago

Without any changes, just having the 8811 plugged in, do you get 2 wlan entries? wlan0 & wlan1? In either RaspberryPiOS or motionEyeOS?

d-looper commented 3 years ago

motioneyeos no, ill check raspberry pi os on my pi 4

starbasessd commented 3 years ago

I am able to find the 'drivers' for it, but not in a pre-compiled form. You can do a 'roll your own' build, instructions are here: https://github.com/ccrisan/motioneyeos/wiki/Building-From-Source but from what I'm seeing, it's not supported in the RPiOS directly, either...

d-looper commented 3 years ago

Nope, doesnt show up in PIos either. looks like ill have to find a different adapter. Do you know of any known working 5ghz usb adapters that do work with MotionEyeOS?

starbasessd commented 3 years ago

Nope, haven't looked. I have a cheap WiFi router dedicated to 2.4GHz for the PiZeros and 11.a,b,g cameras, and a general Dual Band WiFi router for my Pi3B+ and 4s. (Everything else uses the household 11ac WiFi). You might want to consider a cheap repeater that uses the 2.4GHz for AP, and 5GHz for uplink to give you a better signal/feed...

starbasessd commented 3 years ago

BTW, I use a Belkin F4U061 USB to ethernet adapter (works in RPiOS and motionEyeOS), EDIMax, Gigafast, Asus, HomuSpot, Zerox and a number of other USB A,B,G,N wifi dongles in both environments. The GigaFast requires me to copy a folder with the driver to both motionEyeOS and RPiOS and adding a line to modprob.conf for the ZyDas zd1211rw chipset device. I was hoping someone had done something similar for your RealTek...

d-looper commented 3 years ago

I thought about that too. I just tested a driver for the 8811 on my raspberry pi 4 and it does work . So if i was to custom build an image, what would i need to change to add that driver?

starbasessd commented 3 years ago

How did you install the driver?

d-looper commented 3 years ago

cloned from git, make install on the pi 4

starbasessd commented 3 years ago

No compile needed? Which git?

d-looper commented 3 years ago

udo apt install -y bc git dkms build-essential raspberrypi-kernel-headers git clone -b v5.8.1 https://github.com/fastoe/RTL8811CU_for_Raspbian cd RTL8811CU_for_Raspbian make sudo make install sudo modprobe 8821cu sudo reboot

starbasessd commented 3 years ago

Let me see where it puts the files for make install...

d-looper commented 3 years ago

by the way, thats for the 5.10 kernel. 5.4 and earlier is:

sudo apt install -y bc git dkms build-essential raspberrypi-kernel-headers git clone https://github.com/fastoe/RTL8811CU_for_Raspbian cd RTL8811CU_for_Raspbian make sudo make install sudo modprobe 8821cu sudo reboot

This is the link for it : https://github.com/fastoe/RTL8811CU_for_Raspbian

starbasessd commented 3 years ago

Thanks, trying to sort it out. It may be possible to compile on RPiOS and copy to motionEyeOS...

d-looper commented 3 years ago

im at the modification part of the custom build process. I have 2 servers running ubuntu so building a custom os isnt too much of an issue for me. I just dont know what i need to change here.

d-looper commented 3 years ago

This is the output from "sudo make install": (this is the 5.4 and lower kernel install)

pi@raspberrypi:~/RTL8811CU_for_Raspbian $ sudo make install mkdir -p /lib/modules/5.4.83-v7+/kernel/drivers/net/wireless/ install -p -m 644 8821cu.ko /lib/modules/5.4.83-v7+/kernel/drivers/net/wireless/ /sbin/depmod -a 5.4.83-v7+

d-looper commented 3 years ago

I havent been able to figure it out yet, any luck on your end?

starbasessd commented 3 years ago

No, haven't been able to test, hip deep in gators in another project. Might be this weekend before I can get back to it.

starbasessd commented 3 years ago

BTW. I am looking for a section called 'Networking' (in buildroot) but seems to be missing in action in motioneyeOS buildroot (./build.sh raspberrypi menuconfig). This is my current 'breaking point' right now.

d-looper commented 3 years ago

yeah i noticed the same thing

d-looper commented 3 years ago

is it possible to move the driver folder over after the os creation but before the os image is created?

starbasessd commented 3 years ago

Unknown at this time...

d-looper commented 3 years ago

thats where i have been experimenting lately since i didnt fins anything in the menuconfig

Ventnts commented 3 years ago

I wanted to use low energy Bluetooth with Cris's project. Has anyone done that yet?

starbasessd commented 3 years ago

@Ventnts For what funtionality?

Ventnts commented 3 years ago

@starbasessd I want to use DD WRT combined with a BT backend network with multiple cameras, with one master. I am starting to learn more about the BT stack.

starbasessd commented 3 years ago

Considering data rate is limited to ~2Mb/s BTLE5 vs any wifi (802.11g is 54Mb/s) you would be limiting yourself tremendously as to what could be transferred. Also Bluetooth is half duplex.

Ventnts commented 3 years ago

Considering data rate is limited to ~2Mb/s BTLE5 vs any wifi (802.11g is 54Mb/s) you would be limiting yourself tremendously as to what could be transferred. Also Bluetooth is half duplex.

Yes very good point. I may look for something else, I just need to find the most efficient protocol to transfer the videos (ill even do NFS/NAS if it would work). So for that I can use the WiFi to use FTP or something low processing. The master will get the videos and upload to Drive.

I want it as such that I can use the BT low data rate for control, then leverage WiFi for the video bits. I would stick with 2.4 to get more distance, but have to be careful with collisions. 5 Ghz is the way to go, but we lose the physical distance.

starbasessd commented 3 years ago

I use a NAS (SMB/SFTP/SCP supported) for just about everything. I have a DLNA server pointed to it to watch the videos on virtually everything. You might be able to use BTLE for PAN, but the motion web interface allows curl calls, so... https://motion-project.github.io/motion_config.html#OptDetail_Webcontrol

Bitrate is harder to come by. Distance can be overcome by directional antennas or increased power. Obstruction is a different issue, don't want to set wall paper on fire... I'm a HAM and have used USB dongles at the focus of Satellite Antennas, and Pringles cans and Coffee cans for point to point, as far as 1/2 a mile (800m).

starbasessd commented 3 years ago

If you are considering options, LoRaWan might be something to consider for your control channel commands, also. Low overall bitrate, but can be miles range, or even global if you use the LoRaWan network for it. It's like IoT, but uses unlicensed (or even HAM licensed) frequencies, and even places like adafruit.com sell hats and devices...

starbasessd commented 3 years ago

I've found a 11ac wifi dongle that works with an 11ac router at the 5GHz band, that is supported by RaspberryPiOS without any special needed drivers. It is the ASUSTek USB-AC55 (AC1300). I found a couple in my bag from a previous employer while cleaning out a bunch of stuff, and decided to test. I will try it on motionEyeOS in a bit, but it does work with RPiOS and motioneye as is.

starbasessd commented 3 years ago

Yes, it works (motioneyeos-dev20201026) with the on board disabled as above, and the wpa_supplicant.conf file only pointing to my 5G (11ac) wifi router. So there IS at least one true 5G (5GHz band) USB dongle that works with RPiOS and motionEyeOS. It is still available, too. (Theoretically :\ )

d-looper commented 3 years ago

Thats good news. Whats the chipset used in the dongle?

starbasessd commented 3 years ago

pi@raspberrypi:~ $ sudo lsusb -v Bus 001 Device 005: ID 0b05:17eb ASUSTek Computer, Inc. USB-AC55 802.11a/b/g/n/ac Wireless Adapter [MediaTek MT7612U] Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.10 bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0b05 ASUSTek Computer, Inc. idProduct 0x17eb USB-AC55 802.11a/b/g/n/ac Wireless Adapter [MediaTek MT7612U] bcdDevice 1.00 iManufacturer 1 MediaTek Inc.

d-looper commented 3 years ago

Great! Thank you very much!