Soren replied to the topic 'Dome scripting gateway for roll off?' in the forum. 7 hours 51 minutes ago

I don't have the experience needed with indi at the moment to develop driver. But scripts are nice and easy to write, so the scripting gateway seems like a great driver to use. But do you think it will work with a roll off roof?

Read More...

Soren created a new topic ' Dome scripting gateway for roll off?' in the forum. 19 hours 1 minute ago

Hi!

I have a couple of simple scripts to open and close my roll off roof, but would like it to be integrated with indi. Is it possible to use the dome scripting gateway for a roll off by have some of the scripts doing nothing? Or will this cause some unwanted side effects? (like indi thinking the dome is not aligned with the telescope...)

Best Regards,
Søren

Read More...

Soren replied to the topic 'indi_dsi_ccd not working after a while' in the forum. 3 days ago

A very similar script works fine with the asi driver, it have been running here for a couple of months almost continuouslt without problems (except trashed frames once in a while, but no memory leak).

Read More...

Soren replied to the topic 'indi_dsi_ccd not working after a while' in the forum. 3 days ago

Thanks to you all. The exposure start to fail after 2-3 hours of running on my system. With a previous version of indi it worked, untill the driver used up all memory on my rpi, so maybe this have fixed itself in a newer version of indi.

Read More...

Soren replied to the topic 'indi_dsi_ccd not working after a while' in the forum. 6 days ago

Have anyone been able to reproduce this?

Read More...

Soren replied to the topic 'indi_dsi_ccd not working after a while' in the forum. 2 weeks ago

Hi!

Thank you for the efforts! I am currently running Ubuntu mate 16.04 on my RPi and it also did not work when I used raspbian earlier.

Here is how I start the capture process:

indiserver -p 7626 -v indi_dsi_ccd &>/home/pi/dsiindi.log &
(while true; do /home/pi/captureDSI2.sh >>/home/pi/DSI.log 2>&1; sleep 2s; done) &

Here is the capture script (captureDSI2.sh):
#!/bin/bash
cd /home/pi/DSI
date

port=7626

DefaultExp=1
Exp=${1:-$DefaultExp}
echo $Exp

rm DSI_IMAGE_*.fits
indi_setprop -p $port "DSI.CONNECTION.CONNECT=On"
indi_setprop -p $port "DSI.GAIN.GAIN=10"
indi_setprop -p $port "DSI.OFFSET.OFFSET=0"
indi_setprop -p $port "DSI.UPLOAD_SETTINGS.UPLOAD_DIR=/home/pi/DSI"
indi_setprop -p $port "DSI.UPLOAD_SETTINGS.UPLOAD_PREFIX=DSI_IMAGE_XXX"
indi_setprop -p $port "DSI.UPLOAD_MODE.UPLOAD_LOCAL=On"
indi_setprop -p $port "DSI.UPLOAD_MODE.UPLOAD_CLIENT=Off"
indi_setprop -p $port "DSI.CCD_COMPRESSION.CCD_COMPRESS=Off"
indi_setprop -p $port "DSI.CCD_COMPRESSION.CCD_RAW=On"
indi_setprop -p $port "DSI.CCD_EXPOSURE.CCD_EXPOSURE_VALUE=$Exp"

for i in $(seq 1 1000); do
    if [ "$(indi_getprop -p $port DSI.CCD_EXPOSURE.CCD_EXPOSURE_VALUE 2>/dev/null | cut -d '=' -f 2)" == "0" ]; then
        break
    fi
    sleep 0.25s
done

sleep 0.5s

if ! [ -f DSI_IMAGE_001.fits ]; then
    echo Nothing captured...
    exit
fi

title=""
subtitle=$(date)

convert  -font /usr/share/fonts/truetype/freefont/FreeMono.ttf -background '#0008' -fill white -gravity center -pointsi\
ze 16 -size 640x22 caption:"$title $subtitle"  -gravity south DSI_IMAGE_001.fits  -normalize -gamma 2 +swap -composite \
-resize 640x480! obsimage.jpg
mv obsimage.jpg ObsImage.jpg

