Pinephone Pro camera CLI: return of the dots

now set the cli to capture full resolution image, and see the return of the triangular dots, first seen with ppp-cam.

test pattern on pinebook screen

all the settings were “try what worked” not sure if they are optimal, or even correct or consistent.

now need to dig into docs and see….

also has greenish cast. Have tried other encodings, this one seems best for now

Posted in tech | Leave a comment

Pinephone Pro Camera CLI on mobian

Finally got around to looking at the cli commands and the pinephonepro camera.

the new device, is slightly more complex that the docs I found:
installed utility “dot” ( sudo apt install graphviz ) to view the structure of the settings:
run the commands below to generate the image:

media-ctl -d platform:rkisp1 --print-dot > m-1.dot
dot -T png -o m-1.png m-1.dot

results in

above is at boot, notice the dotted lines between the green settings. they need to be hooked up and configured:
This can be done with media-ctl and v4l2-ctl :

note, these commands should all be on the same line, this editor on my screen wraps some longer lines with

Script below will setup the camera, dump to a “raw” file, and then use ffmpeg to convert the raw file into a jpeg file, in the “Pictures” subdirectory, with the name CLI_{dateandtime}.

#!/bin/bash

# make lines shorter
media_cmd="media-ctl -d platform:rkisp1" 
v4l2_cmd="v4l2-ctl -z platform:rkisp1 -d rkisp1_mainpath"

# create a timestamp for the filename
NAME=$(date +"%Y%m%dT%H%M%S")

$media_cmd "-r"

$media_cmd "--set-v4l2" '"imx258 1-001a":0 [fmt:SRGGB10_1X10/1048x780]'

$media_cmd "--set-v4l2" '"rkisp1_resizer_mainpath":0 [fmt:SRGGB8_1X8/1048x780 crop:(0,0)/1048x780]'

$media_cmd "--set-v4l2" '"rkisp1_resizer_mainpath":1 [fmt:SRGGB8_1X8/1048x780]'

$media_cmd "-l" "'imx258 1-001a':0 -> 'rkisp1_csi':0 [1]"

$media_cmd "-l" "'rkisp1_csi':1 -> 'rkisp1_isp':0 [1]"

$media_cmd "-l" "'rkisp1_isp':2 -> 'rkisp1_resizer_mainpath':0 [1]"

$media_cmd "--set-v4l2" '"rkisp1_isp":0 [fmt:SRGGB10_1X10/1048x780 crop:(0,0)/1048x780]'

$media_cmd "--set-v4l2" '"rkisp1_csi":0 [fmt:SRGGB10_1X10/1048x780 ]'

$media_cmd "--set-v4l2" '"rkisp1_isp":2 [fmt:YUYV8_2X8/1048x780 crop:(0,0)/1048x780]'

$v4l2_cmd  "-v" "width=1048,height=780,"

$v4l2_cmd  "-v" "width=1048,height=780,pixelformat=YM61"

### different v4l2 node for camera controls!
v4l2-ctl -z platform:rkisp1 -d "imx258 1-001a" -c exposure=33000

v4l2-ctl -z platform:rkisp1 -d "imx258 1-001a" -c analogue_gain=100

### yet another for focus
v4l2-ctl -z platform:rkisp1 -d "dw9714 1-000c" -c focus_absolute=256

## stream image to raw file
$v4l2_cmd  "--stream-mmap" "--stream-count" "1" "--stream-to=frame.raw"

## convert raw file to jpg in Pictures dir
ffmpeg -y -hide_banner -loglevel error -s:v 1048x780 -pix_fmt yuv422p -i frame.raw ~/Pictures/CLI_${NAME}_%03d.jpg

resulting setup is now below (regenerated with same commands as above). The solid lines show the connection settings from the nodes in the commands above.
I found the exposure was needed to be so large, otherwise the image was very dark. Found the focus_absolute setting did change the image for me (pointing the phone at the pinebook pro screen very near). Will now move the camera farther away and see if the focus control works better.

Posted in tech | Leave a comment

Building Megapixels on mobian

mobian megapixels working from this build:

branch 'linux-megi-6.1' of https://github.com/kgmt0/megapixels

have been apt updating files and am currently running:

Linux mobian 6.1-rockchip #1 SMP PREEMPT_DYNAMIC Thu Jan 12 12:05:39 UTC 2023 aarch64 GNU/Linux

the default megapixels does not seem to work currently.

installed the following to build (may be more than required, but worked)

build-essential
clang-format-14
cmake
curl
git
gtk4
libfeedback-dev
libgtk-4-bin
libgtk-4-common
libgtk-4-dev
libgtk-4-doc
libzbar-dev
make
megapixels
meson
package-cfg
pkg-config
tmux
wget
zbar-tools

manually running from repository dir, via ./build/megapixels seems to work; did have to run
export DISPLAY=:1

Still green tinted, and a bit dark. This is a green shrub and some green/brown leaves…

Posted in tech | Leave a comment

Mobian and megapixels working

since I have an sd card with the manjaro-ppp version installed, updated my mobian sd card with apt update, so now uname -a shows

Linux mobian 5.19-rockchip #1 SMP PREEMPT_DYNAMIC Sat Oct 15 15:03:36 UTC 2022 aarch64 GNU/Linux

and copied the megapixels binary, and config from the manjaro phosh, and it is working.

todo: find a debian version of megapixels; the default one did not seem to find the camera properly, and gave errors when using the copied ini file.

Posted in tech | Leave a comment

October 2022 Manjaro phosh + megapixels-ppp

downloaded an October 2022 dev image of Manjaro phosh:

Manjaro-ARM-phosh-pinephonepro-20221008.img.gz

and installed megapixels-ppp

works!

the default rear image is 1048×780, but modifying the file

/usr/share/megapixels/config/pine64,pinephone-pro.ini

one can change the resolution. Is a bit darker? did click and change the camera settings for shutter and iso, from defaults.

here is a full size image (my messy table with a glowing mouse)

Below, for comparison, a picture from the older ppp-cam utility, still showing the triangular dots, but seemingly better focus.

still not quite working with cli; without Megapixels, does not seem to initialize properly…
need to dig into how metapixels and ppp-cam initialize things so cli commands work.

Posted in tech | Leave a comment

PinephonePRO camera working in July 2022

for the long weekend here in North America (Friday off in Canada, Monday off in US) had some time to again look at the pinephone pro.

downloaded the July 1 manjaro plasma dev image:
https://github.com/manjaro-pinephone/plasma-mobile-dev/releases/tag/202207010605

and also ppp-cam testing utility:
https://megous.com/git/ppp-cam

am inside, so a bit dark, had to set gain > defaults:

test pics at breakfast: all 3 sizes of the world sensor; did notice the lowest resolution is darker, so set the gain higher for a second version

Medium

Small

Small, same gain as large

Large

Do notice the small triangular grid on the large image; software or actual hardware artifact?
also a greenish tinge.

Next?

  • get the cli working with ffmpeg, v4l2-ctl and media-ctl
  • hook python up, and see about some image processing there.
Posted in tech | 1 Comment

BirdNET-Pi in the city

installed BirdNET-Pi on a 4 Gig Raspberry Pi 4. Using a webcam with built in microphone I had lying around. The microphone is not really designed for wildlife recordings, but seems to work! It is sitting in an open window.

Above is an amusing result of my first day: A local emergency vehicle, with its faint rise and fall, then switch to faster siren, is picked up as an Eastern Screech Owl. The very thin clear line in the graph shows it is clear pure tone, and the even colour shows uniform volume.

It has picked up the birds I know do exist around my place, including some very faint Ring Gulls that fly over, way up high, 20m or more above the house! Most impressed by the microphone… and slightly horrified as to what else it picks up when I use it in a zoom meeting?!

here are the stats from this morning; anything before 4 am I assume are city noises, but I can attest that the Robins are awake between 4 and 5 am.

will leave running until I need my webcam back!

Posted in nature, tech | Leave a comment

BrickPI EggBot for Easter

Since was playing with the brickpi earlier, tried an eggbot:

as with most things, the software part is easy for me, the actual pen/egg bits are more challenging.

Found the “gear play” and some friction issues, the egg slipping in the holder, or the pen pressed too hard and pushed the egg out of the correct alignment.

There is some feedback possible to detect the rotation of the NXT motors, but my initial version does not do this.

Did make some easily changeable pen holders:

so once I can get the software/penup calibrated, should be able to make multicolour patterns.

Posted in Art, tech | Leave a comment

Raspberry Pi HQ Camera action shot

Have a Raspberry Pi High Quality Camera with the 16mm Telephoto Lens for Raspberry Pi HQ Camera watching my back yard. Caught a sparrow mid flight this week.

Posted in nature, tech | Leave a comment

MS Code Remote SSH + Pinephone PRO

got my python setup and running remote, with MS Code, on my laptop, connected remotely via SSH to pinephone pro.

MS Code has a very useful capability “Remote Development using SSH“. Briefly, it lets me use my favorite big screen/keyboard to run/test/edit code on a remote system.

The pinephone pro supports this!

my phone currently running:

> uname -a

Linux manjaro-arm 5.16.2-2-MANJARO-ARM #1 SMP PREEMPT Fri Jan 21 21:39:27 UTC 2022 aarch64 GNU/Linux

Notes on pygame

need to configure X display stuff; once you have a pygame test program that runs locally, and you try to ssh and run it, you will see error:

pygame.error: No available video device

have seen this before, need to configure the DISPLAY variable. On a “local” terminal session on the phone, you can type

env | grep DISPLAY

to get the proper value, then “export” it, on your ssh terminal, for me:

export DISPLAY=:1

usually this is sufficient; but I found also needed the XAUTHORITY variable.

the error I first saw was:

Authorization required, but no authorization protocol specified

on my usual generic ubuntu or raspberry pi machines I did not see this error; the pinephone setup uses a “random” name each time, so you need to look it up after each reboot, you can get it with a “find” command

find /run/user/1000 -name "xauth*"

may give a permissions error about subdirectories, if you are not root, but that is fine, it should find the file, something like:

/run/user/1000/xauth_WUxldc

the part after the underscore will change each reboot.

so then you export:

export XAUTHORITY=/run/user/1000/xauth_WUxldc

then you can run your pygame tests!

all of these steps could be put into a bash script; but I have not done that yet, perhaps tomorrow!

Posted in tech | Leave a comment