×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

ASI 120MC bug?

  • Posts: 456
  • Thank you received: 76

Replied by Derek on topic ASI 120MC bug?

The update did seem to improve things for me. It worked for about 1hr of time under a clear sky and then just stopped working and guiding failed.
It was a particularly cold night, about -3 or so. Maybe this affected it.

Anyway, I've just ordered a lodestar x2 and I hope this will cure all my guiding problems....

P.S. if anyone wants to buy an ASI120mm let me know :-)
Last edit: 7 years 2 months ago by Derek.
7 years 2 months ago #13561
The topic has been locked.
  • Posts: 1309
  • Thank you received: 226

Replied by Andrew on topic ASI 120MC bug?

I did a quick and dirty test by putting my ASK120MM in the freezer for a while a firing up linguider. I didn't notice any corrupt frames during my short test.
The following user(s) said Thank You: Derek
7 years 2 months ago #13569
The topic has been locked.
  • Posts: 2876
  • Thank you received: 809

Replied by Rob Lancaster on topic ASI 120MC bug?

According to the ZWO website, at least for the ASI camera I purchased, it says "Working Temperature: -5°C—45°C". So if it is colder than about -5 C or 23 F, then there may be some problems. I haven't seen any yet, but I haven't tried temperatures that cold yet. One option would be to put a dew heater strap on the camera perhaps?
7 years 2 months ago #13572
The topic has been locked.
  • Posts: 278
  • Thank you received: 17

Replied by S on topic ASI 120MC bug?

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
The following user(s) said Thank You: Jasem Mutlaq, Derek
7 years 2 months ago #13911
The topic has been locked.
  • Posts: 2876
  • Thank you received: 809

Replied by Rob Lancaster on topic ASI 120MC bug?

That's really awesome! I should try that. Did you run that from your computer or a pi? I am thinking that I could just set up my pi outside connected to the camera with the fisheye lens attached. Then open KStars/Ekos and configure it to take many many photos with delays between them. Did you do it a different way?
7 years 2 months ago #13915
The topic has been locked.
  • Posts: 456
  • Thank you received: 76

Replied by Derek on topic ASI 120MC bug?

Thats a great video. Is there any chance you could share the code used to capture the images and generate it?
I recently got a lodestarx2 for guiding so now have a spare 120mm to use as an all sky camera :-)
7 years 2 months ago #13916
The topic has been locked.
  • Posts: 278
  • Thank you received: 17

Replied by S on topic ASI 120MC bug?

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)
7 years 2 months ago #13931
The topic has been locked.
  • Posts: 278
  • Thank you received: 17

Replied by S on topic ASI 120MC bug?

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 and bad practices please 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
The following user(s) said Thank You: Derek
Last edit: 7 years 2 months ago by S.
7 years 2 months ago #14008
The topic has been locked.
  • Posts: 456
  • Thank you received: 76

Replied by Derek on topic ASI 120MC bug?

Thanks!! This is great.
7 years 2 months ago #14011
The topic has been locked.

Replied by Jasem Mutlaq on topic ASI 120MC bug?

Locking this thread now, please continue this discussion into a new thread.
7 years 2 months ago #14013
The topic has been locked.
Time to create page: 0.713 seconds