I am thinking about trying to control the speed of playback of a movie. I am trying to make a video sequence for indoor training on my bike. So the fater I pedal the faster the video moves. I can get the gps data for the track and control the resistanc on my trainer, but the video is part is new to me.
Unfortunately I dont have Max/Jitter so I will have to do this in c#, probably will use Win media player api, but if anyone knows a better way..
My question mainly is about whether I should use pwm or just a simple pulse, which one will give me the smoothest play back.
Anyone done somehting similar?
If i get this right, you want the Arduino to sense speed, and send info to a PC controling the speed of the video playback ?
If this is the case i think a simple pulse would be all you need.
Most of those bicycle tachometers out there work by placing a small magnet on one of the spokes in the front wheel, and a reed switch on the front fork. Every time the magnet passes the reed switch, the switch closes and a pulse is generated. You could do the exact same thing. You could have the Arduino or the PC calculate the speed based on the time interval between the pulses and the size of the wheel (perimeter i think it is called :-) )
For every pulse you know you have moved a specifik distance - the perimeter of the wheel, and then you can calculate the framerate of the video accordingly.
Magnets and reed switches are cheap and easy to find.
Thanks for the reply.
I have figured out moving the video frame by frame using Media player API. Pretty simple, but not very smooth.
I have got a cheap cycle computer so I will be able to get the speed as a pulse using the hall effect sensor which willl give me a pulse like you said. I will see if I can feed that directly into the Arduino digital pin.
I also need to figure out how to adjust the resistance on the bike trainer, it is pretty stiff so I will have to look at some kind of actuator. I as hoping to use a servo, but i only have the cheapy hobbby ones and I dont think it will be strong enough.
Hopefully soon I will be able to get something happening here. I still need to get the video of the course I want to ride, with some gps data for gradient.
Sorry for my lateness in repsonding :-[
It's quite an ambitious project you have taken on.
Is the resiatance of the bike the kind that is controlled by a belt "dragging against the wheel" or is it the kind that uses a magnetic field ?
Will you relate the resistance to going uphill / downhill ?
Ambitious, yes ;), but it is do-able. Most of it will be done in C# and let the arduino board do what is does best and interface into the real world. So all it will need to do is tell pulse the speed to my App, and listen for the resitance.
It may not come out as slick as I hoped, but besides being a cool arduino project, will save me some money (famous last words).
The trainer is the magnetic variety, but the dial to control it is pretty stiff, hence the actuator or something similar.
I am planning on adjusting to the resistance acording to gradients. I have a friend who has a fancy cycle computer wich gives the distance and gradients, which will make life easier. But I still have to figure the realtionship between the gradient and the resistance on the trainer. The trainer only has 6 settings, so the options are pretty limited in terms of making it realistic.
The downhills are going to be interesting. I will have to figure out the how fast a rider is going donwhill without pedalling, So I think I will have to read up on Newtons laws, taking into account the riders weight or somehting....
But I think the hardest part will be getting the correct frame rates for the video play back. On average, most fit cyclists will ride a hill at around 10 -20 KMH, and the downhils at around 40-70 KHM, flats will be around 20- 40.
I will need to drive the route at these speeds to get video at a "normal" frame rate, then see how it plays for the slower cyclists, like me :).
Thanks for the help
I was thinking :
What does the control for the resistence actually control ? something mechanic or something electric ?
If it is electric, then maybe the actual dial could be bypassed ?
It controls a mechaincal system. I think is just adjusts the distance between the magnets, so no go on the electrical side :(