Banana Pi OV5640 Camera User Guide


Banana Pi M2+ is a mini form factor development board that provides outstanding computing performance in an ultra-portable form factor. This is a 65mm*65mm ultra-small motherboard with Allwinner H-series chips. It has different versions but shares the same interface.

BPI-M2+ H3

key features

  • Quad-core 1.2GHz Cortex-A7 H3
  • 1GB DDR3
  • 8GB eMMC onboard
  • Onboard WiFi and Bluetooth
  • 10/100/1000Mbps Ethernet port

Android development

Load your first image on M2P

1. You can download the latest pictures from our forum. E.g:
2. Insert your TF card into the TF-USB adapter, then insert the adapter into your Windows PC usb port. 3. Prepare your image and download the image burning tool PhoenixCard.exe. 4. Use "PhoenixCard.exe" to burn the android image to the TF card.
*Here is an example for M3

Load your image on M2P EMMC

1. The only difference from sd card burning is the image burning mode option
*Here is an example for M3

2. After successfully burning the image to SD, insert the SD card into your M2P 3. Press the power button and the device will automatically copy the image to the EMMC

Linux development

basic development

ready to develop

*Prepare 8G/above TF card, USB serial interface, PC with Ubuntu system, use your USB serial connection in M2P to connect the debug console

Load your first image on M2P

1. You can download the latest pictures from our forum. Here is an example of a forum thread link: http://forum . banana-pi . org/t/banana-pi-BPI-m2p-new-image-release-Ubuntu-16-04-v1-1/5719 2. Install the bpi tool on your Ubuntu. If you cannot access this URL or encounter any other issues, please go to the bpi-tools repo and install the tool manually. *apt-get install pv* curl -sL| sudo -E bash 3. After downloading the image, insert your TF card into your Ubuntu *execute "bpi-copy xxx.img /dev/sdx" to install the image on your TF card. 4. After step 3, then you can insert your TF card to M2P, and press the power button to set up M2P. 5. Login User/Password: pi/bananapi或root/bananapi。

Load your first picture on M2P EMMC

*Run your M2P with TF card *Copy "" to your U disk *Insert your U disk in M2P *M2P After identifying the U disk, execute "BPI-Copy" to install the image on the EMMC* and then close the M2P, take out the TF card, and use the EMMC to give the M2P Power-on

Update your picture

For example, update your image to support the new emmc5.1

  * execute “bpi-tools”, to update your bpi tools;
  * execute “bpi-update -c bpi-m2p.conf”, to download new driver to update your image
  * execute “file *.tgz”, to check download files’ type is compressed data
  * execute “bpi-bootsel”, you will see the bootloader path, “/usr/lib/u-boot/bananapi/bpi-m2p/BPI_M2P_720P.img.gz”
  * execute “bpi-bootsel /usr/lib/u-boot/bananapi/bpi-m2p/BPI_M2P_720P.img.gz”, to update your bootloader
  * reboot

Advanced development

How to build uboot & kernel

installation tool

clone code

