Creating a camera solution for PDU
Update device
sudo apt-get update
sudo apt-get upgrade -y
Needed for ribbon camera
sudo raspi-config
sudo pip install pirecorder
sudo pip install "picamera[array]"
sudo apt-get install libhdf5-dev libhdf5-serial-dev libatlas-base-dev libatlas3-base libjasper-dev python3-pyqt5 -y
sudo pip install opencv-contrib-python==4.5.3.56
sudo apt-get install python3-opencv
sudo pip install imutils
- Create a directory called record in the root directory
- Download python script in the record directory, i.e. record.py
- Open terminal, go to record directory
cd record
- Create launcher shell
nano launcher.sh
- This will launch an editor. Type in the following script
#!/bin/sh
# launcher.sh
# navigate to home directory, then to this directory, then execute python script, then back home
cd /
cd home/pdu/record
sudo python record.py
cd /
- Make the launcher script executable
chmod 755 launcher.sh
- Test it. This should run the Python code
sh launcher.sh
- Navigate back to home directory
cd
- Create a logs directory
mkdir logs
- Add to Crontab. Type in
sudo crontab -e
- Enter the line
@reboot sh /home/pdu/record/launcher.sh >/home/pdu/logs/cronlog 2>&1
- Reboot to check
sudo reboot
If it doesn't work, check the log file
cd logs
cat cronlog
Open terminal on Mac
ssh pdu@dogmoves.local
They will ask for a password.
scp pdu@dogmoves:/home/pdu/record/2022-11-23-10:36/NV_7.mp4 /users/nidhi/Desktop