Measure PWM using Free Software and a 192KHz Sound Card

Expanding on these posts:
Terry Oregons - Testing various sensors for changing Photons to Volts.

A must read for those interested in getting the best performance for waveform analysis.

My post about building a sensor from Terry’s design.

My post about using Audio software to measure PWM/

My post about trying O-Scope software to see PWM

All my previous testing was done using a 48KHz sound card.
In ToyKeepers post about seeing PWM in falling water or in a photo,

DavidEF mentioned that there are 192KHz sound cards available.
He also kindly sent me some LEDs to test as sensors as he did for Terry in the above post. My Thanks.

I commented on these higher sample rate cards in my previous testing using O-Scope software. I didn’t know if these would work with the software and what the results would be.

Well it kept bugging me so I just had to try one to see if it would work and what additional information might be seen.

Lights tested
My ever faithful Nitecore TUBE

A Pair of Rayovac Workforce

The New BLF SP36

Set the card to 192KHz

First I needed to set the sound card to 192000Hz in the Windows sound settings.
Next the same had to be done in the O-Scope software.
I used Visual Analyzer for these tests since it gives better screen shots. Find it here:

I did a series of captures using increasing sampling rates.
This illustrates the need for adequate sampling to show what’s going on in a waveform.
This is the Nitecore Tube in a higher ramp brightness with a PWM frequency of about 3050Hz (3.05KHz)

11KHz And again at 22KHz


At 22K Not much to see here, some sort of waveform.
AT 44K starting to resemble – something?

48KHz and again at 96K

48K the normal sound card sample rate. Starting to see a Square Wave.
And we see a duty cycle.
96KHz – Yep that’s a square wave all right

192KHz And my old BK CRT O-Scope.


Looking pretty good. And we see the duty cycle pretty darned well.

A cheap Rayovac 2 AA cell light. on Low

I measure about 12.5KHz PWM and the wave is sort of a triangle.

Here is that same light in the Real O-Scope.

Notice the top of the wave. That is masked in the software scope.

Rayovac AA on High

What’s this? A PWM of 62.4KHz?!
I thought the light was running full on until I pointed it at the sensor.
This would be missed by a 48K or even 96K sample rate on the Freq. Spectrum Analyzer - Or just appear to be noise in the O-Scope view.
Pretty formidable performance for a light that costs less than $15.
Makes me wonder what else might be out there that I just assumed was running all-ahead full.

Rayovac, 3 AAA headlamp. on High

It’s running 235Hz with the duty cycle running about 50%
I can just see the PWM but it’s not bothersome (well maybe a little).

Rayovac Headlamp on LOW

A whole new ballgame. You can’t even see the whole cycle using the same time frame.
The PWM drips to 188Hz.

Changing the time frame I see that it’s running about a 20% duty cycle.

The PWM is downright nasty to see.
Wonder why they could do such a good job with the AA light and yet this one is so awful. Does anyone ever look at these things before they are put into production?

The BLF SP36 with the Samsung LEDs.
(ToyKeeper – standing ovation for the UI – and the rest of the BLF team)

SP36 Moonlight. About 4.8KHz. Invisible to my eyes.

The frequency counter could not pick it up.

SP36 Ramping. 16KHz. Nobody is going to see this.

SP36 High Turbo. Move along, nothing to see here.

No PWM seen at this sample rate.

Conclusion?
I thought most PWM was limited to the audio spectrum. Using the 192K sound card show’s this not to be the case – at least in a limited number of lights.
A sound card with a 192KHz sample can show results that are invisible with a slower sample rate.
Taking a look at these lights, especially the ones with a crappy PWM, perhaps some minimum standards could be established to keep the blinkies at bay.

More light test to follow.

This is impressive, too bad I work on a Mac where the sound card, microphone and speaker are defective.

very interesting post, thank you.

acab,
You could go with an external sound card. In fact I recommend this to protect (your already dead) sound card.
I’m not sure what O-Scope software is available for the Mac…
The audio software Room Eq Wizard has a Mac version. If you like audio, it is wonderful fun to play with.
You can see examples of it in the thread:

All the best,
Jeff

Thanks, that is a great idea. Didn’t know all of this is possible without expensive equipment, sound cards are affordable and available everywhere.
If relevant, I also have Raspberry Pis and Orange Pis.

acab,
I think a number of options are around for the Pi. The key is the front end. You might start your quest here.

