Arduino ST4 telescope control

Telescope GOTO and autoguiding through ST-4 with an arduino

Similar projects worth following
The purpose of this project is to connect a telescope to a computer through the mount guide port (ST-4 port) using an arduino in order to cheaply add GOTO and autoguiding capabilities.

The ST-4 Port is easy to add to "low cost" motorized mounts like the EQ4 or EQ5, and the operation requires minimal modification to your shiny mount.

Hardest part is the code (Arduino sketch ~120 lines and ASCOM driver ~2600 lines), but I already wrote it for you :-)

Basically, you need to build the USB-ST4 interface described in the github project page and modify your control pad like explained here if it doesn't have an ST4 port.

Modifying the control pad means soldering and wiring an RJ12 socket to the pad buttons.

Once the hardware is done, you will need to install the ASCOM platform and the driver.

After this you can use a software like the open source stellarium to play with your telescope or PHD for astrophotography.

More details are available on the github project page.

Sample video of the telescope moving:

  • 1 × Arduino For interfacing with USB
  • 1 × TLP521-4 optocoupler In order to isolate the arduino from the autoguide port
  • 2 × RJ12 socket 1 if your mount already has an ST4 port
  • 1 × RJ12 straight cable To connect the adapter and the mount
  • 1 × A case for the adapter Excepted if you prefer to see the bare electronics :-)

View all 6 components

View project log

Enjoy this project?



Mark Bowles wrote 12/23/2016 at 22:10 point

Can someone confirm that I need to swap the connections over on the RJ12 socket as they do not correspond to the socket on the Star Adventurer? I.E pin 6 on the diagram is pin 1 on the SA socket and GND is pin 5 on the SA socket.

  Are you sure? yes | no

Pablo wrote 12/13/2016 at 15:07 point

Hi there, very interesting.

Not sure how the device is connected to the computer on one hand and to the telescope guiding port on the other. I guess the RJ12 port and the telescope port are connected via ethernet type cable and the arduino is connected to the computer. However,  many cameras such as the Meade DSI have only a printer type cable that would be connected to...? Summarizing, a complete layout of the cabling would be much appreciated. BR/Pablo

  Are you sure? yes | no

Pablo wrote 12/13/2016 at 15:16 point

Wait. The DSI camera goes to one usb port in the computer and then the computer uses the device on a second usb port to the telescope, right?

  Are you sure? yes | no

Kevin Ferrare wrote 01/12/2017 at 21:15 point

Exactly, this device is only there to allow the computer to move the telescope, not to control the camera.

So connection in your case would probably be:

Computer USB -> arduino -> mount rj12

Computer -> camera

  Are you sure? yes | no

subscriptions wrote 10/20/2016 at 07:55 point

Hi Kevin,

Great project.  Just ordered the bits off eBay.  I bought an old satellite dish (also off the Bay) and I've got it mounted on my trusty driven CG5 mount.  I've written a bit of python to collect input from the radio feed and turn it into a sky bitmap, now all I need are a few resistors and stuff to steer the mount to do a Sky scan (eg 30 seconds RA x 30 seconds dec = 15 minutes).


  Are you sure? yes | no

Alexander Axglimt wrote 08/26/2016 at 20:44 point

Took some time but now it's finished! Goto works great! I move the mount manually as close as possible, then use APT to blind-solve, slew, blind-solve, center target. So no alignment is necessary.

Thank you for doing this!

  Are you sure? yes | no

Kevin Ferrare wrote 08/28/2016 at 08:54 point

Glad to hear it worked for you!

  Are you sure? yes | no

Mark W wrote 04/23/2016 at 19:58 point

Cracking bit of work, working up the bottle to attack my non goto HEQ5 too, as well as another tripod and mount. a massive saving on the £300 upgrade kit. I should buy you a beer if I get it all sorted :)

  Are you sure? yes | no

Alexander Axglimt wrote 03/01/2016 at 14:01 point

All parts ordered from ebay! :) So tired of trying to find the DSO's on my non-goto HEQ5... So, if this works i'll be in heaven! :)

  Are you sure? yes | no

Kevin Ferrare wrote 03/01/2016 at 14:50 point