and here is the log from the run:
2017-03-13T05:47:37: startup: indiserver -p 7626 -v indi_dsi_ccd
2017-03-13T05:47:37: Driver indi_dsi_ccd: pid=25375 rfd=3 wfd=6 efd=7
2017-03-13T05:47:37: listening to port 7626 on fd 4
2017-03-13T05:47:37: Driver indi_dsi_ccd: snooping on Telescope Simulator.EQUATORIAL_EOD_COORD
2017-03-13T05:47:37: Driver indi_dsi_ccd: snooping on Telescope Simulator.TELESCOPE_INFO
2017-03-13T05:47:37: Driver indi_dsi_ccd: snooping on CCD Simulator.FILTER_SLOT
2017-03-13T05:47:37: Driver indi_dsi_ccd: snooping on CCD Simulator.FILTER_NAME
2017-03-13T05:47:37: Driver indi_dsi_ccd: snooping on SQM.SKY_QUALITY
2017-03-13T05:53:57: Client 0: new arrival from 127.0.0.1:58288 - welcome!
2017-03-13T05:53:57: Client 0: read EOF
2017-03-13T05:53:57: Client 0: shut down complete - bye!
2017-03-13T05:53:57: Client 0: new arrival from 127.0.0.1:58290 - welcome!
2017-03-13T05:53:57: Driver indi_dsi_ccd: w 1 3                                   [dt=0]
2017-03-13T05:53:57: Driver indi_dsi_ccd:     00000000: 03 01 00                                      PING
2017-03-13T05:53:57: Driver indi_dsi_ccd: r 81 40                                 [dt=1]
2017-03-13T05:53:57: Driver indi_dsi_ccd:     00000000: 03 01 06                                      ACK
2017-03-13T05:53:57: Driver indi_dsi_ccd: w 1 3                                   [dt=1]
2017-03-13T05:53:57: Driver indi_dsi_ccd:     00000000: 03 02 01                                      RESET
2017-03-13T05:53:57: Driver indi_dsi_ccd: r 81 40                                 [dt=0]
2017-03-13T05:53:57: Driver indi_dsi_ccd:     00000000: 03 02 06                                      ACK
2017-03-13T05:53:57: Driver indi_dsi_ccd: w 1 3                                   [dt=1]
.... A lot of lines....
2017-03-13T08:29:37: Driver indi_dsi_ccd: starting image row 483, write_ptr=490728, line_start=190464, is_odd=0, read_ptr=380974
2017-03-13T08:29:37: Driver indi_dsi_ccd: starting image row 484, write_ptr=491744, line_start=190464, is_odd=1, read_ptr=380974
2017-03-13T08:29:37: Driver indi_dsi_ccd: starting image row 485, write_ptr=492760, line_start=191232, is_odd=0, read_ptr=382510
2017-03-13T08:29:37: Driver indi_dsi_ccd: starting image row 486, write_ptr=493776, line_start=191232, is_odd=1, read_ptr=382510
2017-03-13T08:29:37: Driver indi_dsi_ccd: starting image row 487, write_ptr=494792, line_start=192000, is_odd=0, read_ptr=384046
2017-03-13T08:29:37: Driver indi_dsi_ccd: write_ptr=495808
2017-03-13T08:29:37: Client 0: new arrival from 127.0.0.1:40662 - welcome!
2017-03-13T08:29:37: Client 0: read: Connection reset by peer
2017-03-13T08:29:37: Client 0: shut down complete - bye!
2017-03-13T08:29:40: Client 0: new arrival from 127.0.0.1:40664 - welcome!

The last image I find was at 08:38, after this I see no new fits files and indi is still running:
pi@Observatory:~$ ps xavf | grep dsi
22148 pts/4    S+     0:00      0   128  4115   592  0.0              \_ grep --color=auto dsi
25374 ?        S      5:36      0    28  1647  1368  0.1 indiserver -p 7626 -v indi_dsi_ccd
25375 ?        Rl     3:14      0    99 55120 40196  4.2  \_ indi_dsi_ccd

Could it be a hardware fault if you can not reproduce this at all?

Read More...

Soren replied to the topic 'indi_dsi_ccd not working after a while' in the forum. 2 weeks ago

