Pokazywanie postów oznaczonych etykietą linux. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą linux. Pokaż wszystkie posty

poniedziałek, 4 listopada 2019

Half a year with NanoPI M4

After some time of using the AstroBox M4 - FriendlyElec NanoPi M4 - it is time for a little summary...

So far my the experience with the board has been great!

The AstroBox works well - finally this is a board which delivers enough power to drive what is needed. Quite a lot of stuff actually:
  • INDI + Kstars with Ekos (compiled from source)
  • Lin_guider (compiled from source)
  • Celestron Nexstar mount
  • Various scripts (bash, python)
  • Relays controlled by GPIO
  • Heater controlled by onboard PWM
  • Canon cameras via gphoto2
  • Pentax DSLRs via pktriggercord
  • QHY5 guiding camera used directly by Lin_guider, but also via INDI...
  • DreamFocuser via INDI
  • Astrometry.net installed locally
  • TurboVNC - by far the best VNC server! (compiled from source)
All the above runs in Armbian (Debian) and the entire Debian repository is available. I've choosen to compile INDI, Kstars and other software to have the latest versions. In some casese (e.g. TurboVNC) the software is not in the repositories.

Ekos functionality
I wanted to use more of Ekos and less of various scripts. Basically it is just working, however I did not ditch my scripts completely.
  • Autofocus = DreamFocuser + Canon 400d =
    • PROS: works and does the job automatically (stops guiding, finds the star, iterates to reach the best focus)
    • CONS: I can achieve better focus using Bahtivov mask; sometimes it thinks a noise is a star and focus goes completely off (can't be left unattended)
  • Platesolve to synchronize and to slew to your target = Nexstar + Canon 400d =
    • PROS: works and achieves very good precision; just give it target name or even FITS file with your earlier photo; works offilne
    • CONS: sometimes it does not work with FITS (some my files probably miss important data); with my mount it can try ten times until it achieves the target with good enough precision
  • Autoguiding = QHY5 + Nexstar =
    • PROS: all in one program and well integrated with other functions; can use external guider (Lin_guider or PHD2) and still integrate
    • CONS: has tendency to loose the guiding star; external guiders allow more control over guiding parameters
  • Driving the entire session - scheduler
    • PROS: could potentially automate entire sesion
    • CONS: needs a quality mount, quality cameras and telesope to work reliably; in my experience it is quite picky (e.g. autofocus failed -> entire session fails or autoguiding lost the star -> entire session fails etc.); still better to run individual tasks manually...
To summarize
The NanoPi M4 was one of the first SBCs withe enough horsepower to drive astrophoto sessions. IMHO it is currently the best! Only few months ago the RPi4 became available and now the solutions like Stellarmate for RPi4 start to appear. But NanoPi is still better: there is a lot of development around mainlinig the Rockchip boards. As a result NanoPi M4 currently can work with pure, open source Linux! No vendor lock-in. Runs 64bit (ARM64 aarch64) Linux - with the necessary software installed directly from repositories (few exceptions can be compiled - easy). I can use all 7 USB ports (4 are USB3). The onboard wifi and bluetooth work as well, without any special drivers. Performance wise it is equal or better than RPi4.

I bougth another such board, this time with 4GB memory. I will use it as tablet (with a touchscreen). I already installed Arch Linux on it and experiment with Panfrost drivers (open source 3d for ARM Mali)...

Next post: some pictures I made during this half year... Stay tuned ;-)



czwartek, 4 kwietnia 2019

AstroBox M4 inside

Here are ugly internals:

  • one relay module with four relay ports, used to gate power outlets for DLSRs and multipurpose 12V; one relay is used to control the shutter release of DSLR (NanoPi has only one serial port, used for telescope so I had to control shutter with GPIO&relay)
  • two DC/DC voltage convertors, one from 12 to 5V for powering NanoPi M4 board, one from 12 to 7.4V for powering DSLR cameras
  • one PWM module which takes as input the hardware PWM from NanoPI and 12V DC, output is modulated 12V, used to power dew heater
  • one module to convert serial TTL levels to RS232, to control the telescope mount

środa, 3 kwietnia 2019

AstroBox M4

A new toy: NanoPi M4,
brand new development board, similar to RPi but better(!) in quite a few areas. It has 2GB RAM, speed Rockchip Rk3399 processor and a lot of other goodies (WiFi, 1G ethernet, 4 USB3.0 and 3 USB2.0 ports, etc).

I decided to make a new AstroBox with it because the former built on OrangePi had not enough processor power and too little RAM. Now it is ready and runing great.
It is self contained with INDI, Kstars and Ekos. You have to connect to it to initiate the session, but while it is running (making photos, guiding, focusing), you can disconnect and it does not disrupt the session.

