It’s been a while since I started working on my home made telescope focuser. I faced so many challenges in terms of the difficulty in finding the right component. Some I bought from Fry’s Electronics, some are from RadioShack and a lot of research. I was able to finally make something working but still not useful.
During my painful research and component search, I stumbled with what I thought was an easy thing but have proven to be difficult as there are so many solution. Either I can use Stepper Motor or a Servo, Arduino or an Easy Driver. So far, I got some of the basic components and program working. So here’s the latest that I have.
The list of materials so far I have that I’m using on the video
- Arduino
- 360 High Torque Servo
- Bread Board
- FingerTech Timing Belt
- FingerTech Timing Pulley ( so far this is a problem since it can’t fit the servo)
- Variable Resistor
- Stereo Microphone Jack/Port
Materials that I’ve ordered and still waiting (will update once it arrives)
-
Lynxmotion Servo MXLS-02 Timing Belt Pulley – 32 Tooth (Futaba) – hopefully this will fit the Servo
-
Arduino Enclosure
Materials that I’m not using so far
- Stepper Motor
- Raspberry Pi
The Arduino Code
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val = 90; // variable to read the value from the analog pin
int rightpin = 7; // controlling the clockwise turn
int leftpin = 8; // control for the counterclockwise turn
int rightval = 0;
int leftval = 0;
int active = 0; // to check whether the right or left button is pressed
void setup()
{
myservo.attach(10); // attaches the servo on pin 9 to the servo object
Serial.begin(9600);
pinMode(rightpin, INPUT_PULLUP);
pinMode(leftpin, INPUT_PULLUP);
}
void loop()
{
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
rightval = digitalRead(rightpin);
leftval = digitalRead(leftpin);
if (rightval == HIGH && leftval == HIGH){
// don't do anything
Serial.println("NOT DOING ANYTHING");
val = 90;
}
else {
if (rightval == LOW || leftval == LOW){
// turn the motor but identify what direction
if (rightval == LOW){
// val = 91;
val = map(val, 0, 1023, 91, 180);
}
if (leftval == LOW){
// val = 89;
val = map(val, 0, 1023, 90, 0);
}
}
}
// 90 stop
// 180 - left continous
// 0 - right continous
// 93 - slow left
// 89 - slow right
//myservo.write(1);
//delay(1000);
Serial.println(val);
// val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
Serial.println(val);
myservo.write(val); // sets the servo position according to the scaled value
delay(100); // waits for the servo to get there
}