Header Ads

Hands-On With PineCube: An Open IP Camera Begging for Better Kernel Support

When the PineCube was announced by the Pine64 project in 2020, it created a fair bit of interest. Most of this was due to the appeal of a single-board computer (SBC) in a network-based (IP) camera form factor with integrated camera module, for a mere $29.99. Add an enclosure to it, and you would have a neat little package combining a 5 MP camera module with 100 Mbit Ethernet and WiFi. As a bonus, the system could be powered either via an optional battery pack as well as passive PoE, in addition to MicroUSB.

A few weeks ago I bought two of these boards, as part of a client project, and set out to use it for a custom IP camera implementation. With existing Linux-on-SBC and MIPI (CSI) camera experience on my end ranging from the Raspberry Pi to the Odroid, Orange Pi and Banana Pi boards, I felt fairly confident that I could make it work with minimal fuss.

Unfortunately, my experiences were anything but positive. After spending many hours with the PineCube, I’m not able to recommend it for those seeking an IP camera. There are many reasons for this, which I’ll try to explain in this article.

First Impressions

The front of the PineCube, with the lens cap removed.

Ordering these two PineCube boards (PineCubes?) was a somewhat curious experience, even if one is used to ordering hardware online. After clicking through the dialogs in the Pine64 Store and paying for the order (selecting standard shipping), I got a confirmation email. There was no estimated shipping date, but after waiting for a few weeks and wondering whether I would ever get an update, I got a notification that my order had shipped, along with a tracking link.

This tracking ended somewhere at the customs office, so that one day I suddenly was handed the parcel with the PineCubes. Inside the plain cardboard box were the two small white boxes, each containing a PineCube board in a little baggy. During the unboxing I was concerned about tearing off some wires or flex cable while extracting the contraption from the soft baggy.

The enclosure for the PineCube which one cannot get. Yet.

The speaker module is dangling at the end of its two rather long wires, and I felt it necessary to check the flat flex which connects the two boards that make up the system (is Dual-Board Computer a term yet?), in case it had become dislodged. It does not feel like the kind of board you want to handle too often, like one would a Raspberry Pi or similar. It feels fragile and you wish that you could put it into an enclosure right away to keep it safe, with no truly stable orientation to put it down on a desk.

Since the PineCube Wiki page contains a link to what should be an STL file of the case that would be put later on sale – according to a recent blog post – I had figured that I’d print a copy on the 3D printer I have standing around here before the boards got here. Unfortunately, as people in the comments to that blog post noted, no STL files were posted, but proprietary SolidWorks CAD files. Three months later still no STL files are available (Update: a “quick and dirty STL conversion” was added between writing and publishing this review). No enclosure is available for sale yet.

EoL Sensors and Linux Support

There is a GPIO header that provides a UART, SPI, I2C and such as well.

With the enclosure just being a ‘nice to have’ detail in the bigger picture (pun intended), I then focused on the functional parts of the hardware which I had received. It is rather disappointing to see the camera is an OV5640, a roughly 9-year old sensor that has been End-of-Life for a while now. It which makes the PineCube’s future seem rather dubious and probably short-lived.

On the bright side, this also means that support for it under Linux is no problem, with Video4Linux (v4l) happily accepting it as an input source when setting up an RTMP stream using ffmpeg. This is quite different from the situation with the GPU in the S3 SoC, however. As one can see on the ‘Linux mainlining effort‘ page over at Linux-sunxi, Linux kernel 5.11 is the first to list S3 support as having been merged. S3 support in kernel 5.10 is done via the V3s SoC support, as one can tell when looking at the hardware overlay file in Armbian for PineCube, which is using kernel 5.10. The S3 and Allwinner V3 SoCs are derived, so some compatibility there makes sense.

A look inside the PineCube. Notice the easily damaged wires.

