AutoGuider and Focuser Microcontroller Milton Hill Observatory Est 2003
Home Contact MHO
diagram
Software - AutoGuider and Focuser Control Program (AGFP)
AutoGuider and Focuser Control Program (AGFP) is used to communicate with the AutoGuider Focuser Microprocessor unit (AGFM). The AGFP program is written in Visual Basic .net framework and will run on any Microsoft Windows based PC or any system that supports .net framework 4.0 or higher.
There are 2 hardware versions of the AGFM. One using a Basic Stamp 2 and the other using a Arduino nano.
Download AutoGuider_Focuser_Control.zip
Picture
Menu bar functions:
  • Program
  • Always on Top
  • Program window will stay in front of other windows.
  • Show all COM ports found
  • List all COM ports that can be used now.
  • Clear status text
  • Clears status lines at the bottom of the window.
  • Timed beep
  • Will pay a sound when any Timed guide or focus finishes.
  • Set active/hover color
  • Sets colors of the buttons when activated.
  • Get controller version
  • Queries the microprocessor unit and returns verison information.
  • Initialize controller
  • Tells microprocessor to set outputs 1 through 13 to LOW.
  • Show commands sent to AGF
  • When checked command string sent to AGF is also shown on status lines.
  • Enable controller debug
  • When checked AGF controller will output commands received to it's debug terminal.
  • Web page document
  • Display this document in you web browser.
  • About/Help
  • Displays about / help window.
  • Exit
  • Exit program prompting to save settings.
  • COM10
  • COM ports 1 to 255 to select
  • Connect
  • Opens the indicated COM port
Picture
Sending commands and functions:
  • Controls
  • North, South, East, West, Stop
  • Guides autoguider port in the direction indicated.
  • Can guide NS and EW at the same time
  • If 'Timed Guide' is checked Stop button will stop the autoguider.
  • R. NS, R. EW
  • When checked will reverse the N-S and E-W buttons.
  • The command sent will be for the opposite direction of the button pressed.
  • In, Out, Stop
  • There is 1 set of focus motor buttons for each of the focus motors.
  • If 'Timed Focus' is checked Stop button will stop the focus motor.
  • Home, 1 Home, 2 Home
  • The Home button will guide the mount back to a NS and EW 0 position.
  • 1 Home and 2 Home will move focus motor 1 and 2 back to 0 position.
  • Zero, 1 Zero, 2 Zero
  • The Zero button will zero the NS and EW counts.
  • 1 Zero & 2 Zero will zero the selected focus count.
  • Timed controls
  • Timed Guide
  • When checked the N-S-E-W buttons will be active for the time indicated by the ms value or until Stop is pressed.
  • Timed Focus
  • When checked the In-Out buttons will be active for the time indicated by the ms value or until Stop is pressed. There is only one check box and time value for both motors.

This example shows the program connected to COM15 and doing a timed giude and focus for 10000ms (10 seconds).
The North, East, 1 In and 2 Out buttons were pressed and the counters are updating every 500ms (0.5 seconds).
The autoguider port moves the mount in the selected direction at the mount's current guide or slew rate depending on the mount as long as the button is pressed. If Timed Guide is checked the button click will move the mount for the number of milliseconds indicated or until the Stop button is pressed.
Focus motor buttons work the same as the autoguide buttons except when the Timed Focus is less than 10000ms (10 seconds). For Timed Focus between 5ms and 9999ms focus commands are issued to allow the AGF controller to do the focus duration.
The log box shows command communications to and from the AGF.
Picture
  • Record
  • Start
  • Begins recording of all commands sent unitl Stop is pressed.
  • Stop
  • Ends recording of commands and enables Playback.
Picture
  • Playback
  • Loop
  • When checked playback will loop recorded commands until Stop is pressed.
  • Start
  • Begin playback of recorded commands, with correct timing.
  • Stop
  • Ends the playback.
Picture
Keyboard control:
Click on 'Key' to enable the keyboard to send commands to the AGFM.
  • Guiding keys
  • Up arrow
  • Guides North.
  • Down arrow
  • Guides South.
  • Right arrow
  • Guides East.
  • Left arrow
  • Guides West.
  • Focus motor 1 keys
  • Page Up
  • Focus In.
  • Page Down
  • Focus Out.
  • Focus motor 2 keys
  • F1
  • Focus In.
  • F2
  • Focus Out.
  • Stop guiding and focusing
  • All other keys
  • Sends stop commands for everything.
  • Commands
  • C
  • Connect/Disconnect com.
  • S
  • Shrink/Restore window width.
  • E
  • Exit program with prompt.
Picture
About/Help:
About/Help window.
Picture
Shrink/Restore window:
Will make the window narrow hiding some functions and displays.
Shrink changes to Restore put the window back to normal width.

