Miguel replied to the topic 'Qhy cooler at 100% when connected' in the forum. 3 weeks ago

very good news indeed. Thanks for the feedback Jasem. Looking forward to test the new version!

Read More...

Miguel replied to the topic 'Qhy cooler at 100% when connected' in the forum. 2 months ago

hi all,

I wanted to provide some feedback with my findings.

I've been in contact with qhy, and reading other similar posts with this same issue and the same camera (it seems does not affect to all models). In a nutshell: this is the way is designed. That does not make any sense for me, but it seems qhy will not provide (so far) any solution, at least for indi/linux environments (I've read some workaround or fix for ascom/windows).
So I created a very basic script to turn off the cooler at boot time, when the computer starts up. Then created the corresponding systemd unit to execute it at boot time.

This is the script

#!/bin/bash

function execCMD () {
	CMD=$1
	eval ${CMD}
	while [[ $? -ne 0 ]]; do sleep 1; eval ${CMD}; done
}

execCMD "/usr/bin/lsusb -d 1618:c269"
execCMD '/usr/bin/indi_setprop "QHY CCD QHY268M-c3c8ac4.CONNECTION.CONNECT=On"'
execCMD '/usr/bin/indi_setprop "QHY CCD QHY268M-c3c8ac4.CCD_COOLER.COOLER_OFF=On"'
execCMD '/usr/bin/indi_setprop "QHY CCD QHY268M-c3c8ac4.CCD_COOLER.COOLER_ON=Off"'
and the corresponding systemd unit file
[Unit]
Description=qhy268 cooler off

[Service]
Type=simple
User=YOUR_USER
ExecStart=/usr/local/scripts/qhy268CoolerOff.sh


[Install]
WantedBy=multi-user.target
-> modify it accordingly -> also get your qhy device full name from indi_getprop


This works. The cooler is turned off when the system boots up and the camera is connected. You can easily implement it. That's it.


But I wanted to go a step further. I realized that the cooler has some inertia, as expected. So even if the script runs at boot time, it can take up to 30sec until the temperature raises again. But, usually, you are turning up the pc and the camera to do some imaging session. Hence, when started, you usually want to cool down the camera. But at a normal pace not at 100%!!
So I thought the script could take into account if it believes you are going to use your rig for imaging. If I detect the sun has set, I assume the rig is to be used for imaging. So instead of turning off the cooler, I can go directly to cool down to the desired temperature at the right pace (ramp slope).

For this, the following python script returns whether the sun has set or not:
#!/usr/bin/env python3

from astropy.time import Time
from astropy.coordinates import AltAz
from astropy.coordinates import EarthLocation,SkyCoord,get_sun
from datetime import datetime



def is_sunset(loc):
    now = Time(datetime.utcnow(), format='datetime', scale='utc')
    altazframe = AltAz(obstime=now, location=loc)
    sunaltaz = get_sun(now).transform_to(altazframe)
    if sunaltaz.alt.value <= -5:
        return True
    else:
        return False

 #loc=EarthLocation.of_address("sevilla")
loc=EarthLocation(5046167.45010766, -529958.65067131, 3851750.5668941,unit="m")

print(is_sunset(loc))

Note a couple of things:
- you need to install astropy (pip install astropy) to let the python script work
- you must modify the 'loc' parameter accordingly. Execute the EarthLocation.of_address("YOUR_ADDRESS") from a python console and copy/paste the output. I do this cause you need inet access to get the address if "of_address" method is used, and I have no inet when I'm in the field
- the script checks for the sun's altitude. If <5 degrees, returns true. You can change it to accommodate if you wish


So the final bash script will look like this:
#!/bin/bash
#set -x

LSUSB="/usr/bin/lsusb"
USBID="1618:c269"
INDI_SETPROP="/usr/bin/indi_setprop"
INDI_GETPROP="/usr/bin/indi_getprop"
LOGFILE="/var/log/qhy268CoolerFix.log"
QHYNAME="QHY CCD QHY268M-c3c8ac4"
RAMP_SLOPE=2
TEMP="-5"


function log(){
	echo "[ "`date +"%Y-%m-%d %T"` "] $@" >> $LOGFILE
}


function execCMD () {
	CMD=$1
	eval ${CMD}
	while [[ $? -ne 0 ]]; do sleep 1; eval ${CMD}; done
}