Yes, it happens every time I run my script for a few hours. The script captures images, wait for it to appear and then captures yet another image repeatetly. Then suddently no images are found after issuing

indi_setprop -p 7626 "DSI.CCD_EXPOSURE.CCD_EXPOSURE_VALUE=1"

Also, no image appear if I ussue the exposure outside the script once the driver have failed. (so it is not because my script crashes). I can also see that the indi_dsi_ccd aquires more and more memory, so it seems to me there is also a memory problem with the driver. With an older version of indi (1.3.1), I had indi_dsi_ccd use almost 50% of the memory of my RPi.

What's the best way to proceed here?

Read More...

Soren created a new topic ' indi_dsi_ccd nor working after a while' in the forum. 3 weeks ago

Hi!

When my DSI Pro have been running for a while, about 2 hours with about 2 frames pr. minute, the driver no longer produces an image. I don't see any errors or anything, but no image shows up after setting the exposure with

indi_setprop -p 7626 "DSI.CCD_EXPOSURE.CCD_EXPOSURE_VALUE=1"

Any idea on how do get this working or start debugging?

If I kill the indiserver and start it again it starts to work again.

Best Regards,
Søren

Read More...

Soren replied to the topic 'Any tips on how to automate?' in the forum. 2 months ago

That makes perfect sense :-)

Is it working out in general as expected? Any difficulties to be aware of?

Read More...

Soren replied to the topic 'Any tips on how to automate?' in the forum. 2 months ago

Very nice setup! My reason to automate are the exact same as yours :cheer:

So why are you not just running kstars/ekos directly on the Pi and the control it using VNC ?

Read More...

Soren replied to the topic 'Any tips on how to automate?' in the forum. 2 months ago

Thanks for the video. I did see this, but it appears to me that kstars/ekos in the video running on an external device (not the RPi in the observatory) and what then happens when this external device is shut down? Will the "queue" of objects still be imaged by the Pi, the obs. shut down when it becomes cloudy and so on? This I why in my proposed soluton 1 I wrote that I need ekos/kstars running directly on my RPi inside the observatory for example to be accessed via VNC. Is this a viable option? kstars seems to use a lot of juice even when minimized to the taskbar...

Read More...

Soren created a new topic ' How to automate' in the forum. 2 months ago

Dear all,

I am planning to automate my observatory. The first step was to be able to detect clear skies and I have found that using my all-sky camera and a bit of blob-detection is a good way to do this.

Now I want to have the observatory "wake up", roll off the roof, align the mount, initialize the guider, take some guided images of an object and shut down when it is not clear any more. It seems that EKOS can do this in principle, but as far as I understand this requires kstars to be running directly on my RPi which controls everything. I can easily make some small scripts which will open/close the roof, detect clear skies and so on.

My questions are:
1. Is ekos/kstars on the RPi a good and stable solution for this or is this combination not really meant for this completely autonomous operation?
2. I can easily interface the all-sky camera using indi/bash scripting. Are the interfaces for mount and guider just as easy to use? (i.e. does some simple commands exist for unparking, parking, aligning using plate solve, starting the guider and so on) If yes, then I guess this is a viable alternative to no. 1.
3. Any other alternatives? I see there are some python docs, but they seem to be requiring one to write complete drivers and not use indi in the "high level" that I actually want ;)

Thanks in advance for all suggestions and clear skies to y'all B)

Read More...

Derek thanked Soren in topic ASI 120MC bug? 2 months ago
Soren replied to the topic 'ASI 120MC bug?' in the forum. 2 months ago

Here is the code I currently use. Beware that it is not ment for anyone but me, so look and use at your own risk! And if you find any mistakes notify me B) There is a bug in imagemagick when reading fits files, so update to the latest version (I use 7.0.3-10) if your images are strange after using 'convert'. I use jpegpixi for removing hot pixels.

Here is how I start it

indiserver -p 7625 indi_asi_ccd &>/dev/null &

(sleep 15s;
     while true; do
         tic=$(date +%s.%N);
         /home/pi/capture.sh 55 50 2>&1;
         toc=$(date +%s.%N);
         slp=$(echo 60-$toc+$tic | bc -l);
         echo $slp;
         if [ $(echo "$slp > 0.0001" | bc -l) -eq 1 ]; then
             sleep "$slp"s;
         fi
     done)>/home/pi/sky.log &