Use 'S' key or Shrink menu command.
Picture
Disconnect:
Controller functions are disabled when not connected to a COM port.
Picture
Exit:
Program Exit will display a save window to allow setting to be saved.
Ending the program with the Windows X at the top right of the main program window will save the settings without asking.

Hardware - AutoGuider Focuser Microprocessor unit (AGFM) using Basic Stamp 2 (1st Generation Box)
AutoGuider Focuser Microprocessor unit (AGFM). The AGFM is a microprocessor based control box that uses the Parallax Basic Stamp 2 to control a ST4 type AutoGuider port of any telescope mount. It also will control 2 focus motors using an internal 9VDC battery or 12VDC external power.
Command protocol:
The AGFM uses commands formated like the ones for an Astro-Physics GTO controller except for the 2nd focus motor and initialize command. The AP GTO only has one focus output and no initialize command.
  • USB UB232R
  • Datasheet
  • USB COM Port:
  • 9600 baud
  • 8 bit
  • no parity
  • Connector:
  • USB mini-B
  • male
  • Autoguider port:
  • :Mn#
  • Guide north.
  • :Ms#
  • Guide South.
  • :Me#
  • Guide East.
  • :Mw#
  • Guide West.
  • :Qn#
  • Stop South.
  • :Qs#
  • Stop South.
  • :Qe#
  • Stop South.
  • :Qw#
  • Stop South.
  • :Q#
  • Stop all.
  • Focus motor 1:
  • :F+#
  • Focus 1 In.
  • :F-#
  • Focus 1 Out.
  • :FQ#
  • Focus 1 Stop.
  • Focus motor 1 small:
  • :F+nnnn#
  • Focus 1 small In for nnn ms.
  • :F-nnnn#
  • Focus 1 small Out for nnn ms.
  • Focus motor 2:
  • :O+#
  • Focus 2 In.
  • :O-#
  • Focus 2 Out.
  • :OQ#
  • Focus 2 Stop.
  • Focus motor 2 small:
  • :O+nnnn#
  • Focus 2 small In for nnn ms.
  • :O-nnnn#
  • Focus 2 small Out for nnn ms.
  • Initialize:
  • :I#
  • Sets output pins 1 through 13 to LOW.
    This will make sure everything is off.
  • Verison:
  • :V#
  • Returns the current verison and date
    of the AGFM Basic Stamp 2 software.
  • AutoGuider and Focuser Control v3.0
    4-Jan-2018
  • Debug:
  • :D1#
  • Send received commands to the Debug Terminal.
  • :D0#
  • Turn off debug.
Connecting to PC:
Picture
Found New Hardware:
The first time the AGFM is connected to a PC you may be prompted to install a new hardware driver.

Check 'Yes, this time only' then Click 'Next>'

Windows will find the correct dirver if you are connected to the Internet.
This will happen 2 times, once for the USB driver and once for the serial driver.
A drivers can also be found at the Future Technology Devices web site.
Circuit board layout and parts:
Picture
  • U1
  • Basic Stamp 2
  • Microprocessor
  • Digi-Key part STAMP2-ND, schematic
  • U2, U3
  • TPL222A-2
  • Relay OPTO AC/DC 500ma
  • Digi-Key part 255-1967-ND, datasheet
  • U4
  • SN754410
  • IC HALF-H Driver QUAD
  • Digi-Key part 296-9911-5-ND, datasheet
  • J2
  • UB232R
  • USB - Serial Module mini-B
  • Digi-Key part 768-1022-ND, datasheet
  • D1
  • LN222RPX
  • LED RED Diffused 2mm Round Flat
  • Digi-Key part P612-ND.
  • R1, R2, R3, R4
  • Resistors
  • 1/4 watt 390 ohms.
  • Brown, Orange, White
  • R5
  • Resistor
  • 1/4 watt 1.3K ohms.
  • Brown, Orange, Red
  • J1, J5
  • Focus Motors
  • 3.5mm Mono phone jacks.
  • 1 - Center
  • 2 - Barrel
  • J3
  • AutoGuider cable connector
  • RJ12 6 with leads.
  • 1 - Not used (blue)
  • 2 - Gnd. (yellow)
  • 3 - East (green)
  • 4 - North (red)
  • 5 - South (black)
  • 6 - West (white)
  • J4 / J7
  • Focus motors power
  • 2.1mm ID, 5.5mm OD, 2 Conductors, 3 Contacts
  • Digi-Key part SC1047-ND
  • and 9VDC Battery connector.
  • + (red), - (black)
  • J6
  • Programming / Debug RS232 port
  • 4 pin to DB9 female cable, custom made.
  • 1 - GND to (DB9 pin 5)
  • 2 - DTR to (DB9 pin 4)
  • 3 - TXD to (DB9 pin 3)
  • 4 - RXD to (DB9 pin 2)
