Pages

Saturday, September 21, 2019

Harry Nyquist the Scientist (Harry! Harry! Harry!)

Ok, doesn't quite scan, so I guess he's not destined for TV stardom, but one of his ideas is at the core of this week's post. Last week, I was talking to my parents over Facetime and Steve, ever the stickler for visual quality, complained that my lights appeared to be flickering:


Looking at it from my end though, the light appeared fine. I realized that the LED bulb must be flickering (by design) at a rate higher than my eyes can perceive, but my laptop camera is recording below the Nyquist rate, causing the flickers to appear.

Before getting into that, let's talk about how LED bulbs work. LEDs require direct current (DC), while house power is alternating current (AC), so the first thing we need to do is convert between these two. Alternating current is a sinusoid, oscillating between positive and negative of a certain value:
There's an electrical component called a diode that only allows current to flow in one direction. In fact, that's the D in LED, but right now we're just talking about the regular kind of diode, not the Light Emitting ones. By arranging a few of those in a clever way, we can switch the negative part of that curve to positive:
Made with circuit-diagram.org
On the left is the AC source, and on the right is a voltmeter. The diodes in the middle only allow current to flow in the direction of the arrow. The voltmeter's output looks something like this:
This isn't ideal though, since the voltage is going all the way down to zero. We need a way to smooth out this curve. We can do that by adding a capacitor, which stores and releases charge as the voltage changes:
Now the voltage looks something like this:
Still not perfect, but it's the best we can do with something simple. Those little bumps mean the LEDs will be flickering a tiny bit, but it's at twice the rate of the original AC input. In France, this is 2x50 times per second (Hz).

The camera on my laptop captures video at about 30 frames per second. According to Nyquist, to accurately record a signal, we need to take data at twice the rate that the data changes, but that would be 200 Hz, far above what my camera is capable of. We can see why this is necessary by considering a point moving in a counter-clockwise circle:
The dot completes a cycle every 8 steps. The image on the left is sampled every step, while the one on the right is sampled every 7 steps. The slower sample rate causes the dot to appear to be moving backwards. You've probably seen a similar effect in videos which include old TVs or computers that used CRT screens. The screen appears to blink because the camera captures the screen at different points in its refresh.

That leaves us with the question of why the light doesn't blink according to our eyes. That's addressed by the flicker fusion threshold, which comes from the spectacularly-named field of psychophysics. Our eyes aren't able to perceive changes in intensity above a certain rate, instead averaging things out. For most people, it's around 80 Hz, so the LEDs easily surpass that, but the captured video is nowhere close.

Thanks for a great question/complaint Steve!

No comments:

Post a Comment