View: 28900|Reply: 5

Getting the camera module to work with OPi Lite

[Copy link]

2

threads

5

posts

28

credits

Novice

Rank: 1

credits
28
Published in 2017-3-19 18:40:38 | Show all floors |Read mode
Hi everyone!

I got a couple OrangePi Lites with the camera module (gc2035) and expansion board. I spent all of last weekend trying to get it to work but with no success so far. Dealing with hardware is a bit new for me, so I'll try to briefly describe my steps so far as well as the problems.

I mainly used this blog post (http://www.cnx-software.com/2015 ... -linux-with-motion/) as well as a few posts from this forum

The Problem
It seems like the camera is not at all recognised. There is no /dev/video0 device file.

1. plugging everything in.
As simple/supid as it seems, I just want to briefly confirm that the camera and bord is plugged in correctly. To me it only makes sense in one direction, but on the web I stubled upon many pictures (including the official product shots) that show it in the (presumably) wrong way round.

Here's a picture of how I believe it is correct. It should be configuration A in both cases, i.e. with the conducting parts of the flat cable facing the board. Can anyone confirm?


2. OS
I guess I read all the posts and blog entries regarding the camera module, and it seems to me that the latest version of Armbian (kerner version 3.4.113) should already have the camera support as well as kernel modules to support it. The modules are even already present in the modules file, just commented out. So I guess using an Armbian build should work, right? For my tests I used the vanilla download provided on the Armian page. The only thing I did was to connect it to my wifi.
(>> uname -a: Linux orangepilite 3.4.113-sun8i #28 SMP PREEMPT Thu Feb 2 02:01:28 CET 2017 armv7l GNU/Linux

3. Modules
adding the modules at run time (gc2025, vfe_v4l2) with modprobe as described in the blog post completes with any output or errors. Still, no video device file is showing up in /dev/ is there any way I can confirm that the hardware is properly detected and working? Whenever I have the vf4_v4l2 module loaded (either at runtime with modprobe or on startup via the modules file) the system crashes when I try to shut it down or to restart. The terminal on the attached screen shows a few pages of error messages and what looks like a memory/state dump. After that the system just hangs.


I don't have much clue as how to proceed from here. They sell the camera bundled with the OPi Lite, so I assume that they theoretically should work together. I also got 5 units in total, and switched a few parts out here and there just to rule out hardware defects. I haven't tested all of them, but having more than 1 defect part in a batch of 5 is very unlikely.

I am happy for any hint on what I could try to either solve the problem alltogether or to at least find out a bit more.

Thanks!
Simon

PS: I currentlyl use a powerbank as the power supply. According to a small usb power meter, it draws about 0.32 amps at about 5v. The powerbank is rated at 1amps and I also tried it with a usb wall adapter that is rated a 3.1amps.



This thread contains more resources

You need to Log in to download or view,No account?    Register

x

1

threads

5

posts

24

credits

Novice

Rank: 1

credits
24
Published in 2017-3-25 08:34:13 | Show all floors
Edited by Jag at 2017-3-25 20:47

Hi Simon !

Two days ago I was exactly on the same point as you were some days ago.. Yesterday I reply with my first advances.. today I re-edit my reply because yesterday's one had some mistakes.

Let's go:
- I'm working with a ORANGE PI PLUS 2 E board running Armbian - Server Debian Jessie
- About plugging the camera: this is the right schema
      (click to enlarge)
    You have to face the side where you see the wire connectors on your wire to the white part of the board connector (not facing to the pressing black slide), as shown on the picture. On your schema, it's A configuration- I've tried to connect the cammera directly to my board, but it doesn't work, it needs this adapter provided with the camera (I'm not sure if all the versions of Opi needs the adapter)

Distribution versions:

1st attempt: The first thing I tried was to install the lastest Armbian server Debian Jessie distribution (5.25), but I could not make it work !  (didn't get to see /dev/video0)

- I read (I don't remember where! but I think it was in another post of this forum) that there were some problems with the camera drivers on the new distribution, and recommended to try the older distribution (5.20). On the download page there's a link for get Older Versions (example for OrangePiPlus2E)

2nd attempt: I installed the 5.20 distribution. After installing the camera drivers (you'll find a detailed explanation later) I saw /dev/video0. I did a apt-get update -> atp-get upgrade -> apt-get distro-upgrade  and then tryed to follow with my installation (motion service, ..) but It also did'nt work !!

3rd attempt: I decided to retry with the 5.20 installation from zero and don't make the apt-get upgrade.. I installed the drivers and the motion service, i configured everything and it works !!  Then (once it's been working properly) I've tried to make the apt-get upgrade and apt-get distro-upgrade... i expected it was going to fail.. but it stills work. I don't understand then what happened with my second try.. but these were the results.


Installation step-by-step:  (for my OrangePiPlus2E)
1 - Donwload the  Armbian_5.20_Orangepiplus2e_Debian_jessie_3.4.112.7z  image  (Armbian download page for OrangePiPlus2E and then -> Older versions)

2 - Unzip it, burn it into a SD Card and then boot your OrangePi from this SD

3 - Load the camera drivers
  1. sudo modprobe gc2035</div><div>sudo modprobe vfe_v4l2
Copy code


4 - Configure the drivers to be loaded on every reboot
  1. nano /etc/modules
Copy code
  and on that file, uncomment (erase the #) from the two drivers (gc2035 and vfe_v4l2)

5 - The device /dev/video0 should exist !   (just list the files on /dev/ to check.. if it doesn't exist you need a better installation manual than mine )


6 - Install the motion service
  1. apt-get install motion
Copy code

7 - Edit the configuration file:
  1. nano /etc/motion/motion.conf
Copy code
  and on that file, change:
     stream_localhost off                           # otherwise, it will only allow connections from localhost
     target_dir /home/youruser/motion/    # or the folder where you want the images to be saved
     daemon on                                         # we'll left the service running


8 - Create the target folder and set the permissions  (777 for this example to ensure it works.. use the ones that you need)
  1. mkdir /home/youruser/motion/
Copy code


9 - Set the service as a daemon
  1. nano /etc/default/motion
Copy code
     and change start_motion_daemon=yes

10 - Start the service
  1. /etc/init.d/motion start
Copy code


11 - Check if the service is working connecting to your IP at port 8081

Check from your server's console:
  1. wget localhost:8081
Copy code
Or from another computer, open a web browser and go to http://yourIPAddr:8081

IT WORKS ! (Window Capture from a web browser from another computer)
(click to enlarge)


12 - The log file for this service (motion) is located at /tmp/motion.log   (can be changed on nano /etc/motion/motion.conf config file)




13 - If you want to move the installation from the SD to the EMMC:
  1. nand-sata-install
Copy code
and once finished, shutdown, remove your SD card and it's ready to boot !



With this configuration, the drivers are loaded at every reboot and the service is started automatically, so, the camera will begin to capture (and will listen at the 8081 port) automatically on every system reboot


I tried to setup Kerberosio Video Surveillance (https://kerberos.io/) but I don't get to activate the camera.. I've tried a as a RasbpiCamera, as VideoCapture, but nothing seems to work



I hope it can be useful to Simon and to anyother in the same situation ;)

This thread contains more resources

You need to Log in to download or view,No account?    Register

x

2

threads

5

posts

28

credits

Novice

Rank: 1

credits
28
 Author| Published in 2017-4-30 21:11:13 | Show all floors
Edited by Simon at 2017-5-1 13:56

Hi Jag!

thanks for the detailed post and sorry about my late post. I just didn't have enough time on my hand to give it a try.

I also came across the hint with 5.20 but I never found the download link on the Armbian website. Now I did, and am curious to try everything out!
update:
I got everything working on the first try but it does not work anymore now...

Use use OpenCV (http://www.diyprojects.io/orange ... mera-python-opencv/) and installing the loopback device solved a problem as mentioned in the blog post. I coult take picktures but after a reboot all I get is "Setting Pixel Format: Device or resource busy" when trying to start vidcopy again...

I'll try a fresh install to see if I can reproduce the error.

thanks, Simon

0

threads

8

posts

40

credits

Novice

Rank: 1

credits
40
Published in 2017-6-19 13:48:24 | Show all floors
Will it effect the 1080p resolution?

0

threads

8

posts

40

credits

Novice

Rank: 1

credits
40
Published in 2017-9-25 15:25:50 | Show all floors
Transfering of hd video shouldn't be an issue next time.

0

threads

2

posts

14

credits

Novice

Rank: 1

credits
14
Published in 2021-2-3 21:57:45 | Show all floors
For an HD camera, you must need to be on a good budget and know what you need to pick. There is some Golf Swing Analysis Cameras guide which you also read anytime.
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list