Difference between revisions of "Matrix - CAM500B"

From FriendlyELEC WiKi
Jump to: navigation, search
(Connect CAM500B to H3 Based Boards)
(updated by API)
 
(10 intermediate revisions by 3 users not shown)
Line 11: Line 11:
 
* Automatic image control functions: AFC, AWB and AEC etc
 
* Automatic image control functions: AFC, AWB and AEC etc
 
* 24 PIN FPC interface including DVC parallel output, 3.3V power, I2C and GPIO
 
* 24 PIN FPC interface including DVC parallel output, 3.3V power, I2C and GPIO
 +
* 3.3V signal level
 +
[[File:CAM500B DIM.jpg|800px]]
  
==Connect CAM500B to S5P4418/S5P6818 Boards==
+
==How to Connect==
 
+
* If your 4418/6818 based board runs Android5.1 and it is connected to FriendlyElec's LCD or an HDMI monitor after Android is fully loaded click on the "Camera" icon and the application will be started. You can take pictures or record videos.
+
* Under Debian/Ubuntu a camera utility "nanocams" is available for previewing 40 frames and picture taking.You can try it by following the commands below:
+
<syntaxhighlight lang="bash">
+
sudo nanocams -p 1 -n 40 -c 4 -o IMG001.jpg
+
</syntaxhighlight>
+
For more details about the usage of the nanocams run "nanocams -h". You can get its source code from our git hub:
+
<syntaxhighlight lang="bash">
+
git clone https://github.com/friendlyarm/nexell_linux_platform.git
+
</syntaxhighlight>
+
 
+
 
===Connect CAM500B to NanoPi M2===
 
===Connect CAM500B to NanoPi M2===
 
* NanoPi M2 works with CAM500B
 
* NanoPi M2 works with CAM500B
Line 52: Line 43:
 
[[File:CMOS-camera-nanopc-t2.png|frameless|500px|CMOS camera]]
 
[[File:CMOS-camera-nanopc-t2.png|frameless|500px|CMOS camera]]
  
==Connect CAM500B to H3 Based Boards==
+
===Connect CAM500B to NanoPi M1===
Boot Debian, connect your H3 based board to a network, log into the board as root and run "mjpg-streamer":
+
* NanoPi M1 works with CAM500B
 +
[[File:NanoPi-M1-cam500a.jpg|frameless|500px|NanoPi-M1-cam500a]]
 +
 
 +
===Connect CAM500B to NanoPi M1 Plus===
 +
* NanoPi M1 Plus works with CAM500B
 +
[[File:NanoPi-M1-Plus-cam500a.jpg|frameless|500px|NanoPi-M1-Plus-cam500a]]
 +
 
 +
===Connect CAM500B to NanoPi NEO Air===
 +
* NanoPi NEO Air works with CAM500B
 +
[[File:NanoPi-AIR-cam500b.jpg|frameless|500px|NanoPi-AIR-cam500b]]
 +
 
 +
===Connect CAM500B to NanoPi K1 Plus===
 +
* NanoPi K1 Plus works with CAM500B
 +
[[File:NanoPi-K1-Plus-cam500b.jpg|frameless|500px|NanoPi-K1-Plus-cam500b]]
 +
 
 +
==Connect CAM500B to S5P4418/S5P6818 Boards==
 +
* If your 4418/6818 based board runs Android5.1 and it is connected to FriendlyElec's LCD or an HDMI monitor after Android is fully loaded click on the "Camera" icon and the application will be started. You can take pictures or record videos.
 +
* Under Debian/Ubuntu a camera utility "nanocams" is available for previewing 40 frames and picture taking.You can try it by following the commands below:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
cd /root/mjpg-streamer
+
sudo nanocams -p 1 -n 40 -c 4 -o IMG001.jpg
make
+
./start.sh
+
 
</syntaxhighlight>
 
</syntaxhighlight>
The mjpg-streamer application is an open source video steam server. After it is successfully started the following messages will be popped up:
+
For more details about the usage of the nanocams run "nanocams -h". You can get its source code from our git hub:
<syntaxhighlight lang="bash">
+
i: Using V4L2 device.: /dev/video0
+
i: Desired Resolution: 1280 x 720
+
i: Frames Per Second.: 30
+
i: Format............: YUV
+
i: JPEG Quality......: 90
+
o: www-folder-path...: ./www/
+
o: HTTP TCP port.....: 8080
+
o: username:password.: disabled
+
o: commands..........: enabled
+
</syntaxhighlight>
+
 