I have almost the same mount :) Don't hesitate to contact me if you need some help! With this, finding deep sky objects is very straightforward.

  Are you sure? yes | no

4cc3ss wrote 02/20/2016 at 04:25 point

Great project, myself is just starting out with the arduino for controlling a scope.

  Are you sure? yes | no

tarotrocola wrote 11/03/2015 at 09:05 point

Thanks Kevin, great project. ¿How would you outline a project to have it working in Android?

  Are you sure? yes | no

sebktm620 wrote 10/05/2015 at 18:22 point

I tried your project on a Teensy 2.0 and it worked with only changing two single lines in the code. Tested it on my star adventurer but there I had to reverse the pin orders for the j12 plug. Then it worked in phd 2. So kudos for you! But I wan't to use it with in_guider running on a RPi 2. Lin_guider has native support for GPUSB but the Teensy is not recognised... Can you help me or have you tried lin_guider? 

  Are you sure? yes | no

Kevin Ferrare wrote 10/06/2015 at 08:28 point


I looked at lin_guider source code and it seems that it is driving telescopes with its own drivers.

So I guess that you won't be able to use this project with this software unless you either:

 - Write a lin_guider driver

 - Modify the arduino code to behave like one of the supported devices

  Are you sure? yes | no

sebktm620 wrote 10/07/2015 at 10:05 point

Yeah, I also looked at the code and probably modifying the arduino code to behave like the GPUSB device, then I can modify the GPUSB driver given by lin_guider to accept the teensy. But thanks again for your help & Project!

  Are you sure? yes | no

Kevin Ferrare wrote 10/07/2015 at 12:32 point


This project uses the serial over USB capabilities of the arduino to communicate with the host.

However, looking at the drivers for GPUSB, I think that it is using direct USB communication.

If you try, I would be interested in knowing the result. Good luck!

  Are you sure? yes | no

sebktm620 wrote 10/08/2015 at 14:07 point

I managed to get lin_guider talking to the Teensy via the libusb commands. So lin_guider connects and sends commands. The only thing I'm puzzling about is the correct commands. At the moment I'm just parsing the lin_guider commands to the strings your code understands, but I don't understand how lin_guider is timing the lengths of the pulses. 

  Are you sure? yes | no

Kevin Ferrare wrote 10/08/2015 at 22:00 point

There is a documentation of the set of commands implemented on the board available here:

The commands allow you to start and stop movement along the RA/DEC axes (this is all the ST-4 port allows you to do).

If you send for example "RA+#", the RA axis will move in upper direction until you send either "RA0#" (stop) or "RA-#" (move in lower direction).

This very simple protocol is sufficient for pulse guiding.

GOTO functionality is using this set of commands.

The timing is calculated in the driver running on the computer, which computes when each axis should start / stop slewing and executes the commands with the correct timing.

I hope this answers your question.

  Are you sure? yes | no

sebktm620 wrote 10/15/2015 at 08:11 point

I got it working last night. Tried it with my Star Adventurer on tenerife. This mount only moves in RA so there was still some drift in DEC but as far as I can tell it was guiding properly. 

  Are you sure? yes | no

Kevin Ferrare wrote 10/15/2015 at 09:13 point


Would you mind sharing the modifications you made to lin_guider? I would be interested.

  Are you sure? yes | no

sebktm620 wrote 10/15/2015 at 17:50 point

Here you go:

I only changed the vendor id and product id, in and out endpoints and the parsing of the bits to your string commands. Also the interface i'm talking to is different than for gpusb. There could be some bugs because I had to rewrite everything from scratch last night (11pm...), because the raspberry image I was running lin_guider on was corrupt. For the arduino code I only omitted the OK commands, because lin_guider doesn't listen to them.

  Are you sure? yes | no

Kevin Ferrare wrote 10/16/2015 at 08:08 point

Thank you for sharing!

Do you mind if I clean it a bit and upload it to my github? Or maybe you could submit it to lin_guider? It may be useful to other.

One issue to solve may be the variety of USB ids of the arduino ide compatible boards. Using a list of vendor_id / product_id and probing for each element until the device is found should work.

  Are you sure? yes | no

