From PINE64
Jump to navigation Jump to search

The PineCube is a small, low-powered, open source IP camera. Whether you’re a parent looking for a FOSS baby-camera, a privacy oriented shop keeper, home owner looking for a security camera, or perhaps a tinkerer needing a camera for your drone – the CUBE can be the device for you. It features an 5MPx Omnivision sensor and IR LEDs for night vision, as well as Power Over Ethernet, as well as a microphone.

The PineCube


  • Dimensions: 55mm x 51mm x 51.5mm
  • Weight: 55g
  • Storage:
    • MicroSD slot, bootable
    • 128Mb SPI Nor Flash, bootable
  • Cameras: OV5640, 5Mpx
  • CPU: Allwinner(Sochip) ARM Cortex-A7 MPCore, 800MHz
  • RAM: 128MB DDR3
  • I/O:
    • 10/100Mbps Ethernet with passive PoE (4-18V!)
    • USB 2.0 A host
    • 26 pins GPIO port
      • 2x 3.3V Ouptut
      • 2x 5V Output
      • 1x I2C
      • 2x UART (3.3V)
      • 2x PWM
      • 1x SPI
      • 1x eMMC/SDIO/SD (8-bit)
      • 6x Interrupts
      • Note: Interfaces are multiplexed, so they can't be all used at same time
    • Internal microphone
  • Network:
    • WiFi
  • Screen: optional 4.5" RGB LCD screen ( RB043H40T03A-IPS or DFC-XS4300240 V01 )
  • Misc. features:
    • Volume and home buttons
    • Speakers and Microphone
    • IR LEDs for night vision
    • Passive infrared sensor
  • Power DC in:
    • 5V 1A from MicroUSB Port or GPIO port
    • 4V-18V from Ethernet passive PoE
  • Battery: optional 950-1600mAh model: 903048 Lithium Polymer Ion Battery Pack, can be purchase at

GPIO pinout


Note: Pin1 is marked on the board by a white dot on the PCB. See the PDF and HTML for details.


The following projects are documented here:

Further projects:

Case information


User models:

Operating Systems


Armbian is a Linux distribution designed for ARM boards. They are usually Debian or Ubuntu flavored.




NixOS is a Linux distribution built on top of the Nix package manager using declarative configuration to allow reliable system upgrades.


Elimo Engineering integrated support for the PineCube into Buildroot.

This has not been merged into upstream Buildroot yet, but you can find the repository on Elimo's GitHub account and build instructions in the board support directory readme.

The most important thing that this provides is support for the S3's DDR3 in u-boot. Unfortunately mainline u-boot does not have that yet, but the u-boot patches from Daniel Fullmer's NixOS repo were easy enough to use on buildroot.

This should get you a functional system that boots to a console on UART0. It's pretty fast too, getting there in 1.5 seconds from u-boot to login prompt.

Mainlining Efforts

Please note:

  • this list is most likely not complete
  • no review of functionality is done here, it only serves as a collection of efforts
Linux kernel
Type Link Available in version
Devicetree Entry Pinecube 5.10
Correction for AXP209 driver 5.9
Additional Fixes for AXP209 driver 5.12
Device Tree Fixes 5.10
Audio Device and IR LED Fix TBD
Type Link Available in version
PineCube Board Support v2021.04
Type Link Available in version
PineCube Board Support


Camera issues can be debugged with the gstreamer pipeline. If the camera does not appear to work, it is possible to change the v4l2src to videotestsrc and the gstreamer pipeline will produce a synthetic test image without using the camera hardware.

If the camera is only sensor noise lines over a black or white image, the camera may be in a broken state. When in that state, the following kernel messages were observed:

[ 1703.577304] alloc_contig_range: [46100, 464f5) PFNs busy
[ 1703.578570] alloc_contig_range: [46200, 465f5) PFNs busy
[ 1703.596924] alloc_contig_range: [46300, 466f5) PFNs busy
[ 1703.598060] alloc_contig_range: [46400, 467f5) PFNs busy
[ 1703.600480] alloc_contig_range: [46400, 468f5) PFNs busy
[ 1703.601654] alloc_contig_range: [46600, 469f5) PFNs busy
[ 1703.619165] alloc_contig_range: [46100, 464f5) PFNs busy
[ 1703.619528] alloc_contig_range: [46200, 465f5) PFNs busy
[ 1703.619857] alloc_contig_range: [46300, 466f5) PFNs busy
[ 1703.641156] alloc_contig_range: [46100, 464f5) PFNs busy

Camera Adjustments


The focus of the lens can be manually adjusted through rotation. Note that initially, the lens could be tight.

Low light mode

To get imagery in low-light conditions you can turn on the infrared LED's to light up the dark area and also enable the IR cut filter using the commands below. Note that these were performed on Armbian using the instructions from here [1].

# Run these as root

# Turn on the IR LED lights (note that you can see a faint red glow from them when it's low light)
# Turn them off with echo 1 instead (this may be inverted depending on the version of the kernel you have)
# echo 0 > /sys/class/leds/pine64\:ir\:led1/brightness
# echo 0 > /sys/class/leds/pine64\:ir\:led2/brightness

# Export gpio, set direction
# echo 45 > /sys/class/gpio/export
# echo out > /sys/class/gpio/gpio45/direction

# Enable IR cut filter (note that you can hear the switching noise)
# Disable with echo 0 instead
# echo 1 > /sys/class/gpio/gpio45/value

Camera controls

It is possible to adjust the camera using certain internal camera controls, such as contrast, brightness, saturation and more. These controls can be accessed using the v4l2-ctl tool that is part of the v4l-utils package.

