I have a requirement to measure the rotational position of a rotating cylinder and sync it to a processing program that is projecting on it.
The cylinder will be rotating at appromimately 30hz, and I need to know the time at which it completes a full rotation, so if the cyl is marker from 1 to 360 degrees, I need the draw routine to know at what point it has passed 0 degrees.
So far , i have tried using an old mouse, and took the ball out and used the IR / detecter emmiter to try to track a moving tab that passed between them, but this did not work, as the mouse used quaderature interference to tell which direction the mouse wheel moves and will only work with the small circular grating found in mice, and not with a simple blocking of the signal. The other problem, is that I think mice only interupt at about 125 hz, so this would probably not give an accurate position of the cylinder, as those 125 pulses would be spread over 30 rotations and only give a resolution of about 85 degrees.
My next idea is to use the minim library and record the noise of the cylinder hitting a small flexible tag on each rotation, and then use beat detection to tell how far appart the noises are which would also give the speed of the rotation.
Can anybody think of a better way??
Ideally an LED / Light detector shining through a hole in a disc would be best but can't think of a way of reading this into processing without custom hardware.
I think the interrupt speed of the mouse click would probably be around 125hz too, so probably too slow to give me an accurate rotational position , I wonder if theres a way to increase the resolution of the input device?
Yeah, I think so. I did think of that, but the problem would be , the webcam woudl have a 30hz refresh so doubt, and any marker would be very blurred if the disk was spinning at 30 hz. Even if I used a strobelight, the resulting image analyses would probably be computationally too expensive to make it work.
Millis is reasoably useful for ensuring that my animation runs at a constant 60fps, where I can count the millies since the last frame and add a delay if required to ensure the next frame is processed as close to 16.666 ms since the last one, but its does not help me sync the output to the rotational offset of the cyl being rotated.
It is essential to sync the video projection with the rotating platform as I am building a holographic projector and miss-allignment causes vertical shift anomolies.
I notice that device has a 50hz operating frequencey. Ig my disk is spinning at 30 hz, and there s hole drilled in it to let light through, then the light would only shine for a small fraction of 1/30th of a second, would that not be too fast for it to register?