"This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)"

Astronomy is awesome and seeing cool bright astronomical objects is even cooler!

But if you're anything like me, you take your telescope outside and then find out there's more into star gazing than just going outside and randomly looking up in random parts of the sky and hoping to see asteroids, planets, Nebulas, Quasars, etc. So now you can either take time out of your busy day to sit down and go through your Astronomy guide 101, and learn how to use an equatorial mount and read sky charts OR you can just build your own self-aligning mount and type in coordinates into your telescope, sit down relax, roast a marshmallow, and enjoy the view!

In this Instructable I will show you how I built my prototype of a self-aligning telescope mount and hopefully get novice astronomers like myself an easy start into your star hunting.

The materials used were:

Electronics-

• Arduino Uno
• 3 Stepper Motors
• 3 Motor Shields
• LCD display

Parts-

• All structure parts were 3D printed
• 9 V batteries
• 15 normally open buttons

Tools

• Soldering iron

## Step 1: 3D Modeling

For this prototype I completely 3D printed a model of a equatorial mount.

Check out the STL files and the SolidWorks parts and assemblies files for more details and dimensions!

My tip for you if you're trying to build your own mount is:

• Be sure to leave enough clearance between moving parts.
• Ensure motors are properly fixed.
• If you're having the wires inside the mount make sure they don't get tangled.

## Step 2: One Wire Analog Key Pad

Now we'll build a numerical keypad for our telescope mount.

Steps necessary:

• Follow the wiring diagram closely.
• Wire all the Vin wires horizontally to your buttons.
• Wire all the ground wires vertically.
• I found the values for the resistors of 4.7 Kohms for the rows and 1 Kohms for the columns enough of a voltage drop to ensure you'll receive reliable readings.
• Be sure to insulate any overlapping wires.
• Keep track of the wires.

This resistor set up is so every time a different key is pressed, their current will flow through different number of resistors in series. Giving each button an voltage "address" that a single analog pin can read.

The reason you don't see the resistors inside the keypad box is because I decided to place them in a breadboard inside the main telescope box structure.

## Step 3: Writing Your Arduino Sketch

The idea behind this project is that with each step of a stepper motor will correspond to a fixed angle change. For example if a stepper motor has 500 steps per revolution, each step should account for 360/500 = 0.72 degrees difference. Based on that knowledge, we can align the telescope accordingly.

However, first things first.

Lets set up our sketch for the One Wire Key Pad

Then setting up the constructor for it should be easy following the examples.

I would first test the Keypad readings to see if you're getting a reliable and consistent values

char KEYS [ ]=

{ '1', '2', '3',

'4', '5', '6',

'7', '8', '9',

'*', '0', '#',};

Use functions "Key_State", and "Getkey". here is a quick sketch to send the Key value to Serial print

#include

char KEYS[]= { '

1','2','3',

'4','5','6',

'7','8','9',

'*','0','#',

};

Keypad(Serial, KEYS, 5, 3, A0, 4700, 1000 );

void setup() {

Serial.begin(115200);

}

void loop() {

Serial.println(keypress);

}

}

The Main sketch will depend on the stepper motor and shield you are using.

I used 3 different motors and shield, their picture are attached above.

sketch for the Seeed Shield v2.0 with the Nema 11 stepper motor

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//Nema stepper motor pins definitions
#define MOTORSHIELD_IN1 8 //8

#define MOTORSHIELD_IN2 11 //11

#define MOTORSHIELD_IN3 12 //12

#define MOTORSHIELD_IN4 13 //13

#define CTRLPIN_A 9 //9

#define CTRLPIN_B 10 //10

#define delaytime 10

int numberOfSteps;

void setup()
{

//Define output pins for the nema stepper motor
pinMode(MOTORSHIELD_IN1, OUTPUT);
pinMode(MOTORSHIELD_IN2, OUTPUT);
pinMode(MOTORSHIELD_IN3, OUTPUT);
pinMode(MOTORSHIELD_IN4, OUTPUT);

}

void loop()
{

//Move Nema stepper motor commands

numberOfSteps = 500;
while(numberOfSteps>0)
{ forward();
numberOfSteps --; }
delay(2000);

}

