Why don't we turn something useful like a stroboscope into something useless, but educational and fun to watch! Check out the videos.

In the 80-ies and still nowadays, stroboscopes were commonly used to check and set the ignition timing of car engines by adjusting the contact-breaker position. They were also called timing lights. To check the ignition timing, the stroboscope was connected to the spark plug of the cylinder that is the reference for the ignition timing.

This connection is made using an inductive pickup element that is clamped on the spark plug cable and this way picks up the high voltage pulse that is used to generate the ignition spark. Every time the spark plug is fired, the stroboscope flashes a xenon or neon flash tube for a very brief period. This stroboscope flash is pointed to the timing mark on the crankshaft pulley of the engine.

There is also a fixed pointer that is located on a bracket mounted over the pulley. When the ignition pulse comes at the exact right moment, the stroboscope will flash each time right at the moment that the rotating timing mark on the pulley is located right next to the fixed pointer. The rotating timing mark appears to be standing still right next to the fixed pointer. That means that the ignition timing is OK. When the timing mark appears to be standing still before or behind the fixed pointer, the ignition has to be adjusted by adjusting the distributor.

In that kind of stroboscope applications, an input signal is used to synchronize the stroboscope with the rotation that we want to measure. But you can also use a stroboscope without using a trigger signal. In that case we adjust the frequency of the flashes until the mark on the rotating object appears to be (almost) standing still and only one mark is visible. When multiple marks are visible and (almost) standing still, this means that the flash frequency is either a multiple of the rotational speed or the rotational speed is a multiple of the flashing frequency.

When the rotation is clockwise and the mark appears to be slowly moving clockwise, that means that the flash frequency is slightly too low. The flash comes too late, meaning the mark moves into the rotation direction. When the rotation is counter-clockwise and the mark appears to be slowly moving counter-clockwise, that means the flash frequency is slightly too high. In that case, the flash comes too soon, so the mark moves against the rotation direction.

This way rotational speed can be measured by adjusting the flash frequency of the stroboscope until the mark on the rotating object appears to be standing still and only one mark is clearly visible. The width of the flash should be short enough in relation to the frequency, so we get a clear reflection. When the width of the flash would be too long, the reflection will be smeared out and instead of a clear reflection, we get a kind of blurred reflection.

But let's turn a stroboscope into something more fun to play with.

What if we generate multiple flashes with the same frequency, but with different colors and with a phase shift between the different flashes ? What if we use a nice shiny reflective white object that is rotating using a DC motor at a constant speed and we change the frequency, phase shift or width of the different color flashes ?

Well, all of this can be easily done using a microcontroller, so let's try it out. When can use an RGB LED to generate color flashes. We can use multiple RGB LEDs in parallel to increase the flash power and get a good visible reflection.

To control the frequency, phase and width of the flashes we use an Arduino Pro Mini because it has enough I/O to play with it is more than fast enough for our purpose. We could choose to use the three dedicated PWM modules of the Arduino Pro Mini to do the job, but these PWM modules run on three different timers, which makes it more difficult to synchronize them or to program phase shifts between them. Furthermore we need rather low frequency PWM signals and there is no need for resolutions up to 16 bit.

A more adequate method to generate PWM signals is the so-called software PWM or softPWM. With softPWM, we generate the PWM signals using common digital outputs that we set and reset using a counter value, that is updated using a timer overflow interrupt. The timer overflow is set to a time interval that is small enough to accommodate the smallest time interval that we need to fine-adjust the width or phase shift of the PWM signal.

In our case, the motor is running at about 2,000 RPM which is a rotational frequency of 2000/60 = 33.3 Hz. This means that we need a flash frequency of about 33.3 Hz. But then our eyes would see the flickering of the flashing LEDs. Therefore we choose the double frequency of about 67 Hz, so we don't see the LEDs flickering. This means the PWM signal has a period of 1/67 Hz = 14.9 ms. To get a clear reflection without too much blurring, we need a duty cycle around 5%, which means a pulse width of 14.9*5/100 = about 0.8 ms. When our PWM timer is set to an interval of 0.1 ms, this is fast enough to set any pulse width (duty cycle) or phase shift that we need.

Below you can find a youtube video in which you can see the three PWM signals of the red, green and blue LEDs on the oscilloscope together with the rotating object, so you can see how the different effects are implemented by changing the frequency, duty cycle and phase of the three PWM signals.