+
In our case the board's IP address was 192.168.1.230. We typed 192.168.1.230:8080 in a browser and were able to view the images taken from the camera's. Here is what you would expect to observe:<br>
+
[[File:mjpg-streamer-cam500a.png|frameless|600px|mjpg-streamer-cam500a]] <br>
+
The mjpg-streamer soft-encodes data with libjpeg and you can hard-encode its data with ffmpeg which will greatly increase CPU's efficiency and speed up data encoding:
+
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
ffmpeg -t 30 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video0 -pix_fmt nv12 -r 30 -b:v 64k -c:v cedrus264 test.mp4
+
git clone https://github.com/friendlyarm/nexell_linux_platform.git
 
</syntaxhighlight>
 
</syntaxhighlight>
By default it records a 30-second video. Typing "q" stops video recording. After recording is stopped a test.mp4 file will be generated.
 
  
===Connect CAM500B to NanoPi M1===
 
* NanoPi M1 works with CAM500B
 
[[File:NanoPi-M1-cam500a.jpg|frameless|500px|NanoPi-M1-cam500a]] <br>
 
  
===Connect CAM500B to NanoPi NEO Air===
+
==Connect CAM500B to H3/H5 Based Boards==
* NanoPi NEO Air works with CAM500B
+
{{FriendlyCoreAllwinner-DVPCam}}
[[File:NanoPi-AIR-cam500b.jpg|frameless|500px|NanoPi-AIR-cam500b]] <br>
+
 
 +
==Resources==
 +
