Go Down

Topic: running a bipolar stepper on macro rail (Read 4292 times) previous topic - next topic


Jun 09, 2012, 11:54 pm Last Edit: Jun 10, 2012, 11:37 pm by geetee50 Reason: 1
Hi i'm looking at buying the uno board and other bits to move a linear rail for micro photography up to 20x magnification , i have the motor but wonder if anyone has done the same or similar and could share the programing, the motor should give me a 0.001mm minimum step but on top of that i want to trigger the shutter on my camera, I have had a long look over the programs at Arduino and can't find anything suitable at this moment in time, any help would be welcomed.

Parts list:

uno board
SN754410ne H-Bridge
5v bipolar stepper motor


geetee50 ...

What are the drive specs on your motor?  Does each winding run on 5 volts with a current drain of less than about 40 milliamps?  If "yes", you can (WITH PROPER OVERVOLTAGE CLAMPING DUE TO INDUCTIVE SPIKES!) drive it directly from the Arduino.  If "no", you will need a "shield" (= interface board) to connect to the Arduino to provide the proper drive voltages/currents for the motor.  I think there are several stepper motor shields available.  Go through the same analysis for the shutter driver.  Google for "Arduino shields".  (An example: http://www.robotshop.com/ca/adafruit-motor-shield-kit-arduino-8.html) From there, you can start to get a better idea of the hardware complexity you are facing. 

Blessings in abundance, all the best, & ENJOY!
Art in Carlisle, PA USA
Blessings in abundance, all the best, & ENJOY!
Art in Carlisle, PA USA


I have had a long look over the programs at Arduino and can't find anything suitable at this moment in time,

The trick is to write your own programs.

This is like saying I have looked all over the supermarket and I can't find an apple, plum and gooseberry pie, you won't, so bake your own.


Jun 10, 2012, 06:14 am Last Edit: Jun 10, 2012, 08:31 am by focalist Reason: 1
I'll make a couple of assumptions.. one is that you have a rail, that it can be driven by the motor physically (geared to it, screw drive, what have you, as long as rotation of the motor causes the camera to travel), that kind of thing.  

Since it seems like you are just getting started, I'd skip soldering boards, and like these guys are suggesting, get a stepper controller "shield".  There are a number of them, I'm a fan of Adafruit and Rugged Circuits, but they are typically fairly similar.. They are just a series of digital switches which can handle the actual load of a motor, which an Arduino can't directly.  Happily, these are not all that particular about voltage or current requirements of most small to midsized steppers, within reason.. they can usually handle most DC steppers other than heavy CNC stuff.  Your stepper motor will list it's requirements in terms of voltage and current, you are just going to get a controller board capable of that or greater.  As for the arduino, any of them is fine for the project, so I'd just get an Uno to keep it all simple as possible.

You are also going to want an optocoupler, I use 4n25 and pc817, but basically any NPN optocoupler will do, and a resistor for it, 1k ohm or so.  This acts as a way to electrically protect the camera while allowing the arduino to operate the shutter via a cable release port (2.5mm on most SLR's).

From there, it's a matter of working out how the bits go together, and taking a whack at working out how to do it in code.  Rest assured, you are not facing a huge coding effort... but I'll suggest that you take some time, and learn a bit about the whole thing.  Arduino is a heck of a powerful tool for photography.

I'm currently building a 10K lumen LED photo special effects flash with Arduino control at it's core.  

Read, do some browsing, particularly around the "Playground" areas, and search the forums for some similar stuff.  It's here to be found.  If you do actually get stuck-- the folks here are more than happy to help.. the general requirement is one of "Sure we'll help, but you need to try it yourself first." - but in a good way.


I can't find an apple, plum and gooseberry pie

Damned good thing. :)
The art of getting good answers lies in asking good questions.


Jun 10, 2012, 11:07 pm Last Edit: Jun 10, 2012, 11:09 pm by geetee50 Reason: 1
Almost helpful guys

I was asking if anyone had made a program for the uses I stated, I've done the homework for parts and just wanted a simple programme to step the motor and trigger the camera, dead simple really and happy to write it if nothing comes up on here. Grumpy_Mike  Really why do you bother to be honest I doubt I would get that much satisfaction from writing a program that moves a motor then waits 3seconds then triggers the camera waits 1 second and repeats same 200 times, if its already written I'll have it thanks.

Webtest: thanks I was looking at adding a shield

Focalist: thank you interesting post, if you know of a post with similar issue please post back

Paul S:  Good effort!


Jun 11, 2012, 06:27 pm Last Edit: Jun 11, 2012, 06:36 pm by focalist Reason: 1
heheh, you basically just wrote your program.

Your pseudocode is fine, just a matter of translation to C/Arduino.

Your main loop consists of:

Code: [Select]

void loop()
for(int i=1; i<201; i++) {
digitalWrite(shutterpin, HIGH);
digitalWrite(shutterpin, LOW);

You'll then be just looking at what pin is connected to what.  The variable names above ought to be fairly descriptive.  I am assuming it's a pretty typical response SLR above, and gives 100msec duration of "holding down the shutter".  That's usually plenty.

You are going to also need some type of limit sensing.. the program will also need to be able to return the carriage to the home position, unless you are just going to do all that manually.  If this is a one off, it may be easiest just to do that.  You know the length of travel and the home position, to position sensing itself isn't actually required.  KISS (Keep It Simple, Stupid) principle of prototyping...


Sorry for late reply thank you very much.

Go Up