It provides the following conectivity to telescope and other astro devices:

  • 2 x 7.4V switchable power outlets for DSLR cameras
  • 1 x shutter release mini jack for Canon or Pentax DSLRs
  • 1 x RS232 with RJ11 socket (for simple 1 to 1 connection to Celestron mount)
  • 1 x 12V PWM for heater
  • 2 x 12V switchable power outlets for other devices
  • 4 x USB 3.0
  • 2 x USB 2.0
  • 1 x USB3 socket (but USB 2.0 speed only)
  • 1 x 1G ethernet
  • HDMI (not used)
  • headphones (not used)
From the PC side, one can connect to it using VNC or RDP.

Basically it covers all the AstroBox v1 did, but just better...





piątek, 27 lipca 2018

AstroBox v2 in action - lunar eclipse!

Not too many posts recently. But here is a fresh photo taken with scope + Pentax K-5 II. All driven by AstroBox v2 :)
Photo tethering of Pentax using pktriggercord program.


poniedziałek, 2 kwietnia 2018

AstroBox v2 cont.

Easter = hobby time ;)

Some progress is done with the AstroBox v2:
  • the box is printed
  • components are collected
Next step is soldering!

Below are all major components, the only missing is a 4-ports relay box, which is currently installed in AstroBox v1...

Windows deploy with Clonezilla

Recently I reinstalled Windows 8.1 on 14 computers (total 15 but one of them was a "donor" of OS image for the rest), using the Clonezilla multicast feature. I'd like to share how does it look like...


The deployment was done from a DRBL server which is including Clonezilla service. All the PCs received the same network packets in a synchronous way - so all 14 PC were re-imaged simultaneously.
The entire process took about 50 minutes over 1Gbit network (the OS image had 53 GB). Here, the DRBL server is relatively weak and old machine with 4GB RAM, running Debian Linux with a DRBL packages installed.

The benefit of DRBL is that any of the PCs can also run Linux directly from the server, without installing it (PXE boot from the network and system via NFS). The boot menu for selecting locally installed Windows or remote Linux is visible at 1:45 in the movie.

The below movie shows just the ending of the process. After re-imaging, PCs were restarted to apply changes made by a small script, which was started automatically, to:
  • change the PC name
  • install proper Windows license key
  • set a nice wallpaper, different for each PC :)

niedziela, 18 marca 2018

AstroBox v2

AstroBox v2

An improved AstroBox is in preparation. I'm using the Orange Pi PC2 development board instead of OrangePi PC. It has four cores and Allwinner H5 64bit processor, running on Armbian Linux distribution.

The v2 has all the capabilities of AstroBox v1, with the following improvements:

  • Orange Pi PC2 has 1GB ethernet and faster processor. 
  • Added shutter interface and power connector for second DSLR. So it is possible to have one DSLR connected to main scope (e.g. SCT 8), and second DSLR piggybacked, with tele lens.
  • Added PWM with 12V to connect heater tape.
  • All four USB 2.0 ports, which are exposed by Orange Pi, are now available. In my case connected will be:
    • DSLR 1 - Canon 400D, on SCT8
    • DSLR 2 - Pentax K5II with 300mm tele on piggy back
    • QHY5 camera - as OAG (Off Axis Guider)
    • DreamFocuser
Here is a screenshot of the case ready for printing on Ultimaker 2 3d printer:


BTW. INDI driver for DreamFocuser is here.

sobota, 6 stycznia 2018

AstroBox

A little hardware project in the astro-photo domain.

AstroBox v1 :-) contains:

  • Orange Pi PC small and not expensive development board, running:
    • Armbian - operating system for many development boards except RPi, based on Debian
    • INDI - with Celestron Nexstar mount and DreamFocuser drivers. More drivers availabe: QHY, Gphoto2 etc. but not used currently
    • lin_guider - nicely connects with QHY5 and provide guiding with OAG
    • KStars - sky map, mount controll, INDI control panel and Ekos
    • Xpra - which gives X screen for KStars and lin_guider and can be connected remotely in "seamless" mode (each app separately, not the entire desktop)
    • Couple of other small apps and scripts to capture photos with gphoto2, easily steer the mount, preview the photos or enable/disable devices. It can also run Ekos, but I did not master it yet...
  • Relay board with 4 relays. This is used to enable/disable power outlets, 3 with 12V (mount, focuser, heater) and one with 9V (for the Canon DSLR)
  • Two voltage converters to convert input 12V to 5V (for Orange Pi PC) and 9V (for Canon DSLR)
  • Two logic converters from 3V TTL to RS232 standard for the mount serial connection.
  • Shutter release connector for DSLRs, controlled by GPIO port of Orange Pi 
  • The box, which is 3d printed and designed to fit in the place for batteries in the mount. The original battery holder is removed and cables which were connected to batteries are now used to connect power directly from the AstroBox (so there is no loose power cable to the mount hanging around)