And how I convert to a movie and move files around (run as a cron job one a day)

organize.sh
#!/bin/bash
date

shift=${1:-1}
shift0=$(echo $shift-1 | bc)
cd /home/pi/Sky
d=$(date -d "-$shift day 12:00:00" +"%Y-%m-%d-%H%M%S")
echo date $d
echo shift $shift
echo shift0 $shift0

files=$(find . -maxdepth 1 -type f -name 'Sky*.jpg' -newermt "-$shift day 12:00:00" ! -newermt "-$shift0 day 11:59:59" -exec ls -rt -dlist{} +)

nf=$(echo $files | wc -w)
echo $nf

if [ "$nf" -gt "0" ]; then
    cat $files | avconv -f image2pipe -codec:v mjpeg -i - -loglevel warning -r 25 -an videos/Sky-$d.mp4
    mkdir $d
    mv $files $d/
fi
cd

The code for capturing and converting:

capture.sh
#!/bin/bash
date
port=7625

ExpMax=${1:-55}
gain=${2:-50}

solEle=$(/home/pi/solElevation.py  | cut -d ' ' -f 3 | cut -d '=' -f 2)

#AltMax=15 previously

exp=$(echo $solEle $ExpMax | awk '{ExpMin=0.00001; ExpMax=$2; AltMin=-16; AltMax=9; if ($1<=AltMax && $1>AltMin) {print ExpMin*exp(log(ExpMin/ExpMax)/(AltMax - AltMin)*($1-AltMax))} else {if ($1>AltMax) {print ExpMin} else {print ExpMax}}}')
exp=$(echo $exp | awk '{printf "%.6f\n",$1}')

echo solEle=$solEle, exp=$exp, gain=$gain
expMin=0.0003
gainMin=10
if [ $(echo $exp '<' $expMin | bc -l) == 1 ]; then
    exp=$(echo $exp/$expMin | bc -l)
    gain=$(echo $gainMin*\(1-$exp\)+$gain*$exp | bc -l | awk '{printf "%.0f\n",$1}')
    exp=$expMin
fi

moon=$(/home/pi/moon.py)
moonAlt=$(echo $moon | cut -d ' ' -f 2 | cut -d '=' -f 2)
moonPhase=$(echo $moon | cut -d ' ' -f 3 | cut -d '=' -f 2)
if [ $(echo $moonAlt '>' 0 | bc -l) == 1 ]; then
    moonAltMax=20
    gain2=$(echo "("$gain"-1)"*"(100-"$moonPhase")/100+1" | bc -l | awk '{printf "%.0f\n",$1}')
    m=$(echo $moonAlt/$moonAltMax | bc -l)
    if [ $(echo $m '>' 1 | bc -l) == 1 ]; then
        gain=$gain2
    else
        gain=$(echo $gain*\(1-$m\)+$gain2*$m | bc -l | awk '{printf "%.0f\n",$1}')
    fi
fi

echo solEle=$solEle, exp=$exp, gain=$gain, moonAlt=$moonAlt, moonPhase=$moonPhase

#if [ $(echo $solEle '>' -5 | bc -l) == 1 ]; then
#    echo "Sun To High, exiting..."
#    exit
#fi

indi_setprop -p $port "ZWO CCD ASI120MC.CONNECTION.CONNECT=On"
indi_setprop -p $port "ZWO CCD ASI120MC.CCD_CONTROLS_MODE.AUTO_Gain=Off"
indi_setprop -p $port "ZWO CCD ASI120MC.CCD_CONTROLS.Gain=$gain"