How to create an image

  • Prepare an SD card with the system installed (Ubuntu/Raspbian/..)
  • Boot your SD card with M2P, after M2P finishes booting, copy your files and configure your system, then close M2P. [If you don't want to configure your system, you can skip this step]
  • Insert your SD card into the PC (running Linux), insert "cd /media", then "ln -s %3c your account %3E pi"
  • implement“BPI-migrate-c BPI-m2p . conf-c Ubuntu-mate-from-SD . conf-d/dev/sdx”
  • then you can now get your own image

GPIO control

  • To access a GPIO pin, you first need to export it using
echo XX % 3E/system/classes/gpio/export
  • where XX is the number of the desired pin. To get the correct number you have to calculate it from the pin name (like PH18)
(position of letter in alphabet - 1) * 32 + pin number of PH18, this will be (8 - 1) * 32 + 18 = 224 + 18 = 242 (since "h" is the 8th letter)
  • echo " out/in " % 3E/sys/class/gpio/gpio *number*/direction
  • echo " 0/1 " % 3E/sys/class/gpio/gpio *number*/value

Digital companion

1. On the M2P console:

  • Execute "./", then execute "ps -ax | grep adbd" to see if adbd is set

2. On the PC terminal:

  • If the adbd setup is successful, plug the OTG USB port into the M2P and PC (using Ubuntu)
  • Execute "adb device" to check whether the PC has recognized M2P · OTG
  • If yes, we can now execute "adb shell" to connect m2p via adb

American Board of Graduate Management Admissions

  • Test gmac with iperf3


  • Use the bluetooth ctl tool to operate bluetooth
  • Execute "bluetooth ctl"
  • If you don't know how to use bluetooth ctl, type "help" and you will see more commands
  • Execute these commands:

M2P WiFi

Driver code:

WiFi Client

You have two ways to set up the WiFi client

1. Use the command to set up the WiFi client

  • ip link settings wlan0 start
  • iw dev wlan0 scan | grep SSID
  • vim/etc/wpa application/wpa _ supplicant . conf
network = { ssid = " ssid " PSK = " password " priority = 1 }
  • wpa _ supplicant-iwlan 0-c/etc/wpa _ supplicant/wpa _ supplicant . conf
  • dhclient wlan0

2. Use the UI interface to set up the WiFi client

1. Download M2P bsp code

  • After cloning the project, execute the command "cd BPI-M2P-bsp"

2. Change your boot logo

  • Prepare a ".bmp" picture, here I rotate 180°, as shown below:

  • change your image name to“bootlogo.bmp”
  • Put your picture in "Sun Qian-pack/chips/sun 8i w7 p 1/configs/BPI-M2P-xxxP/”

Here I replaced "bootlogo.bmp" under "sunqian-pack/chips/sun 8i w7 p 1/configs/BPI-M2P-720 p/" as an example:

3. Build your code

  • "./ BPI-M2P-720P
  • choice 1

  • After you build the project, you will see the "SD" directory

4. Install a raspbian image on your SD card

5. Insert your SD card into your Ubuntu computer

(1) Check your sd card is recognized as /dev/sdxx, as you can see my sd card is recognized as /dev/sde

6. Then“cd SD/bpi-m2p/100MB”

7. Execute the command“BPI-bootsel BPI-M2P-720P.img.gz/dev/SDE”

8. Insert the updated SD card into the motherboard, turn on the power and you will see:

Clear boot

Camara function

We are using HDF5640 camara.


  • Operate camara using your UI interface
  • application-%3E audio-visual-%3E guvcview


  • We also have built-in commands to test camara in /usr/local/bin
  • "./ "Test camera function
  • "./" to test the recording function

Infrared function

  • execute "getevent"
  • Send information to M2P using your infrared device

BPI tool

Install Bpi Tools

Update Bpi tool

  • Implement "Business Process Improvement Tools"

RPi. General purpose input and output interface

Install the RPi. General purpose input and output interface

  • implement "git clone"
  • After cloning the repo, cd RPi. General purpose input and output interface
  • Execute "sudo apt-get update"
  • Execute“sudo apt-get install python-dev python 3-dev”
  • Execute“sudo python install”or“sudo python3 install”to install the module

Use RPi. General purpose input and output interface

  • cd /usr/local/bin
  • Execute "./" to test the RPi. General purpose input and output interface


How to Update WiringPi

  • Execute“bpi-update -c pkglist.conf”

  • Execute“BPI-update-c BPI-pkg-BPI-wiring pi . conf”

RGB 1602 LCD Display

  • Execute “/usr/local/bin/BPI _ test _ LCD 1602 . sh”

0.96-inch organic light-emitting diode display

  • Execute “/usr/local/bin/BPI _ test _ 52pi . sh”

Price: $13.89
Part Number: Banana Pi OV5640 Camera
Brand: Spotpear
SKU: 0801006