Phantom powered pink-noise generator.
NG03 is a phantom powered pink-noise generator housed in a XLR plug that works with P12, P24 and P48 systems.
The generator is based on a PIC uC and as there was some code-space left over, some sine-waves was added.
The output signal can be pink noise, white noise, 320 Hz, 440 Hz or a 640 Hz sine wave.
The 320 Hz and 640 Hz sine waves are accurate to within a few percent.
The 440 Hz sine wave is clocked by a crystal.
Fig.1: NG03 schematic.
J1 is not a physical component, but a footprint for programming connector from TAG-Connect.
The PIC can be programmed with R1 and R2 installed.
R1, R2 and X1 determines the operating mode at power-on ( you can not change it except by resetting the PIC ).
If R1 is chosen for a sine output and X1 is installed, the output will be 440 Hz controlled by the crystal.
Without the crystal, the frequency is selected by R1.
The value for C2 and C3 are specified in the crystal data-sheet.
R3, R4 and R5 is a voltage divider that reduce the output from the PIC to around 5 mV for noise and 10 mV for sines.
Change the value of R3, R4 for other output voltages.
Absolute minimum value for R3, R4 is 2.6 kΩ as they limit the current into the PICs protection diodes when the plug is connected to a live 48 V line.
C4 and C5 are DC-blocking capacitors.
X7R types are used on this board to save space.
These have a very high voltage coefficient ( the capacitance will drop by up to 50% if their rated voltage is applied ) so I suggest using 100 V types.
C6, C7 and C8 is a low-pass filter.
For sine-waves this is set a little higher than the oscillator frequency and for the noise outputs around 20 kHz.
C8 alone can do the filtering, but then there is a high-level common-mode signal on the output with a slew-rate determined by R3, R4 and the cable capacitance.
This emits a lot of noise as the return path is through the cable shield.
C6 and C7 each with the double value of C8 works fine for sine-waves with X7R capacitors and the noise is decoupled to GND locally.
Using X7R capacitors ( from the same tape ) for C6 and C7 does not work with the noise signals. The amplitude will increase by 1..2 dB from a few kHz and up.
Replacing C6 and C7 with film capacitors does fix the frequency response, but the HF noise does increase as their self-resonance is on the low side for this application.
The combination of C6, C7 and C8 works and can be build with X7R capacitors.
As I can not find room on the board for C8, R5 goes on top of C8 on the R5 footprint. This sounds difficult, but is actually quite easy.
C1, D2, R6 and R7 is a voltage regulator. R6 and R7 should ideally be 0.1% types or better to avoid DC across an input transformer, but these are expensive and can be difficult to get.
If you use 1% resistors, these will normally be within 0.1% of each other if they are from same tape ( only the matching is important ).
D3 is a standard LED mounted in the connector's cable entry. If you do not want it, short it.
D1 protect D3 against reverse voltage in case of a mis-wired cable.
|Mode||R1||R3, R4||C2, C3||C6,C7||C8||X1|
|320 sine||None||12 kΩ||None||2.2 µF||None||None|
|440 sine||None||10 kΩ||15 pF||2.2 µF||None||22 MHz|
|640 sine||220 kΩ||10 kΩ||None||2.2 µF||None||None|
|Pink noise||100 kΩ||5.6 kΩ||None||4.7 nF||33 nF||None|
|White noise||47 kΩ||10 kΩ||None||4.7 nF||33 nF||None|
D1 and D2 are a SOT-23-3 cases, U1 a SOIC-8 case, other components 1206 SMDs ( 0805 can be fitted ).
R1..R5 can be 1% or 5% types.
R6, R7 should be 0.1% types, but 1% types from the same tape will normally work.
C1..C3 voltage rating should be 25 V or more.
C4..C8 voltage rating must be 50 V or more ( 100 V preferred ).
All the components have larger-than-normal pads for easy hand-soldering.
Sorry, but I am not publishing the software as I have done so before and seen it end up in "commercial" products.
The white noise generator is a 39-bits long Maximum Length Linear Feedback Shift Register. See , , ,  and .
The pink noise filter is a 31-stage single-bit Voss-McCartney algorithm.
The sine waves are generated from a look-up table. Timing is an interrupt.
The look-up table for the sine generator is calculated using an algorithm by Roman Black , reducing the THD+N by 15 dB compared to a "normal" look-up table.
The 320 Hz and the 640 Hz sine waves are based on the internal oscillator and is accurate to within a few percent.
The 440 Hz sine wave is an integer division of the crystal frequency, so its frequency accuracy is the same as the crystal's.
The fall-back mode for 440 Hz ( in case the crystal oscillator stops ) is 640 Hz.
There are 2 additional features in the PIC not used in the NG03 ( these were intended for prototype testing, but I have left them active ):
For sine modes, pin RA1 is a square-wave "in phase" with the sine-wave. Due to phase-shift in the analog output filter it is not exactly in phase.
For noise modes, pin RA0 is a re-seed input with internal pull-up. Re-seed is triggered by a falling edge on this pin.
During the re-seed, pin RA1 goes high. Re-seed is finished on the falling edge on this pin. This takes around 10 µs.
Some additional info about the PIC:
The internal 32 MHz oscillator is used.
Under voltage reset is enabled, so minimum supply voltage is 2.85 V.
All outputs use the low slew-rate mode.
The supply current for the prototype is 2.8 mA at 5 V with all outputs unloaded.
Fig.2: Photo of mounted PCBs.
Download NG03A design files.
Download NG03A sound samples ( 60 s of white and pink noise).
I have boards and PICs available for this project. See the PCBs page.
No known issues.
As this is the first time I have tried to use this ( actually any ) sound-card for measurements, I checked it.
My first attempts were quite disappointing as the frequency response started to roll off below 20 kHz ( with an assumed 192 kHz sample-rate ).
The solution is described in .
It is "Control Panel", "Sound", "Recording", "Line In", "Properties", "Advanced" for an English Windows 7 ( make sure there is a plug in "line in" ).
There also seems to be some dynamic processing in the sound-card as the frequency response starts to roll off above 1 kHz when the input is close to full scale.
With inputs below -10 dB full scale, the frequency response is as shown above with a 192 kHz sample-rate.
All measurements are made at -10 dB full-scale and normalized for the plots.
Fig.A1: Sound card performance.
Frequency response ( left axis ) and spectrum of a 1 kHz sine-wave ( right axis ).
The spike at 50 Hz is from the PC/sound-card. It is there even with a shorted plug in the input.
Fig.A2: Spectrum of the 320 Hz, 440 Hz and 640 Hz sine waves.
The sine waves have a 2.order component at around -55 dB while the rest of the harmonics are around -70 dB or lower.
The wide skirts on the 320 Hz and 640 Hz signals are caused by jitter from the PICs internal oscillator.
The spike at 50 Hz is a ground-loop in the measurement setup.
Fig.A3: Spectrum of the noise signals.
|Red:||White noise without any filtering except for the sound-card ( left axis ).
The upper -3 dB frequency is around 50 kHz.
I do not know how far down in frequency it goes ( the LF roll-off is the sound-card ), but the counter repeats after approximately 40 days.
|Blue:||White noise with filter ( left axis, 1 dB offset ).
-3 dB points are at 10 Hz and 20 kHz.
|Magenta:||Pink noise deviation from ideal response without any filtering except for the sound-card ( left axis, 2 dB offset ).
This shows the typical response of a Voss-McCartney algorithm.
The upper -3 dB frequency is around 25 kHz.
I do not know how far down in frequency it goes.
|Lime:||Pink noise deviation from ideal response with filter ( left axis, 3 dB offset ).
-3 dB points are at 20 Hz and 18 kHz.
|Cyan:||Pink noise response without any filtering except for the sound-card ( right axis ).|
|Brown:||Pink noise response with filter ( right axis ).|
The sine-wave plots are made with LTspice with a wave-file as input.
The noise plots are made with Spectrum Lab with Hann window, an FFT size of 500K and approximately 1k averages ( maybe overdoing it a little ).
22 Hz - 22 kHz
2 kΩ load
22 Hz - 22 kHz
|320 Hz sine||12 mV||321 Hz||0.18%|
|440 Hz sine||12 mV||440.04 Hz||0.15%|
|640 Hz sine||11 mV||642 Hz||0.15%|
|White noise||5.2 mV|
|Pink noise||5.2 mV|
I can not guarantee the accuracy of the 440.04 Hz measurement as I do not have a calibrated frequency counter.
I calculated the following in order to get an idea of how accurate an instrument tuner should be in engineering terms.
Instrument tuner accuracy is normally specified in cents on a logarithmic scale.
To convert between this and linear units ( see  ):
f1 and f2 are 2 frequencies.
n is the number of cents between f1 and f2.
n = 1200 * log2 ( f2 / f1 )
f2 = f1 * 2 ( n / 1200 )
|f2/f1 [Cents]||(f2-f1)/f1 [ppm]||(f2-f1)/f1 [%]|
Instrument tuner accuracy is typically in the order ±0.1 cent to ±1 cent.
±1 cent requires a crystal with an accuracy of ±500 ppm, so any crystal you can find will do. A crystal resonator will not though.
±0.1 cent requires a crystal with an accuracy of ±50 ppm, so this can be achieved with a very cheap crystal.
The crystal suggested for this design ( TXC 9C-22.000MEEJ-T ) was selected for its low price.
It has an initial accuracy of ±10 ppm ( ±0.017 cents ) and a yearly aging of ±3 ppm ( ±0.005 cents ) maximum.
|||Bryan H. Suits: White Noise Source.|
A simple white noise generator and a list of possible shift registers using between 7 and 159 registers.
|||Xilinx: XAPP210 (v1.3) April 30, 2007. Linear Feedback Shift Registers in Virtex Devices.|
Includes a list of of some possible tap points for registers from 3 to 168 registers.
|||New Wave Instruments: Linear Feedback Shift Registers. Implementation, M-Sequence properties, Feedback Tables.|
A short, precise explanation of LFSR and an extensive list of tap points. Note that the feedback tap numbers differ from this text.
|||Wikipedia: Linear-feedback shift register.|
|||EDN: Make noise with a PIC.|
An example of designing a LFSR in a PIC micro-controller.
|||Roman Black:1kHz precision sine generator using PIC.|
|||Spectrum Lab Configuration Dialog. ( search for: Selecting higher sampling rates under Windows 7 )|
|||Wikipedia: Cent (music)|
This web-page, including but not limited to all text, drawings and photos, is the intellectual property of Poul Petersen, and is Copyright ©.
Reproduction or re-publication by any means whatsoever is strictly prohibited under International Copyright laws.
The author grants the reader the right to use this information for personal use only.
Any commercial use is prohibited without express written authorization from Poul Petersen.
The information is provided on an "as-is" basis and is believed to be correct, however any use of the information is your own responsibility.
This web-site may contain links to web-sites outside Poul Petersen domain ( www.poulpetersen.dk ).
Poul Petersen has no control over and assumes no responsibility for the content of any web-site outside Poul Petersen own domain.
|Copyright © Poul Petersen 1990 - 2018. Last update: 20181111.||Valid HTML!|