log "STARTING"
log "qhy dev name: "${QHYNAME}

log "waiting for usb device ${USBID}"
execCMD "${LSUSB} -d ${USBID}"

log "connecting camera"
execCMD '${INDI_SETPROP} "${QHYNAME}.CONNECTION.CONNECT=On"'

if [[ "$(/usr/local/scripts/is_sunset.py)" == "False" ]] 
then
	log "sun has not set. Disconnecting cooler"
	execCMD '${INDI_SETPROP} "${QHYNAME}.CCD_COOLER.COOLER_OFF=On"'
	execCMD '${INDI_SETPROP} "${QHYNAME}.CCD_COOLER.COOLER_ON=Off"'
else
	log "sun has set. Setting temp to ${TEMP} -- ramp slope ${RAMP_SLOPE}"
	execCMD '${INDI_SETPROP} "${QHYNAME}.CCD_TEMP_RAMP.RAMP_SLOPE=${RAMP_SLOPE}"'
	execCMD '${INDI_SETPROP} "${QHYNAME}.CCD_COOLER.COOLER_OFF=Off"'
	execCMD '${INDI_SETPROP} "${QHYNAME}.CCD_COOLER.COOLER_ON=On"'
	execCMD '${INDI_SETPROP} "${QHYNAME}.CCD_TEMPERATURE.CCD_TEMPERATURE_VALUE=${TEMP}"'
fi


log "end"

-> modify it accordingly

This is not a solution *at all* but at least I avoid stressing the camera in vane. Maybe I complicated it but now have much more control

Hope someone finds it useful.

Miguel

Read More...

Jasem, just to my understanding. Why did this feature stop working? It worked in some previous version (I don't remember which one sorry). What has changed that makes so difficult to fix it? Just out of curiosity

Read More...

Miguel created a new topic ' Qhy cooler at 100% when connected' in the forum. 2 months ago

Hi,.
I always experience the same (and undesirable) behavior with my qhy camera. Once connected and just when the firmware is loaded, the cooler start to work at maximum power. Indi control panel shows a 0% of consumption but the cooler is for sure at 100%. The pace of cooling down, a power meter and even the noise, states it
How can I avoid this?

Regards

Read More...

Jasem, has been this issue, by chance, solved in this last update?

Read More...

Thanks for the feedback Jasem. I hope you can modify it again. I don't remember the version I had before but it was working fine. I guess a lot of code has changed and recovering this behavior may not be trivial. Thanks for your effort.
I will pay attention to the next updates, but if you are aware of the fix and remember this thread, please post :)

Read More...

Hi,

I've recently updated kstars/ekos/libindi to latest version (running on a rpi). I've noted a major difference while I'm using stellarium and connected to the indi server. When I slew to an object with stellarium and go to ekos and try to plate solve and sync, it solves, but also slews to the previous object I slewed in first instance (or parking, if none). With the previous version, it solved correctly and slewed to the current object, as expected.

Any ideas?

Miguel

Read More...

This thread leads me to another question. Since sequence settings apply only to a particular sequence, if I want to refocus every 30min in a scheduled job (with a duration of several hours) but that job is linked to a sequence of 15min duration (the sequence would repeat several times in the schedule definition), I guess it will never refocus. Am I wrong?

Read More...

Hi Jasem. Unfortunately, this does not work. Looping for example through 20 LRGB loops (scheduler, "repeat for"=20) and dithering every 4 frames, does not never dither. I have to dither every <4 frames. It seems that when it finishes a job (.esq), it doesn't take into account that another loop is coming.
any ideas?

Read More...

yes, that is the only solution that came into my mind. I have to test it and check if suits my needs. Thanks for the reply

Read More...

Hi there,

Sorry for bumping this thread, but it's just was I looking for. Paul's tips are very useful, I agree. However, I'm trying to setup this kind of cycling shooting but I want to dither in every loop (this kind of imaging, by the way, can avoid wasting too much time for dithering). Is this possible? How can I dither between loops? If this is not possible natively, can I run a particular script in every loop? The idea is to run a python script to perform send a manual dither to phd2. I've been tinkering for a while but cannot find the way.

miguel

Read More...

Miguel replied to the topic 'Help with QHY268M cooler' in the forum. 12 months ago

Hi Paolo. Thanks for the reply. I need to investigate a bit more

Read More...