Plan was go use the Pi’s own built in camera connector and add a USB camera for a second view. I also added a USB Wifi dongle because the Pi2B doesn’t have WiFi.
So this was one of those things that was theoretically easy, but turned into an abject nightmare of ridiculousness. Mainly because the Pi2B doesn’t have WiFi and is *extremely* finicky about power supply for its USB connections, so just plugging in a cheapie (‘linux compatible’) WiFi card didn’t work*.
After much failure the process I used that worked was:
Use a powered USB hub for the WiFi dongle and the USB webcam.
Make sure you have a really rock solid power supply for the Pi2B
- Install Kali Linux on the Micro SD card. The version I got that worked for me was: kali-linux-2023.2-raspberry-pi-armhf
- Connect the Pi to wired ethernet, plug the USB camera and Pi camera in, plug the WiFi dongle in and boot. Run through all the Kali Linux setup stuff.
- Install the RPi config utility (missing from Kali)
- Add this line to /etc/apt/sources.list:
deb http://archive.raspberrypi.org/debian/ jessie main
- Run these commands:
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7FA3303E
apt-get update
apt-get -y install raspi-config
- Add this line to /etc/apt/sources.list:
- Run Raspi-Config and setup the camera.
- Install Motion
sudo apt-get -y install libav-tools motion
- Use v4l2-ctl to identify the cameras and configure motion to use both cameras. This involves both setting up the default configuration file and the secondary camera config files. There’s a good explanation of what needs to go in those other config files here, since everyone else seems to skip over it.
- Okay, now the fun bit… a lot of the cheap WiFi dongles are based on a chipset that’s not installed by default in debian installs (it’s part of the non-free repositories – and has to be compiled for the Rpi). That’s the RTL8188FU chipset. If that’s the chipset you’ve got then you’ll need to do all this guff: the best set of instructions was on this github project page.
- Build the driver and install it:
sudo ln -s /lib/modules/$(uname -r)/build/arch/arm /lib/modules/$(uname -r)/build/arch/armv7l
sudo apt-get install build-essential git dkms linux-headers-$(uname -r)
git clone -b arm https://github.com/kelebek333/rtl8188fu rtl8188fu-arm
sudo dkms add ./rtl8188fu-arm
sudo dkms build rtl8188fu/1.0
sudo dkms install rtl8188fu/1.0
sudo cp ./rtl8188fu-arm/firmware/rtl8188fufw.bin /lib/firmware/rtlwifi/
- I had to tweak the configuration to disable rtw_ips to make it work – which tweaks the github instructions to look like this:
sudo mkdir -p /etc/modprobe.d/
sudo touch /etc/modprobe.d/rtl8188fu.conf
echo "options rtl8188fu rtw_power_mgnt=0 rtw_enusbss=0
rtw_ips_mode=0"
” | sudo tee /etc/modprobe.d/rtl8188fu.conf
- I also disabled mac address spoofing as is recommended in the firmware build instructions, and for 5.15 and 5.16 kernels you have to blacklist the built in driver otherwise they conflict:
sudo mkdir -p /etc/NetworkManager/conf.d/
sudo touch /etc/NetworkManager/conf.d/disable-random-mac.conf
echo -e "[device]\nwifi.scan-rand-mac-address=no" | sudo tee /etc/NetworkManager/conf.d/disable-random-mac.conf
echo 'alias usb:v0BDApF179d*dc*dsc*dp*icFFiscFFipFFin* rtl8188fu' | sudo tee /etc/modprobe.d/r8188eu-blacklist.conf
- Build the driver and install it:
- And at that point, for me, it worked. However, if you want it to start at start-up I have never managed to get the motion service to work right. It starts up, but I think because of when it starts, the cameras often don’t come up. So instead I add it as a cron job. For that, you want to tweak the motion configuration to start in daemon mode, and then edit your crontab. For me that was just a case of adding:
@reboot
/usr/bin/motion
*Made doubly tricky by the fact that I’d picked up a fake MicroSD card that lied about its size, which I didn’t realize – and so it kept corrupting data. Always test your MicroSD cards, kids.