2009-07-09

DIY camera motion control

Hows about moving your HF100 like a pro?

DIY camera motion control from Martin Koch on Vimeo.
The system consists of a ready-made IGUS DryLin W rail system and a small stepping motor which is controlled by an Arduino interface board. Once the controller program is loaded the system works stand alone. It can be powered by a battery and can be controlled by a simple power switch because the programmed task starts automatically each time the Arduino board is powered on. It's possible to horizontally move loads (camera + mounting head) of up to 6 kg (13 lbs) with the system described below.
Here's what you need:

Slider

1000 mm long Igus DryLin WS 10-80 rail.
Costs: about 50 EUR / m
Ready-mounted Igus DryLin WW 10-80-15 sledge.
Costs: about 30 EUR
The maximal possible length of movement equals rail length minus slider length (the WW 10-80-15 sledge is 150 mm long) so the usable length will be 850 mm ( 1000 mm - 150 mm).

The Igus order number for a complete system with 1 meter long rail and 150 mm sledge is WK-10-80-15-01, 1000 (the first number is the rail diameter in millimeters, second is the rail width followed by length of sledge, number of sledges and rail length).
The DryLin-W railsystem is a maintainance free, self lubricating linear guide system. It is available in three rail diameters: 10, 16 and 20 mm.

Official Igus procedure for aligning the carriage (needs to be done once).
1. Loosen all carriage bolts - (don't remove - just loosen a few turns)
2. slide carriage back and forth to allow bearings to align themselves
3. Tap the center of the carriage to "bump" the bearings into place
4. With downward pressure on carriage tighten the bolts again a few turns at a time (alternating them - i.e. do NOT crank one down and then do the other ones)

Alternatively you could also use the narrower 10-40 system but the savings are minimal. Or for a super strong version for long rails or cameras that weigh more than 3 kg (1.5 lb) use the 16-60 system. Read this thread at dvxuser.com for more info and inspiration. (a 10-40 version is shown in post #336 on page 34). Post #475 shows how to move along an arc.
You can order directly from Igus. They have offices around the world. More info at Drylin-W.de
This is about all you need when you move the camera manually. You can also build a hand cranked version if you wish. I went a step further and motorized the whole assembly.

Controller board

Arduino Duemilanove (or Arduino Uno see update below) or Arduino Nano USB I/O controller board. Visit arduino.cc for more information and where to buy it.
Costs: Arduino about 25 EUR, Arduino Nano about 50 EUR.
The current (as of 2009) Arduino is called Duemilanove which is italian for "2009". It is meant to be used with a "shield", an interface board that sits on top of the Arduino.

I used the Arduino Nano. It offers the same features in a smaller 30 pin package that can be used just like an integrated circuit. You need an USB to USB mini cable to program it. Such a cable came much likely with your digital camera.

Software

Download and install the Arduino software for Windows, Mac OS X or Linux.
Costs: free.
Copy and paste the following Arduino sketch into the developing enviroment and download it to the board. Make sure to choose the correct board under Tools>Hardware. If you use an Arduino Nano replace the digital output numbers with the ones in the comment. Once downloaded the Arduino executes the sketch on its own. Every time power is turned on or the tiny reset button is pressed the sketch starts.
/*
Move an unipolar stepper motor
Version 2.0 with simpler, leaner code
2010, Martin Koch
http://canon-hf100.blogspot.com/
----------------------------------------

Use a 12 V, 0.16 A to 0.5 A unipolar (6 wires) stepper motor

If you use the Arduino Nano assign these digital output numbers:
#define D0 2
#define D1 3
#define D2 4
#define D3 5
*/

// Arduino digital output numbers
#define D0 13
#define D1 12
#define D2 11
#define D3 10

int rpm = 30; //revolutions per minute (keep below 100)

void setup() { 
 pinMode(D0, OUTPUT);
 pinMode(D1, OUTPUT);
 pinMode(D2, OUTPUT);
 pinMode(D3, OUTPUT);
 delay(1000);

//Choose number of steps by trial and error 
//so the slide runs the whole length of the DryLin W rail
 for (int step=0; step<9000; step++) {
   moveMotor(step); 
   delay (150 / rpm);
 }
 motorOff();
}

void loop() { 
// run again and again (not used)
}

void moveMotor(int step) {
 switch (step % 8) // Half steps (step modulo 8 ensures 0 to 7 cycles)
 {
  case 0:   //1000
  digitalWrite(D0, HIGH);
  digitalWrite(D1, LOW);
  digitalWrite(D2, LOW);
  digitalWrite(D3, LOW);
  break;
  
  case 1:    //1100
  digitalWrite(D0, HIGH);
  digitalWrite(D1, HIGH);
  digitalWrite(D2, LOW);
  digitalWrite(D3, LOW);
  break;
  
  case 2:    //0100
  digitalWrite(D0, LOW);
  digitalWrite(D1, HIGH);
  digitalWrite(D2, LOW);
  digitalWrite(D3, LOW);
  break;
  
  case 3:    //0110
  digitalWrite(D0, LOW);
  digitalWrite(D1, HIGH);
  digitalWrite(D2, HIGH);
  digitalWrite(D3, LOW);
  break;

  case 4:   //0010
  digitalWrite(D0, LOW);
  digitalWrite(D1, LOW);
  digitalWrite(D2, HIGH);
  digitalWrite(D3, LOW);
  break;
  
  case 5:    //0011
  digitalWrite(D0, LOW);
  digitalWrite(D1, LOW);
  digitalWrite(D2, HIGH);
  digitalWrite(D3, HIGH);
  break;
  
  case 6:    //0001
  digitalWrite(D0, LOW);
  digitalWrite(D1, LOW);
  digitalWrite(D2, LOW);
  digitalWrite(D3, HIGH);
  break;
  
  case 7:    //1001
  digitalWrite(D0, HIGH);
  digitalWrite(D1, LOW);
  digitalWrite(D2, LOW);
  digitalWrite(D3, HIGH);
  break;
 } 
 return;
}

void  motorOff() {
   digitalWrite(D0, LOW);
   digitalWrite(D1, LOW);
   digitalWrite(D2, LOW);
   digitalWrite(D3, LOW);
}
There's also an Arduino stepper motor class available but I prefered to write my own stepping motor control code just for fun. To cut noise the motor is operated in half step mode so it doesn't offer the full torque but the ULN2803A interface allows to connect twice as strong motors.

Stepping motor

Small 12V unipolar (6 wires) stepping motor with maximal 0.5 A per winding.
Costs: about 30 EUR.

My stepping motor needs just 0.16 A per winding and offers a force of just 70 mNm (0.070 Nm = 0.62 Pound-force inches). Nonetheless it is still able to horizontally pull loads up to 6 kg (3 lb). I bought it from RS-Components. The part number is 440-436. In order to fit my interface I had to rearrange the wires. To loosen a wire in the type of connector shown above use a needle to press in the latch from the front then pull out the wire. The wire easily clicks in place at the new location. If you use the same motor the wire arrangement in the plug should be B brown, E brown, A white, F blue, C red, D yellow.

Interface

1 ULN2803A integrated circuit, prototyping board, connection pins, wire
Costs: A few Euros.
The interface is as simple as it can get. Make sure to connect the stepping motor wires as shown in the schematic.
Schematic for Arduino board

Schematic for Arduino Nano board


This board also shows a 5 V relais (orange part) that is used to trigger a still camera.

Battery

A small maintainance-free 12 V lead battery with about 2 Ah is inexpensive and sufficient for hours of continuous operation.
Costs: about 20 EUR.

You'll also need a lead battery charger

Assembly

The most silent solution is to use a nylon rope to pull the sledge across the track. It works in one direction only but by turning the whole assembly by 180° its easily possible to move in the opposite direction.
The usual camera move is from left to right just as we read. It tells the viewer that everything is alright. If you want to disturb the viewer move the camera from right to left.

The rope bobbin can be made on a lathe.

The whole assembly is not completly silent but silent enough to be usable. The noise of the stepper motor is cut significantly by using rubber mounting bolts.

Ideas

If you don't mind the noise (e.g. music video) you can also use a d.c. motor with gear assembly. The Arduino board offers pulse width modulation (PWM) control to set different speeds.
The Arduino board also offers analog and digital inputs so you can wire a potentiometer or switches to set different speeds.
The possibilities are endless and it's fun to play with the Arduino system. I recommend the book "Getting started with Arduino" for an easy start.
Here's an example video: vimeo.com/5535135

Update March 9, 2010: I updated the Arduino sketch above with a simpler and leaner version that does the same.
Update November 20, 2010: There's a new Arduino UNO available which replaces the Arduino Duemilanove and works the same.
Update February 15, 2011: If you use the Arduino UNO it's best to built the interface circuit on a ProtoShield that can be plugged directly into the Arduino.
Update June 19, 2011: As far as I know Igus doesn't sell directly to individuals any longer but they offer ready-made sliders with predrilled 3/8" hole at Amazon.com.

The image from Amazon above shows that you need 8 bolts to properly fasten the plate to the four linear bearings.

Do you want an even leaner code? Well I recently learned how to use the Arduino stepper library with an unipolar stepper motor. It's way simpler to use than I thought and although I haven't tested the code below I post it to give you an idea how little code is neccessary using the Stepper.h library included with the Arduino software download:
#include <Stepper.h> //include the function library
#define STEPS 200 //1.8 deg motor (200 steps per revolution)
#define D0 13 // Arduino digital output numbers
#define D1 12
#define D2 11
#define D3 10
Stepper stepper(STEPS, D0, D1, D2, D3); //create the stepper

void setup() 
{
  stepper.setSpeed(30); //set speed to 30 rpm
  delay(1000); 
  stepper.step(200); //move 200 steps = 360 deg in one direction
  delay(1000); 
  stepper.step(-200); //move 200 steps = 360 deg in the opposite direction
}

void loop() 
{}

97 comments:

Carleton - Director said...

This is an awesome looking rig. It's exactly what I've been looking for to complete a stop-motion animation motion-control rig!

My plan is to mount a panning/ tilting base ( like this one here: http://shop.telescope-warehouse.com/product.sc?categoryId=1&productId=119 ) to the rail system so I can have a panning, tilting and tracking shot all controlled one frame at a time.

Do you know if a larger stepper motor will be able to pull more weight, or does the 6 kg limitation seem to be more about the pressure on the rails.

Also, since you obviously know how to write code, what do you think about having a unit like the GigaPan ( http://www.gigapansystems.com/epic-100-product-page.html ) sit on top of the rail system. If it could be controlled frame by frame as well, that would basically be a complete stop-motion-control system for under $1,000.

Finally, to conclude my seemingly endless barrage of questions, can more than one Arduino be hooked up together? For example, can I have the setup like shown on Post 475 with the two tracks running at angles to eachother where each has it's own Arduino controlling it's own motor? If so, can it be programed to move at a specific increment each frame. Some times, hours can elapse between frames of animation, so I would need to figure out a way to set up the program to only move a little bit each time I needed to get another frame.

Again, thank you for posting this awesome how-to. I am certainly going to be building this very soon.

Carleton

Martin Koch said...

That are a lot of questions :-)

You can use a stepper motor with up to 0.5 A / Winding which would pull a heavier load with the simple interface shown. But 6 kg is pretty much for the tiny one I used.

Dragon Stop Motion 2.0 supports the Arduino interface and I posted a simple solution in their forum:
http://www.dragonstopmotion.com/forum/viewtopic.php?f=3&t=144

I don't think you can control 2 Arduinos from your computer but you can use as much as you want in stand alone mode.

Martin Koch said...

As for the GigaPan, if you build the slider you could also build a GigaPan yourself as it is basically a stepper motor controlled by the Arduino board. You can use one Arduino board to control up to three motors since there are enough digital outputs available.
You can also use one digital output to push the shutter button via a lift magnet as on the GigaPan or you use Dragon Stop Motion. I hope this helps.

Carleton - Director said...

Martin,

Thanks a bunch for your reply(s). You are right about making my own giga-pan. It would be a simple matter to connect the pan head to a similar system as yours, although I think tilt would give me some trouble. Maybe I could hook up a worm gear to another gear on the pan-bar?

I just found this today and it seems to be a really useful open-source program. Have you seen this before? http://openmoco.org/ Their timelapse engine looks to be very comprehensive. I was wondering if this is similar and compatible with the rig and code you created.

Thanks again for all your help!

Carleton

Martin Koch said...

You're correct, tilting would require a stronger motor or a gear assembly.

Openmoco is a good find, I didn't know it. It will sure work with the Igus slider. You just need to adapt the stepper interface.

Brian Hockenstein said...

super excited, going to be building one of these next week...

one questions, would 12 volt/4 amp battery work as well? my supplier has these much cheaper than the 4 amp variety? in fact, what is the smallest battery that the setup can operate on? I will be using it in some pretty remote locations and weight will be an issue.

Any other motion-control projects in the works??

Martin Koch said...

Brian, the maximum allowed current with the interface shown is 0.5 A (my motor consumes less). This means a 2 Ah battery will theoretically operate the unit for 2/ 0.5 = 4 hours. A tiny 12V / 1.2 Ah battery will continuously operate it for 1.2 / 0.5 = 2.4 hours. Your 12V / 4 Ah batterry will last 8 hours. You see it all depends on how long you need it to work. You can also use 10 x 1.2 V AA size accus for even less weight.

Currently I have no motion-control projects in the works.

Brian Hockenstein said...

thanks so much for the reply... getting really excited!

what you said about the batteries made perfect sense, thank you so much for taking the time to explain it.

can you please explain the AA option? are you saying I could build it to use regular AA batteries?

Martin Koch said...

Yes if you buy a battery holder like this http://www.batteryprice.com/10xaabatteryholder.aspx where ten 1.2 V AA-accus are connected in series you'll get 12 V with the power rating of a single cell. E.g for instance if you use ten identical 1.2 V - 2000 mAh cells you get a rechargable 12 V 2Ah battery.

Non-rechargeable AA cells should also work but note that they have 1.25 V. I think the stepper motor will also cope with 12.5 V supply though.

Brian Hockenstein said...

wow, thanks so much for the help. I will let you know how it all turns out!

Meredith said...

Hi Martin

Have you thought about building these motor units for sale?
How much would you charge to build one and ship it to Canada?

thanks
Stephen Webb

Martin Koch said...

Hi Stephen, sorry I don't have the time to start such a business. I suggest you look for someone in your town and pay him to build it for you. Believe me it's quite simple to make for someone with basic electronics skills.

Stephen said...

Fascinating rig.

I noticed some jerkiness in the video. Any idea what may be causing this?

Martin Koch said...

Thank you Stephen.

As for jerkiness take your choice:
Vimeo, your computer, your browser, your internet connection. It's certainly not in the video.

Stephen said...

It could be an artifact in Vimeo. Let me describe what I am seeing: In the opening seconds as the camera pans past the flower, I see a noticeable stutter in the motion of the pan. It is more noticeable in the small, embedded player. In full screen mode (both scaled & unscaled) it is less noticeable. My thinking was that this could be due to binding in the bearings, either as a result of their design or due to the deflection of the rail; or it could've been due to foreplay in the tow system.

I saw a similar stutter in this video (http://www.vimeo.com/8889765) using the same apparatus. The boundary conditions are different between the two setups. Your's is cantilevered form the center, his is supported at the ends.

Does what I've describe here match with your experience with working with the device?

Stephen said...

Oh wow, PWNed by predictive typing.

foreplay = freeplay

Martin Koch said...

I can asure you there's no deflection and the Arduino controlled movement is as smooth as it can get. The other video you mentioned shows a manual operated slider and this needs practise, lots of practise to get it smooth.

Stephen said...

Thanks so much for clarifying. I'm off to the drawing board.

burle said...

You Rock, Thank You!!!
I am building this-this weekend!
Lots of great idea's

antoine said...

Hello martin,
i'm a french documentay director.
you made a pretty nice solution for our film making configuration.
thank you and congratulation.
i have a few question about the motorization.

#1.
i went on the arduino internet site and the nano hardware is specifie with the 6v - though in your blog you recommand 12 v batterie - and the 12 v batterie is compliant whith the RS motors taged 440-436
http://radiospares-fr.rs-online.com/web/search/searchBrowseAction.html?method=searchProducts&searchTerm=440-436&x=0&y=0#header

#.2
In the software you put on your blog , it is written "steps: 400 steps = 360°" though in the RS web site the motor tagged 440-436 is specified to have a 1.8° / step.
Is it a problem that the softwar is not similar?
thank's to answer back?
and thank's to share you ingeniuty.

J.A

Martin Koch said...

Antoine, thank you for the kind words.

The Arduino Nano has the same specifications as the Arduino Duemilanove e.g 7-12 V recommended supply voltage. You need 12 V for the stepper motor.

The motor has 200 steps / revolution but since I drive it in half step mode it has 400 (half)steps / revolution.

Did you know that you can now buy an Arduino from rs-components?
http://radiospares-fr.rs-online.com/web/search/searchBrowseAction.html?method=searchProducts&searchTerm=arduino

PhotosByStephan said...

Martin,

Have you considering adding a switch connected to an interrupt to stop the motor? This would eliminate the need to know the exact bounds of the slider.

Also, what are you using to sketch up the diagrams of your circuits?

Thanks,

Martin Koch said...

Stephan, connecting an end switch to pin 2 or 3 and attaching an interrupt would be simple but is not necessary. If I really start to close to the end and the slider stops before the motor, the weak motor I'm using simple slips and no damage is done.

I used Adobe Illustrator for these schematics but switched recently to the free version of EAGLE available at cadsoft.de. It's CAM processor can produce high quality eps files from the schematics you draw.

PhotosByStephan said...

Who's awesome? You're awesome, Martin. Viele Danke!

Angelo said...

Hi, Martin

Congratulations for this beautiful rig and the clear and precise tutorial.
I am thinking to use it for a project, it is simple and configurable for different situations. But... I'm stuck in how to proper setup the software instructions. I am using the same Igus parts, the camera is a little more heavy: a Canon 5D. But the real challenge is the time length of the footage, something between 12 hours. So... the camera have to move 850mm in
720 minutes. Rough 1,78mm/s. I don't know if I can accomplish it only with software, without a gear box. Can you throw some light on this? Thank you in advance. Angelo

Angelo said...

just to correct wrong math in my post:

850 mm in 720 min
850 mm in 34.200 sec
1.18 mm/min
0.018 mm/sec

Martin Koch said...

Angelo, you can only film for 12 minutes with the 5DMKII so I asume you want to do a timelapse shot over 12 hours. In this case I would divide the 850 mm length into very short distances and stop, shoot and start at each position. There's no need for a constant movement. How much photos you need is determined by the desired playback speed and movie duration e.g. with 24 fps and a movie duration of 3 minutes you need 24 * 3 * 60 = 4320 timelapse photos. That would be a photo every 850 / 4320 = 0,2 mm. One revolution of the stepper motor can be divided into 400 steps so it should be possible.

Angelo said...

Martin, it´s really a timelapse what I am planning. The last information (one revolution=400 steps) was all what I needed. Perhaps it´s an obvious information but I'm really a novice.
Danke schön!

Angelo said...

Danke schön! Martin,

You're right. It'a a timelapse project. Your last information (1 rev = 400 steps) was extremely useful, now I can figure out how to do. One more thing I can´t adjust... these motors are 1.8 degrees per step, right? How can it do 400 steps per revolution? These steps have to measure 0.9 degrees (360 / 400).

Angelo said...

1.8 degrees makes 200 steps... Are 400 steps achieved with microstepping?

PhotosByStephan said...

Angelo, the 400 'steps' are achieved by half-stepping the motor. Martin has configued his steppers above to do this. Refer to the schematic.

FForstand said...

Hi,

you wrote that you replaced the "Arduino sketch with a simpler and leaner version".
Could you give any info on what you are using now?

Danke!

Martin Koch said...

Sorry if my update remark was unclear. I just updated it. I use the sketch you see above which uses less lines but does the same as a previous more bloated sketch.

Will said...

Hey Martin,

Incredible system, inspiring work. I'm still wrapping my mind around the design, so please excuse me if this is a stupid question. Can I build the track with a wide 90 degrees curve to send the camera around a corner? What supplies would you suggest for this modification?

Also, (this might have been asked already) how would you go about motorizing the mounting head to pan + tilt, and can the pan+tilt move still be controlled by the same interface?

Thanks a lot
Will

Will said...

Or, do you figure I could somehow sync this item perfectly to your motion control rig?

http://www.b-hague.co.uk/hague_pan_and_tilt_powerhead_ph.htm

Peakbagger said...

Just trying to verify - is it 6kg (13.2 lbs)or 3 pounds? Or do you mean 6 lbs ( 3 kg)?

Martin Koch said...

It was 6 kg (13 lbs). I corrected the mistake.

Stairs said...

What a superb endeavour - I'm very impressed with what you've done, and plan to attempt similar towards the end of the summer - since my fiancé is moving away for 12 months for work, I will need something as exciting as this to distract me!

I have been looking at the stepper motors advertised on the RS website; is there any disadvantage to using alternatives such as:

http://tinyurl.com/RS440458

or

http://tinyurl.com/RS440442 ?

I realise that they are 8 wired, but the voltage requirements are similar or lower. Perhaps I am being naïve; if so, please forgive me; it has been many years since I have dabbled in electronics of this kind.

Best wishes,
Stairs.

Martin Koch said...

One of the motors you linked to exceeds the current limit of the ULN2803A interface but as long as you stay below the limits you can use other stepper motors. It's just not required to use stronger ones for this application. 8 wires is no problem you only have to connect two pairs to get a six wire configuration as shown above. Enjoy building!

Marco said...

Martin,
your project is wonderful and also the clip you made with it. I was working on something similar when I found the link to this blog (thank God!).
Although I have a few doubts as I am very new to moco. I just got an Arduino Duemilanove in an Italian retail shop; in the same store I got a L298 IC (as interface?); apparently is one of the most common to find... BUT It seems strange that I cannot find a clear schematic to connect it to arduino (which pins go to arduino, which to motor). Beside that I have a spare bipolar stepper motor taken from an old Epson printer (no specifications).
The first question is:
1. can I use your sketch even for a bipolar motor in junction with L298?
2. can a bipolar motor go half steps... Mine ha only 4 wires and not 6?
I appreciate any help to go farther on in my project.
-bye-

Stairs said...

Thank you for taking the time to provide a response, Martin; I realise that you're getting many questions about this! When the time arrives, I shall document my build and certainly credit your input!

tom said...

Hey there,

thanks for this great device.
I am a complete electronic newbie but will try to get it to work with your explanations. Since i will be using a HDSLR with a rig, it will probably be useful to use a stronger motor. would this one work with your setup:

http://de.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=1918334

thanks in advance,

bbbelly

Martin Koch said...

Marco: I suggest you use the parts from above. It's the simplest and most straightforward way. Better save your bipolar stepper and the L298 for another project.

Tom: Yes this stepper http://de.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=1918334 will work perfectly with the interface. You will have to connect wires B and C and also G and F to get the required six wires.

Conjure said...

Inspiring work!

One thing I am confused by is your breadboard photo; what is the big black thing under your Nano, and the other black thing to the left of it (the 5V relay and ULN2803A you have explained already).

Otherwise, thanks for the book recommendation; even things like VIN and GND (ground?) on your schema confuse me - I guess there is a lot to learn.

Danke!

Marco said...

Thank you Martin for your reply.
A couple of questions about your rig.
What happens if, for example, during the setup process -to find out the correct number of steps to run completely the length of the rails-, the sledge gets to the end of the rails? Is the motor easily breakable?

If you would care to increase the speed of the motor, should I have to go into PWM sketches or I can modify yours somewhere?

Thank you, that's all.
-Marco-

Martin Koch said...

Conjure, one is a socket for the Nano and one is a power plug socket which are not needed when you use the Arduino Duemilanove.

Marco, use end stops and alter the rpm variable in the Arduino sketch to get different speeds.

Ryan said...

Brilliant! I'm working on setting up a similar system, only using an Easydriver stepper driver for up to 1/8 microstepping.

One question:
You mention that you can lathe a bobbin. Is the bobbin you're using custom? Can you purchase one like that anywhere?

Thanks!

Marco said...

I just made a copy and paste of your script into Arduino software (v. 0018) and it returns error!!!
It says....

In function 'void setup()':
error: 'motorOff' was not declared in this scope

I don't know what to do as it does not allow me to upload anyway :-(

Martin Koch said...

Ryan, I cut my bobbin from an aluminum rod using a small lathe. I'm pretty sure there are readymade suitable bobbins available I just don't know where.

But this will also work without any bobbin. Just fix the rope end to the axis and use some extra windings.

Martin Koch said...

Marco, please try again. I just changed motorOFF() to motorOff()

Marco said...

Martin,
it is correct now!
I just notice that either MotorOFF or Off will work, as long as they are both the same in the two positions of the script.

Thank you for your help.

tom said...

"Tom: Yes this stepper http://de.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=1918334 will work perfectly with the interface. You will have to connect wires B and C and also G and F to get the required six wires."

Thanks a lot for your answer.

When i connect wires B and C, which wire (letter) does that replace in your original 6 wire layout?

When i connect wires G and F, which wire (letter) does that replace in your original 6 wire layout?

thanks in advance
t

Martin Koch said...

A B C becomes A BC D
F E D becomes H GF E

tom said...

thanks :)

Camjo said...

Hi Martin,

really nice to see someone figured it out for me.. Great job.
I already have the slider and now i want to ad the motor to it.
I'm not realy technical and i wondered if i need more stuff then only the nano-board the motor and the interface ULN2803A.
On the picture ware you have the 5 V relais (orange part) i see al ot of other stuff. Can you help me out wit a shoplist?

Thanks
Kevin.

Martin Koch said...

Kevin, the orange part triggers a still camera.
You really need just the http://arduino.cc/en/Main/ArduinoBoardDuemilanove board the specific RS motor and the interface ULN2803A. Since I used the Nano I had to put a power socket on. The Duemilanove board is a little bit bigger but it has everything needed already on board. You only need the parts shown in the appropriate schematic above.
Have fun!

Camjo said...

Tnx a lot Martin.
Up and runing now.
One more question. Is it possible to set the rpm to 0.5 or even 0.01? When i set the rpm to 1 sec it runs the 90cm in 45 minutes.

Tnx Kevin

Martin Koch said...

Sure, you can get as low as you want but what you actually want is to increase the revolutions per minute so the camera travels faster. Just don't go over 100 rpm with "my" motor.

Gorka said...

Wonderfull gadget.
I want to build it for timelapse photography with a 5D canon.
Is your motor enough powerfull?
I found your sketch in the 5D forum that is perfect:
http://www.cinema5d.com/viewtopic.php?f=14&t=972&st=0&sk=t&sd=a&sid=be739e059d11437093cb8f9175be2d61
As I´m going to use the normal Arduino I supose that I have to change the digital output to 13,12,11,10 ?
Them I have to change the pin 12 for triggering the camera(that I think is was you assigned).Which one could I use? How can I trigger the camera thru the 2,5 stereo jack?
And how know the skecth the length of the rail?
Thanks a lot for your help and great job.
Gorka

Marco said...

Martin, sorry to bother you again, but recently I came back to this project and I would like to make some changes to your sketch for Arduino but I really don't know how to write it! Maybe you can help me.
First of all, let me tell you that I tried the sketch included in Arduino software called "MotorKnob" and yours work a lot smoother. The advantages of MotorKnob were that the Arduino is connected also to a sensor (potentiometer) to change speed of the stepper motor... But it does not work well! Not sure why.
How is it possible to change the line in your sketch "int rpm = 30; //revolutions per minute (keep below 100)" so that if a potentiometer is set to 0 of its scale, stepper RPM are 1 and if potentiometer is at the end of its scale (1024), RPM are 100?
I know what I would need but I cannot put it in C language.
I believe this change could improve a lot your rig for field use without the need of a laptop.
I hope you can help me.
Thank you again.
-Marco-

Marco said...

Martin,
I made it! I added a line to your script so now I can change speed between 1 and 100 rpm with a pot.
Can I publish your script (with your copyright) in a diy guide made for bipolar stepper motors using L298 driver?
Thank you.

-Marco-

Martin Koch said...

That's great Marco! Feel free to post my script.

Martin Koch said...

@Gorka
The motor has no problem with a 5D.

Yes you have to change the pin numbers.

You can't trigger the camera thru the 2,5 stereo jack.

The sketch "knows" the length of the rail because I figured out the number of steps by trial and error.

Marco said...

I have found a different and interesting sketch of yours just for timelapse at this address.
I was just wondering about 2 things:
1) What ramp is?
2) Do I have to change also the values at
"int shot = 0;" at the beginning of script....
And...
" int output_pattern = 0;
int steps_so_far = 0;
int ramp_counter = 0;
int msWait = 150 / rpm;

do"
Toward the end.
_________
Thank you very much for your help.
-Marco-

Kramer Klaymation said...

This looks like a really cool setup. You've gotten me interested in checking out arduino and possibly trying this out in the future. One question I have is about the time lapse. Is the arduino just controlling the stepper motor, or is it also controlling the camera's captures? I see nothing on the page about plugging into a camera so I assume that you'd need a separate intervalometer for the captures.

Thanks, Luke.

Martin Koch said...

Luke, it's certainly possible to also control the camera. Here's a guide to do this via infrared LED for a HF100 http://controlyourcamera.blogspot.com/2010/02/finding-out-ir-signal-timing-with.html
using this circuit http://controlyourcamera.blogspot.com/2010/01/infrared-controlled-timelapse.html

For a DSLR you need a cheap cable release from eBay. Take it apart and replace the switches with Arduino controlled relay contacts. The orange relay in one of the photos above is such a solution.

Martin Koch said...

Marko, ramp is for gradually increasing or decreasing the speed of movement at the beginning or end. I found it's not necessary and removed it from the script above.

Keep experimenting!

Julian said...

Its great! thanks for the idea!

Do you know what potentiometer could be build in to control speed?

thanks!

Julian said...

Hi
I build an interface like yours but with a arduino uno (to use it with dragon stop motion). Now, when i plug in a 12v, 1A DC Motor the uln2803 gets very hot after a few seconds and the motor stops. Any idea what could cause the problem?
thanks!

Martin Koch said...

Julian, the ULN 2803 can only supply 12V / 0.5A. You must use the motor I've listed above or one with 12V and 0.5A max!

You are not using a DC motor with the sketch above do you? You need an unipolar stepper motor or if you wrote your own sketch and use a DC motor only 0.5A max are allowed. Otherwise you must use a stronger Transisors driver.

TheAarduino website has examples on how to connect a potentiometer to an analog input and use this to control a value.

PhotosByStephan said...

Martin,

The ULN2803A is rated to 50V / 0.5A output, 30V input. Julian can use a 1A motor by simply adding another DTA in series. The simplest method would be to stack a second chip on top of the existing one and solder the contacts together.

ULN2803A Datasheet:

http://focus.ti.com/lit/ds/symlink/uln2803a.pdf

PhotosByStephan said...

I'm sorry, it's only Tuesday and I have appeared to have already checked out for the weekend.

Julian needs not add a second chip. Each transistor pair on the chip is rated to 0.5A. There are 8 arrays on each chip. Higher currents can be achieved by hooking the outputs together in parallel, giving the chip a total output of 4.0A if all outputs are used together.

Julian, I will add that most likely the array that you've subject to 1.0A is likely burned out by your description. This leaves you seven more on the chip, if true.

Martin Koch said...

That are great tips Stephan. Thank you.

Hugo Covarrubias said...

Hi martin, im from Chile, the only motor that i found in chile is this:
http://www.riabelectronics.cl/stepper-motor-with-cable.html
i´m trying to make the DIY moco for a stop motion shortfilm, i use DragonStopmotion
this motor will work?
thanks

Martin Koch said...

Hi Hugo, sorry this motor has just 4 wires and needs a bipolar driver. To use my circuit you need a 6 wire unipolar or hybrid motor with <=0.5 A / winding. An 8 wire motor also works. If you connect the "middle" wires of an 8 wire motor you also get a 6 wire motor.

Hugo Covarrubias said...

Thanks Martin,
I found a local RS distributor in chile,
wich one of these motors works for your circuit?:
this one: http://cl.rsdelivers.com/product/rs/dsh40es6fa1k40050/motores-paso-a-paso-18%C2%BA-70mnm-5v/0440420.aspx

or this one: http://cl.rsdelivers.com/product/rs/dsh40es66b1ku0050/motores-paso-a-paso-18%C2%BA-70mnm-12v/0440436.aspx

I´m looking for the cheapest motors on the list, but they have many other motors in stock.

Thanks again

Martin Koch said...

The second link goes to RS part number 440-436 and this is exactly the motor I use and show above. RS also offers the Arduino and the interface IC and a nice box: http://cl.rsdelivers.com/catalogue/search.aspx?query=arduino&Family=3212

Its nice to have such a global source.

Hugo Covarrubias said...

Thanks!
The connections on a Arduino UNO board are more simple than a NANO one?. I dont need a integrated circuit, prototyping board, connection pins ??
sorry but im new in the circuit world.

Martin Koch said...

You will always need a seperate board for the ULN2803A interface IC but yes, the UNO is the better choice. It already has the power connector and it allows to put a prototype shield on top and now there's a very nice little case available (see previous link to RS). If I had to build it again I would use this.

I suggest you google "Arduino proto shield" to get familiar with this concept.

By the way don't forget to download the data sheet of the motor at the RS page. It helps with figuring out the wires just in case my description above is unclear. You should also find someone near you with a bit of electronics knowledge. Have fun!

Sean O'Donnell said...

Martin, this is a great rig you have created! I have the slider, and am thinking about giving this a try. However, it will be my first foray into electronics, so I will be proceeding after doing some homework! I have a couple of questions.

I am in the US, so some items like the motor don't line up with what you have. Would this one here http://www.alliedelec.com/search/productdetail.aspx?SKU=3160035
work for me? I can't quite tell from the specs they give? I take it I will need to tinker with the steps and revolutions (trial and error) to get the speed and distance? Will I be able to figure out the wiring scheme needed to configure this motor?

I have scouted out the Arduino Uno, Protoshield and Box and it looks fairly straightforward. I would solder the shield together, then put a breadboard on it, and put the interface on that? Then line up the inputs and outputs per the schematic?

Any advice or thoughts would be great, and nice work on this rig!
-Sean

Martin Koch said...

If motor #H17120434 is available with 6 wires I think it will work with my interface.
You don't need a breadboard just solder a socket for the interface IC to the protoshield.
A breadboard will not fit into the Arduino box.

Sean O'Donnell said...

Thanks, Martin.

Most of my parts are in now, so this weekend I will see what I can learn/make with all of it! Hopefully the learn/make curves will match up.

My motor did not come with a connector, so I will need to track down something like this to connect to the shield? http://docs-europe.electrocomponents.com/webdocs/002c/0900766b8002c282.pdf
or this kit: http://www.alliedelec.com/search/productdetail.aspx?SKU=8631387

Anyways, thanks for posting this. I'm excited to learn some new things...I think...

Happy shooting!
-Sean

Graphections said...

Hi there, I am looking to build one of these - but for time-lapse photography.

How slow can the motor controller go?
Ideally id like a 2 hour lapse along 5 feet of track.

Is your set-up capable of this, or is it all in the programming?

Graphections said...

Hey man, so how slow can you get this to run - idealy im thinking 2 hours of 5 feet of track

Possible?

Martin Koch said...

Its all in the programming man, if you wish you can code it to move one step a day/month/year. It's a stepper motor!

hallmat said...

i was wondering how can i control 2 stepper motors with this?

and also can i get it to control 2 per axis so 4 altogether but to control the pairs seperatly

hope you understand that its late and im tired

thank you

Martin Koch said...

You can buy an Arduino Mega with enough digital outputs to control 4 steppers.

Graphections said...

Hi Martin, I built a driver for a DC motor with a Potentionmeter similar to this and it worls great!.

I was wondering if you had a photo or illustration of your breadboard showing how you power the stepper motor for this project?

Id realy apprecaite it :)

