# Phase Shifted PWM from Arduino & TLC5940

Phase shifting is the process of shifting signals in TIME such that signals that would have been in sync originally, occur at a time / phase after the other. For example, they may be 180 degrees out of phase, which equates 50% delay in terms of PWM duty cycle, 90 degrees out of phase, which equates a 25% delay in terms of PWM duty cycle. The reason for expressing such delays in terms of PWM duty cycles is to make the following mathematics easier, as well as explain PWM signals’ phase/time shift in terms of percentage of the signal.

Optics: A PWM signal means that heads shine for a small time period over a certain period of time. This can be anything up to 30% in certain cases. This means that for 70% of the time, the media sees no light. If the media, or the head, is moving, this means that certain areas of the media may only see dark spots. In case different LEDs are phase shifted over the head, different LEDs will be shining at different periods of time, which means that the head can cover a better overall area and the media has a better chance of avoiding dark spots.

Current Loading: Phase shifted PWM signals mean a distributed load on the Power Supply. If the signals are distributed in terms of when they come off and on, it means the power consumption is distributed over that period of time as well, which means there is less pressure in terms of PEAK outputs from the power supply. This can essentially mean that cheaper and smaller power supplies can be used to power the LEDs.

· There are limitations to the amount of delay that can be achieved. This is directly related to the maximum PWM that shall be attained. If a PWM of more than 50% is required as an output, than the out-of-sync approach with using 2 clocks that are out of Phase on the Arduino Mega should be used. The maximum delay is given by:

Maximum delay < 100 – Maximum PWM output required

So for a maximum PWM of say 30%, a delay less than 70% can be achieved. So a number of delays between 0% and 69% can be applied on the PWM signals.

· Direct consequence of the above is that the maximum PWM is limited.

· Using up useful PWM output pins to produce the required delay signals. (More on that when covering the application).

· Extra hardware required. (More on that in the following)

Technique used:

· TLC5940 signals are all synced on the falling edge.

· TLC5940 to produce the ‘delay’ signal. So if we want to phase shift the signal by 90 degrees, we produce a 25% delay signal. In our example, we use a 10% delay.

· Invert this signal through a NOT gate. 7414 has been used to do this. Since the signals are all in SYNC, this signal cannot be produced directly from the TLC5940 chip.

· Produce a ‘Modified PWM’ signal using the TLC5940. This signal is the original signal plus the delay. So for example, if the original signal was 30%, the modified signal will be 30 + 10 = 40%.

· This explains why the delay can never be more than the maximum PWM.

· Input this signal with the inverted delay signal into an AND gate. A 7408 has been used to do this.

· The AND gate lets the first 30% of the modified PWM get through, and stops the last 10% of the modified PWM. This means that we have achieved a delayed PWM which has the exact same value as the original PWM, but is time shifted by 10%.

The following diagram shows the flow for this technique: The next page shows our executed example in terms of waveforms: 