Earlier this month, I wrote a Quick Start Guide for Orange Pi Allwinner H3 boards such as Orange Pi PC, and showed how to install and configure Debian on the boards. I’ve also received the $5.90 Orange Pi camera, which when combined an Orange Pi PC, costs around $27 including shipping. So today, I’ve attached the CSI camera to my Orange Pi 2 mini board, and used it with motion to transform for the board into an IP camera.
First, you’ll need to insert the camera into CON1 connector with the camera facing the ceiling, and close the black clip to keep it in place.
Now connect all cable and power on your board. First, I studied the steps described on that forum thread, and modified Allwinner configuration files, but after one or two hours, I found out some work at been done since May, and it was now much easier to use the camera since gc2035 drivers was part of the Debian image, and the script.bin file (allwinner config file) was already setup to be used with Orange pi camera.
Open a terminal window in the board to load drivers:
1
2
|
sudo modprobe gc2035
sudo modprobe vfe_v4l2
|
and then mostly followed the instructions for USB webcams on Orange Pi website to install and configure motion:
1
2
|
sudo apt–get install motion
sudo nano /etc/motion/motion.conf
|
and enable the following line:
1
|
stream_localhost off
|
This will make sure the web server started by motion will be accessible from other network devices.
I’ve also changed target_dir to /home/orangepi/motion, as motion would crash each time it would create a file when detection motion.
1
2
|
mkdir ~/motion
chmod 777 motion
|
You’ll also need to change the startup script
1
|
sudo nano /etc/default/motion
|
and change the only line in the file as follows:
1
|
“start_motion_daemon=yes”
|
Finally, we are ready to give it a try:
1
|
sudo /etc/init.d/motion start
|
You can launch your favorite browser, or access localhost:8081 if you are using your board, or <orange_ip_address>:8081 from another machine on the network, and you should the the picture camera updated into your web browser about twice per second.
If the system detects motion will save pictures and videos in target_dir directory, which I set to /home/orangepi/motion earlier. The image resolution is set to 800×600, and it ignored width and height settings (320×240) set in motion.conf.
Motion will start automatically, but you still need to load the modules automatically at boot time for this to work. Simply edit /etc/modules, and add the two required modules at the end of the file.
1
2
|
gc2035
vfe_v4l2
|
Now motion will run automatically, and the camera work properly each time the board starts.
https://www.cnx-software.com/2015/09/26/how-to-use-orange-pi-camera-in-linux-with-motion/