How it works:

  • Connection is with ethernet cable, no Wifi yet but it can be added via USB dongle
  • External power supply must provide 12V and enough power for all connected devices

Future possibilities:

  • Would be nice to connect the heater using PWM which is available on the Orange Pi
  • Ideally replace a bulky DreamFocuser box&cables and steer a focuser stepper directly (already bought RAMS 44988 module)
  • attach BT gamepad to control the mount and focuser
  • Add second shutter release connector, so two

poniedziałek, 18 grudnia 2017

Chinese "3.0 Bluetooth Numeric Keypad"

I bought a bluetooth numeric keypad on Aliexpress.
The main purpose was to use it for Blender, to switch views. My laptop has only a basic keyboard, so I decided to try this cheap device. There are also versions with radio dongle but I preferred BT version not to block the USB port. Here is the obligatory photo:
You will find A LOT of these on Aliexpress.

So, problems... and solutions:
  1. There are no instructions bundled! How to enter pairing mode?
    After some trials I found that quickly blinking green diode indicates pairing mode. I managed to enter it by pressing 4 5 6 keys together (not every attempt was successfull).
    In Linux I used bluetoothctl to pair it. Probably using Gnome or some other graphical tools would also work, but with bluetoothd one can see the entire dialog between the system and a device. Bold are commands typed by me (when PIN is given, type it on the keypad and press ENTER at the end):

    > bluetoothctl
    [Bluetooth Mouse]# devices
    Device 00:00:00:00:1C:77 Bluetooth Mouse
    [Bluetooth Mouse]# scan on
    Discovery started
    [CHG] Controller E4:A7:A0:38:D1:BD Discovering: yes
    [Bluetooth Mouse]# agent on
    Agent is already registered
    [Bluetooth Mouse]# default-agent
    Default agent request successful
    [NEW] Device 92:29:1C:04:00:8A Bluetooth Keyboard
    [Bluetooth Mouse]# pair 92:29:1C:04:00:8A
    Attempting to pair with 92:29:1C:04:00:8A
    [CHG] Device 92:29:1C:04:00:8A Connected: yes
    ****** [agent] PIN code: 123456
    [CHG] Device 92:29:1C:04:00:8A Modalias: usb:v05ACp0220d0001
    [CHG] Device 92:29:1C:04:00:8A UUIDs: 00001124-0000-1000-8000-00805f9b34fb
    [CHG] Device 92:29:1C:04:00:8A UUIDs: 00001200-0000-1000-8000-00805f9b34fb
    [CHG] Device 92:29:1C:04:00:8A ServicesResolved: yes
    [CHG] Device 92:29:1C:04:00:8A Paired: yes
    Pairing successful
    [CHG] Device 92:29:1C:04:00:8A ServicesResolved: no
    [CHG] Device 92:29:1C:04:00:8A Connected: no
    [Bluetooth Mouse]# connect 92:29:1C:04:00:8A
    Attempting to connect to 92:29:1C:04:00:8A
    [CHG] Device 92:29:1C:04:00:8A Connected: yes
    Connection successful
    [CHG] Device 92:29:1C:04:00:8A ServicesResolved: yes
    [Bluetooth Keyboard]# trust 92:29:1C:04:00:8A
    [CHG] Device 92:29:1C:04:00:8A Trusted: yes
    Changing 92:29:1C:04:00:8A trust succeeded
  2. Now it is connected and working, but... I still can't use it in Blender(!). The device reports normal numbers not the "keypad numbers" to the system! So it can't be used to switch views :(
    Here Linux comes to rescue (I do not think anything similar can be done in  Windows...). In Linux it is possible to remap the keys of any keyboard/gamepad/etc. by placing the map file in /etc/udev/hwdb.d/ folder. Here is the file I used: /etc/udev/hwdb.d/70-pd_bluetooth_keypad.hwdb. It also remaps numlock (and make it always on) as a home key.

poniedziałek, 18 maja 2015

Kodi HDMI & Analog audio at the same time

XMBC / Kodi - dual audio output HDMI & Analog

I have a HTPC with Kodi connected to TV with HDMI (Nvidia 240 GT) and also to amplituner using analog output from motherboard audio. The HTPC is running Debian Sid Linux and Kodi 14.2.

The problem

To send the audio output to TV and amplituner at the same time, one can use special setup of ALSA or Pulseaudio. Newest versions of XBMC / Kodi accept for me only the special setup of Pulseaudio, anyway, it still works :)
The TV has delay in processing the HDMI input. As a result there is an enormous echo!
Somehow we need to delay the analog output, to match the delay done by TV to HDMI signal.

