Remote Control of a 10" Newtonian

Anthony Wesley
10th November 2005

After the 2003 Mars opposition I became interested in options for remotely controlling parts of my 10" f/6 newtonian. I had found that manually focussing was very tricky, and my stock rack-and-pinion focusser made life even harder than it ought to have been.

After some shopping around I bought a JMI DX1-M motorized crayford focusser. It is a major improvement on my old focuser and I noticed that it came with a serial port to allow communication with a host PC. I had previously noticed that my G-11/Gemini GOTO unit also had a serial port, and so the wheels started to turn in my head, but nothing happened straight away as I was busy with other projects.

Then about a year later I bought a monochrome firewire camera and filter wheel to replace my venerable ToUcam. I had heard that higher quality images might be possible this way, and I immediately noticed that the wheel came with a serial port for remote connection to a PC. Hmmm. Now there were three parts of my scope that could be driven by serial port.

This quickly grew to four items when I built myself a 4 port temperature logger that sends its data back to the host over yet another serial port.

The conundrum

I thought about the logistics of having four serial devices running back to my laptop while I was out in the field, in addition to the video cable that I use for grabbing images off the scope, and it seemed to me that it would be a nightmare to use. The laptop would be virtually tied down with wires and cables.

I wanted to find a better solution, and shortly afterwards an idea occurred... Coincidentally (or maybe not...) my wife wanted to upgrade her Sony Vaio laptop to a newer model. She had one of the early picturebook format Vaios, very compact and easy to use but only had 128Mb of RAM and a P2-400 processor, not really enough for her anymore. After a little bit of negotiating I inherited that laptop, called ceres and she upgraded to a shiny new Vaio. It was a win-win situation, I planned to put ceres into a case which would then sit under the scope, run all the serial cables to it and use a wireless connection to talk between ceres and my main laptop (mimas).

USB saves the day

Now another problem loomed. The picturebook came with no serial ports - it had one s.400 firewire port and a USB 1.1 port for external connection, and that was that. How was I going to connect four serial-port devices to a laptop without a serial port?

Lucky for me the gods provided an answer in the form of serial-to-usb adapters. The theory is that you plug the serial end of these things into your serial device and the usb end into a spare usb port on your PC, and then the device appears as a serial port to your host PC. Sounded ideal to me - all I had to do was use a 4-port USB hub to plug all the devices together and then plug the hub into the one and only USB port on ceres.

Well, it turns out that this works only if you get the right sort of usb-to-serial adapter. You see there are various different ones available and some of them "cheat" and do not look like real serial ports. In particular they don't bother passing all the extra signal pins through from the serial device, all they pass is the basic data pins. This was a problem for me, as I relied on having all the serial port pins available to my software.

In the end I found a good, reliable usb-serial adapter that had a driver chip which presented all the serial pins and also used a nice, lightweight usb cable. In Australia these were "dolphin" brand and resold by Dick Smith and Tandy (Radio Shack). There is a picture of one of these adapters below. They use the FT232BM chipset and work extremely well.

Here are some pictures of all the bits and pieces:


The Losmandy G11/Gemini GOTO unit. Note the RS323 socket for remote serial port control of the scope.
The True-Technologies filter wheel. Two jacks for power and serial data are visible on the right hand side of the unit.
The JMI smartfocus hand unit for controlling the DX1-M focusser. Note the serial port for remote control of the focusser.

Yes, I know that it's upside down, I did that so you could see the serial port on the top of the unit, silly :-)

The home-built temperature logger that I use for reading the temperature of my mirror and switching the cooling unit on and off.
My homebuilt 12v switchbox, also serial port controlled. I can switch on or off any 12v load via a serial port, and I use it to switch my mirror cooling system on and off.
The Dolphin-brand USB to serial adapter. These are ideal because they connect through all the serial pins (signal and data) and also use a lightweight cable.
The 4-port USB hub that I plug everything into. A single usb cable runs from this hub back to the PC (ceres).
Ceres, the Sony Vaio that Leisa donated to me for use as a scope control computer. You can see the usb cable running out from the right side of the unit and out of the case. This connects to the 4-port USB hub.

