Sync a motor to HDMI signal.


First of all thanks to anyone reading this and excuse me if this is solved before on this board somewhere.

I am looking for a solution to sync up an old projector with a videocamera. I want to do this at half speed so I get two duplicate videoframes of each filmframe. The reason for this is that I will install a 180 degrees ND filter in the lightpath where the shutter usually sits so that every other frame is darker/lighter. Reversal filmstock has an extreme amount of contrast(dynamic range) and it is very difficult to get the correct exposure from scene to scene.This way I can choose to either make a HDR version of the film or just choose the one that is exposed best.

My idea is to sync using the HDMI vertical sync pulse and with PID or similar algorithm control the motor driving the pulldown claw mechanism with PWM so a perfect sync between the halleffect sensor pulse and the videocamera sync pulse is achived.

I really have no idea how to isolate the hdmi sync signal or how PID works. Its important that a stable sync is achieved fast, within a few frames. Any and all help is very appreciated

See attached gif animation:

Here is my best guess, since I never to film to video convert but from time to time edit home video;-

rent 24 fps camera shoot directly, and do all the video frame, contrast edit at post video edit. You might want post question about this at post video edit software forum.

P.S. You made very nice gif animation, may be share the software name you use?

Thanks for your suggestion, the problem with a videocamera is that it typically can capture only a few stops of dynamic range. There is no way to get blown whites or crushed blacks back, hence the idea of using a ND filter in the lightpath. Also it still needs to be in sync with the projector. I already have a frame by frame super8 telecine that works great but it is a bit slow and needs to be teethered to a computer. This will be a lot faster, even realtime if i shoot at 50P and “simpler”.

Also its fun to overengineer :smiley:

The software used for the gif is Adobe After Effects, a bit overkill perhaps but its a tool in my dayjob.


Simplest approach is probably to use an HDMI-to-VGA adapter such as, then there is a pin on the VGA connector Redirect Notice that carries the vertical sync signal.

Then use a digital phase-locked loop to sync the motor to the vertical sync pulses.

Is it possible use LCD panel from LCD projector to replace ND filter ? I know Epson sell those to third party OEM, but Sony is never bother.
destruct one since you like overengineer. :stuck_out_tongue:

to control it will be very simple, VGA white and grey.

To dc42.

Thank you for you answer! I have looked into the phase locked loops you suggested but I havent really understood it yet. I found a motor shield that has some PLL function. 2x2A DC Motor Shield For Arduino - DFRobot is this what you mean? How would you solve it? Could you point me in the right direction to figure out how to use PLL in my application?

Best regards


Ok, I guess I am fail at first try.

DIY- homemade projector

The person manage to use lcd from ebay for $28.00

homemade projector,

We still need Dave's approach to have vertical sync signal, but all the mechanical parts, stepper motor, sensor are gone.

Wow that projector is really interesting! But I already have the backlight finished. It is three red green and blue 1w led with a wavelength close to the sensor sensitivity, shining into a pingpong ball with a small square opening behind the film. Its basicly a very small intergration sphere, and that gives me a perfectly flat backlight.

Best regards


Wow that projector is really interesting! But I already have the backlight finished. It is three red green and blue 1w led with a wavelength close to the sensor sensitivity

Using RGB LED with a wavelength close to the sensor sensitivity is extraordinary idea! It is very cool.

Here is Plan C extend from your idea;-

Use double PWM control LED light to replace ND filter and LCD.

High frequency pwm (500 KHz) is used to control the current and keep it constant (300 mA).
Low frequency dimming (400 Hz, implemented with override feature, and high enough to eliminate blink) controls the light intensity, We use 12.5 Hz which will be blink. That is what we want.

The RGB LED’s response time should be faster enough, said 2~4 ms.

The LDD-300H cost <6.00 USD, should be easily find locally.

Diagram of LDD-300H

Internal IC use at LDD-300H

Now no more mechanical parts, no LCD panel, even no Arduino. All you need the Fv/2 ( Fv is from Dave method) square wave to drive LDD-300H.

I don’t know what is spec of your ND filter, I guess it is like this;-

ND1 100% % transmittance
ND(1/0) 0% % transmittance

If you need other than ND(1/0), let me know and circuit is needed to modify.

That is awesome! Thanks for your help! It would indeed be nice to have a tunable ndfilter. The missing piece of the puzzle for me now is how to sync the movement of the film with the video camera. How will i sync the motor so the pulse coming from the hall effect sensor line up with the vsync from the video camera? Any ideas on libraries and/or code for the arduino, or a circuit that will take care of that?

Best regards


Then use a digital phase-locked loop to sync the motor to the vertical sync pulses.

Dave already have the answer, wait he is back online to show us light. I would like to learn too.

OK, here is the problem. You have a vertical sync signal from your video signal. You have a Hall sensor detecting the rotation of the motor. You want to set the motor speed so that the frequency of the Hall sensor pulses matches the frequency of the vertical sync pulses. You also want the position of the Hall sensor pulses to bear a defined relationship to the position of the vertical sync pulses. So you want to match both the speed and phase of the motor to the speed and phase of the vertical sync pulses. This is exactly what a phase-locked loop does.

Phase locked loops have been important in analog electronics for many years. With a microcontroller, you can build a digital one

To make it easier, position the Hall sensor so that you want one of the edges of the pulse from it (say, the leading edge) to occur approximately midway between leading edges of adjacent vertical sync pulses.

Here's one approach to constructing the DPLL. Feed the vertical sync pulses and Hall sensor pulsed to digital inputs. Have the code watch for the leading edges of the pulses on both pins. Measure the time T1 between the vertical sync pulse leading edge and the Hall sensor leading edge, the time interval T2 between adjacent vertical sync pulse leading edges, and the time T3 between Hall sensor leading edges. Your target is to make T3 = T2 and T1 = 0.5 * T2 (you can adjust the 0.5 a little to get the exact phase relationship you want).

A standard PLL doesn't use T3, but by using it you should be able to get faster lock-in. As long as T3 is more than a few percent different from T2, use the difference between T2 and T3 to adjust the PWM so as to reduce the difference. When T3 is close to T2, shift the target to making T1 = 0.5 * T2. So calculate (T1 = 0.5 * T2), low-pass filter it by taking a moving average, and use that average to adjust the PWM.

For fastest lock-in while maintaining stability, you can use PID controller software to adjust the PWM based on the target. I think a single PID controller with the target of making (T2 + T3 - 1.5 * T1) zero may work well.

If you are trying to do other things on the Arduino at the same time, then I suggest you feed the 2 inputs to the interrupt pins, then you can capture the times and calculate T1, T2 and T3 in the interrupt service routines.

Thanks so much!
I am going to try this out, it will probably take me some time :cold_sweat:.
I will start with the standard PID library I think. I do need the interupt pins but I will try it out first using the common way.

Best regards


Did anything ever come out of this project? I am trying to do exactly the same thing, with very limited electronics knowledge so please excuse any stupid questions from me.

I already got one of these cheap hdmi to vga converters and i think i will start by measuring the VSYNC from the VGA plug and - as an excercise - flash an LED in the VSYNC speed. Supposedly VSYNC is a squarewave between 0v and 5v so that should be an achievable task for an electronics newbie.