Tuesday, January 2, 2018

USB Motorized Focus Adjuster Project


USB Motorized Focus Adjuster
Project Objective:
  • Install motorized focus control for my 8" SCT telescope
  • Adjust motorized focus in person with push buttons
  • Utilize USB to control telescope's focus remotely with a DC motor.
  • The pulse duration should be adjustable.
  • USB should be the only source of power

Background:
  • After adding a motorized filter wheel, the USB focuses is the only missing puzzle in order to control my entire astro-photography imaging equipment remotely.  It is difficult to find right focuser that can fit my 8" SCT telescope from the market without breaking my bank.  Therefore, I decide to build my own motorized focus adjuster.


Hardware List:
  • One Arduino Nano
  • One USB cable for Arduino Nano
  • One pieces two wire phone line
  • One project enclosure box
  • One L293D h-bridge motor driver ic.
  • One 12V/5RPM DC motor
  • Two pieces pulley, 57105K14 from McMaster-CARR.
  • One pieces timing belt, 1679K11 from McMaster-CARR.
  • Two pieces push switches.  
  • Three pieces of 470 ohm resisters.
  • One sheet metal (simple book stand)
  • Option: I find a better timing pulley set from eBay.  
1:4 Timing Pulley Set
Step 1: Setup the pulley system
  • Locate the location for the driver motor and the SCT shaft on the sheet metal.
  • Cut and drill the sheet metal for the 12v motor screw and opening area.
  • Cut and drill the sheet metal for the SCT's shaft and three screw holes.
  • Modify one pulley, and make it fit-able to the SCT shaft with 12.5mm OD 
  • Assembly the focuser on SCT
Engaged Configuration

Disengaged Configuration

Top view of the design



Step 2: Building PCB board
  • Require material:
    • Arduino Nano
    • USB cable
    • L293D
    • Two small capactors
    • Wires and heat shrink tube
    • Phone wire
    • One 470 ohm resistor




Prototyping-1


Prototyping-2



Protected with heat shrink tube


Step 3: Handheld Controller
  • Require material:
    • Two momentary switches 
    • Three 470 ohm resistors
    • Small project box
Wiring the switches
Simple controller schematics. 
Note: A1 need to be pulled up by another 470 ohm resister


Assembled hand held controller



Step 4: Build the Arduino Nano firmware 

// #########################################
// # USB Motorized Focus Adjuster Project  #
// # ------------------------------------- #
// # Author: Samson Yang                   #
// # Date: 01/JAN/2018                     #
// # Version: 1.3                          #
// #                                       #
// # Warring:                              #
// #   High torque motor may damage your   # 
// # telescope. Please use this design with#
// # caution and at your own risk!!        #
// #                                       #
// # Note:                                 #
// #  Enter 0: reset position              #
// #  Enter 1: rotate CW                   #
// #  Enter 2: rotate CCW                  #
// #  Enter 50~10001 update pules time     #
// #  Hand held controler has fix pules    #
// #  Rotation speed is ~1RPM              # 
// #  Rotation resolution is ~15' with 50ms#
// #  Current design has ~ 1000ms backlash # 
// #########################################

// Pins assignment and set deafult value
const int Pin_P = 9;
const int Pin_N = 8;
int pulse_time = 1000;  //unit: ms
long int total_time = 0;

void setup() {
  Serial.begin(9600);
  pinMode(Pin_P, OUTPUT);
  pinMode(Pin_N, OUTPUT);
  Serial.println("USB Focuser is initialized!");
  Serial.println("Version 1.3, 01/JAN/2018");
}

void loop() {   
  //Check 1st button on hanld held controler. 
  //Check 2nd button on hanld held controler. 
  int sensorValue = analogRead(A1);  
  if ((sensorValue >450)*(sensorValue <700)) MCP(Pin_N, 100); //Its typical value is ~510
  if ((sensorValue >300)*(sensorValue <400)) MCP(Pin_P, 100); //Its typical value is ~340

  //Waiting for input from serial port
  while (Serial.available() > 0) {
    int data = Serial.parseInt();
    if (data==0) {total_time=0;Serial.println("Total_time is reset!");} //reset total time
    if (data==1) MCP(Pin_N, pulse_time); //rotate CW
    if (data==2) MCP(Pin_P, pulse_time); //rotate CCW    
    if ((data>49) * (data<10001)) {
      pulse_time=data; //update pulse time
      Serial.println("########################################");
      Serial.print("       New pulse time is ");Serial.print(pulse_time);Serial.println("ms");
      Serial.println("########################################");
     }
  }
}

//Control Motor by Pulse
void MCP(int PIN_NO, int Pulse_Length) {
  //When pin 8 = high, shaft rotate CW
  //When pin 9 = high, shaft rotate CCW
  if (PIN_NO == 8) {total_time=total_time+Pulse_Length;Serial.print("//  CW with ");Serial.print(Pulse_Length);Serial.print("ms.  Adjusting... ");}
  if (PIN_NO == 9) {total_time=total_time-Pulse_Length;Serial.print("** CCW with ");Serial.print(Pulse_Length);Serial.print("ms.  Adjusting... ");}
  digitalWrite(PIN_NO, HIGH);   
  delay(Pulse_Length);                       
  digitalWrite(PIN_NO, LOW);  
  Serial.print("Done! New position is: ");Serial.print(total_time);Serial.println("ms");
}

Demonstration:
  Click on the YouTube link. 




Enjoy it!