# Help with stepper motor to turn 90° exactly every 15 min

Hey there,
I'm a biologist and I'm studying how plants grown in the dark by using infrared-based time lapse imaging. To increase the amount of plants I image, I want to make a rotating platform that turns 90° every 15 min so that I can image 4 plant set-ups/hour. Cruising through the internet brought me to Arduino. I decided to use a stepper motor and steer it via a BIG EASY DRIVER from SPARKFUN with an Arduino
Many thanks to the arduino inventors starting up this platform. Its great. I'm unfortunately a beginner and face some problems with my sketch.

I hooked up a 4 wire stepper motor to a big easy driver (Driverboard from Sparkfun) and connected it to my Adruino Uno.
I did exactly as shown in this youtube tutorial

the sketch I made upt for now is the same as in the video

``````int Distance = 0; // records the number of steps we have taken

void setup () {
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
digitalWrite(8, LOW);
digitalWrite(9, LOW);

}

void loop() {
digitalWrite(9, HIGH);
delayMicroseconds(750);
digitalWrite(9, LOW);
delayMicroseconds(750);
Distance = Distance + 1; //record this step to see if we are et the end of our move

if (Distance == 800)
{
{
digitalWrite(8 , HIGH);
}
else
{
digitalWrite(8, LOW);
}

Distance = 0;

delay(500);
}
}
``````

It nicely turns but I'm stuck with the following.
I want it to make a turn of 90°, starting every 15 min (so not with a delay of 15 min). Like this, I can synchronize my rotor with a camera that will take a picture every 15 min.

Does some of you know how to integrate this kind of timing in my sketch. Do I need more hardware to realize this? Or is this set up appropriate?

Besides, does someone knows how to prevent the stepper motor getting hot over time. One experiment takes 4 days so I guess the hardware might get very hot during this time.

Thank you so much for your help.

Big greetings
Elbar

I want it to make a turn of 90°, starting every 15 min (so not with a delay of 15 min).

So, look at the blink without delay example. It shows how to do things periodically without needing to use delay().

Besides, does someone knows how to prevent the stepper motor getting hot over time.

The amount of heat generated is a function of current, voltage, and cooling. Seems you've missed telling us about 3 of them.

Thanks a lot.
I will have a look.

I use a 12V stepper motor with 300mA.
For now, there is no cooling involved.

grtz
elbar

I use a 12V stepper motor with 300mA.

You should be using a much higher voltage, with a lot more current capability.

PaulS:

I use a 12V stepper motor with 300mA.

You should be using a much higher voltage, with a lot more current capability.

There may be some confusion here. The stepper motors I have are rated at 12v and 300mA. Using a stepper driver board like the BigEasydriver you can drive it at a higher voltage as long as the correct current limit is set. In the OPs project a higher voltage may not be necessary.

@elbar, Stepper motors naturally run hot because the full coil current is flowing even when they are stationary.

If you are sure the motor won't accidentally move when the power is disconnected you could use the enable pin on the driver board to disable the driver which should disconnect power from the stepper. However if accurate positioning is important this is a risky strategy.

If all that is needed is to rotate a turntable periodically a geared DC motor might do the job just as well. With a worm gear the turntable could not move when the motor is powered off. You could use a microswitch to enable the Arduino to detect the position of the turntable.

...R

Hi ELBAR ,
I read that you have interface the camera successfully , i have some problems in it , can you tell you how you did that , help will be highly appreciated

We haven’t seen a link to the motor’s details, which would be useful to confirm its
details.

Assuming it really is a motor with 40 ohm windings there was no need to use a
chopper driver, it could be driven from an H-bridge (if 4 wire) or a darlington
array (ULN2003) if 6 or 8 wire.

(Basically steppers fall into two categories, low impedance with 0.2 to 5 ohm
windings, and high impedance with 20 or more ohms. The low impedance
motors need chopper drive such as the EasyDriver, the high impedance ones
generally don’t and won’t benefit much.)

I’d use the AccelStepper or Stepper libraries for this if possible, save complicating
the body of the code with unnecessary detail.

MarkT:
it could be driven from an H-bridge (if 4 wire) or a darlington
array (ULN2003) if 6 or 8 wire.

It is a great deal easier to use a proper stepper driver board such as the Easydriver, especially if the OP already has one.

...R

Dear all,

This is the motor I have Stepper motor - NEMA-17 size - 200 steps/rev, 12V 350mA : ID 324 : \$14.00 : Adafruit Industries, Unique & fun DIY electronics and kits
Sorry I did not mention it earler

@Maha 21: We use a Canon camera since the software to operated comes with it for free. I would not make a program to synchronize the camera with the platfom, since I'm too much a beginner in that. As I want a picture ever 15 min, and the shutter time of the camera is 30 sec. I would start the camera loop 7 min later than then the platform. To be still fine if there would be a certain % of error on the timing.

Thanks also for the other suggestions. As I'm such a beginner, I would like to stick on the big easy driver, since that keeps it easier I think.

I have checked the 'blink without a delay' example and think this one will help me further. I 'll tryy to figure out how to integrate it into my sketch and get back to you.

But could someone tell me to how to set a time of 15 min with the arduino. I red many posts on that topic but I'm afraid I still don't manage to overcome this millisec problem.

Thanks a bunch

But could someone tell me to how to set a time of 15 min with the arduino. I red many posts on that topic but I'm afraid I still don't manage to overcome this millisec problem.

Get over the idea that you need to set a timer. Suppose you want to cook some biscuits, and the recipe says to cook them for 15 minutes. Put them in the oven, and look at your watch. Note what time it is. Periodically, look at your watch. Has 15 minutes gone by? If so, check on the biscuits. If not, do something else. No need to use a timer.

15 minutes is just 1000 * 60 * 15 = 900,000 millisecs.

...R