Remote Telescope Focus using Maestro with Rotary Encoder

Here’s a way to control a stepper motor with a 6Ch Maestro using a rotary encoder. It uses a standby function to minimize power consumption as there is no need for the motor to firmly hold it’s position in this application. It’s interfaced through a L293D (see link for schematic)

Here’s a link http://scopefocus.info to my website that describes the whole project which also includes a C# program to do the same and automatically focus the scope via Nebulosity camera control software. Probably a bit of an atypical use but might be helpful for someone.

Feedback appreciated…thanks,

Here’s the maestro code

begin
standby
0 get_position 512 less_than
1 get_position 512 Less_than
logical_and
if
one
else
  0 get_position 512 greater_than
  1 get_position 512 less_than
  Logical_and
  if
  two
  else
  0 get_position 512 greater_than
  1 get_position 512 greater_than
  logical_and
  if
  three
  else
  four
endif
endif
endif
repeat


sub one
 depth  2 equals 
  if
  swap drop
  else
  dup 11 equals
  if
  standby
  else
  8000 2 servo
  8000 3 servo
  0 4 servo
  0 5 servo
  11
  endif
  endif
  25 delay
  return

sub two
 depth  2 equals 
  if
  swap drop
  else
  dup 22 equals
  if
  standby
  else
  0 2 servo
  8000 3 servo
  8000 4 servo
  0 5 servo
  22
  endif
  endif
  25 delay
  return

sub three
 depth  2 equals 
  if
  swap drop
  else
  dup 33 equals
  if
  standby
  else
  0 2 servo
  0 3 servo
  8000 4 servo
  8000 5 servo
  33
  endif
  endif
  25 delay
  return
    
sub four
  depth  2 equals 
  if
  swap drop
  else
  dup 44 equals
  if
  standby
  else
  8000 2 servo
  0 3 servo
  0 4 servo
  8000 5 servo
  44
  endif
  endif
  25 delay
  return

sub standby
8000 2 servo
8000 3 servo
8000 4 servo
8000 5 servo
10 delay
return

Hello.

Cool project. I am very impressed by how much documentation you have for it! I’ve added your project to the community projects page.

- Ryan