indi_setprop -p $port "ZWO CCD ASI120MC.UPLOAD_MODE.UPLOAD_LOCAL=On"
indi_setprop -p $port "ZWO CCD ASI120MC.CCD_COMPRESSION.CCD_RAW=Off"
indi_setprop -p $port "ZWO CCD ASI120MC.CCD_COMPRESSION.CCD_COMPRESS=Off"
indi_setprop -p $port "ZWO CCD ASI120MC.CCD_VIDEO_FORMAT.ASI_IMG_RGB24=On"
indi_setprop -p $port "ZWO CCD ASI120MC.CCD_CONTROLS.HighSpeedMode=0"
indi_setprop -p $port "ZWO CCD ASI120MC.FPS.AVG_FPS=1"
indi_setprop -p $port "ZWO CCD ASI120MC.FPS.EST_FPS=1"

Name=$(date +%s)
indi_setprop -p $port "ZWO CCD ASI120MC.UPLOAD_SETTINGS.UPLOAD_DIR=/home/pi/Sky"
indi_setprop -p $port "ZWO CCD ASI120MC.UPLOAD_SETTINGS.UPLOAD_PREFIX=SKY_IMAGE_$Name"
indi_setprop -p $port "ZWO CCD ASI120MC.CCD_EXPOSURE.CCD_EXPOSURE_VALUE=$exp"
FITS="/home/pi/Sky/SKY_IMAGE_$Name".fits
echo $Prev $Next $FITS

h=$(date +"%H")
d=$(date +"%Y-%m-%d-%H%M%S")
# Get some weather info from the weather log files...
W=$(tail -n1 /home/pi/weatherLog.txt)
WSHumidity=$(echo $W | cut -d ' ' -f 2)
WSTemp=$(echo $W | cut -d ' ' -f 3)
ObsHumidity=$(echo $W | cut -d ' ' -f 4)
ObsTemp=$(echo $W | cut -d ' ' -f 5)
Rain=$(echo $W | cut -d ' ' -f 6)
Peltier=$(echo $W | cut -d ' ' -f 7)
title="Rain="$Rain", Peltier="$Peltier
subtitle="Hout="$WSHumidity"%, Tout="$WSTemp"C, Hin="$ObsHumidity"%, Tin="$ObsTemp"C, SEle="$solEle"."
width=1280
convert -font /usr/share/fonts/truetype/freefont/FreeMono.ttf -quality 85 -background '#0008' -fill white -gravity center -pointsize 20 -size ${width}x24 caption:"$d $title $subtitle" -flip -flop /home/pi/Sky/text-$Name.tiff &
textPid=$!

slp=$(echo $exp+1 | bc -l)
sleep $slp"s"

for i in $(seq 1 100); do
    if [ "$(indi_getprop -p $port 'ZWO CCD ASI120MC.CCD_EXPOSURE.CCD_EXPOSURE_VALUE' 2>/dev/null | cut -d '=' -f 2)" == "0" ]; then
        break
    fi
    sleep 0.2s
done

if ! [ -f $FITS ]; then
    echo Nothing captured...
    indi_setprop -p $port "ZWO CCD ASI120MC.CCD_ABORT_EXPOSURE.ABORT=On"
    wait $textPid;
    rm -f /home/pi/Sky/text-$Name.tiff;
    exit
fi

wait $textPid;
(
 if (( $(echo "$ExpMax" > "30" | bc -l) )); then
     convert $FITS -sigmoidal-contrast 10,20% -combine -quality 100 /home/pi/Sky/temp-$d.jpg;
 else
     convert $FITS -sigmoidal-contrast 10,10% -gamma 1.3 -combine -quality 100 /home/pi/Sky/temp-$d.jpg;
 fi
 jpegpixi -f /home/pi/Sky/HotPixels/deadpixels-stretch.txt /home/pi/Sky/temp-$d.jpg /home/pi/Sky/temp-$Name.jpg >/dev/null 2>&1;
 convert /home/pi/Sky/text-$Name.tiff -gravity south /home/pi/Sky/temp-$Name.jpg -flip -flop +swap -composite -quality 85 /home/pi/Sky/Sky-$d.jpg;
 cp -f /home/pi/Sky/Sky-$d.jpg /home/pi/Sky/latest.jpg;
 rm -f /home/pi/Sky/temp-$Name.jpg /home/pi/Sky/text-$Name.tiff $FITS /home/pi/Sky/temp-$d.jpg;
)&

Code for calculating the position of the sun (could also have been done nicely with python using ephem):

