Portable Precision Stroboscope

by rgco in Workshop > Science

5825 Views, 31 Favorites, 0 Comments

Portable Precision Stroboscope

20181122_184212.jpg
20181122 190340

The flashing lights of a stroboscope can give amazing hallucinating effects. But precise repetitive flashes of light also allow to visualize motion that is too fast to be seen by eye or by a regular camera. The great video and instructable by GreatScott inspired me to make a portable battery-operated stroboscope with precise frequency control. It turns out that the Arduino is quite capable of doing so, and more so, implementing settable duration of the flashes was quite straightforward too.

Precise frequency settings means that a stroboscope can actually be used to make precision measurements of the rotation frequency of a motor, or precision measurements of speed using stroboscopic photography. A simple potentiometer dial is not sufficient to reach permille precision in the frequency setting. Instead, here the flashing frequency is related to the 16MHz clock of the Arduino, and the desired frequency can be given in 4 decimals.

Repetitive signals can be generated in many ways with an Arduino. Extremely accurate frequency control can be achieved with a phase increment in a fast loop, as for this waveform generator. However, the Arduino has three built-in timers, and the 16-bit TIMER1 together with its clock prescales turned out to be sufficient to cover the range of frequencies 0.3-999.9 Hz that I was interested in. The use of a timer leaves the CPU free for other tasks so that a compact 4-segment LED display can be used to display the frequency. Moreover, the 4-segment display can be soldered right on an Arduino Nano (as also done for this timer ) giving a very compact and easy-to-buid setup, leaving free pin D10 which is the B-output of TIMER1.

Getting bright flashes with a battery-powered device is a challenge, and the scheme shown here is definitely insufficient for lighting up a dance floor. However, by clever use of capacitors and somewhat overdriving the LEDs, fairly bright flashes can be generated, while being powered with only 2 AA batteries.

Last but not least I should emphasize the feature to set the flash duration: ultra-short flashes result in very ‘static’ images, but the average light-output is low. Longer flashes give more light but are less able to ‘freeze’ the image. Thus I put in the ability to change the flash duration between 64 and 960 microseconds, always staying below a duty cycle of 10%. This extra feature greatly enhances the number of applications that this stroboscope can be used for.

The video above illustrates the functionality. Note that it's been taken with 30fps, so when the the stroboscope is at that frequency, or at a multiple of that, it doesn't seem to be flashing at all, since each picture being taken receives a flash.

If you like this project please consider giving it your vote for the 'make it glow' contest!

The Code

Attached is an Arduino sketch. Beware, depending on your display version (common cathode or common anode) and how it is connected (UNO with breadboard or soldered to Nano), you do have to adapt some settings by commenting and/or uncommenting the relevant lines.

Note that the flashing of the stroboscope is done completely with timer1, so that all of the CPU is available run the 7-segment display and to check the buttons. Most of the obscure settings of the timer are hidden in the setfreq routine. The prescale is chosen to be the lowest one compatible with the chosen frequency, such that the best resolution is obtained.

Breadboard Version (single 5mm LED Version)

20181108_234122.jpg

I recommend to make a breadboard version first, to test the components and try out the software. Modifications to the software or to the LED driver to suit your purpose are best done here. The following components were used:

* An Arduino UNO R3 with a prototype shield for compact connections

* A 0.56” 4-digit 7-segment display with decimal dots. Either common anode or common cathode.

* A white 5mm LED plus a 100Ohm current-limiting resistor

* Two push-buttons

* Some hookup wire

The 7-segment display has 6 pins on the top and 6 on the bottom. The connections to the segments and digits seem arbitrary, but they are the same for all displays I’ve seen. Through software we can choose which to fire when, so there is no need to connect them in any particular way. Here the wiring is chosen to match the wiring when the display is soldered directly to an Arduino Nano: A0-A5 and D4-D9.

Connect the LED with the Anode (long lead) to D10 and to ground with a 100Ohm current-limiting resistor. The voltage drop over a white LED is ~3V, so the current will be (5V-3V)/100Ohm=20mA.

Connect the two push-buttons between ground and D11, D12. The software will activate the internal pull-up resistors on D11 and D12, so this minimal wiring will work fine.

Now upload the Arduino sketch (from the ‘Code’ step) through the regular Arduino IDE and if all is well the display shows the number 20.0 and the LED flashes faintly at a rate of 20.0Hz. If the display shows segments in a seemingly random order, it may be that you have a common-anode display. Try commenting and uncommenting the relevant lines in the code. If the display is still messed up you may have a different pin-layout then mine, and you should probably check the datasheet.

To raise the frequency, push one button, to lower push the other. A single push will change in steps of 0.1Hz, keeping it pushed longer will make the changes go progressively faster. The minimal frequency is 0.3Hz, the maximum 999.9Hz.

