How to Use Orange Pi Camera in Linux (with Motion)

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.

Orange_Pi_2_mini_CameraFirst, 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:

and then mostly followed the instructions for USB webcams on Orange Pi website to install and configure motion:

and enable the following line:

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.

You’ll also need to change the startup script

and change the only line in the file as follows:

Finally, we are ready to give it a try:

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.

Orange_Pi_PC_Camera_Motion
Click to Enlarge

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.

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/

How to Use Orange Pi Camera in Linux (with Motion) was last modified: June 16th, 2023 by Jovan Stosic

Leave a Reply