Simple LED display for DAC freq?

If you're using a USB DAC input you could use a JLSounds USB board in front of the DAC - it has signals exposed on its headers that make it really simple to indicate PCM/DSD and 44.1/48KHz family data rates. I used the function on a recent ValveDAC build to show DSD rates using bi-colour LEDs to indicate 44.1 or 48KHz base rates.
 
Last edited:
If you're using a USB DAC input you could use a JLSounds USB board in front of the DAC - it has signals exposed on its headers that make it really simple to indicate PCM/DSD and 44.1/48KHz family data rates. I used the function on a recent ValveDAC build to show DSD rates using bi-colour LEDs to indicate 44.1 or 48KHz base rates.
Sorry that was a bit muddled, I meant if you have an i2s input on the DAC...
 
The following is a simple F to V conversion using one (or two for double-edge triggered) monostable 74HC123s. Freq is swept from 0 to 192kHz. The multibit comparator is not shown.


1676181352226.png
 
There could be 2 more ways.
1. using an Arduino nano as an programmable IC. I use it in my Whazon spdif mux project. Sample rate identification is part of the MCU functionality in Whazon. It can ID 32, 44.1, 48, 88.2, 96, 176.4, 192 Ksps, with a +/-3% error window and robust performance. The code for that part of functionality is attached below. In Whazon code the identified sample rate is written to a variable, but you can instead easily toggle a bunch of output pins to drive LEDs directly. Other MCUs can also be use as long as an event capture pin is available. The sample rate ID is base on Arduino's 62.5ns clock cycle (16MHz clock). If using MCUs of different clock frequency, need to work out a new set of numbers.

2. using a PLL IC such as 74HC4046. Design the timing and the loop filter circuit (described in the datasheet) so that it would lock on to all sample rates. Buffer and feed the VCO control voltage to a multi level voltage comparator, or even a panel meter 🙂
 

Attachments

Just use a Arduino nano or uno with the frequency measurement library..... easy and cheap....


#include <FreqCount.h> // Frequency measurement library


This would be the reading FS function:

void Read_FS_Frequency() {
if (FreqCount.available()) {
FS_Hz = FreqCount.read(); // Sorting out FS
if ((FS_Hz > 4200) && (FS_Hz < 4600)) FS = 44;
if ((FS_Hz > 4600) && (FS_Hz < 5000)) FS = 48;
if ((FS_Hz > 8500) && (FS_Hz < 9100)) FS = 88;
if ((FS_Hz > 9300) && (FS_Hz < 9900)) FS = 96;
if ((FS_Hz > 17200) && (FS_Hz < 18000)) FS = 176;
if ((FS_Hz > 18800) && (FS_Hz < 19600)) FS = 192;
if (FS_Hz < 1000) FS = 0; // Just in case.... like DAC powered OFF
if (FS_Hz > 22000) FS = 999; // To avoid unknown situations
}
}



than based on FS you could something like this:

//==========================================================================================================
void Drive_Status_LED() {
switch (FS) {
case 0:
digitalWrite(LED_44, LOW);
digitalWrite(LED_48, LOW);
digitalWrite(LED_x2, LOW);
digitalWrite(LED_x4, LOW);
break;
case 44:
digitalWrite(LED_44, HIGH);
digitalWrite(LED_48, LOW);
digitalWrite(LED_x2, LOW);
digitalWrite(LED_x4, LOW);
break;
case 48:
digitalWrite(LED_44, LOW);
digitalWrite(LED_48, HIGH);
digitalWrite(LED_x2, LOW);
digitalWrite(LED_x4, LOW);
break;
case 88:
digitalWrite(LED_44, HIGH);
digitalWrite(LED_48, LOW);
digitalWrite(LED_x2, HIGH);
digitalWrite(LED_x4, LOW);
break;
case 96:
digitalWrite(LED_44, LOW);
digitalWrite(LED_48, HIGH);
digitalWrite(LED_x2, HIGH);
digitalWrite(LED_x4, LOW);
break;
case 176:
digitalWrite(LED_44, HIGH);
digitalWrite(LED_48, LOW);
digitalWrite(LED_x2, HIGH);
digitalWrite(LED_x4, HIGH);
break;
case 192:

digitalWrite(LED_44, LOW);
digitalWrite(LED_48, HIGH);
digitalWrite(LED_x2, HIGH);
digitalWrite(LED_x4, HIGH);
break;
case 999: // ALL LEDs active to show > 192kHz FS signal or switches are in unvalid position
digitalWrite(LED_44, HIGH);
digitalWrite(LED_48, HIGH);
digitalWrite(LED_x2, HIGH);
digitalWrite(LED_x4, HIGH);
break;
}
}
 
It is possible to go completely passive: It is a solution I have used in a telecom context, with HDB3 signals and similar, but it could certainly work with other frequencies.
1676724366410.png


It is simply a bandpass filter centred on the frequency of interest, and a parallel red LED.
The LED takes some current at the voltage peaks and limits the voltage across the resonant circuit.
With the values shown in example, the frequency is 100kHz, and the resulting average current is almost 0.5mA, which is ample for a modern high-brightness LED.
You need as many circuits as the number of frequencies to be detected, and each one needs to be adjusted individually using a function generator. You use a main cap (C1), and you fine-tune with a smaller cap (C2).
If you have many such parallel circuits, the loading caused by the 1K resistors might be excessive for a single output, and you may need to add buffers, or increase the resistor's value.
It is probably possible to increase the value and keep an acceptable brightness.
Note that higher frequency detectors might weakly react to F/3 signals, because of the harmonic contents.
In this sim, the coil has realistic parameters, compatible with a resistor-like choke.
 

