USB switching controller for Lhires III spectrograph

There are different solutions to remotely control the motorised calibration unit for Lhires III, I would describe the one that makes use of a USB relay controller. By means of a very simple application (below the link to download it) you can light up the Ar-Ne lamp, the tungsten lamp and set up the spectrograph for dark mode from PC (virtual switch panel). However, an advanced control mode is available using a script in Astroart 5, so you can automate all sequence frames (flat, calibration-start, light, calibration-end,...).

The USB-RLY08B relay module is used to switch almost any electronic device from computers. It is powered from any standard USB port and can handle currents up to 1A (per relay). Each relay has normally open, normally closed and common pins. For Lhires III operations you need only two relays but I used the eight-relays model board thinking of further use (i.e. telescope focusing).

The USB module is distributed by many shops, just google the name "USB-RLY08B" to find them.

Some details:

Model:
USB-RLY08B - Devantech 8 Channel Relay Module

General info:
http://www.robot-electronics.co.uk/htm/usb_rly08btech.htm

Driver (VCP, Virtual Com Port):
http://www.robot-electronics.co.uk/files/usb-devtech-inf.zip


Wiring diagram:

We use "normally open" contacts, that is no current flow between them when the relay is OFF. Wires must be connected to C and NO screw terminals for each relay. When you activate a relays, contacts are closed and current execute the appropriate functionality on Lhires III.

I assembled the board in a small box provided with panel-mounted connectors. The unit requires 12V DC power supply (relays power source come from USB port) and it is connected to spectrograph with a four wires cable (note I used the unit also for telescope focusing, so there are other connections).


 


Concerning the software to manage the unit, a demonstrative program is provided by manufacturer (see general info web page), also with source files. You can activate/deactivate each relay by pressing the related button. Anyway I create a very simple Visual Basic 6 application conceived for Lhires III operations. Developed on Win XP 32 bit operative system, it should work on almost every edition (I use it on Win 8.1, 64 bit OS). Buttons are ON/OFF type and a virtual orange led light up when the related functionality is active.



For the "dark" command example, both relays 1 and 2 are simultaneously activated (see the new Lhires III specifications).

The application can be downloaded from here:
http://quasar.teoth.it/html/USB_relay/USB_relays_install.zip

Installing procedure ad setting here:
http://quasar.teoth.it/html/USB_relay/inst_ctrl.htm

Several software allow remote controlling with two computers (one near the telescope, the other far away), for example Virtual Network Computing (via LAN network, google VNC) or TeamSpeak (via Internet, www.teamspeak.com/).


The advanced alternative involves the use of a script in CCD camera control, that is a list of commands which are executed in sequence, to full automate observing sessions (taking all requires frames in "unmanned" mode). Astroart 5 communicates with relay card through COM port using Serial.Connect and Serial.Send commands.

Follows a sample script that automatically turn on the Ar-Ne lamp, take an initial lamp spectrum, turn off the lamp and clear the optical path, take a series of 10 x 480 frames, turn on the Ar-Ne lamp and take a final lamp spectrum, then switch off all. By acquiring some familiarity with script language (very easy and similar to classical Basic), you can add an appropriate user interface and many additional features.

CCD control panel during operations:

 

Full script command list:

'Variables init for 1st and 2nd relays (calib and flat respectively) of USB-RLY08B . If you use other relays, codes are different.

calib_on$ = Chr(92) + Chr(1) 'code to activate relay 1 from all off state
flat_on$ = Chr(92) + Chr(2) 'code to activate relay 2 from all off state
dark_on$ = Chr(92) + Chr(3) 'code to activate relay 1 and 2 from all off state
all_off$ = Chr(92) + Chr(0) 'code to turn off all relays

Serial.Connect (3) 'USB relays card is seen as COM3 (example)

Serial.Send (calib_on$) 'turn on the calibration lamp
pause (1) 'wait 1 second
Camera.Start(2) 'take a 2 second exp. frame for lamp spectrum
Camera.Wait 'wait the end of exposure
Serial.Send (all_off$) 'turn off the calibration lamp
Image.Save("c:\spec\20150210\ar-ne_target_start.fit")
Image.Close

'take 10 x 480 s frames
for i = 1 to 10
Camera.Start(480)
Camera.Wait
Image.Save("c:\spec\20150210\target-" + str$(i) + ".fit")
Image.close
Next i

Serial.Send (calib_on$)
pause (1)
Camera.Start(2)
Camera.Wait
Serial.Send (all_off$)
Image.Save("c:\spec\20150210\ar-ne_target_end.fit")
Image.Close

Serial.Disconnect()
 

Output files in c:\spec\20150210\ folder at the end of the script execution:

ar-ne_target_start.fit
target-1.fit
target-2.fit
target-3.fit
target-4.fit
target-5.fit
target-6.fit
target-7.fit
target-8.fit
target-9.fit
target-10.fit
ar-ne_target_end.fit
 

AA commands for script are described in CCD control user guide (manual.pdf):
http://www.msbsoftware.it/astroart/CCD541.zip

MSB Astroart website:
http://www.msbsoftware.it/astroart/


Paolo Berardi
February 2015