sebktm620 wrote 10/16/2015 at 11:41 point

No I wouldn't mind. I was also thinking of sharing it with the hobby astronomy community and lin_guider devs.

  Are you sure? yes | no

sebktm620 wrote 10/22/2015 at 10:10 point

@Kevin Ferrare

I could test the guiding with a losmandy g11 on my last day on tenerife and I found a small typo in the parsing code, which only affected DEC guiding. I updated the source in the dropbox.

  Are you sure? yes | no

subscriptions wrote 02/17/2017 at 08:54 point

Hi Seb,  great job on writing the lin_guider driver.  I downloaded it and compiled it in lin_guider but I'm not sure I got it right.  I changed the vendor and product ids, which seems to work.  I got a whole load of permissions errors so I'm running under root (what groups do I need to join?), but my main issue is that after "if( (m_handle = locate_and_open_device( GPUSB_VENDOR_ID, GPUSB_PRODUCT_ID)) == NULL )", which works I get "-1" for "rcode = libusb_bulk_transfer".

Any ideas how to debug this?

  Are you sure? yes | no

dariotubio wrote 08/15/2015 at 16:04 point

hello do your project and it works very well with Cartes du Ciel but with stellarium no way it works for you tell me how to do it because I read and watched videos of how it's done but do not work I thank you for your project works perfectly very grateful for his contribution

  Are you sure? yes | no

Kevin Ferrare wrote 08/16/2015 at 08:20 point

Hello, stellarium cannot use ASCOM directly. I use The StellariumScope program which creates a bridge between ASCOM and the stellarium network telescope control interface:

  Are you sure? yes | no

dariotubio wrote 07/03/2015 at 08:50 point

Thank you for responding so fast is that your connection pins are not polarity-standard st4 and as new engines Enhanced Skywatcher Dual-Axis Motor Drive and the port st4 bienen Interface Autoguider I would not do a bad connection and damage relay box.
Find out how to change the pin assignment in the Arduino code,

since I'm not very good with this programming thank you very much again when you have it working I will comment thanks

  Are you sure? yes | no

dariotubio wrote 07/02/2015 at 17:36 point

St4 port (1) Open or sometimes powered• (2) Common (ground)• (3) RA+• (4) Dec+• (5) Dec-• (6) RA-

in the picture is described to you upside the pins 3456 equipment could be damaged by reverse polarity not? this will take the link you put up more gpusb.estoy contemplating build your project for my neq3-2 but with new engines Sky -Watcher's built bringing the port st4

tanks dario

  Are you sure? yes | no

Kevin Ferrare wrote 07/03/2015 at 08:08 point

Interesting. Apparently there are different pinouts for the autoguiding port.

As long as 1 is open and 2 is ground, there should not be any danger of equipment damage though.

In this project, the pin assignment can be changed in the arduino code.

ArduinoCode/ArduinoCode.ino line 53 through 58.

  Are you sure? yes | no

Alexis wrote 06/30/2015 at 22:24 point

Congrats for this project!!!  I have an EQ5 whit dual axis. I add RJ-12 port to the handpad and guide whit the QHY5 ST4 port. Do you think that is possible to make a sort of goto whit it? 

  Are you sure? yes | no

Kevin Ferrare wrote 07/01/2015 at 08:45 point

Thank you. I see that we have the same mount.

I think that It would be possible to do a GOTO with your camera if you can reverse engineer the protocol it uses to pulse guide the mount.

If you manage to do so, you could reuse most of the driver code, the only places that would need to be changed would be DeviceController.cs and the GUI for connection if it is not using serial.

Good luck, and keep me informed if you manage to adapt/extend the driver!

  Are you sure? yes | no

stevenbauer10 wrote 02/23/2015 at 21:13 point

Great project! But I was wondering; why don't you use any current limiting resistors at the LEDs on the optocoupler?

  Are you sure? yes | no

Kevin Ferrare wrote 02/23/2015 at 23:21 point

You are right, there should be a ~100Ω resistor between each digital pin of the arduino and the optocoupler (Forward voltage for the IR diodes of this model of optocoupler seems to be around ~1.15V depending on the current).

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates