That's great. Now you should spend a bit of time working through some of the Arduino examples so that you learn how code is constructed.
Sorry - I don't use Windows so I don't know exactly where your programs (sketches) are stored. If you click the preferences button in the Arduino IDE I think it tells you.
Thank you for thinking of writing up a tutorial re control of stepper motors, and in particular, a camera slider. As soon as I have time, I will outline how I think the project should work.
I am working through the Arduino worked examples, firstly "blink" that tests the board, so far so good.
I have searched for other camera slider projects, and to me, they seem quite complex. They probably aren't that complicated, just to my inexperienced brain.
For me I just want a track fitted with a carriage, all openbuild stuff. At one end a nema17 stepper motor, the other, an idler pulley. The carriage will be driven forwards and backwards with a toothed belt.
ELECTRONICS
I would like to use an Arduino uno R3 board fitted with an Adafruit stepper motor controller.
A 3-position switch, or two pushbuttons, will drive the carriage in one direction or the other until a limit switch is triggered. A potentiometer will control speed.
With the 3-position switch midway, no power will be sent to the motor and the carriage can be pushed to one end or the other.
That's about it unless someone can suggest some improvements.
The whole kit and caboodle will be used in the field, and hence, be powered by a decent 12v battery.
AFTER THOUGHT
I'm just wondering whether the carriage should stop when a shot is being taken.
I wont have any trouble with the mechanical side of things, I've tinkered with mechanical things all my life.
Lets forget about stopping the carriage whilst a shot is taken. I can't see that it will make much difference. I'm not a photographer, this project is for my son who's right into it.
Help with driving the carriage forwards and backwards at variable speeds, would be appreciated.
I shall look back through some of your replies to look for stepper motor control ideas.
I am using the Pololu A4988 stepper drivers. That web page has a lot of useful information including a wiring diagram.
I wrote my Simple Stepper Program Thread for people who already have a basic understanding of stepper motors. Wikipedia has a good info.
By the way I have just realized that instead of 2 separate programs in that Thread I had repeated the first program (nobody seems to have noticed). I have now corrected that and I hope that has not been the cause of your confusion. Feel free to slap my wrist.
I don't think I can provide a teaching-from-nothing introduction. In any case it would just be duplicating info that is widely available elsewhere.
I wrote my demo code with what I hope are meaningful names for variables rather than comments. I hope they make sense for someone who already knows the general concept of stepper motors.
Writing in the Forum is necessarily different from a face-to-face experience where either or us can instantly interrupt the other if we don't understand something.
If you want to point out specific items in my code I will be happy to try to explain further.
Sounds like you have have pulled the pin on helping me.
With respect to your Simple Stepper Program, any chance you could include a wiring/schematic diagram?
From just the code, I can't tell how you control the motor ie, is it push button control for direction or software control. Is there a motor reversal routine in your code?
neksmerj:
Sounds like you have have pulled the pin on helping me.
I'm not sure if you mean I am doing more or less? Which would you prefer?
With respect to your Simple Stepper Program, any chance you could include a wiring/schematic diagram?
have you looked at the diagram on the Pololu page I gave you a link for?
From just the code, I can't tell how you control the motor ie, is it push button control for direction or software control. Is there a motor reversal routine in your code?
I don't know how to answer this. I'm quite sure you realize there is code to make the motor go in both directions - even if you can't identify where it is.
I can't help feeling that the problem is your lack of background knowledge about the basics of stepper motors and stepper motor drivers. There is loads of information on the web about that and I am not going to write duplicate stuff. I already suggested Wikipedia.
And, as I already mentioned, the Pololu page has a lot of info.
It would be much easier to help if you were asking questions like "I was reading BBB and it says XXXX in paragraph NN and I don't understand what it means".
neksmerj:
it's a pity a schematic is not forth coming for your easy stepper motor.
Well, there actually is one: it's on the link to the Pololu driver that Rob(with an "i" not a "y")n2 gave earlier. It shows exactly how to set it up, except it doesn't explicitly say Arduino since it's correct for any micro.
The 4988's input "step" and "dir" pins are called "stepPin" and "directionPin" as outputs in Robin2's sketch. The whole thing happens in software:
stepPin in pulsed HIGH/LOW for numberOfSteps, one sequence with directionPin as HIGH (= one direction) and another full sequence with directionPin LOW (= the other direction).
Why don't you give yourself a challenge, and see if you could rig a simple switch (say directionSwitch), whose value (HIGH or LOW) is then used as a flag for direction, so that you could output a HIGH or LOW in directionPin based on what you read from directionSwitch.
With respect to the rest of your challenge, I'm not yet up to the stage of writing code, just beginning to get the gist of sketches via tutorials.
I have on order an Easy Driver board, hasn't arrived as yet. Have found a tutorial where speed and direction of a stepper motor is addressed plus wiring diagram. Have the Arduino uno R3 board and have been having a play.
I wouldn't say there are any deficiencies in your thread, it's all at this end.
I found this tutorial re Arduino and EasyDriver employing 3 push buttons for forward, stop and reverse plus potentiometer for speed on the fly. Included also is a schematic diagram.
neksmerj:
With respect to the rest of your challenge, I'm not yet up to the stage of writing code, just beginning to get the gist of sketches via tutorials.
Well you have to start sometime! And if you have the Uno and a couple of led/resistor pairs, you can sort of mimic the direction thing. Read a switch (which if you don't have one can simply be a wire from an i/o pin which is either jabbed into a GND hole or not), and if the result is HIGH switch on led #1 and if it's LOW switch on a different one.
Or, if you like, draw a flow chart of the logic of what you want to do and code it in pseudo-code. Pseudo code is just words that you make up, which should reflect what you want to do, but needn't be correct in terms of the programming language's rules. So you could say something like:
read switchPin
if switchPin is high-
set led1Pin high
set led2Pin low.
otherwise-
set led1Pin low
set led2Pin high.