The other cables and things in the case are the 12v power pack for ceres. I decided that I wanted to have only the 240v main power cable leaving the case so it was easy to look after out in the field.


The Software

Okay, so I now had all the hardware stuff sorted out, and I could connect all my serial ports back to the PC.

Well, no, that's not quite true. as some of you might have noticed, I have five devices listed that use serial ports, and only a 4-port hub. At present I don't actually use the G11/Gemini serial cable for remote GOTO so that one is omitted from my setup. This is sort of ironic since it was the serial port on the Gemini that first got me thinking about remote serial control in the first place.

When I want to connect that one as well then I'll need to switch to a 5-port or 8-port or something hub, but at the time of writing I'm only connecting 4 devices at a time so the 4-port hub is perfectly ok.

Linux to the rescue

All of the software that I am about to describe is written in the Perl programming language and runs under RedHat Linux. I know that many of you who are reading this have just gone "oh s**t, I don't know anything about Linux..." but don't panic, I'll try and describe all the bits in a platform-neutral sort of way so that you could possibly build something like this for Windows if you were insane enough :-) (lol, just kidding...).

The USBTTY server

The first issue that confronted me when I sat down to write the programs to control my various devices was that I had no way of knowing which serial port anything was connected to - that would be determined at runtime by the order in which all the devices were plugged in. So for example I could not know beforehand whether my filter wheel was plugged into serial port 1, port 2, port 3, or port 4. The only sensible solution I could think of was to probe each port and try to work out what device was on the other end by what data I got back.

I had written a collection of small perl scripts to control all the devices, one perl script for the wheel, another one for the focusser, another one for the switchbox, etc, and now I needed to write a "super server" that would monitor all the serial ports as they came and went, routinely probe all the ports to see what was attached to them, and then launch the correct perl script for the device that it found.

The individual scripts were told by a commandline parameter from the "super server" which serial port they were to connect to, and so they didn't have to know anything about how or when devices were connected. They took care of all the details of operating the device on the serial port and when that device was unplugged or switched off then the scipt would just exit and the "super server" would see that this port is free again and would go back to polling it once every few seconds until something else was connected.

This made for a nice arrangement. I could plug and unplug my devices as I pleased, and the "super server" (called USBTTY) would keep track of what devices were plugged into which port and launch the correct device script as new devices were plugged in.

Remote Access to devices

Okay, so now I had ceres knowing which devices were plugged in, and able to launch a script to attach to and control each device. This wasn't the end of the story, as I still had to get the connection from ceres (remember, it's sitting in a closed instrument case under the scope) back to my laptop where I am sitting.

The answer was to make each of the perlscripts that talk to the devices into network-aware scripts which accepted network connections to control their devices. I made each device use a different network port - the Filter wheel script listens on port 12000, the focusser script listens on 12001 etc, so al I have to do is connect to those ports from my remote laptop and I will be talking to the appropriate device.

Here's a rough diagram of this whole process just to help you visualise it in you mind:

	Device (e.g. filter wheel) plugged into
	random serial port on ceres
		|
		|
	USBTTY server on ceres polls all the ports and detects
	the new device, launches the appropriate script
		|
		|
	script for device (e.g. wheel.pl) opens the serial port
	and talks to the device.
		|
		|
	script also listening on port 12000 for network connections

		...

	Remote PC (mimas) connects to ceres:12000 and talks to the 
	device via the script.
Both ceres and mimas are running wireless 802.11g network cards, and so there are no problematic cables running back to my laptop. My main problem has been eliminiated!

Success

At the end of this process, after a month or so of hacking on software I have a system that lets me remotely access and control all of the systems on my 10" scope.

I've considered making the scripts available for general download, but they aren't really suited for general use, they are very specific to my setup and it wold just be a lot of work for anyone else to get them going, so in the end I decided to write up this description instead and hope that it would be enough for anyone who wanted to try this for themselves.

Summary

In the end, after having used this system for a few months now I can say that it has made my life a whole lot easier - there's nothing quite like sitting at a table a few metres away from the scope and controlling teh focusser, filter wheel and camera. From a practical perspective it makes my hobby of planetary imaging a lot more enjoyable!

Anthony Wesley 10th November 2005