void Step_A1()
{ digitalWrite(MOTORSHIELD_IN1,HIGH);
digitalWrite(MOTORSHIELD_IN2,LOW);
digitalWrite(MOTORSHIELD_IN3,LOW);
digitalWrite(MOTORSHIELD_IN4,LOW);
digitalWrite(CTRLPIN_A,HIGH);
digitalWrite(CTRLPIN_B,LOW);
}
void Step_B1() {
digitalWrite(MOTORSHIELD_IN1,LOW);
digitalWrite(MOTORSHIELD_IN2,LOW);
digitalWrite(MOTORSHIELD_IN3,HIGH);
digitalWrite(MOTORSHIELD_IN4,LOW);
digitalWrite(CTRLPIN_A,LOW);
digitalWrite(CTRLPIN_B,HIGH);
}
void Step_C1() {
digitalWrite(MOTORSHIELD_IN1,LOW);
digitalWrite(MOTORSHIELD_IN2,HIGH);
digitalWrite(MOTORSHIELD_IN3,LOW);
digitalWrite(MOTORSHIELD_IN4,LOW);
digitalWrite(CTRLPIN_A,HIGH);
digitalWrite(CTRLPIN_B,LOW);
}
void Step_D1() {
digitalWrite(MOTORSHIELD_IN1,LOW);
digitalWrite(MOTORSHIELD_IN2,LOW);
digitalWrite(MOTORSHIELD_IN3,LOW);
digitalWrite(MOTORSHIELD_IN4,HIGH);
digitalWrite(CTRLPIN_A,LOW);
digitalWrite(CTRLPIN_B,HIGH);
}
void forward() {
Step_A1();
delay(delaytime);
Step_B1();
delay(delaytime);
Step_C1();
delay(delaytime);
Step_D1();
delay(delaytime);
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Sketch for the EasyDrive Shield and Small Stepper motor ROB- 10551

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//Smaall Stepper motor EasyDrive Shield pins
int EASYSHIELDdir =2;
int EASYSHIELDstep = 3;

void setup(){

//EasyShield output pins
pinMode(EASYSHIELDdir, OUTPUT);
pinMode(EASYSHIELDstep, OUTPUT);
}

void loop(){
//Run stepper motor connected with EasyShield

for(i = 0; i <numberOfStep; i++)
{
digitalWrite(EASYSHIELDstep,LOW);
digitalWrite(EASYSHIELDstep,HIGH);
delayMicroseconds(5000);
}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

28BYJ stepper motor and shield

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

//Stepper motor 28BYJ pin definitions
#define STEPPER1 4
#define STEPPER2 5
#define STEPPER3 6
#define STEPPER4 7
#define delaytime 8

void setup(){
//Define output pins for the 28BYj stepper motor

pinMode(STEPPER1, OUTPUT);
pinMode(STEPPER2, OUTPUT);
pinMode(STEPPER3, OUTPUT);
pinMode(STEPPER4, OUTPUT);

void loop(){
while(numberOfSteps>0){
stepperforward();
numberOfSteps -- ;
}
}
void Step_A(){
digitalWrite(STEPPER1, HIGH);
digitalWrite(STEPPER2, HIGH);
digitalWrite(STEPPER3, LOW);
digitalWrite(STEPPER4, LOW);
}
void Step_B(){
digitalWrite(STEPPER1, LOW);
digitalWrite(STEPPER2, HIGH);
digitalWrite(STEPPER3, HIGH);
digitalWrite(STEPPER4, LOW);
}
void Step_C(){
digitalWrite(STEPPER1, LOW);
digitalWrite(STEPPER2, LOW);
digitalWrite(STEPPER3, HIGH);
digitalWrite(STEPPER4, HIGH);
}
void Step_D(){
digitalWrite(STEPPER1, HIGH);
digitalWrite(STEPPER2, LOW);
digitalWrite(STEPPER3, LOW);
digitalWrite(STEPPER4, HIGH);
}

void stepperforward(){
//one tooth forward
Step_A(); delay(delaytime);
Step_B(); delay(delaytime);
Step_C(); delay(delaytime);
Step_D(); delay(delaytime);
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

After writing the sketch for each stepper motor, we can use the OnewireKeypad function "addEventKey()" and "ListenforEventKey()" to call for each stepper motor and input a numerical value for their individual step size.

Look at the attached complete sketch to see the complete sketch with all the stepper motors, LCD display, and event keys code.

## Step 4: Notes

My suggestions and reminders if you are trying to make a project like this is:

• If you are using gears be sure to account the gear ratio while making your calculations for angle per step.
• The sketch I wrote only inputs number of steps. I did not get around into doing the actual angle per step calculations.
• Use stronger stepper motors than the ones I have used! The smaller stepper motors do not hold their position while they're inactive.
• The Nema 11 stepper motor was sufficiently strong for this project. So my suggestion is to use three of those or equivalent.
• Use the backwards functions for the stepper motors as well as the forward function.

I really enjoyed making this project and I'm glad to share with anyone who might also enjoy building an aligning telescope. For any questions about my project just drop me a comment.

I am planning on doing a full scale Aligning Telescope based on this prototype and will make a new Instructable once I do get around to doing so.

<p>(Thanks, Elon. Now I can make my own car.)</p><p>Like a lot of ables, this one caused great excitement. I purchased my first telescope this year. Mistake. I need a degree in astronomy. Who has time? Can't find squash, and if I do it disappears, even with my motor drive. Joined a club and felt like a dummy.</p><p>So I see your Instructable and a tinge of hope rises, only to scan and see the deal breaker: I don't know of anyone, nor have I meet anyone that knows anyone, that owns a 3D printer. The electronics I can handle. Oh well. Hope springs eternal...</p>
<p>Awesome telescope. I love how 3D printing lets people make their own science tools.</p>