# List the current values of the controls
v4l2-ctl -d /dev/v4l-subdev* --list-ctrls

User Controls

                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=0 value=0 flags=slider
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=64 value=64 flags=slider
                            hue 0x00980903 (int)    : min=0 max=359 step=1 default=0 value=0 flags=slider
        white_balance_automatic 0x0098090c (bool)   : default=1 value=1 flags=update
                    red_balance 0x0098090e (int)    : min=0 max=4095 step=1 default=0 value=0 flags=inactive, slider
                   blue_balance 0x0098090f (int)    : min=0 max=4095 step=1 default=0 value=0 flags=inactive, slider
                       exposure 0x00980911 (int)    : min=0 max=65535 step=1 default=0 value=4 flags=inactive, volatile
                 gain_automatic 0x00980912 (bool)   : default=1 value=1 flags=update
                           gain 0x00980913 (int)    : min=0 max=1023 step=1 default=0 value=20 flags=inactive, volatile
                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=3 default=1 value=1

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=1 default=0 value=0 flags=update

Image Processing Controls

                     pixel_rate 0x009f0902 (int64)  : min=0 max=2147483647 step=1 default=61430400 value=21001200 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0

# Set the contrast controls to the maximum value
v4l2-ctl -d /dev/v4l-subdev* --set-ctrl contrast=255

You can see which flags can be changed and which ones cannot by looking at the flags. The inactive flag indicates that it is currently disabled. Some of these flags are disabled when other flags are turned on. For example, the gain flag above is inactive because gain_automatic is enabled with a value of "1." Note that at the current time the auto_exposure flag is inverted, so a value of "0" means on, while "1" means off. Maybe the auto_exposure flag will get changed someday. You'll need to turn off auto_exposure (value=1) if you want to manually set the exposure flag.

Sound Controls

Note that sound is only currently available with special patches on top of a 5.13.13 or higher kernel with Armbian or NixOS. Once you have a kernel that supports sound you can install alsa-utils to get the alsamixer tool. The following mixer settings have been found to work with both playback and record. Note that you'll need to press F5 to get the capture controls and space bar to turn on/off capture for a device. The speaker dangles on a wire from the device. The microphone is located about 1cm below the lens on the front facing circuit board.



Stock Linux:


You can either setup a machine for the build environment, or use a Vagrant virtual machine provided by Elimo Engineering

Compile on a dedicated machine

Recommended system requirements:

  • OS: (L)Ubuntu 16.04
  • CPU: 64-bit based
  • Memory: 8 GB or higher
  • Disk: 15 GB free hard disk space

Install required packages:

sudo apt-get install p7zip-full git make u-boot-tools libxml2-utils bison build-essential gcc-arm-linux-gnueabi g++-arm-linux-gnueabi zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32z1-dev

Install older Make 3.82 and Java JDK 6:

pushd /tmp
tar xfv make-3.82.tar.gz
cd make-3.82
sudo apt purge -y make
sudo ./make install
cd ..
# Please, download jdk-6u45-linux-x64.bin from (requires free login)
chmod +x jdk-6u45-linux-x64.bin 
sudo mkdir /opt/java/
sudo mv jdk1.6.0_45/ /opt/java/
sudo update-alternatives --install /usr/bin/javac javac /opt/java/jdk1.6.0_45/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /opt/java/jdk1.6.0_45/bin/java 1
sudo update-alternatives --install /usr/bin/javaws javaws /opt/java/jdk1.6.0_45/bin/javaws 1
sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws

PineCubes SPI Flash support patch:

From 9316112c37ee86645fd691c6d3352183b95177d8 Mon Sep 17 00:00:00 2001
From: Marek Kraus <>
Date: Fri, 8 Jul 2022 21:01:47 +0200
Subject: [PATCH] Add support for xt25f128 SPI Flash

drivers/mtd/devices/m25p80.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 31e5795..0f46a4c 100755
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -803,6 +803,7 @@ static const struct spi_device_id m25p_ids[] = {
 	{ "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
 	{ "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
 	{ "W25q128", INFO(0xef4018, 0, 64 * 1024, 256, 0) },
+	{ "xt25f128", INFO(0x0b4018, 0, 64 * 1024, 256, SECT_4K) },
 	/* Catalyst / On Semiconductor -- non-JEDEC */

Unpack SDK and then compile and pack the image:

7z x 'PineCube Stock BSP-SDK ver1.0.7z'
mv 'PineCube Stock BSP-SDK ver1.0' pinecube-sdk
cd pinecube-sdk/camdroid
# apply SPI Flash patch above or edit m25p80.c file
source build/
lunch # select [1] here
make -j3

Compile using Vagrant

You can avoid setting up your machine and just use Vagrant to spin up a development environment in a VM.

Just clone the Elimo Engineering repo and follow the instructions in the readme file

After spinning up the VM, you just need to run the build:

cd pinecube-sdk/camdroid
# apply SPI Flash patch above or edit m25p80.c file
source build/
lunch # select [1] here
make -j3

Flashing the image

See PhoenixCard for a manual on how to flash Allwinners BSP images.

Board information, schematics and certifications

PineCube mainboard schematic:

PineCube faceboard schematic:

PineCube certifications:

Datasheets for components and peripherals

Allwinner (Sochip) S3 SoC information:

X-Powers AXP209 PMU (Power Management Unit) information:

CMOS camera module information:

LCD touch screen panel information:

Lithium battery information:

WiFi/BT module information: