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:
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.
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.
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.
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.
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.
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!