Attachments

  • Like
Reactions: newvirus2008
It's possible to improve the accuracy of Elvee's method above, by using a piezoelectric crystal (series resonance) in place of the parallel resonant circuit. Crystals are readily available for multiples of all standard sampling frequencies with Q-factors typically upwards of 20000. Ceramic filters may also be used, but are less accurate when compared to crystals.

1676795092128.png
 
I didn't know there were 44.1 kHz, 48 kHz and so on crystals readily available. The only very common value I know below 100 kHz is 32768 Hz - and those crystals usually have an ESR of 35 kohm typ., 50 kohm max. and a maximum drive level of 1 uW.
 
Last edited:
The ceramic resonator could work, but it requires an anti-parallel diode on the LED, otherwise it will go off after the few first cycles. The sharpness of a crystal might be problematic in this case, because the type of resonance/loading might not match this application, and the initial accuracy on the clock generator and the crystal could result in a frequency mismatch, very small but sufficient to keep the LED dark
 
I didn't know there were 44.1 kHz, 48 kHz and so on crystals readily available. The only very common value I know below 100 kHz is 32768 Hz - and those crystals usually have an ESR of 35 kohm typ., 50 kohm max. and a maximum drive level of 1 uW.
They exist and are called "tuning forks". Piezoelectric crystals at their multiples could directly detect the BCLK at 64fs or even the MCLK, which is much higher.

The sharpness of a crystal might be problematic in this case, because the type of resonance/loading might not match this application, and the initial accuracy on the clock generator and the crystal could result in a frequency mismatch, very small but sufficient to keep the LED dark

MarcelvdG said:
According to the IEC standard that specifies the S/PDIF interface, the tolerance on the sample rate is either +/- 50 ppm (high accuracy) or +/- 1000 ppm (normal accuracy).
The Q-factor maybe reduced by adding resistor in series (100ohm to ~1kohm), but that would also reduce the amplitude of the tuned sinewave at the output, which in turn may require amplification to light up an LED.

I have successfully converted square waves made by crystal oscillators into sinusoidal waveforms using crystals. I've also used them as test signals for example, all the sinusoidal waveforms in the following thread. If anyone is interested, I shall post some waveforms obtained that way.

https://www.diyaudio.com/community/...-accurate-are-simulated-results.382820/page-2
 
Last edited:
I know it is possible to have tuning fork crystals specially made for 44.1 kHz rather than 32768 Hz, but they are hardly "readily available". For example, looking at the Mouser site, these are the crystal frequencies below 1 MHz:

32 kHz
32.7 kHz
32.768 kHz
38 kHz
40 kHz
60 kHz
65.536 kHz
75 kHz
100 kHz
153.6 kHz
306.768 kHz
307.2 kHz

I have seen 77.5 kHz once in some other webshop (no doubt meant for DCF77 receivers).

Besides, if the crystal has a similar ESR and drive level as a normal 32768 Hz watch crystal, it can only handle a few microamperes of current.

If there is a bit clock available at a fixed multiple of the sample rate, then filtering the bit clock with crystals sounds more feasible.
 
Yes, Marcel, bit clock, not sure if you saw it, but I had edited post #29 to say "multiples of the sample rate" etc.

Try running a square-wave into a decent MHz crystal and a 470 ohm resistor in series, and watch the output across the resistor. My contraption was misplaced, if I'm able to find it, I'll post some waveforms. For a 5V squarewave, the sinewave is usually about a volt or two in magnitude that is sufficient to light up an LED in most cases.
 
Regular crystals, made from a simple platelet of quartz withstand that kind of treatment, but lower frequency ones having a reasonable size are always a variety of the tuning-fork type, and their power handling capability is extremely limited: I still remember the crystalline snapping noise a 32K crystal made when I tested it at a few volts on a generator set at 32768Hz
 
the simplest solution is to use a greenpak (silego/dialog/renesas) programmable circuit. I contains various timers, that can be configured as frequency detect oneshot. for example the SLG 46824 or 826 is easy to program on it`s i2c pints, and the programmer is really cheap. it has on board oscillators but you maybe able yo use the system clock for better stability
 
Yes, Marcel, bit clock, not sure if you saw it, but I had edited post #29 to say "multiples of the sample rate" etc.

I hadn't seen it, I replied to your message when it still said that crystals at the sample rates and their multiples are readily available. I agree for the multiples, usually 2n times the sample rate where n is some positive integer. By the way, the schematic is not updated: LRCLK should be BCK and you need Elvee's antiparallel diode.
 
Sorry, edit time over, so anyone following please note Marcel's post above.

Regular crystals, made from a simple platelet of quartz withstand that kind of treatment, but lower frequency ones having a reasonable size are always a variety of the tuning-fork type, and their power handling capability is extremely limited: I still remember the crystalline snapping noise a 32K crystal made when I tested it at a few volts on a generator set at 32768Hz

Yes, I used metal cased MHz crystals starting from around the NTSC carrier frequency of 3.58MHz to about 12MHz ones, no problems.