Telescope focuser

hello not sure if i am in the right place but here goes ! I am building a telescope and i want to use a powered focuser, my plan is to use a stepper motorto control the rack in and out of a focuser .I now know how to load and use sketches ( programming comes later) and i am at the stage where i can put the whole thing together i just need some ideas on how to drive the motor. What i need to do is run the motor at the press of a button in either direction until i achieve focus in the telescope ie press the buttons back and forth unti i get focus. I do apologise if i have not explained this well at 75 yrs of age i am happy to have got the arduino to control my motor this is a journey of discovery for me i need to move on to the required sketch to dive the rack on the focuser Many thanks Dave C

Welcome to the forum

Are you aiming for automatic focus or just manual control ?

Have you got any of the hardware yet ?

if this is for manual focusing - may be you could use a rotary encoder instead of just a button. They usually come with a button builtin in.

You could envision a user interface where:

  • double-clicking the button would switch the direction
  • single-clicking would start / stop the stepper in the current direction
  • turning left or right the encoder would help you do 1 step to fine tune the focus

You could use libraries to make this easy:
encoder library for handling the step by step
OneButton library for handling clicks and double clicks

I assume you have a stepper motor. The AccelStepper library for Arduino could come handy too.

Is there a reason you want to use a stepper instead of some other type of motor ?

What you are asking for sounds like a simple DC motor would work.
press one button, it moves in, press the other and it moves out.
a miniature gear motor might be all you need.
[ edit: the listed speeds are an 'or' you can get 15 rpm motor, or you can get a 30 rpm motor
it may be possible to control speed of these with a driver or some such ]


the benefit of a stepper is rapid and slow movement.
in this application, a stepper does not need constant power or end switches as you would be doing the focus manually. so battery power is not a problem

What size of telescope ? a small stepper on a 12 inch telescope would be simple enough to add. the weight of a stepper on a 6 inch would be noticeable.

They do make miniature steppers motors.
but the energy needed to driver your mechanism needs to be known to size a motor.

motor sizing is to know the torque required for use.

if you can wrap a string around the existing knob or shaft. and put a cup on the string.
then add, sand, water, marbles, gravel, sugar... pretty much anything
until the weight of no movement , the weight of some movement and the weight of minimum acceptable movement
are all known,
you can calculate energy by the diameter of the shaft or knob and the weight of the cup.
my experience with telescopes is that the adjustments need some pressure to move, not much but they will not turn by themselves. there is some built in resistance.
the stepper in the second photo is just a motor. it is available with a gear train like in the first photo.

Many thanks for your reply, all i would like to achieve for now is a simple 2 button in an out focuser with a slow rate, it is so i can bring a subject into focus when my camera (either a dslr or webcam) is attached to my telescope thereby reducing vibration at the telescope. It would be good to use a sketch of some sort as i have only just got into the arduino stuff so i am an absolute beginner at all things arduino. Many thanks again

great info will look at these sugestions an keep you posted dave c

What size telescope do you have,

Does the eye piece have a twist knob?

Do you have a tracker?

On a different note. How easy is it to add a digital video camera?

hello the scope is 110mm celetron reflector, the focuser rack has a twist control, no tracker (yet) ,quite e asy to attach a video camer or a web cam loads of adapters on ebay etc. cave c

many thanks for info i am looking at loads of options what i really want is fine control of a motor and a stepper seemed to offer this many thanks dave c

A stepper is probably easier to deal with to control your small movements need to focus

It will give you fine grain control, you'll get a good low speed torque but torque will decrease as speed increases. So ensure the stepper you choose is fit for purpose.

hello i think i am at an impasse while i can construct the focuser my efforts a at getting it controlled are a miserable failure i am never going to be a programmer so it looks like a no go for now until i can find a way to put together a sketch that will run the motor forward stop an back i need learn how to do this from scratch any ideas welcome dave c

Which type of motor and supporting circuitry have you decided to use ? Given that the programming will be easy

here is a sample code I have done some time ago that is very similar to what I described in post #3

#include <AccelStepper.h>   //
#include <Encoder.h>        //
#include <OneButton.h>      //

const uint8_t motorPin1  =  8;  // IN1 on the ULN2003 driver
const uint8_t motorPin2  =  9;  // IN2 on the ULN2003 driver
const uint8_t motorPin3  = 10;  // IN3 on the ULN2003 driver
const uint8_t motorPin4  = 11;  // IN4 on the ULN2003 driver

const uint8_t encoderDTPin  =  2;  // Encoder DT
const uint8_t encoderCLKPin =  3;  // Encoder CLK
const uint8_t encoderSwPin  =  4;  // Encoder SW

const float   motorMaxSpeed   = 1000.0;
const float   motorSpeed      = 300.0;
const float   motorAccel      = 1000.0;
const long    motorStepFactor = 8;

AccelStepper stepper(AccelStepper::HALF4WIRE, motorPin1, motorPin3, motorPin2, motorPin4);
Encoder   rotary(encoderDTPin, encoderCLKPin);
OneButton button(encoderSwPin);

bool stepperIsMoving = false;
enum : uint8_t {Forward, Backward} stepperDirection = Forward;

inline void forward() {
  stepper.moveTo(+2000000000); // go very far forward
  stepperDirection = Forward;

inline void backward() {
  stepper.moveTo(-2000000000); // go very far backward
  stepperDirection = Backward;

inline void fullStop() {

void startStop() {
  stepperIsMoving = !stepperIsMoving;
  if (stepperIsMoving) {
    if (stepperDirection == Forward) forward(); else backward();
  } else fullStop();

void changeDirection() {
  if (stepperIsMoving)
      if (stepperDirection == Forward) backward(); else forward();
  else stepperDirection = (stepperDirection == Forward) ? Backward : Forward;

void checkRotary() {
  if (!stepperIsMoving) {
    long deltaPos = >> 1; // 2 pulses per tick, so divide by 2
    if (deltaPos != 0) {

void setup() {

void loop() {

This was meant to be used with a 28BYJ-48 stepper and ULN2003 hence the stepper instantiation

AccelStepper stepper(AccelStepper::HALF4WIRE, motorPin1, motorPin3, motorPin2, motorPin4);

this would need to be tailored to your specific settings as would those constants:

const float   motorMaxSpeed   = 1000.0;
const float   motorSpeed      = 300.0;
const float   motorAccel      = 1000.0;
const long    motorStepFactor = 8;

the motorStepFactor is the number of relative positions ticks you'll go in one direction by using the rotary encoder. That's basically how fine you want the fine tuning to be.

Otherwise it's just

  • press/release the rotary button and the stepper goes forward (with acceleration).
  • double click the rotary button to change direction
  • press/release to stop (will continue a bit to handle acceleration and not come to a brutal stop)
    while it's stopped, turning the rotary encoder in one direction or the other will move the stepper forward or backward by the motorStepFactor

may be that's helpful to some, I've not tried that in a long time so I don't know if it's full up to date with the various libraries.

give it a try, code is not too long so should be self explanatory.

If you are still having issues.
Post a photo.

I think @osso is MIA…

many thanks to all who have helped me jml /helibob got one working now thanks bob many thank dave c

Can you please show us your solution?
It will help with continuity of the thread and the ultimate purpose of the forum, to help with arduino problems for other enquirers.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

this is the final option i settled for many thanks but i am a bit sad that i have not mastered the aduino /stepper thing but i have not given up yet its now my personal challenge 72 or not dave c

Have you tried the code offered in #14?