Wow, it’s amazing the difference you see after you pass the 48kHz limit of most onboard sound cards! That first waveform you showed testing at 192kHz next to the real scope looked just the same to my eyes. I’m impressed. I’m looking forward to seeing more of your test results, when you get them up here.

David,
Actually this is an on-board sound card. On a gen 3 i3 Intel motherboard from years ago. I didn’t know it supported 192K until I was fussing around with the settings.
And not following my own advice, I had an Oh-NO! Second - and fried one of the input channels using the PV cell as an input - instead of the photo diode.
Harrumph!
Age does not (apparently) impart wisdom (at least for me).
All the best,
Jeff

There’s already something we call the “snob index”:

Basically, for a standard, we could say that lights must have a snob index of less than 5%, or something like that?

ToyKeeper,
I’m glad you mentioned that thread. maukka uses a fancy diode front end and outputs to a software package for analyses to create the snob index. Great name BTY.

The VA software I used has various filters and counters etc. I wonder if some of them might be used to generate some sort of usable info.

The software has a run-time only version so it can be tried without installing it.
One of the problems with using the sound card is knowing if the bottom of the wave is at zero volts. For example the 62KHz PWM is sitting on a slower sinusoidal wave that has a positive DC offset.

I’ll post a note over in maukka’s thread asking him to look at the VA software. He’s clearly way ahead of my computational levels.
All the best,
Jeff

More Lights to the PWM test bed.

First up the Convoy L6.

I picked up this light because it looked like it would be a good truck light on the times I was out on a ranch and needed to put some light on things. Or perhaps the unlikely event I ever needed something in a search and rescue type of scenario.

L6 On Low

A 14.7K PWM with the expected low duty cycle.

L6 on Medium 2

The same 4.7K PWM with about a 50% duty cycle.

L6 Turbo Brightest High

What’s going on here? The frequency counter can’t get a reading but the spectrum shows 59KHz peak.
This (I think) is a ripple sitting on top of the DC the driver is pushing at the LED. I don’t believe the light is doing a full on-off cycle at 59KHz.

Compare this to the Sofirn SP70 tested below. I think the only way to figure out what’s really going on is to get at the innards of one of these and take a look at what the driver is really doing when this thing is on turbo.

Perhaps some of the more technical reviewers have done this already and could point me to a thread looking at this.

PWM on The Sofirn SP70

Here you get a view of my highly organized test bed in what clearly is a Class 5 Clean Room (not). I find it very hard to get a signal when I don’t manage to connect the leads before turning on the light.

Since it is so similar to the Convoy L6, I though this should be next in line.
This light has the fastest PWM I’ve seen so far. Other lights with higher apparent PWM (I think) are actually putting a ripple on top of a DC that is being pushed to the LED.
Terry mentions a biscotti controlled light at 35K. I wonder if that is a full on off cycle or something like I’ve been seeing in a few lights I’ve tested. Like the Convoy L6 on Turbo or an AA Rayovac?

SP70 Moonlight
I got nothing. Just a flat line. I didn’t bother with a capture.
As far as I can tell it’s just a constant voltage.
BUT looking at a real scope shows noise with a ripple form.

SP70 Medium 1

A lower duty cycle as expected. With a PWM of 19.95KHz

SP70 High

Looks like the duty cycle about 67%

SP 70 Turbo

Here we see the same 19.95Hz PWM. The duty cycle is around 95%.
I crudely drew in what the wave would look like if we had more samples to work with.

So it seems that Sofirn is using the same PWM to control the full Turbo mode.
Quite different than the L6 running in turbo which is doing something quite different (see above post).

So, Sofirn is cheating SP70 users out of that last 5% on Turbo? (should be 100% on with no PWM) I wonder what their reason is.

David,
Perhaps it’s their way to control the max voltage being pushed to the light. There has got to be an oscillator in there someplace (I think) for the voltage boost to 12V. Perhaps this is the frequency used by that. I’m fairly clueless as to what’s going on inside a driver.

I wonder if the 59K in the L6 is the frequency Convoy is using for the same thing.
Both lights are 70.2 LEDs both run (2)x 26650. The Sofirn is noticeably and measurably brighter on turbo. I’m going t do a comparison of the two sometime soon.

I need to order some drivers and get a direct reading off the electronics.
Perhaps one of the more knowledgeable members will chime in.
All the Best,
Jeff

Ah, didn’t think about buck and/or boost drivers. Don’t those drivers have some amount of ripple due to normal function?

I would think so. Interesting that the SP70 is doing it different than the L6.
The L6 acts like the Rayovac AA light that had 62.4K ripple (?) happening at full brightness.