×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Qhy cooler at 100% when connected

  • Posts: 179
  • Thank you received: 7
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
1 year 8 months ago #84949

Please Log in or Create an account to join the conversation.

  • Posts: 179
  • Thank you received: 7
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
The following user(s) said Thank You: Massimo
1 year 8 months ago #85194

Please Log in or Create an account to join the conversation.

I can confirm this issue is fixed as of today's 22.9.9 QHY SDK release. I proposed to QHY they turn this off by default at the firmware level and just leave to high level software to manage the cooler and I'm very glad it was implemented.
1 year 7 months ago #86200

Please Log in or Create an account to join the conversation.

  • Posts: 179
  • Thank you received: 7
very good news indeed. Thanks for the feedback Jasem. Looking forward to test the new version!
1 year 7 months ago #86207

Please Log in or Create an account to join the conversation.

Time to create page: 0.459 seconds