At this point in time, Video Encoding is still WIP (Work In Progress). This means that ffmpeg, gstreamer, or whichever graphics framework one uses for video encoding has to do all of this in software, using the single Cortex-A7 CPU core and NEON vector progressing extensions. With a simple RTMP stream from the camera, this seemed to be sufficiently performant.

The PineCube also has a speaker, as mentioned earlier. Unfortunately, this cannot be used currently, with no audio device being registered. It appears that support for this may arrive with the next Armbian release, however, courtesy of an improved hardware overlay fix that was recently contributed.

Use as a Camera

In general use, the PineCube is much like any other SBC. You download the image for the target board, write it to a MicroSD card and insert it into the board’s MicroSD card reader before turning the system on. Since the PineCube has no video outputs, interaction methods are limited to either a serial connection, or SSH (if hooked up to Ethernet). After establishing a console connection using either method, logging into Armbian is as simple as 1234. (That’s the default root password.)

Once logged into Armbian, getting to the point where it’s possible to set up an RTMP stream takes little more than installing  media-ctl (package v4l-utils) and ffmpeg, before running the following commands to set up a 640×480 FLV-encoded stream to an RTMP server:

$ media-ctl --set-v4l2 '"ov5640 1-003c":0[fmt:UYVY8_2X8/640x480@1/15]'
$ ffmpeg -s 640x480 -r 15 -i /dev/video0 -vcodec flv -f flv rtmp://<rtmp_server>/live/pinecube

After running this command and connecting to the RTMP server with a player from a desktop system, the video from the PineCube can now be observed in glorious 640×480 at 15 FPS, with a few second delay. The FPS can be increased to 30 FPS at 1080p, but without hardware encoding support, this may result in stuttering and glitches.

While setting up the system, I noticed that it would reliably hang while downloading some resources via HTTP and only resume again after the HTTP download timed out. When I kept top open in another SSH terminal, I could see that the system load went up to 12 and beyond, as the system’s 111 MB of RAM (out of a total of 128 MB) filled up, along with the swap.

This same pattern repeated when I tried to set up an RTMP stream which added more local processing (h.264 encoding) and a custom security layer (encryption). Without hardware encoding support, I could see system load skyrocket until the system stopped responding. Sending Ctrl+C via the SSH terminal eventually worked after about a ten-minute delay.

The S3 SoC

The S3 SoC can be spotted deep inside the PineCube stack.

When I compare the PineCube to other SBCs I have worked with, the S3 SoC on this particular board seems to be the main limiting factor, and in particular the low amount of RAM and ongoing lack of hardware support. It seems to be first and foremost an SoC aimed at low-cost IP cameras, which means that trying to exceed the limitations that come with that focus will come with repercussions.

In that regard it is fascinating to see that Olimex are also planning to release an S3-based board this year, in the form of the S3-OLinuXino. Perhaps that having more open source boards like this around helps with increasing the support for these more obscure SoCs. What is clear to me is that without full hardware support, particularly for video encoding, the uses of these platforms will be limited.

Wrapping up

For the more casual user, I might compare the $30 PineCube with the above considerations, and something like the Raspberry Pi Zero W ($18) or Banana Pi M2 Zero (Allwinner H2+ SoC, $25), along with something like the Raspberry Pi V2 camera module with Sony IMX219 8 MP camera module ($25). For less than $50 one would have a board with more RAM (even the RPi Zero has 512 MB), a better camera, as well as the option of ready to buy or print enclosures (including with camera module).

Both the Allwinner H2+ and Raspberry Pi Zero’s BCM2835 SoCs have had mainline Linux support for years, including things like video encoding. All of this leads one to wonder just what exactly the raison d’être of the PineCube is, along with that of the presence of the S3 SoC in more general settings.

As for the more specialized setting for which I bought these PineCube boards, I’m fairly confident that it can be made to work, and very likely most lingering issues and gaps in hardware support will be resolved over time. After this experience, I do however feel that it is not the right platform for anyone who does not feel inclined to put in significant amounts of time to make even basic things work.


No comments