Whole-sky scanner of the light pollution

Project solved at the Department of Experimental Physics of FMFI UK

iPANO AllView Pro mount control

Connect the mount to the computer

The mount is connected to the computer via a serial line (RS232). Since modern laptops and PCs no longer have a serial port, a standard USB-> RS232 converter must be used, which creates a serial port when connected to a computer. For compatibility reasons and based on the mount manufacturer's recommendations, we have decided for converter with FTDI chipset. The serial port settings of the mount are:

<

The complete instruction set is quite comprehensive, as the mount is primarily intended for shooting panoramas with cameras. For our purposes, we only need a few commands to direct the mount and determine the status of the mount:

Mount control concept

We used the pyserial library to control mount in Python.

Mount identification

So that the user does not have to find out on which serial port the mount is connected, we use special function in the "pyserial" library to find out the list of ports. Then we open each of the ports with parameters as required by iPANO (with a timeout of 1 s) and ask the device with the command ": 01INF #" for identification. If it answers ": 10INF3600 #", the mount is connected to the given port. Otherwise the communication will end on timeout and we will try another serial port:

myportdevice=''
ports = serial.tools.list_ports.comports(include_links=False)
iPANOfound=False
for port in ports :
     print('Checking '+port.device)
     ser = serial.Serial(port.device,115200, timeout=1) # open serial port
     ser.write(b':01INF#')
     s=ser.read(11)
     if s==b':10INF3600#':
         print('iPANO mount found on '+port.device)
         myportdevice=port.device
         iPANOfound=True
         break
     ser.close()
if iPANOfound==False:
     print('iPANO mount not found')
     quit()

Direction of mount and waiting for the final position

We use the command GOTO (": 01SSLnTTTTTZZZZZ #") to direct the mount and the command ": 01GAS #" to find out if the mount is still in motion. The fact that the mount is in motion is indicated by the number 1 in the 18th place in the text of the answer. After the GOTO command, we have to wait a while until the mount starts, otherwise we could get the answer that the mount is not moving yet. The direction in which the mount is to be rotated is stored in the variables "azimuth" and "height":

command=':01SSL+%s%s#' % (str((int)(100*azimut)).zfill(5),str((int)(100*vyska)).zfill(5))
command=command.encode() #conversion to the sequence of 8-bit characters
ser.write(command) #move to the next position
ser.read(19) #ignore the answer
time.sleep(0.1) #wait for the movement is started
ser.write(b':01GAS#') #read the position and the state of the mount
s=ser.read(19)
while s[17]== ord('1'): #ASCII code of 1 = is moving
     ser.write(b':01GAS#') #read the position and the state of the mount
     s=ser.read(19)

Exception handling

When measuring in the field, it can easily happen that the connection between the notebook and the mount fails (for example, if the USB connection cables are handled carelessly). As some types of measurements can take up to two hours, it is crucial to ensure that the measurement does not end with such an error, but that it is possible to continue it after the error has been rectified. Our concept of exception handling is as follows:

  1. After each measurement step, the number of the step, that was successfully completed, is written to the "running.txt" file, together with the file names (measuring point positions, measurement results, ...). At the end of the entire measurement cycle, the "running.txt" file is deleted.
  2. If the USB connection fails, one of the "serial.serialutil.SerialException" exceptions (inability to write to or read from port) will be thrown, depending on the time of the interruption, or "IndexError" (erroneous data - error in the index when determining whether the assembly is still moving) exception will be thrown. The program catches these exceptions, notifies you of the problem with the mount connection also acoustically, and after elimination the problem with the connection (the user presses a key on the keyboard), the action is repeated and the measurement continues.
  3. If the connection repair in point 2 was unsuccessful or the measurement failed in any other way (power failure, system reset, ...), after restarting the program, it is found that the measurement was not completed (there is a file "running.txt" present), the user can decide whether to continue the interrupted measurement or start a new measurement. If he wants to continue the interrupted measurement, the measuring points are read, those that have already been measured are omitted, and the measurement continues.

Program Exception Handling Concept:

...
try:
    commands for the communication with port;
except (serial.serialutil.SerialException,IndexError):
    print('\a')
    print("Connection to the iPANO mount is lost. Reconnect and press any key...")
    input('')
    repeat commands for the communication with port;
...

Mount control test

The test program reads the sequence of measuring points (declination, azimuth) from the prepared file, gradually directs the mount in individual directions, waits one second (measurement simulation) and saves the current direction to the output file. Since we are counting on building the program into the GUI, we use functions "filedialog.askopenfilename ()" and "filedialog.asksaveasfilename ()" from the "tkinter" library to open the file and choose the name of the output file.

Full test program: ipano.py