The pulse length can be changed by pushing both buttons simultaneously and keeping them pushed until the desired pulse length is displayed. It will go in steps of 64 microseconds until it reaches either 960 microseconds or the largest number that corresponds to a duty-cycle of 10%.

Increasing the Light Output

20181110_160903.jpg
20181111_103206.jpg
20181111_103346.jpg
20181111_103357.jpg

The setup from the previous section will flash a single LED, which is just fine for testing the software but not exactly stellar. However, the current (20mA) is close to the maximum that a single Arduino pin can handle (40mA). To get stronger light, we need a driver, power-LEDs and a power source.

Power-MOSFETs are the components of choice for switching high currents, it’s the first time I use them but they work straightforwardly and can handle large currents with little voltage drop. I use the IRLZ44N. The ‘L’ is essential: it means that it can fully switch with ‘logic’ levels : 5V. In my experience, the Arduino can directly drive the MOSFET without need for a MOSFET driver. However, it is better to tie the gate to ground with a 10kOhm resistor to make sure the MOSFET is off when not explicitly switched on.

The MOSFET can easily handle voltages up to 50V, which may be needed if you want to switch the super-high-power (>10W, even 100W) LED COB chips. However, for a battery-operated device, I decided to stick to using the same 5V of the Arduino also for the LEDs. Two AA batteries with a boost module set to 5V can deliver a continuous current of 200mA to the LEDs plus 50mA to the Arduino. 200mA continuous at a maximum duty cycle of 10% means that the LEDs can be chosen to consume an instantaneous current of 2A.

I've done that by using 10 LEDs of 0.5W, the surface-mount 5730 ones, each in series with a 10Ohm resistor. That should give an instantaneous current of 200mA per LED, which is slightly in overdrive, but since they are pulsed at maximum 10%, that is very conservative. See here how to solder these SMD LEDS.

Capacitors are needed to deliver the high instantaneous current for a flash. The time in between flashes is then used to recharge the capacitors. The charged Q stored on a capacitor is the product of the voltage V and the capacity C. However, as soon as the capacitor starts to discharge, its voltage drops, so only a small fraction of the total charge is available to produce the flash. A 1000muF capacitor at 5V would not be able to flash the LEDs strongly for 1ms since it loses 2V if it delivers 2A for 1ms. Thus I use two 1000muF capacitors in parallel. The scope trace shown above demonstrates that the voltage on the capacitors decrease by only 0.5V after being discharged for 1ms.

Final Portable Version

stroboscope_breadboard.jpeg
20181110_165741.jpg
20181111_215107.jpg
20181112_173203.jpg
20181112_175912.jpg
20181112_220017.jpg
20181112_231555.jpg
20181114_173856.jpg

To make the stroboscope into a permanent instrument, it needs to be put into a sturdy box. I managed to make it fit inside a standard 100x60x25mm enclosure. Power is provided by 2 AA recharcheable NiMH batteries that are stepped up to 5V. An on/off switch is introduced to prevent the batteries to drain. The nice pushbuttons that I had were too large to fit in the box so I used 12x12mm pushbuttons that are really meant for PCBs, but they are very compact and actually work very well.

First I drew with a pencil the approximate places to cut the 4 holes in the enclosure. With a rotary tool, I cut them out crudely and with a hand file cut the holes to precision. The lamp is connected externally, so it’s sufficient to make 2 small protruding holes on the ‘lid’ of the enclosure.

The Nano is soldered to the 7-segment display as shown in the picture. The 10kOhm resistor nicely fits on the back of the MOSFET to connect the gate to the source.

The step-up module I used has a fixed 5V output, they are slightly smaller than the regulated modules, and there is no danger to accidentally fry the Arduino. The wires that carry signal (such as those to and from the push-buttons) can be thin, but the wires to the LED should have low resistance.

Note how in the schematic the 12 connections from the Arduino to the 7-segment display have been left out to avoid a cluttering of lines. I hope the connections are clear from the pictures and from the description!

The Stroboscopic Effect

20181122 191439

Finally, a video to show how the stroboscopic effect can be used to measure the frequency of a fast-rotating object, in this case a cappuccino-maker.
First, the frequency is set to 157 Hz, and it is seen that the wheel appears perfectly still. This means that the rotation frequency is 157 Hz, or an integer multiple of that. To check that the actual frequency is not 314 or 471Hz, we also try out doubling and tripling the original frequency. At 314Hz, we clearly see that the wheel has rotated half a turn at every flash and at 471 Hz one third of a turn, so it’s confirmed that the rotation frequency is 157rotations per second, or 9420RPM.