motor-controlled pulley system

I'm making a sensor-based alarm clock that involves an object being lowered by a motor. However, my algorithm works so that the object must be lowered at a perfectly consistent time every time. I had it working decently before (it took about 26 seconds for it to lower the object every time), but recently, it's started fluctuating (it averages between 24-27 seconds now). How can I get my object to be lowered at the exact same pace every time?

I've enclosed a photograph of my system so that you can get a sense of what it looks like (it's a spool being lowered on a string, and I attached a wheel to the motor. I made the wheel myself by chiseling away at a tea light, because I don't know where I can find little wheels for a project like this).

Photo on 2011-10-19 at 02.05.jpg

Lower it for 24 seconds, then at 26 go the rest of the way really fast....

Wind it all way up, and let it free fall down. Gravity should be pretty consistent day to day.

Thanks, but I don't think either of those will work.

The way my program works is as follows:

  1. User enters a time for the alarm to go off
  2. I have an algorithm which, based on that time and the current time, calculates the number of seconds that will have to elapse between those two times
  3. I subtract 26 from that number of seconds, then divide the result by 26.
  4. There are 26 delays in my program—which stop the motor for a certain number of seconds. That number was the final number the program came up with in step 3. So it delays for x amount of seconds, then moves for one second, then the loop is repeated 26 times (it worked before because the object always took 26 seconds to lower without delays).

If you're confused, just ask me to clarify certain things. I've also attached my program for reference.

In light of all that, do you have any other suggestions?

ChronoDotPorgram_alarmAlgorithm_withSensor_4.pde (7.97 KB)

y = (772.92 * 9.723 * 1/(val))*(5/2.5);

Why not simplify, do operation instead of 4 or 5: y = 15030.202/val
Saw some other like that too - if the numbers are important, just note them in the comments.

Is there some friction in the system that is causing the rate to change?

This might sound like a dumb question…but are you suggesting that if I simplify it, it might work better?

I have no idea. It's really difficult for me to tell.

I don't know if it will or not. Could be the compiler reduces it for you and thus there will be no performance difference.

Can you try something like changing the weight on the end of the string?