# Display a rotating vector on four LEDs

Asked here because EE's are familiar with concepts of rotating vectors...
Have as input inside a microcontroller, two signed numbers which correspond to rectangular coordinates. These numbers are related as the two rectangular components: a real and imaginary similar to R + jI.

Intend to have as output a display on four similar LEDs which would be interpreted by eye to indicate a vector angle...similar to atan2(real,imaginary). Light intensity will be done via Pulse-width-modulation (PWM). For example an input of (140,0) would light up LED 00 fully, while the other three would be off. An input of (38,0) would display similar full brightness on LED 00, since the display is for angle, not amplitude.
Symmetry reduces the full circle into eight similar segments. It is obvious that at 0, 90, 180 and 270 degrees, only one-of-four LEDs should be fully lit with 100% PWM. And at 45, 135,225,315 degrees, two adjacent LEDs should be partially lit an equal amount.
But lit how much? relative to full 100% PWM.
Should it be 50%/50%? Should it be $\frac{100}{\sqrt{2}}$%/$\frac{100}{\sqrt{2}}$%?
Probing into intensity perception of human eye presents a morass of scenarios, each of which has a different non-linear transfer function between input and perceived brightness. It is unclear to me which scenario applies here.

Display update rates will be close to, or just past persistence-of-vision, in the 20-40 Hz area. Background would be darker than LEDs, and LEDs would be observed directly.
I hope to discern whether a vector rotates clockwise vs counterclockwise - it will be rotating quite slowly (period of one second or far more), but in a potentially noisy environment (phase noise). At some point, a PLL will be applied, and the vector should settle near LED00. This PLL will have a l-o-n-g time constant. I would be happy to be able to tell if it is locked in the presence of noise.

At angles of 0,90,180,270 degrees, PWM would be 100% for one-of-four LEDs.

At angles 45,135,225,315, PWM for two-of-four adjacent LEDs should be ???, considering the crazy erratic intensity perception of human eyes? Once nailed, I can probably work out a sane transition for intermediate angles (0-45 degrees).

• I hate to say it, but I can't tell what you want to do. I'm glad there are answers, because I guess that means it's just me and that others are apprehending the question better than me. While I have some background, and while I can read your sentences one at a time, I admit I'm struggling to understand the single goal that relates to all of it. I'm falling down over the "interpreted by eye to indicate a vector angle" part, I suppose. I can't translate that to a personal experience, right now. (But I totally understand the atan2() math.) Must be over my head. – jonk May 9 '17 at 23:34
• @jonk thanks (I'm struggling too). Added refinements to goals that might help. Perhaps attempting to explain goals is the more useful exercise. Perhaps there's a better way to display a rotating vs locked vector. Am mightily impressed with how ears can hear a tone below noise. Am hoping an eye might do something similar. – glen_geek May 10 '17 at 0:38

Well, you've got the core thing correct:

Perception is non-linear. For $n\cdot 90° + 45°,\,n\in\mathbb N$, yes, the brightness of the adjacent LEDs should be identical, but that's about it.

Yes, we generally model perceived brightness to be logarithmic to irradiation. That doesn't mean the base of that logarithm is known for any color, for any human.

It also isn't clear that at the very low end of your PWM duty cycle, this will really be a sufficient model; so, I'm afraid, you'll have to do some characterization yourself, if you want to do this "properly".

Luckily, I think that if you're aiming for direction visualization with four LEDs of which you at most use 2 at the same time, you won't lose much "perceived accuracy" if you just try out one or two exponents, and settle for one that you deem "good enough". No magic involved, just try it out.

• Decent suggestions. Will be using a lookup table and rotate it x8, so it'll be easy to try a few profiles. It is unclear from published papers how much perception varies human-to-human (few error bars on graphs). Am looking a one PWM'd LED right now, and find that intensity resolution near 0% PWM is far better than near 100% PWM. – glen_geek May 9 '17 at 22:41

Even though eye has a dynamic range of > 140 dB from <1LUX to the sun of >100k LUX this requires long latency for iris modulation a scotopic settling time for the eyes to adjust.

Now for TV it is more like 40-50 dB and it is linear over this range. So 50 IRE is half brightness and 1/2 voltage of 100 IRE full intensity (e.g. 1Vpp) and black is 0 IRE. ok?

Ambient Glare off the glass can be 1 IRE more or less depending on room light.

So you want your LEDs to be linear current sharing for intensity.

But considering then eye speed is less than your possible dynamic load changes and thus PWM changes, I would opt to define 16 sectors of constant intensity for SPACIAL acuity recognition over trying to interpret changing quadrant intensities.

16 level LED bar drivers using 2 chips is possible converting PWM with a high order >6 LPF to suppress PWM ripple with the minimum latency using TI free active filter software.

• In the old days we had in the EE lounge on campus, we had a demo from an audio retailer with QUAD sound and a TV colour organ. they rotated the yoke 45 deg and ripped out the guts of a TV to make a quadraphonic vector audio graphic light organ with RGB for Bass,mid,treble coming out from a dot in the centre. LOTs of fun doing correlation with Quad sound effects and pattern recognition, – Tony Stewart Sunnyskyguy EE75 May 9 '17 at 21:55
• Yes, 50% seems more correct. I don't expect much angle resolution out of this display, so your LEDbar idea is somewhat overkill. But now you've given me an alternate idea: play a stereo tone into headphones and listen for a rotating vector (front,left,rear,right). Fun messing with your brain, isn't it? – glen_geek May 9 '17 at 22:30