Schematic, BS2 software and Circuit board:
The board was made by using expresspcb software and manufacturing.
schematic
BS2
  • Basic Stamp 2
  • Microprocessor
  • The AFGM uses a Basic Stamp 2 microprocessor by parallax and is programed in PBASIC.
  • Software
  • Microprocessor program download.
layout
  • PC Board Layout
  • Silkscreen
  • Printing on top of board is show in light blue.
  • Top layer
  • Pads and traces on top of board are shown in red.
  • Bottom layer
  • Pads and traces on bottom of board are shown in green.
The board shown in the previous pictures do not have the silkscreen printing or green solder mask.
board
  • PC Board used in prototype
ST4 pin out
  • ST4 Autoguider Pin Out
Enclosure:
Box
  • Box
  • A-279V GRAY
  • BOX 9V A SERIES GRY 3.6 X 5.3 X 1.5
  • Digi-Key part SRA27-9VG-ND.
  • End Panel
  • 2010 IR
  • BOX END PANEL INFRA-RED A27 SERIES
  • Digi-Key part SRA27-IR-ND.

  • View large picture of the enclosure.
    Inside of enclosure.

Hardware - AutoGuider Focuser Microprocessor unit (AGFM) using Arduino (2nd Generation Box)
AutoGuider Focuser Microprocessor unit (AGFM). The AGFM is a microprocessor based control box that uses the Arduino Nano to control a ST4 type AutoGuider port of any telescope mount. It also will control 2 DC focus motors using an internal 9VDC battery or 12VDC external power.
Command protocol:
The AGFM uses commands formated like the ones for an Astro-Physics GTO controller except for the 2nd focus motor and initialize command. The AP GTO only has one focus output and no initialize command.
  • Autoguider port:
  • :Mn#
  • Guide north.
  • :Ms#
  • Guide South.
  • :Me#
  • Guide East.
  • :Mw#
  • Guide West.
  • :Qn#
  • Stop South.
  • :Qs#
  • Stop South.
  • :Qe#
  • Stop South.
  • :Qw#
  • Stop South.
  • :Q#
  • Stop all.
  • Focus motor 1:
  • :F+#
  • Focus 1 In.
  • :F-#
  • Focus 1 Out.
  • :FQ#
  • Focus 1 Stop.
  • Focus motor 1 small:
  • :F+nnnn#
  • Focus 1 small In for nnn ms.
  • :F-nnnn#
  • Focus 1 small Out for nnn ms.
  • Focus motor 2:
  • :O+#
  • Focus 2 In.
  • :O-#
  • Focus 2 Out.
  • :OQ#
  • Focus 2 Stop.
  • Focus motor 2 small:
  • :O+nnnn#
  • Focus 2 small In for nnn ms.
  • :O-nnnn#
  • Focus 2 small Out for nnn ms.
  • Initialize:
  • :I#
  • Sets all output pins to LOW.
    This will make sure everything is off.
  • Verison:
  • :V#
  • Returns the current verison and date
    of the AGFM Arduino software.
  • AutoGuide Focus - Arduino
    20-Jul-2021 V4.00
  • Debug:
  • :D1#
  • Expand messages sent to USB serial port.
  • :D0#
  • Turn off debug.
  • Help:
  • :?#
  • Return address of this web page.
Command protocol used when connected to Astroberry Raspberry Pi Ekos software:
The following commands are valid after receiving an ACK character or ':U#' command.
  ACK sets Meade LX200 mode.
  :U# sets Astro-Physics mode.
