sobota, 20 stycznia 2018

Reces egzekucyjny - ciąg dalszy Ugody Altransztackiej

Udostępniam tłumaczenie recesu egzekucyjnego, który zawiera szczegółowe informacje jak wykonano ustalenia zawarte w ugodzie.
Dziękuję tłumaczce - Pani Aleksandrze Milcarz!

środa, 17 stycznia 2018


Something completely different. I made quite a few wallpapers during several years, sharing it now.
Please check and leave the feedback if you like them!

sobota, 6 stycznia 2018


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.


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/ file
  3. Put the below contents into your ~/.config/pulse/ 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


### 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

piątek, 9 stycznia 2015

Ugoda altransztadzka

W skrócie

Król Szwecji, Karol XII, stojąc ze swoją armią w Saksonii, wymusił na Cesarzu złagodzenie prześladowań religijnych (dla ścisłości katolicy prześladowali protestantów). Stało się to w 1707 i nazywamy to ugodą altransztadzką.
Dzięki tej ugodzie powstał Kościół Jezusowy w Cieszynie. W kościele tym jest nawet pomnik Karola XII'ego, po prawej stronie ołtarza!

Nie mogłem nigdzie znaleźć polskiego tłumaczenia ugody altransztadzkiej, co mnie dość mocno zdziwiło...
Oto świeże tłumaczenie z łacińskiego oryginałuUgodaAltransztadzka.pdf (tłumaczyła Pani Aleksandra Milcarz - bardzo dziękuję).

Skąd ten temat?

Polecam posłuchać płyty "Carolus Rex" szwedzkiej grupy "Sabaton". Dwa utwory są poświęcone Karolowi XII'emu, cała reszta innym królom, bitwom i podbojom... Teksty są zabójcze, niejedną lekcję historii można by z nich zrobić! Muzyka też fajna, jeśli ktoś lubi metal :-)


Udostępniam tłumaczenie recesu egzekucyjnego, który zawiera szczegółowe informacje jak wykonano ustalenia zawarte w ugodzie.

Carolus Rex

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.


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.


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.


# Written by Piotr Dlugosz
# License GPL

#set -x # uncomment to debug

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

# Base directory for the photos

# Serial port for BULB cable

# 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
geeqie -t -r "$ARGUMENT" #>/dev/null 2>&1
[ "$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
read -ei "$OP" -p "Enter the photo parameters: " ANSWER # otherwise ask
eval $ANSWER

# Prepare environment
ABSPATH=`cd ${0%/*} && echo $PWD/${0##*/}`
DATE=`date -d "-6 hours" +"%y%m%d"`
[ -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"

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

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

echo "Killing gphoto"
pkill gphoto2