Solution

Advanced configuration of Pulseaudio using LADSPA delay filter (you can configure the delay amount to match the TV).
  1. Install LADSPA filters (in Debian it is ladspa-sdk package)
  2. Backup your ~/.config/pulse/default.pa file
  3. Put the below contents into your ~/.config/pulse/default.pa. I had to disable autodetection to be able to recognize sinks propery, for me hw:0,0 is internal card analog output, hw:1,7 is Nvidia HDMI. Please modify it to match your system.
    The green values control the delay of LADSPA delay_5s filter. Refer to LADSPA documentation for explanations - generally just modify the first number.
  4. Restart the system and test! You may need to check Kodi audio settings and change the output device.
#!/usr/bin/pulseaudio -nF

.fail

### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
load-module module-alsa-sink device=hw:0,0 sink_name=internal
load-module module-alsa-sink device=hw:1,7 sink_name=nvhdmi

### Apply delay to internal sink
load-module module-ladspa-sink sink_name=internal_delay master=internal plugin=delay label=delay_5s control=0.18,1

### Combine delayed internal sink with hdmi sink
load-module module-combine-sink sink_name=combine slaves=nvhdmi,internal_delay

### Load several protocols
load-module module-native-protocol-unix

### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
#load-module module-suspend-on-idle

### Make some devices default
set-default-sink combine

sobota, 21 lipca 2012

Astrophotography in Linux with gphoto2

Astro-photography with Linux

Script for making series of photos using Canon Rebel 350D connected to PC using USB cable and an additional cable to trigger BULB exposures.This script is especially useful for astrophotography.

Installation

Just place the script in the directory which is in the PATH, for instance: /usr/local/bin. Make it executable:
> sudo chmod a +rx /usr/local/bin/foto

Two additional programs are required: gphoto2 and geeqie. In Debian use the following command to install them:
> apt-get install gphoto2 geeqie
To configure the script review and modify variables in the SETTINGS section at the beginning of the script, especially BASE and SPORT, to match your setup.

Usage

Start the script:
> foto
It will ask for the parameters. Optionally you can specify the parameters directly:
> foto name=m27 frames=20 exptime=60
This will make 20 60 seconds exposures, with common name m27.


#!/bin/bash

# Written by Piotr Dlugosz
# License GPL

#set -x # uncomment to debug

# ***** SETTINGS *****

# Base directory for the photos
BASE=/home/share/ASTRO

# Serial port for BULB cable
SPORT=/dev/ttyUSB0

# Gphoto2 settings
OG="--quiet --port usb: --set-config shutterspeed=Bulb --set-config imageformat=RAW --set-config focusmode=3"

# Photo parameters (these params can be given on the command line)
OP="name=test frames=1 exptime=10 iso=400"

# ***** END SETTINGS *****

# ***** HOOK PART *****

if [ "$ACTION" = "download" ]; then
echo "DOWNLOAD"
geeqie -t -r "$ARGUMENT" #>/dev/null 2>&1
fi
[ "$ACTION" ] && exit 0

# ***** END HOOK *****


# ***** START *****

echo "*** FOTO AUTOMAT ***"

[ -d "$BASE" ] || { echo "$BASE does not exist!"; exit 1; }

# Ask for parameters and set the script variables
eval $OP # set the defaults first
if [ "$1" ]; then
eval $@ # if command line is not empty take params from command line
else
read -ei "$OP" -p "Enter the photo parameters: " ANSWER # otherwise ask
eval $ANSWER
fi

# Prepare environment
ABSPATH=`cd ${0%/*} && echo $PWD/${0##*/}`
DATE=`date -d "-6 hours" +"%y%m%d"`
NAME="${name}_${DATE}_$$"
FOLDER="$BASE/$name/$DATE"
[ -d "$FOLDER" ] || mkdir -p "$FOLDER"
cd "$FOLDER" || { echo "$FOLDER does not exits!"; exit 1; }

echo "** Folder: $FOLDER, session number: $$"
echo "** Params: exptime=$exptime frames=$frames iso=$iso"

((count=frames-1))
export count

# Start gphoto in tethered mode and set the parameters
gphoto2 $OG --set-config iso=$iso --filename "${NAME}-%03n.cr2" --hook-script "$ABSPATH" --wait-event-and-download >~/gphoto.log 2>&1 &

# Loop to make photos
for a in `seq 0 $count`; do
echo -n "* Frame: $a/$count "
sleep $exptime >$SPORT
echo "finished."
sleep 0.5
done

# Wait till the last photo is saved before exiting
LASTPHOTO="${NAME}-`printf '%03d' $count`.cr2"
while [ ! -s "$LASTPHOTO" ]; do
sleep 1
done

echo "Killing gphoto"
pkill gphoto2