Daniel replied to the topic 'Cooling of CCD via pyindi' in the forum. 6 years ago

Hello Together,

fehlfarbe ( indilib.org/support/community/2262-fehlfarbe/profile.html ) helped me to get the temperature control working.

To read the device temperature I changed the "def newProperty()" function, it looks now like this:

  def newProperty(self, p):
        self.logger.info("new property "+ p.getName() + " for device "+ p.getDeviceName())
        if self.device is not None and p.getName() == "CONNECTION" and p.getDeviceName() == self.device.getDeviceName():
            self.logger.info("Got property CONNECTION for CCD Simulator!")
            # connect to device
            self.connectDevice(self.device.getDeviceName())
            # set BLOB mode to BLOB_ALSO
            self.setBLOBMode(1, self.device.getDeviceName(), None)
        if p.getName() == "CCD_TEMPERATURE":
            temp = self.device.getNumber("CCD_TEMPERATURE")
            print(temp[0].value)
            self.disconnectServer()
so it waits until the property "CCD_TEMPERATURE" is available and prints its value.

To change the temperature set-point one can use the following:
    def newProperty(self, p):
        self.logger.info("new property "+ p.getName() + " for device "+ p.getDeviceName())
        if self.device is not None and p.getName() == "CONNECTION" and p.getDeviceName() == self.device.getDeviceName():
            self.logger.info("Got property CONNECTION for CCD Simulator!")
            # connect to device
            self.connectDevice(self.device.getDeviceName())
            # set BLOB mode to BLOB_ALSO
            self.setBLOBMode(1, self.device.getDeviceName(), None)
        if p.getName() == "CCD_TEMPERATURE":
            temp = self.device.getNumber("CCD_TEMPERATURE")
            temp[0].value=np.float(1)                        ### new temperature to reach
            self.sendNewNumber(temp)
            self.disconnectServer()

This sets the temperature to 15°C and sends this new set-point to the server.
The temperature is then regulated internally to the new set-point.
With the first example of "newProperty()" you can watch the temperature drop and finally stabilize at the new temperature.

Thanks.

Read More...