Skip to content

Latest commit

 

History

History
134 lines (109 loc) · 8.18 KB

README.md

File metadata and controls

134 lines (109 loc) · 8.18 KB

Banana Pi M2 zero + OV5640

A Banana Pi image with OV5640 camera, WiringPi and OpenCV

output image

License


Installation.

  • Get a 16 GB (minimal) SD-card which will hold the image.
  • Download the image (5.5 GByte!) from our Gdrive site.
  • Flash the image on the SD card with the Imager or balenaEtcher.
  • Insert the SD card in your Banana Pi and enjoy.
  • Login: pi
  • Password: pass1234
  • Do not $ sudo apt-get upgrade as the newly installed software will remove the OV5640 drivers!
  • Read the instructions below!


Split image.

Because the image is large (5.5 GB), the download may take quite some time. It makes downloading vulnerable.
That's why we split the file into smaller chunks. These are more manageable than one huge download.
If you prefer this partial download over one large one, download the following 12 files (500 MB each) and place them in one folder.

Once you have all the files run

7z x BananaPi_M2_zero_OV5640.7z.001

7Z will start extracting the first file (*.001) and then automatically the next files in order.
You will endup with BananaPi_M2_zero_OV5640.zip, the original image which you now can flash on a SD card with Imager or balenaEtcher.

If you get the error '7z' is not recognized as an internal or external command, operable program or batch file. please give the full path to 7z. For instance,

"C:\Program Files\7-Zip\7z.exe" x BananaPi_M2_zero_OV5640.7z.001

output image


Good to know.

  • The Banana Pi M2 zero has only 512 MByte RAM onboard, which limits the performance even with the quad-core A7 Allwinner H2+. Don't expect high-resolution live video, although we managed to transfer a 1280x720 UDP stream at 30 FPS using GStreamer.
  • This Armbian OS is the first we tested that keeps the CPU temperature fairly cold. All other BPi operating systems heats the CPU at 65°C or higher, even when idle.
  • We limited the screen resolution to 1280x720 to avoid flickering.
  • If you require extra space, you can delete the ~/opencv and /usr/src (1.9 GB) folder from the SD card. There are no longer needed since all libraries are in the /usr directory. The /usr/src keeps all the code required for building the Linux kernel.
  • Use a tool like GParted sudo apt-get install gparted to expand the image to larger SD cards.


OV5640.

First, we would like to thank Wim van ‘t Hoog for the many hours of work rebuilding the Linux device tree on the Banana Pi to get the OV5640 drivers installed. Please visit his website, if you want more information on the subject. Also, if you like to get the Cedrus encoder (used for FFmpeg and GStreamer) up and running. Note, Wim is using the Nano Pi with the Allwinner H3, instead of the Banana Pi with the H2+.

output image

👉 You cannot use a Raspberry Pi camera! The OV5640 has a parallel output port, while the RPi OV5647 has a MIPI-lane interface.

👉 There are several connector layouts of the OV5640 camera. Buy one specifically for the Banana Pi, like this one.

output image
With the wrong connector you are facing issue #6.

Before using the ov5640 camera, it must be initialized. It is done by the command $ sudo media-ctl --device /dev/media1 --set-v4l2
The command allows you to set the resolution, framerate, compression and other parameters. You can issue a new command at any time to change the parameters. You can also set the initialization during boot, for example by placing the command in /etc/rc.local.
The camera is located at /dev/video1, not /dev/video0 where the cedrus engine lives.
Some examples

$ sudo media-ctl --device /dev/media1 --set-v4l2 '"ov5640 2-003c":0[fmt:YUYV8_2X8/1280x720]'
or
$ sudo media-ctl --device /dev/media1 --set-v4l2 '"ov5640 2-003c":0[fmt:YUYV8_2X8/640x480]'

With framerate:

$ sudo media-ctl --device /dev/media1 --set-v4l2 '"ov5640 2-003c":0[fmt:YUYV8_2X8/640x480@1/30]'
or
$ sudo media-ctl --device /dev/media1 --set-v4l2 '"ov5640 2-003c":0[fmt:YUYV8_2X8/1280x720@1/15]'

GStreamer

You can use GStreamer. However, be aware of the limited resources on the Banana Pi M2 zero.
Streaming to screen:

$ gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw, width=640, height=480, framerate=30/1 ! videoconvert ! autovideosink

UDP streaming to another computer. (192.168.178.84 is the address of the recieving host)

$ gst-launch-1.0 -v v4l2src device=/dev/video1 num-buffers=-1 ! video/x-raw, width=1280, height=720, framerate=30/1 ! videoconvert ! jpegenc ! rtpjpegpay ! udpsink host=192.168.178.84 port=5200

OpenCV

Once the camera is set up, you can receive the video stream in OpenCV for further processing.
We've added an example to the SD image. It is almost identical to the OpenCV camera example for the Raspberry Pi. See our webpage for more information.

output image


Pre-installed frameworks.

output image

output image


Tips.

If you want to change the password, here are the commands( =pi ).

$ sudo -i
# passwd <username>
New password: 
Retype new password: 
passwd: password updated successfully
# exit
$ sudo reboot

paypal