solElevation.py
#!/usr/bin/python
# Source:
# http://www.pveducation.org/pvcdrom/properties-of-sunlight/suns-position
from math import cos,sin,asin,acos,pi
import arrow

utc=arrow.utcnow()
local=arrow.now()

Longitude=10
Lattitude=60

newyear=local.replace(month=1,day=1,hour=0,minute=0,second=0,microsecond=1)
midnight=local.replace(hour=0,minute=0,second=0,microsecond=1)

ddays=local-newyear

#N is number of days since Januar 1st
N=ddays.days+1

dGMT=(local.hour-utc.hour)+(local.minute-utc.minute)/60.0

LT=(local.hour-midnight.hour)+(local.minute-midnight.minute)/60.0

B=360.0/365.0*(N-81.0)/180.0*pi
EoT=9.87*sin(2*B)-7.53*cos(B)-1.5*sin(B)

Phi=Lattitude
LSTM=15.0*dGMT
TC=4.0*(Longitude-LSTM)+EoT
LST=LT+TC/60.0
h=15.0*(LST-12)

delta=23.45*sin(B)

delta=delta/180.0*pi
Phi=Phi/180.0*pi
h=h/180.0*pi

alpha=asin(sin(delta)*sin(Phi)+cos(delta)*cos(Phi)*cos(h))
elevation=alpha/pi*180.0
azimuth=acos((sin(delta)*cos(Phi)-cos(delta)*sin(Phi)*cos(h))/cos(alpha))/pi*180.0
if (LST>12 or h>0):
    azimuth=360-azimuth

print local, "EoT=%.2f"%EoT, "Elevation=%.2f"%elevation, "Azimuth=%.2f"%azimuth


Code for calculating the position of the moon:

moon.py
#!/usr/bin/python
from datetime import date, datetime
from math import radians as rad,degrees as deg

import ephem

g = ephem.Observer()
g.name='Somewhere'
Longitude=10
Lattitude=60
g.lat=rad(Lattitude)  # lat/long in decimal degrees
g.long=rad(Longitude)

m = ephem.Moon()

g.date = datetime.utcnow()

m.compute(g)
print "MoonAz=%.2f"%deg(m.az)," MoonAlt=%.2f"%deg(m.alt), "MoonPhase=%.2f"%m.phase


Read More...

Jasem Mutlaq thanked Soren in topic ASI 120MC bug? 2 months ago
Soren replied to the topic 'ASI 120MC bug?' in the forum. 2 months ago

The movie is captured on a RPi using a bash script once pr minute which captures a fits file and converts it to jpg. The script sets the exposure time and gain based on the altitude of the sun and moon. Imagemagick is used for a bit of stretching, merging with some text, and conversion to jpg. I will post the script later when I have some more time, but it is not very readable but may be useful for inspiration ;) The move is made using avconv on the jpgs the bash script captures.

indi and RPi is a great match B)

Read More...

Derek thanked Soren in topic ASI 120MC bug? 2 months ago
Soren replied to the topic 'ASI 120MC bug?' in the forum. 2 months ago

Here is a 24 hour movie with one image pr minute with the "new" driver:
drive.google.com/open?id=0B182-tJ-4ZQtZHB2bjk5V2tYUlE

As you can see, there are some glitches every now and then. It seems to me that the glitches occur most frequently when I am changing the exposure time and/or gain. If I run with the same exposure time and gain for a long time it does not seem to happen so often. Anyways, it is not perfect but it is much more stable that when I started this post :D

Read More...

Soren replied to the topic 'ASI 120MC bug?' in the forum. 3 months ago

Ihoujin wrote:

Yesterday things seemed to stabilize. Linguider went from nothing but garbled frames to what appeared to be quite stable. The only thing I did was flash to and back from compatibility firmware, maybe apt-get update/upgrade too.

I updated today and I still see messed up frames from time to time. Whatever they did, it did not work :ohmy:

Read More...

Login

3rd Party

Choose from the numerous 3rd party INDI drivers to suit your needs!

Got Problem?

Check out the FAQ, the forum, and the bug tracking system to resolve any issues you might have!
You can also subscribe to INDI newsletter and development mailing lists to get the latest updates on INDI!