Barn Door Tracker Help Please

Hi all, im new to the forum so appologies if this is in the wrong section. Im building a barn door tracker and need help with writing a program to control my stepper motor. Basically ive rigged my setup like this:

http://fstop138.berrange.com/2014/01/building-an-barn-door-mount-part-1-arduino-stepper-motor-control/

The only difference is that I have used a slightly smaller motor. This exact one:

http://pages.ebay.com/link/?nav=item.view&alt=web&id=201071754064

Also my tracker has a curved drive thread so I don't have to worry about side real tracking errors.

I want my motor to run both ways at 4rpm and at 60rpm by using the analogue toggle switches. I would be very gratefull if someone could please write me a program that would do this. I am a total newb with this and am scared I might break it. Thank you in advance to anyone who is willing to help me out. Kind regards Ryan

My general recommendation when driving stepper motors is using a current chopping and micro stepping motor driver. This helps to minimize vibration and resonance. The ideal driver for this kind of application would have 64 or even 128 microsteps but these are hard to come by. Easy driver or Big easy driver give you 16 microsteps and are a good place to start experimenting

http://www.schmalzhaus.com/BigEasyDriver/index.html

nilton61: My general recommendation when driving stepper motors is using a current chopping and micro stepping motor driver. This helps to minimize vibration and resonance. The ideal driver for this kind of application would have 64 or even 128 microsteps but these are hard to come by. Easy driver or Big easy driver give you 16 microsteps and are a good place to start experimenting

http://www.schmalzhaus.com/BigEasyDriver/index.html

Hi thank you for your reply and help. I have already bought an Easy Driver and was kind of hoping this would be ok for my application? As long as the motor drives as near to 4rpm as possible everything should be ok. As I said above. I don't really want to experiment as I really only will ever want it to perform this 1 action from the parts I have already bought. I was hoping someone could just write the program for me and I could upload it and away I go. I know this is lazy but this probably the only time ill ever have to use a setup like this. Once I have programmed it ill never reprogram it again. Hence the fact I could do with just a simple copy and paste of the program I need. Thanks Ryan

As far as I can tell the program I need is the one in this tutorial:

http://fstop138.berrange.com/2014/01/building-an-barn-door-mount-part-1-arduino-stepper-motor-control/

The only difference is that I want my motor to go 4rpm and 60rpm.
So, what part of this program do I need to change to make my motor go at those speeds?

#include <AccelStepper.h>

int debug = 0;

int dgPinStep = 8;
int dgPinDirection = 9;

int anPinForeward = 4;
int anPinBackward = 5;
int anPinSpeed = 3;

AccelStepper stepper(AccelStepper::DRIVER, dgPinStep, dgPinDirection);

void setup() {
pinMode(anPinForeward, OUTPUT);
pinMode(anPinBackward, OUTPUT);
pinMode(anPinSpeed, OUTPUT);

stepper.setMaxSpeed(3000);

if (debug) {
Serial.begin(9600);
}
}

