Go Down

Topic: Arudino UNO +Motor 28BYJ-48 , rotate every 24 hours (Read 993 times) previous topic - next topic

1337ss

Hey,

I am newbie in arduino projects. and i searched in google how to make stepper motor spin 360 degress every 24 hours with UNO controller.

I succeed in making it spin every 5 sec, but it seems that if i try more then 5 sec, it just give me wrong timing.

Thanks.

Robin2

The speed of a stepper motor depends entirely on the interval between step pulses. If, for example, you want to move 200 steps in 24hrs you need 432 seconds between steps.

Very crudely the code would be


Code: [Select]
void loop() {
   motorStep();
   delay(432000UL);
}


However an Arduino is not going to keep precise time over 24 hours and you may need to use a Real Time Clock module if accurate time keeping is important.

And, of course, use millis() for timing rather than delay() - see several things at a time

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

1337ss

Thanks for the answer.

I got the RTC, can you refer me to what code need to be added that every 24 hours the stepper motor will move?


Thanks

Robin2

I got the RTC, can you refer me to what code need to be added that every 24 hours the stepper motor will move?
This suggests your requirment is different from what I thought. I had assumed you wanted the motor to run continuously during the 24 hrs so that it made a single very slow revolution. What you have now written makes me wonder if you want a single fast revolution once every 24 hrs.

Sorry, I don't know the code for an RTC but it comes up regularly and Google will find you lost of examples.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up