The AGFM box with the Arduino can be connected to a Raspberry Pi running the Astroberry software. Kstars and Ekos INDI driver for the Meade LX200 Classic telescope can be selected as the telescope mount and the Focus and manual move controls will work. Only focus motor 1 can be used since the Meade LX200 mount only has one focus function. Addition Meade LX200 commands are programmed into the AGFM box so that no errors are returned when connecting to the AGFM Arduino box.
All of these commands are only used to prevent errors when the connecting software thinks the connection is a telescope mount. This allows the AGF box to be used to test some software without having a telescope mount present.
  • Meade LX200 Classic and Astro-Physics commands.
  • :GR#
  • Get RA
  • If RA as not been set returns RA of Polaris 02:57:53#
  • Otherwise the value from the last :Sr command is returned
  • Returns: RA
  • :GD#
  • Get DEC
  • If DEC as not been set returns RA of Polaris +89*20'55#
  • Otherwise the value from the last :Sd command is returned
  • Returns: DEC
  • :Sr HH:MM:SS#
  • Set RA
  • Value is saved and will be returned for :GR# command
  • Return: '1'
  • :Sd sDD*MM:SS#
  • Set DEC
  • Value is saved and will be returned for :GD# command
  • Return: '1'
  • :MS#
  • Slew to target
  • Returns: '0'
  • Meade LX200 commands.
  • ACK [decimal 6]
  • Initial connection for Meade LX200
  • Returns: 'A'
  • :RM#
  • Set slew rate to Find Rate
  • Returns: Nothing
  • :V#
  • Get version
  • Returns: '4.00#'
  • :GM#
  • Get site 1 name
  • Returns: 'AGF-MHO'
  • :Gc#
  • Get calendar format
  • Returns: '24#'
  • :GT#
  • Get tracking rate in Hz
  • Returns: '60.0#'
  • :Gt#
  • Get site latitude
  • Returns: '+38*20#
  • :GG#
  • Get UTC offset
  • Returns: '+05#'
  • :Gg#
  • Get site longitude
  • Returns: '+076*55#
  • :GL#
  • Get local time
  • Returns: '01:00:00#'
  • :GC#
  • Get current date
  • Returns: '07/14/21#'
  • :GVD#
  • Get firmware date
  • Returns: 'May 17, 2006#'
  • :GVT#
  • Get firmware time
  • Returns: '10:25:38#'
  • :GVN#
  • Get firmware number
  • Returns: '2.0#'
  • :GVF#
  • Get firmware version
  • Returns: '4.2g#'
  • :GVP#
  • Get product name
  • Returns: 'LX2001#'
  • :SgDDD:MM#
  • Set longitude, does not store data
  • Returns: '1'
  • :StsDD*MM:SS#
  • Set site latitude, does not store data
  • Returns: '1'
  • Astro-Physics commands.
  • :U#
  • Set long format
  • Returns: Nothing
  • :V#
  • Get version
  • Returns: 'S#'
  • :pS#
  • Get side of pier
  • Returns: 'None#'
Connecting to PC:
Found New Hardware:
The first time the AGFM is connected to a PC you may be prompted to install a new hardware driver.
The Arduino uses an FTDI USB to serial chip and Windows install the driver using Connect to Windows Update.
Circuit board layout and parts:
  • A1
  • Arduino Nano
  • Microprocessor
  • Digi-Key part 1050-1001-ND, datasheet
  • U2, U3
  • TPL222A-2
  • Relay OPTO AC/DC 500ma
  • Digi-Key part 255-1967-ND, datasheet
  • U4
  • SN754410EN
  • IC HALF-H Driver QUAD
  • Digi-Key part 296-9911-5-ND, datasheet
  • J2
  • UB232R
  • USB - Serial Module mini-B
  • Digi-Key part 768-1022-ND, datasheet
  • R1, R2, R3, R4
  • Resistors
  • 1/4 watt 390 ohms.
  • Brown, Orange, White
  • J1, J5
  • Focus Motors
  • 3.5mm Mono phone jacks.
  • 1 - Center
  • 2 - Barrel
  • J3
  • AutoGuider cable connector
  • RJ12 6 with leads.
  • 1 - Not used (blue)
  • 2 - Gnd. (yellow)
  • 3 - East (green)
  • 4 - North (red)
  • 5 - South (black)
  • 6 - West (white)
  • J4 / J7
  • Focus motors power
  • 2.1mm ID, 5.5mm OD, 2 Conductors, 3 Contacts
  • Digi-Key part SC1047-ND
  • and 9VDC Battery connector.
  • + (red), - (black)
Schematic, BS2 software and Circuit board:
The board was made by using expresspcb software and manufacturing.
schematic
BS2
  • Arduino Nano
  • Microprocessor
  • The AFGM 2 uses a Arduino Nano microprocessor by Arduino and is programed using Arduino C .
  • Software
  • Microprocessor program download.
  • Nano 33 Bug? Issue?
  • There is a bug/issue with the Arduino Nano A000005 based on the ATmega328.
    This only happens on the Nano and not other Arduino processors I have used.
    When a serial connection is made to the Nano, after the Nano has powered on, the first command (serail data) sent to the Nano is missed. Putting at least a 2 second delay between opening the serial port and sending the first command fixes this problem. This only happens after a power on (plug into the USB port) of the Nano.
layout
  • PC Board Layout
  • Silkscreen
  • Printing on top of board is show in yellow.
  • Top layer
  • Pads and traces on top of board are shown in red.
  • Bottom layer
  • Pads and traces on bottom of board are shown in green.
board
  • PC Board before components
ST4 pin out
  • ST4 Autoguider Pin Out
Enclosure:
Box Arduino
  • Box
  • A-279V GRAY
  • BOX 9V A SERIES GRY 3.6 X 5.3 X 1.5
  • Digi-Key part SRA27-9VG-ND.
  • End Panel
  • 3D printed part
  • PLA Clear STL file.
Last update 3-Feb-2022 4.0