Martin Koch said...

All the info, the schematic and a photo of the battery used for powering the project can be found above.

Unknown said...

Hi Martin! First let congratulate you, You've done a great job whit this rig.
I have a question about the code you posted in arduino forum. That code is only for unpolar steppers right? Do you have any idea where i can get some code to drive a bipolar stepper with arduino + easydriver?
Thanks in advance!
Best regards from Argentina!

Pedro said...

Hi Martin

I´m making a similar camera motion control system as you have. I don´t know much about electronics. However, I managed to build a similar Arduino Nano board. Unfortunately, I did not realize to rearrange the stepping motor wires. And moreover, testing the stepping motor for the first time I put the connector the wrong way round. I changed the connections correct, but the stepping motors refuses to turn. Is it possible that I broke the engine?

Martin Koch said...

High Unknown from Argentina. Sorry for the late reply. The code is for unipolar. I'm sorry I have no experiences with bipolar steppers. I stick with unipolar ones for the simplicity.

Martin Koch said...

Hi Pedro,

it's very unlikely that you damaged the motor. Sleep over it then check everything again with fresh eyes. I'm positive it's just a little thing preventing the circuit from working.

Pedro said...

I found out what was wrong. I made a bad solder joint. Now everything works fine! Thank you for this great tutorial! This inspires me to learn electronics.

Martin Koch said...

Ha, I knew it. Congratulations!

Neil Camara said...

Hi Martin,

I have a 6 wire stepper motor that I yanked out from an old dot matrix printer. I already found the center taps. I am using uln2003.

I made this diagra, http://i.imgur.com/L7ZnT.png

I am using Arduino UNO R3. My power supply is 12v. My uln2003 gets so much hot. I can't figure out the proper wiring for the 4 remain wires on my stepper motor.

I used this code
http://pastebin.com/bWH3SjJf

it will work but on the forth movement, it will step backward for a degree. Then goes forward again for 3 times, backwards again and so on.

Should I buy a differnt stepper motor?

Martin Koch said...

Hi Neil, it looks like you have to experiment with the four coil wires until the motor moves in just one direction. The two center wires should go to 12V AND for protection against voltage spikes also to pin 9 of the ULN2003. Also note that the code you use only switches one coil at a time. It works but you get more torque if you energize two coils like I do.