* [http://wiki.friendlyelec.com/wiki/index.php/File:OV5640_datasheet.pdf Datasheet]
 +
* [http://wiki.friendlyelec.com/wiki/index.php/File:CAM500A-CAM500B-Schematic.pdf CAM500A-CAM500B-Schematic.pdf]
 +
* [http://wiki.friendlyelec.com/wiki/images/7/74/CAM500B_dxf.zip CAM500B_dxf.zip]
 +
An open source APP developed by FriendlyElec for CAM500A/CAM500B (supports preview, picture-taking and video recording)
 +
* [APP source code: https://github.com/friendlyarm/android_CameraDemo]
 +
* [Source code for NanoPi 2:https://github.com/friendlyarm]
 +
 
 +
==Update Log==
 +
===Dec-27-2016===
 +
* Released English Version

Latest revision as of 07:17, 21 February 2022

查看中文

1 Introduction

CAM500A
  • The CAM500B module uses Omni Vision’s QSXGA CMOS OV5640 module. It has DVP parallel output interface and supports up to 2592 x 1944 photographing and 720P@30fps video recording. It has automatic image control functions: AFC, AWB and AEC etc.
  • The CAM500B uses a cell phone camera. This camera’s focal length is 2.7mm. Its aperture is 2.8. Its viewing angle is 66 degree.

2 Features

  • 5MP (2592 x 1944) photographing, 720P@30fps video recording
  • Focal length: 2.7mm, Aperture: 2.8, Viewing angle: 66 degree
  • Automatic image control functions: AFC, AWB and AEC etc
  • 24 PIN FPC interface including DVC parallel output, 3.3V power, I2C and GPIO
  • 3.3V signal level

CAM500B DIM.jpg

3 How to Connect

3.1 Connect CAM500B to NanoPi M2

  • NanoPi M2 works with CAM500B

CMOS camera-M2

3.2 Connect CAM500B to NanoPi 2

  • NanoPi 2 works with CAM500B.

CMOS camera

3.3 Connect CAM500B to NanoPi 2 Fire

  • NanoPi 2 Fire works with CAM500B.

CMOS camera01

3.4 Connect CAM500B to NanoPC-T2

  • NanoPC-T2 works with CAM500B

CMOS camera

3.5 Connect CAM500B to Smart4418

  • Smart4418 works with CAM500B

CMOS camera

3.6 Connect CAM500B to NanoPi M3

  • NanoPi M3 works with CAM500B

CMOS camera-M3

3.7 Connect CAM500B to NanoPC-T3

  • NanoPC-T3 works with CAM500B

CMOS camera

3.8 Connect CAM500B to NanoPi M1

  • NanoPi M1 works with CAM500B

NanoPi-M1-cam500a

3.9 Connect CAM500B to NanoPi M1 Plus

  • NanoPi M1 Plus works with CAM500B

NanoPi-M1-Plus-cam500a

3.10 Connect CAM500B to NanoPi NEO Air

  • NanoPi NEO Air works with CAM500B

NanoPi-AIR-cam500b

3.11 Connect CAM500B to NanoPi K1 Plus

  • NanoPi K1 Plus works with CAM500B

NanoPi-K1-Plus-cam500b

4 Connect CAM500B to S5P4418/S5P6818 Boards

  • If your 4418/6818 based board runs Android5.1 and it is connected to FriendlyElec's LCD or an HDMI monitor after Android is fully loaded click on the "Camera" icon and the application will be started. You can take pictures or record videos.
  • Under Debian/Ubuntu a camera utility "nanocams" is available for previewing 40 frames and picture taking.You can try it by following the commands below:
sudo nanocams -p 1 -n 40 -c 4 -o IMG001.jpg

For more details about the usage of the nanocams run "nanocams -h". You can get its source code from our git hub:

git clone https://github.com/friendlyarm/nexell_linux_platform.git


5 Connect CAM500B to H3/H5 Based Boards

connect your board to camera module. Then boot OS, connect your board to a network, log into the board as root and run "mjpg-streamer":

$ cd /root/C/mjpg-streamer
$ make
$ ./start.sh

You need to change the start.sh script and make sure it uses a correct /dev/videoX node. You can check your camera's node by running the following commands:

$ apt-get install v4l-utils
$ v4l2-ctl -d /dev/video0 -D
Driver Info (not using libv4l2):
        Driver name   : sun6i-video
        Card type     : sun6i-csi
        Bus info      : platform:camera
        Driver version: 4.14.0
	...

The above messages indicate that "/dev/video0" is camera's device node.The mjpg-streamer application is an open source video steam server. After it is successfully started the following messages will be popped up:

 
$ ./start.sh
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 1280 x 720
 i: Frames Per Second.: 30
 i: Format............: YUV
 i: JPEG Quality......: 90
 o: www-folder-path...: ./www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled

start.sh runs the following two commands:

export LD_LIBRARY_PATH="$(pwd)"
./mjpg_streamer -i "./input_uvc.so -d /dev/video0 -y 1 -r 1280x720 -f 30 -q 90 -n -fb 0" -o "./output_http.so -w ./www"

Here are some details for mjpg_streamer's major options:
-i: input device. For example "input_uvc.so" means it takes input from a camera;
-o: output device. For example "output_http.so" means the it transmits data via http;
-d: input device's subparameter. It defines a camera's device node;
-y: input device's subparameter. It defines a camera's data format: 1:yuyv, 2:yvyu, 3:uyvy 4:vyuy. If this option isn't defined MJPEG will be set as the data format;
-r: input device's subparameter. It defines a camera's resolution;
-f: input device's subparameter. It defines a camera's fps. But whether this fps is supported depends on its driver;
-q: input device's subparameter. It defines the quality of an image generated by libjpeg soft-encoding;
-n: input device's subparameter. It disables the dynctrls function;
-fb: input device's subparameter. It specifies whether an input image is displayed at "/dev/fbX";
-w: output device's subparameter. It defines a directory to hold web pages;

In our case the board's IP address was 192.168.1.230. We typed 192.168.1.230:8080 in a browser and were able to view the images taken from the camera's. Here is what you would expect to observe:
mjpg-streamer-cam500a
The mjpg-streamer utility uses libjpeg to software-encode steam data. The Linux-4.14 based ROM currently doesn't support hardware-encoding. If you use a H3 boards with Linux-3.4 based ROM you can use the ffmpeg utility to hardware-encode stream data and this can greatly release CPU's resources and speed up encoding:

$ ffmpeg -t 30 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video0 -pix_fmt nv12 -r 30 \
        -b:v 64k -c:v cedrus264 test.mp4

By default it records a 30-second video. Typing "q" stops video recording. After recording is stopped a test.mp4 file will be generated.

6 Resources

An open source APP developed by FriendlyElec for CAM500A/CAM500B (supports preview, picture-taking and video recording)

7 Update Log

7.1 Dec-27-2016

  • Released English Version