void loop() {
int valForeward = analogRead(anPinForeward);
int valBackward = analogRead(anPinBackward);
int valSpeed = analogRead(anPinSpeed);
int run = 0;

if (debug) {
Serial.print("Foreward: “);
Serial.print(valForeward);
Serial.print(” Backward: “);
Serial.print(valBackward);
Serial.print(” Speed: ");
Serial.println(valSpeed);
}
if (valForeward < 5) {
if (valSpeed < 5) {
stepper.setSpeed(200);
} else {
stepper.setSpeed(2000);
}
run = 1;
} else if (valBackward < 5) {
if (valSpeed < 5) {
stepper.setSpeed(-200);
} else {
stepper.setSpeed(-2000);
}
run = 1;
} else {
run = 0;
}

if (run) {
stepper.runSpeed();
} else {
stepper.stop();
}
}

What speed does it run at using the code you posted?

Presumably all you need to do is change the setSpeed() values to meet your needs.

...R

I haven't actually tried it yet. I have the barn door tracker all built but I haven't yet soldered all the controllers together yet. So, it is the set speed parts that need changing? So is the 200 and 2000 milliseconds or microsteps? My motor is 1.8 degree steps. So what would that figure be to make it go 4rpm and 60rpm? And does this look all well and good for my application? Will it work? I also understand there is a set screw on the easy driver for small adjustments?

At the very least you should read the documentation of the AccelStepper library. That will explain what the parameters mean. http://www.airspayce.com/mikem/arduino/AccelStepper/

Ryan21210: So what would that figure be to make it go 4rpm and 60rpm?

Won't you be able to figure that out when you find out what speed the existing values give you?

The Arduino is a great system for learning-by-doing.

And I wholeheartedly endorse what @jremington said.

...R

Ok guys sorry, I never meant to come across as lazy and can't be arsed learning etc. It's just that until the other week I had never heard of an Arduino controller or even stepper motors for that matter and i'm just finding all the coding and understanding it all a little overwhelming. I'm still trying to get my head around it all a little and since i've never done anything like this before it is all very puzzling. lol :~ I just thought that I could bypass the steep learning curve and kind of cheat because i'm really not out to become a master Arduino programmer. However I can fully appreciate I should at least have some idea about what I am meddling with lol. So I will have a look at the link you provided and hopefully learn something. I have looked at lots of other barn door tracker builds and its a bit of a minefield, some say this is a good idea then others disagree etc. I finally settled on the idea above because it kind of made the most sense to me. It's just the programming side of things with microsteps etc that I wanted help with. I am totally lost with it.

Ryan21210: I am totally lost with it.

If you have no prior experience of Arduino projects then you are jumping in at the deep end.

All programming will feel like that if you try to eat the elephant in one bite. All programs consist of a series of small pieces and when you separate them out each should be easy to follow. Unfortunately with some code the bits and pieces are hard to disentangle.

This Thread may give you some general ideas about planning and implementing a program

There are lots of example programs that come with the Arduino IDE and which illustrate different bits and pieces.

...R

I had a thought when investigating to find out just what a “barn door tracker” is - to correct my own ignorance.

Would an alternative physical structure be a simper alternative:

  • provide the drive from the stepper motor to the hinge mechanism via some form of suitable reduction gear. That is, the stepper motor would rotate the mount platform via a reduction gear.

Say the reduction gear was a combination of either spur gears or a worm and screw gear to give a reduction rate of whatever was suitable, then the control algorithm would be far simpler than for a mechanism subject to tangent error. A small biasing force could be used to eliminate slack in the gear mechanism.

If a reduction rate of 20:1 was used, then each step of the stepper motor would result in alteration of the platform angle by 1/20th of the step amount.

Just a thought … hope it helps …

it appears that the tutorial in the link is rather complete.

the best thing too do is to make the circuit, run the motor and make sure that your motor is capable of moving the threaded rod and that the drive train can move your 68 inch dobsonian !

the first part of the match is distance from the axis to the screw will create the triagle. trigonometry will reveal the distance the threaded rod has to move to change the angle.

your motor, the setting on the EasyDriver (which should work fine) and your pulse rate all come together to move the axis at some rate. all that is explained on the second page of the link.

part 3 offers some of the authors settings

static const float STEP_SIZE_DEG = 1.8;
static const float MICRO_STEPS = 8;
static const float THREADS_PER_CM = 8;
static const float BASE_LEN_CM = 30.5;

notice how this is in a little box ? this is done by using the # above, it gives a place to put any program code and is the preferred way to post ANY code when posting on here. please note that for future references to posting code.

the bottom line is that once you have made the unit and have tried it out, you will need to adjust the code to make it move your modified version of the threaded rod.

as you know the barn door tracker is flawed in that it only works for a short time before the movement of the device departs from the rotation of the earth. this does offer short periods of good enough alignment for photography or viewing.

I would offer that once you built it and tried out the movement, come back and ask for more help.

I see that a home or end switch should be installed and I would add a pot to alter the speed on the fly as well as a readout to show some of the parameters. since your device departs from the one in the link, the sidereal time will be different. the link allows for the ever changing angular movement vs the earths rotation and allows for a few hours of operation.

in my view the best path is to follow what the link offers as close as you can. once you get it running, the issues of movement will become clear.

in the simple review of your parts, you are on the right track and your parts should work.

Ryan21210: Also my tracker has a curved drive thread so I don't have to worry about side real tracking errors.

do you have any more data about this ? the barn door use an continuously altering sine as the basis of simplicity. the arduino can calculate position and allow for the inherent mechanical tracking error

using a worm gear drive eliminates that mechanical error with a much more complicated mechanical drive.

since the sample sketch in the link is based on the known mechanical errors, your program will need to allow for your design.

the software and programming needed to overcome the inherent mechanical tracking error of the barn door design is to compensate for mechanical constraints by sophisticated software.

the worm gear is without that mechanical error so the software would be very simple in comparison.

can you elaborate on your curved screw ?

Any update from Ryan? I have recently become interested in using my intervalometer to also control a simple barn door mechanism. I would love to hear more about the equipment you are starting with.

Have you started experimenting yet? It is very addictive and pretty easy to get into if you start small. :slight_smile: