Preamp Development
This is the development notes for the Anarchian Audio Preamp project.
Source gain capacitor Cs:
Rd = 16.2k, Rs = 2.64k, parallel: 2.27k
1/(2*pi*2.27k*100uF)= 0.81Hz
Output coupling capacitor Co:
Powerbook input impedance 47k, output resistor 64.9k, parallel: 27.2k
1/(2*pi*27.2k*4.7uF)= 1.2Hz
mouser Order
Number: 2829905
Bill of Materials:
2 J201 JFETs
2 100 uF electrolytic capacitors (gain)
2 100 uF electrolytic capacitors (Vdd filt)
2 4.7 uF electrolytic capacitors (output)
2 10k Ohm rev log potentiometers
2 2640 Ohm 1% metal film resistors (Rs)
2 16200 Ohm 1% metal film resistors (Rd)
2 34000 Ohm 1% metal film resistor (v div)
1 64900 Ohm 1% metal film resistor (ch2 out)
1 150 Ohm 1% metal film resistor (Vdd filt)
1 56 Ohm 1% metal film resistor (Vdd filt)
2 1/4" mono switched jacks
1 1/8" stereo jack
1 USB-B jack
enclosure, screws, rubber pot knobs, spare comps? docs?
cables: outletpc.com
potentiometers: pedalpartsplus.com - very nice
4 10k, 4 50k rev log taper 16mm pots $10 + $1.75 (1st class ship) =
$11.75
Mouser order: $24 + $7.50 ship + $2.50 tax = $34
resistors 8 ea
1300
1740
2100
2670
3920
5620
7500
9530
12400
16200
24900
34000
48700
56200
64900
75000
capacitors 8 ea
100uF
47uF
4.7uF
8ea
1/4" mono sw jacks
4 ea
1/8" stereo jack
USB-B jack
16ea
J201
J202
4 ea
10K rev log
50k rev log
1st mouser shipment
Vgsc(V), Idss(mA), Vdd=5v, R=500k (Vgsc very close using
830k)
(starting at end of breadboard)
J201
-.54 .281
-.73
.506 used in first batch of
two preamps
-.65
.412 used in first batch of
two preamps
-.48
.229
-.63
.373
-.78 .563
-.65 .423 used in first
batch of two preamps
-.56
.311
-.74
.507 used in first batch of
two preamps
-.63
.302
-.51 .399
-.55
.249
-.73
.291
-.62
.504
-.81
.364
j202
-1.75 2.23
-1.74
2.20
-1.76
2.24
-1.77
2.28
-1.85
2.42
-1.76
2.21
-1.55
1.89
-1.74
2.21
-1.80
2.28
-1.78
2.30
-1.76
2.19
-1.67 2.06
-1.75
2.20
-1.95
2.59
-1.83
2.47
-1.77 2.25
// J201
// Idss Vgsq/Vgsc Vgsc Vdq sc Vdq Id Rs Rd Rv Avdb
// -.73 .00051 .62 .68 2.77 .000074 6100 30300 50000 12-24db d12
Used Rs = 5620, Rd = 34000, Vdq is 2.66, and Id is .000078, but Av appears to be 1.5, expecting 3.78,
Avv = 1.6, Avs = Avv * 4 so we have the 12 db range on the pot. We have lots of distortion as we
try to get near the line-in standard 2.82 Vpp level. May have to use 9v Vdd. Also got lots of hum/buzz
from the wall wart.
2nd day used 330 ohm 100 uF RC lowpass on Vdd to knock hum/buzz peak from -51 to -65 db.
freq response using sweepsine drops 8 db from 20 to 20k Hz. Removed Rv, R & C on Vdd, output R,
lowered siggen gain, nothing changed it.
# ./analyze_ossio - headphone-direct-to-line-in, alsa pcm 48
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 1.8 -35.1 -56.6 -21.5 -18.4
20 1.6 -35.8 -54.2 -18.5 -15.5
40 0.2 -55.8 -73.1 -17.3 -14.3
80 1.5 -36.6 -53.5 -16.9 -13.9
160 1.9 -34.6 -51.4 -16.8 -13.8
320 1.8 -34.9 -51.8 -16.8 -13.8
640 1.3 -37.6 -54.4 -16.8 -13.8
1280 1.9 -34.6 -51.4 -16.8 -13.8
2560 0.7 -42.6 -59.4 -16.8 -13.8
5120 1.3 -37.8 -54.6 -16.8 -13.8
10240 1.4 -37.0 -53.8 -16.8 -13.8
# ./analyze_ossio - preamp, gain down, alsa pcm 43
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 1.8 -34.7 -55.9 -21.2 -18.0
20 1.7 -35.5 -53.7 -18.3 -15.1
40 0.7 -43.3 -60.4 -17.1 -13.9
80 2.0 -34.1 -50.8 -16.7 -13.5
160 0.2 -52.1 -68.8 -16.6 -13.4
320 0.3 -50.1 -66.7 -16.5 -13.3
640 0.4 -47.7 -64.3 -16.6 -13.4
1280 0.7 -43.2 -60.0 -16.7 -13.5
2560 2.3 -32.7 -49.7 -17.0 -13.8
5120 1.9 -34.5 -52.4 -17.9 -14.7
10240 2.2 -33.2 -53.4 -20.3 -17.1
# ./analyze_ossio - preamp, gain up, alsa pcm 25
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 1.8 -34.7 -60.6 -25.9 -22.7
20 1.6 -35.9 -58.8 -23.0 -19.7
40 1.2 -38.1 -60.0 -21.8 -18.4
80 1.3 -37.8 -59.3 -21.4 -18.0
160 1.5 -36.3 -57.5 -21.2 -17.8
320 1.8 -35.0 -56.0 -21.0 -17.6
640 0.3 -50.4 -71.7 -21.3 -17.9
1280 0.7 -43.1 -64.5 -21.4 -17.9
2560 1.3 -37.9 -59.5 -21.5 -18.1
5120 2.9 -30.7 -53.1 -22.4 -19.0
10240 3.6 -28.8 -53.7 -24.9 -21.6
#
# ./analyze_ossio - preamp, gain up, alsa pcm 25
switched from 5620 34000 resistors to 3920 24900 resistors for max current
this makes Vdq = 2.45 and Id = .0001
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 1.5 -36.2 -72.1 -35.9 -32.7
20 1.4 -37.4 -70.2 -32.9 -29.8
40 0.7 -43.1 -74.8 -31.7 -28.5
80 0.6 -44.2 -75.5 -31.3 -28.2
160 0.6 -44.9 -76.0 -31.2 -28.1
320 1.3 -37.9 -69.0 -31.1 -28.0
640 1.9 -34.3 -65.5 -31.2 -28.1
1280 0.5 -45.8 -77.1 -31.3 -28.1
2560 0.8 -41.4 -72.9 -31.4 -28.3
5120 1.4 -37.3 -69.5 -32.2 -29.1
10240 1.5 -36.7 -71.0 -34.3 -31.2
now compare the preamp above with gain down to the headphone-direct-to-line-in below.
the preamp gives 5 db gain and the rel THD+N is as good or better
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 0.4 -47.0 -88.5 -41.6 -38.5
20 1.4 -36.9 -75.4 -38.5 -35.5
40 1.8 -34.8 -72.1 -37.3 -34.2
80 1.3 -37.8 -74.7 -36.9 -33.9
160 1.3 -37.8 -74.6 -36.8 -33.8
320 1.8 -34.7 -71.5 -36.8 -33.8
640 1.0 -39.6 -76.4 -36.8 -33.7
1280 1.7 -35.1 -71.9 -36.8 -33.7
2560 1.3 -37.8 -74.6 -36.8 -33.8
5120 1.4 -37.1 -73.9 -36.8 -33.8
10240 1.4 -37.0 -73.8 -36.8 -33.8
#
The second one below has the Vdd filter and the first does not. The filter
lowers rel THD+N 8dB in the 100s of Hz and raises it 10dB in the 1000s of Hz.
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 1.9 -34.5 -66.3 -31.8 -28.7
20 1.5 -36.5 -65.4 -28.8 -25.8
40 1.1 -39.4 -67.0 -27.7 -24.6
80 1.1 -39.3 -66.6 -27.3 -24.2
160 1.3 -37.8 -64.9 -27.2 -24.0
320 1.8 -34.9 -61.9 -27.1 -24.0
640 1.0 -40.1 -67.3 -27.2 -24.1
1280 1.6 -35.8 -63.0 -27.2 -24.1
2560 1.6 -35.9 -63.4 -27.4 -24.3
5120 1.4 -37.4 -65.5 -28.2 -25.1
10240 1.5 -36.7 -67.0 -30.3 -27.2
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 1.8 -34.8 -66.6 -31.8 -28.1
20 1.5 -36.5 -65.4 -28.8 -25.4
40 1.0 -40.3 -67.9 -27.6 -24.8
80 0.8 -41.8 -69.1 -27.3 -24.0
160 0.5 -45.9 -73.1 -27.2 -23.8
320 0.6 -45.2 -72.2 -27.1 -23.7
640 0.8 -41.6 -68.8 -27.2 -23.8
1280 3.1 -30.1 -57.3 -27.2 -23.8
2560 4.2 -27.6 -55.0 -27.4 -24.0
5120 4.4 -27.1 -55.2 -28.2 -24.7
10240 5.6 -25.0 -55.3 -30.3 -26.7
#
Increased Vdd to 7.5v - everything was about the same.
Next one is usb supplying Vdd, doesn't appear to need Vdd filtering.
BUT! listening test revealed a big difference - with the filter
The high THD+N at high freq is due to high output sig level.
Let's increase input level to see if it gets worst
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 0.3 -49.8 -64.9 -15.2 -10.9
20 1.9 -34.3 -46.6 -12.3 -8.0
40 1.8 -35.1 -46.2 -11.1 -7.2
80 1.6 -35.7 -46.5 -10.7 -7.2
160 1.0 -40.4 -51.0 -10.6 -7.2
320 1.7 -35.3 -45.8 -10.5 -7.2
640 1.9 -34.6 -45.2 -10.6 -7.3
1280 1.7 -35.4 -46.1 -10.7 -7.3
2560 3.9 -28.2 -39.0 -10.8 -7.3
5120 9.3 -20.6 -32.0 -11.4 -7.6
10240 13.1 -17.6 -30.9 -13.3 -9.4
#
worst as expected. next, lower gain to see if it improves
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 0.2 -54.4 -67.3 -12.9 -5.5
20 1.9 -34.2 -44.4 -10.2 -4.5
40 1.0 -39.7 -48.8 -9.1 -5.2
80 0.2 -54.9 -63.7 -8.7 -6.0
160 1.1 -39.3 -47.9 -8.6 -6.5
320 1.5 -36.3 -45.0 -8.6 -6.8
640 2.1 -33.6 -42.3 -8.6 -6.8
1280 5.2 -25.6 -34.4 -8.7 -6.9
2560 13.5 -17.4 -26.3 -8.9 -7.0
5120 19.5 -14.2 -23.7 -9.5 -6.8
10240 17.6 -15.1 -26.1 -11.0 -7.1
#
it's somewhat better at the lower input level
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 0.2 -53.6 -81.3 -27.8 -24.5
20 1.6 -35.9 -60.7 -24.8 -21.5
40 1.3 -38.1 -61.7 -23.6 -20.3
80 1.2 -38.2 -61.4 -23.3 -19.9
160 1.5 -36.2 -59.3 -23.1 -19.7
320 1.8 -34.8 -57.7 -22.8 -19.5
640 0.4 -49.1 -72.3 -23.2 -19.8
1280 0.7 -42.7 -65.8 -23.2 -19.8
2560 1.3 -37.9 -61.1 -23.3 -19.9
5120 2.3 -32.7 -56.7 -23.9 -20.6
10240 2.8 -31.1 -57.2 -26.1 -22.9
#
now we're trying the .65 .412 JFET - not much difference between it
(first one below) and the original jfet (second one below)
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 0.3 -49.8 -76.0 -26.2 -22.9
20 1.4 -37.2 -60.5 -23.3 -20.0
40 1.6 -36.1 -58.2 -22.1 -18.6
80 1.7 -35.2 -56.9 -21.7 -18.2
160 1.6 -35.8 -57.2 -21.5 -18.0
320 1.2 -38.2 -59.5 -21.3 -17.8
640 1.8 -35.1 -56.7 -21.6 -18.1
1280 1.1 -39.2 -60.8 -21.6 -18.1
2560 1.8 -34.9 -56.6 -21.7 -18.2
5120 3.0 -30.5 -52.9 -22.4 -19.0
10240 3.7 -28.7 -53.4 -24.6 -21.3
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 0.2 -55.8 -81.6 -25.8 -22.6
20 1.8 -34.9 -57.7 -22.9 -19.6
40 1.4 -37.0 -58.7 -21.7 -18.3
80 1.2 -38.2 -59.5 -21.3 -17.9
160 1.7 -35.6 -56.7 -21.1 -17.7
320 1.7 -35.6 -56.5 -20.9 -17.5
640 1.8 -35.1 -56.3 -21.2 -17.8
1280 1.1 -39.2 -60.5 -21.2 -17.8
2560 1.8 -35.0 -56.3 -21.3 -17.9
5120 2.7 -31.3 -53.3 -22.0 -18.6
10240 3.3 -29.6 -53.8 -24.2 -20.9
#
# gcc -lm -o jfet jfet.c; ./jfet .69 .34
# this is for the shipped J202s with measured Idss and Vgsc below
# parameters adjusted to match resistor values available
(prev setup was J201 with 24.9k and 3.92k)
verified quiescent values below
Vdd = 5.00 Volts d supply voltage
Vgsc = -1.74 Volts d JFET g-s cutoff voltage
Idss = 0.002200 Amps d JFET Id saturation current
Vgsq = -1.20 Volts s quies. g-s voltage, hi |Vgsq| = hi gain, Vsq=|Vgsq|
Idq = 0.00021 Amps l quies. drain current, hi Idq = lo dist.
Rs = 5679 Ohms l source resistor
Vdq = 2.97 Volts s quies. drain voltage - be less than 3.12
Rd = 9584 Ohms l drain resistor
gm = 0.00078 Mhos l transconductance
Av = 1.38 l gain with Rs tween src & gnd ( 2.8 dB)
Avv = 1.50 l gain with Rs+Rv tween src & gnd ( 3.5 dB)
Avs = 7.51 l gain with short tween src & gnd ( 17.5 dB)
it appears the J202 has a flatter response
frequency(Hz) THD+N rel(%)(dB) THD+N rms(dB) SINE rms(dB) SINE peak(dB)
10 2.4 -32.4 -46.5 -14.1 -8.6
20 1.5 -36.4 -47.6 -11.2 -6.7
40 0.8 -41.6 -51.6 -10.0 -6.9
80 0.4 -48.5 -58.1 -9.6 -7.1
160 1.6 -36.0 -45.5 -9.5 -7.3
320 1.7 -35.4 -44.8 -9.4 -7.4
640 0.9 -40.6 -50.1 -9.5 -7.4
1280 2.3 -32.8 -42.3 -9.5 -7.5
2560 7.9 -22.0 -31.6 -9.6 -7.5
5120 12.8 -17.9 -27.7 -9.8 -7.7
10240 7.7 -22.2 -32.8 -10.6 -7.4
20480 1.1 -39.3 -52.0 -12.7 -9.7
#
In the next two J201, Rs= 3.92k, Rd= 24.9k,
First one pream gain down, second one preamp gain up with alsa pcm level compensation.
the slightly lower THDNrel in the second one seems to indicate only a lowered
signal/noise ratio between the powerbook digital output and the preamp.
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.4 -48.5 -72.4 -23.9 -20.8
20 1.5 -36.7 -57.7 -21.0 -17.9
40 1.1 -39.5 -59.4 -19.8 -16.7
80 0.9 -40.9 -60.3 -19.5 -16.3
160 0.8 -41.5 -60.8 -19.3 -16.1
320 1.2 -38.1 -57.4 -19.3 -16.1
640 1.8 -34.9 -54.3 -19.4 -16.2
1280 1.1 -39.4 -58.9 -19.4 -16.2
2560 1.7 -35.6 -55.2 -19.6 -16.4
5120 1.8 -35.1 -55.4 -20.4 -17.2
10240 1.9 -34.3 -56.8 -22.5 -19.3
20480 1.0 -40.0 -67.5 -27.5 -24.4
#
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.8 -42.0 -66.2 -24.2 -20.9
20 1.1 -38.8 -60.1 -21.3 -17.9
40 1.8 -34.9 -55.0 -20.1 -16.6
80 1.4 -37.2 -56.9 -19.7 -16.2
160 1.7 -35.3 -54.8 -19.5 -15.9
320 1.7 -35.5 -54.8 -19.3 -15.7
640 1.1 -39.1 -58.8 -19.6 -16.1
1280 1.7 -35.5 -55.1 -19.6 -16.1
2560 1.5 -36.8 -56.5 -19.7 -16.2
5120 3.6 -28.8 -49.3 -20.4 -16.9
10240 4.5 -26.9 -49.6 -22.6 -19.2
20480 1.2 -38.4 -65.9 -27.6 -24.4
#
Using oscope_oss_x11 and a SWEEPSINE signal:
I measured Avs - Avv of about 4.9 which should be 6. We really need more
gain, not less. Also verified the preamp's response rolloff at high freq.
Better than the J201 maybe, don't know. The output resistor has negligible
effect.
I checked the function of the gate resistor. It doesn't seem to make much
difference with pops but will allow hum when touching the end of a cord
pluggein into it - I think this is ok - guitar amps do it - so let's omit
the input resistor.
J201, Rs= 5.62k, Rd= 34k
J201, Rs= 3.92k, Rd= 24.9k
J202, Rs= 5.62k, Rd= 9.53k
The next two show that J202 has better frequency response
# amixer get "PCM" | grep "Left: Playback"; make analyze_ossio; ./analyze_ossio
Front Left: Playback 72 [41%], J201, Rs= 5.62k, Rd= 34k
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 1.7 -35.4 -49.5 -14.1 -9.4
20 2.0 -34.1 -45.4 -11.3 -6.6
40 1.7 -35.5 -45.7 -10.2 -5.8
80 1.5 -36.6 -46.4 -9.8 -5.7
160 1.3 -37.8 -47.5 -9.7 -5.8
320 0.5 -45.5 -55.1 -9.6 -5.8
640 1.3 -37.5 -47.2 -9.7 -5.9
1280 1.8 -34.8 -44.6 -9.8 -5.9
2560 4.6 -26.8 -36.7 -9.9 -5.9
5120 14.2 -17.0 -27.5 -10.6 -6.2
10240 19.5 -14.2 -26.7 -12.5 -8.2
20480 2.1 -33.7 -50.9 -17.2 -14.1
# amixer get "PCM" | grep "Left: Playback"; make analyze_ossio; ./analyze_ossio
Front Left: Playback 72 [41%], J202, Rs= 5.62k, Rd= 9.53k
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.7 -43.1 -59.3 -16.3 -11.3
20 1.6 -35.7 -48.9 -13.2 -9.3
40 1.2 -38.5 -50.4 -12.0 -9.0
80 1.1 -39.1 -50.7 -11.6 -8.9
160 1.3 -37.6 -49.0 -11.4 -8.8
320 1.7 -35.2 -46.6 -11.3 -8.8
640 1.5 -36.4 -47.8 -11.4 -8.9
1280 1.9 -34.6 -46.0 -11.4 -8.9
2560 4.3 -27.4 -38.9 -11.5 -8.9
5120 7.0 -23.1 -34.8 -11.7 -9.1
10240 5.6 -25.1 -37.5 -12.4 -9.3
20480 1.3 -37.7 -52.8 -15.1 -12.1
#
# amixer get "PCM" | grep "Left: Playback"; ./analyze_ossio
Front Left: Playback 32 [18%]
This is about as low an input level that minimizes THD+Nrel.
Lower input levels show raised TDH+Nrel, probably noise.
The higher THD+N measurd at higher sig levels suggest harmonic distortion
which may
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.5 -46.9 -81.2 -34.3 -31.1
20 1.6 -35.7 -67.0 -31.3 -28.0
40 0.4 -47.4 -77.5 -30.1 -26.9
80 1.7 -35.5 -65.2 -29.7 -26.5
160 0.3 -50.1 -79.6 -29.5 -26.3
320 0.3 -51.5 -80.9 -29.4 -26.2
640 0.4 -48.0 -77.6 -29.6 -26.4
1280 0.8 -42.1 -71.6 -29.6 -26.4
2560 1.4 -36.8 -66.3 -29.5 -26.4
5120 1.7 -35.2 -65.0 -29.8 -26.6
10240 1.9 -34.6 -65.4 -30.8 -27.6
20480 1.7 -35.2 -69.4 -34.3 -31.0
#
It's frustrating because I'm measuring less gain than calculated in ./jfet,
e.g. J202, Rs= 5.62k, Rd= 9.53k is supposed to have from 4.1 to 18 dB gain
varying Rv and I'm measuring 0 dB to 12 dB. I need more gain
good combo:
J201#1 J201#2 J201#3 J201#7
Vdq = 3.13 3.13 2.82 3.10
Idq = .017mA .017 .020 .017
Rs = 2.67k
Rd = 16.2k
Avvmin 6dB
Avvmax 15 dB
the following three are Avvmax, Avvmin and headhpone to line-in for the four J201s.
and bias resistors above.
# amixer get "PCM" | grep "Left: Playback"; make analyze_ossio; ./analyze_ossio
Front Left: Playback 60 [34%]
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.5 -45.7 -64.6 -18.9 -15.3
20 1.8 -34.9 -50.9 -16.0 -12.3
40 1.6 -36.1 -51.0 -14.8 -11.0
80 1.6 -35.9 -50.3 -14.5 -10.6
160 1.6 -35.8 -50.1 -14.3 -10.3
320 0.3 -50.0 -64.1 -14.1 -10.2
640 0.9 -40.7 -55.0 -14.3 -10.5
1280 2.0 -33.8 -48.1 -14.4 -10.5
2560 1.6 -36.0 -50.4 -14.4 -10.5
5120 6.3 -24.0 -38.9 -14.9 -11.1
10240 8.1 -21.8 -38.5 -16.6 -13.0
20480 1.7 -35.2 -63.0 -27.8 -22.8
# amixer get "PCM" | grep "Left: Playback"; make analyze_ossio; ./analyze_ossio
Front Left: Playback 60 [34%]
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.4 -47.4 -74.6 -27.2 -24.1
20 1.8 -35.0 -59.2 -24.2 -21.1
40 1.0 -39.8 -62.9 -23.0 -19.9
80 1.0 -40.4 -63.1 -22.7 -19.5
160 1.2 -38.7 -61.2 -22.5 -19.4
320 1.7 -35.4 -57.9 -22.4 -19.3
640 1.6 -36.0 -58.6 -22.6 -19.4
1280 1.7 -35.4 -58.0 -22.6 -19.4
2560 1.5 -36.4 -59.1 -22.7 -19.5
5120 1.6 -35.7 -58.9 -23.2 -20.1
10240 1.8 -35.0 -59.9 -24.9 -21.8
20480 1.5 -36.7 -66.1 -29.4 -26.3
# amixer get "PCM" | grep "Left: Playback"; make analyze_ossio; ./analyze_ossio
Front Left: Playback 60 [34%]
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 2.3 -32.8 -66.3 -33.5 -30.4
20 1.4 -36.8 -67.3 -30.5 -27.5
40 1.0 -39.7 -69.0 -29.3 -26.2
80 0.9 -40.5 -69.4 -28.9 -25.9
160 1.1 -39.0 -67.8 -28.8 -25.8
320 1.7 -35.4 -64.3 -28.8 -25.8
640 1.6 -35.8 -64.5 -28.8 -25.7
1280 1.6 -35.8 -64.6 -28.8 -25.7
2560 1.3 -37.6 -66.4 -28.8 -25.8
5120 1.4 -37.0 -65.8 -28.8 -25.7
10240 1.4 -36.9 -65.7 -28.8 -25.8
20480 1.7 -35.6 -65.5 -29.9 -26.9
#
J201#1 J201#2 J201#3 J201#7
Vdq = 3.13 3.13 2.82 3.10
Idq = .17mA .17 .20 .17
Rs = 2.67k
Rd = 16.2k
Avvmin 6dB
Avvmax 15 dB
measured in first production unit (piepan):
Vdq L 3.12 R 3.09
Vsq .30 .30
measured in second production unit (cardboard):
Vdq L 2.80 R 2.80
Vsq .35 .35
- oscope thru mode, giving feedback loop to preamp, preamp oscillates at -6dB,
but only when BOTH chans full gain!
- freq resp is flat within 3dB (down at high freq)
- gain is 6 dB to 15dB
- the two channel levels are well matched for the balanced line function
- it sounds good, even with full gain thru both chans. congrats!
- There's a 1khz or so squarish wave present in the output when
the USB ground is connected, raising noise floor 6 dB from -80 db
to -74 dB.
- There is a low freq transient on a 3 sec interval present in the output,
raising noise floor transiently from -80 dB to -70 dB on average. It's present in
the left output and inverted in the right output independently of guitar in input jack
and left gain, but its level in the right output is dependent on the right gain.
The inversion and dependence on right gain lost when guitar in right input.
- Using balline_ossio, the balanced line function appears to reduce noise ten dB!
With guitar turned down, bal line shows -90dB while unblanced is -80dB.
final test of cardboard preamp:
# siggen -t SINE -f 300 -n 2; ./oscope_oss_x11 -t 0 -p 1 -r 1 -x 1 -n 2 -i siggen.out
using ./oscope_oss_x11 meter visually distortion harmonics pop up at -7.6dB left chan,
right chan when alsa level 48, and -7.9dB left+right chan when alsa level 48, JEFT gains
down.
amixer get "PCM" | grep "Left: Playback"; ./analyze_ossio
left chan, gain up, alsamix 48%:
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.5 -45.7 -61.1 -15.4 -11.9
20 1.9 -34.3 -46.9 -12.5 -9.1
40 1.7 -35.3 -46.7 -11.4 -8.0
80 0.8 -42.1 -53.1 -11.0 -7.7
160 1.7 -35.3 -46.2 -10.9 -7.6
320 1.5 -36.6 -47.4 -10.8 -7.6
640 1.7 -35.3 -46.2 -10.9 -7.7
1280 1.9 -34.5 -45.5 -10.9 -7.7
2560 1.9 -34.5 -45.6 -11.1 -7.8
5120 4.1 -27.8 -39.4 -11.6 -8.3
10240 5.0 -26.1 -39.4 -13.4 -10.0
20480 1.0 -39.8 -57.7 -17.9 -14.8
# ./analyze_ossio
amixer get "PCM" | grep "Left: Playback"; ./analyze_ossio
left chan, gain up, alsamix 36%:
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 2.8 -31.0 -47.5 -16.5 -12.9
20 1.6 -35.7 -49.4 -13.6 -9.9
40 1.0 -39.9 -52.4 -12.5 -8.7
80 0.5 -45.4 -57.5 -12.1 -8.3
160 0.2 -55.4 -67.3 -11.9 -8.0
320 0.4 -48.2 -60.0 -11.8 -7.9
640 1.2 -38.4 -50.4 -12.0 -8.1
1280 2.0 -33.9 -45.9 -12.0 -8.1
2560 1.8 -35.0 -47.1 -12.1 -8.2
5120 6.9 -23.2 -35.8 -12.6 -8.8
10240 9.1 -20.9 -35.3 -14.5 -10.8
20480 1.9 -34.5 -53.5 -19.0 -15.9
#
amixer get "PCM" | grep "Left: Playback"; ./analyze_ossio
left + right chan, gains down, alsamix 43%:
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.0 -68.7 -84.2 -15.4 -11.8
20 1.9 -34.4 -46.8 -12.4 -9.0
40 1.9 -34.3 -45.5 -11.2 -8.1
80 1.4 -37.2 -48.1 -10.9 -7.9
160 1.6 -36.0 -46.8 -10.8 -7.9
320 1.9 -34.6 -45.4 -10.9 -7.9
640 0.5 -46.3 -57.0 -10.8 -7.9
1280 0.8 -41.8 -52.6 -10.8 -7.9
2560 2.3 -32.9 -44.0 -11.1 -8.1
5120 3.5 -29.2 -40.9 -11.7 -8.6
10240 3.3 -29.7 -43.1 -13.3 -10.1
20480 1.4 -36.8 -55.1 -18.3 -10.4
#
amixer get "PCM" | grep "Left: Playback"; ./analyze_ossio
left + right chan, left gain up, right gain down, alsamix 36%:
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.1 -61.5 -75.8 -14.2 -9.8
20 1.2 -38.3 -49.6 -11.3 -7.1
40 1.7 -35.4 -45.5 -10.0 -6.7
80 1.9 -34.6 -44.9 -10.3 -6.6
160 1.7 -35.4 -45.0 -9.6 -7.5
320 1.1 -39.3 -49.0 -9.7 -7.7
640 1.6 -35.8 -45.4 -9.6 -7.7
1280 2.0 -34.0 -43.7 -9.7 -7.7
2560 5.8 -24.7 -34.6 -9.9 -7.8
5120 7.4 -22.6 -33.1 -10.5 -8.0
10240 3.6 -28.8 -40.8 -12.0 -8.8
20480 1.8 -34.8 -50.9 -16.1 -13.0
#
amixer get "PCM" | grep "Left: Playback"; ./analyze_ossio
left + right chan, left gain up, right gain up, alsamix 23%:
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.3 -50.8 -66.7 -15.8 -12.2
20 1.5 -36.2 -48.7 -12.5 -8.6
40 1.0 -40.3 -51.4 -11.1 -7.3
80 0.8 -42.2 -53.0 -10.8 -7.0
160 1.0 -40.2 -51.2 -11.0 -7.4
320 1.8 -34.8 -46.4 -11.6 -7.8
640 1.6 -35.7 -46.3 -10.6 -6.9
1280 1.6 -36.1 -47.0 -10.9 -7.2
2560 2.2 -33.1 -44.7 -11.5 -7.8
5120 6.1 -24.3 -36.7 -12.3 -8.6
10240 8.3 -21.6 -35.2 -13.6 -9.9
20480 1.3 -37.9 -56.3 -18.3 -15.1
#
amixer get "PCM" | grep "Left: Playback"; ./analyze_ossio
right chan, gain down, alsamix 48%:
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 0.5 -45.5 -61.0 -15.5 -12.0
20 1.6 -36.1 -48.6 -12.6 -9.1
40 1.2 -38.2 -49.6 -11.4 -8.0
80 1.2 -38.4 -49.5 -11.0 -7.8
160 1.5 -36.5 -47.4 -10.9 -7.7
320 1.7 -35.3 -46.1 -10.8 -7.7
640 0.4 -49.0 -59.9 -10.9 -7.7
1280 0.6 -44.3 -55.2 -11.0 -7.8
2560 1.8 -34.9 -46.0 -11.1 -7.9
5120 4.0 -28.0 -39.7 -11.6 -8.3
10240 4.8 -26.3 -39.7 -13.4 -10.0
20480 1.9 -34.6 -52.5 -17.8 -14.8
#
amixer get "PCM" | grep "Left: Playback"; ./analyze_ossio
right chan, gain up, alsamix 36%:
freq(Hz) THD+Nrel(%) THD+Nrel(dB) THD+Nrms(dB) SINErms(dB) SINEpeak(dB)
10 1.8 -35.1 -51.7 -16.6 -13.0
20 1.7 -35.4 -49.1 -13.7 -10.0
40 1.2 -38.3 -50.9 -12.6 -8.8
80 1.0 -39.9 -52.1 -12.2 -8.3
160 1.1 -39.3 -51.3 -12.0 -8.1
320 1.4 -37.2 -49.0 -11.8 -8.0
640 1.6 -35.7 -47.8 -12.1 -8.2
1280 0.7 -43.6 -55.7 -12.1 -8.2
2560 1.8 -35.0 -47.1 -12.2 -8.3
5120 6.8 -23.3 -36.0 -12.7 -8.9
10240 8.9 -21.0 -35.5 -14.5 -10.8
20480 1.5 -36.5 -55.5 -19.0 -15.9
#
// jfet.c
//
// JFET comon source amplifier with gain adjust
// determin value of reverse audio taper pot for gain control
// given: JFET characteristics Idss, Vgsc, Vdd, and Rv
// calc: Vgsq, Idq, Vdq, Rd, Rs, gm, and Av (for a range of Rv)
//
/*
gcc -lm -o jfet jfet.c; ./jfet
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define sqr(x) ((x)*(x))
#define par(x,y) (1/(1/(x) + 1/(y)))
int
main(int argc, char *argv[]){
// Vgsq scale factor adjusted to set Idss*Rs
// Vgsc Idss Idss*Rs=2.18 Idss*Rs=1.18
// J201 JFET
// -0.3 .0002 20-30db d10 21-30
// -0.3 .0010 16-30db d14 19-30
// -0.5 .0010 12-24db d12 15-24
// -0.7 .0010 10-20db d10 12-20
// -1.0 .0002 09-15db d06 11-16
// -1.0 .0010 06-15db d09 09-16
// -1.5 .0002 06-11db d05 07-12
// -1.5 .0010 03-11db d08 06-12
// -.63 .00037 08-23db d15 using Vgsq = 0.79*Vgsc; Vdq = 4.07; Rv=50000
// -.63 .00037 13-28db d15 using Vgsq = 0.79*Vgsc; Vdq = 3.26; Rv=50000
// -.63 .00037 11-21db d10 using Vgsq = 0.56*Vgsc; Vdq = 3.41; Rv=50000
// problem is output impedance is extremely high, drain current low - maybe ok?
// J202 JFET
// -0.8 .0009 08-18db d10 11-19
// -0.8 .0020 08-18db d10 10-19
// -0.8 .0045 07-18db d11 10-19
// -1.0 .0045 05-15db d10 08-16
// -4.0 .0045 -05-00db -d05 -----
// -1.0 .003 06-19db d13 using Vgsq = 0.64*Vgsc; Vdq = 3.48;
// -1.0 .003 08-23db d15 using Vgsq = 0.78*Vgsc; Vdq = 3.48;
// -1.0 .003 10-25db d15 using Vgsq = 0.78*Vgsc; Vdq = 3.0;
// these are the values of all the first shipment transistors
// -1.7 .0022 06-18db d12 using Vgsq = 0.79*Vgsc; Vdq = 3.55; Rv=10000
// J201
// Idss Vgsq/Vgsc Vgsc Vdq sc Vdq Id Rs Rd Rv Avdb
// -.63 .00037 .79 .5 4.07 .00002 30500 56900 50000 08-23db d15
// -.63 .00037 .77 .5 3.54 .00002 24700 74500 50000 11-26db d15
// keeping Vdq and gain range steady while Id varies - lose gain range at higher Id
// -.63 .00037 .81 .35 3.35 .000013 38200 123600 50000 13-29db d16
// -.63 .00037 .79 .4 3.26 .000016 30500 106800 50000 13-28db d15
// -.63 .00037 .77 .46 3.26 .000020 24800 88900 50000 13-28db d15
// -.63 .00037 .75 .51 3.20 .000023 20400 77700 50000 13-28db d15
// -.63 .00037 .73 .56 3.17 .000027 17000 68000 50000 13-27db d14
// -.63 .00037 .71 .62 3.17 .000031 14400 57900 50000 12-26db d14
// -.63 .00037 .69 .67 3.19 .000036 12200 50900 50000 12-25db d13
// -.63 .00037 .67 .72 3.20 .000040 10500 44800 50000 12-25db d13
// -.63 .00037 .64 .79 3.20 .000048 8400 37400 50000 12-24db d12
// now we raise Vdq and see what happens - Idq and gain range same but gain abs drops
// -.63 .00037 .64 .82 3.33 .000048 8400 34900 50000 11-23db d12
// -.63 .00037 .64 .85 3.45 .000048 8400 32400 50000 11-23db d12
// keep 3.20 Vdq and see what happens - Idq and gain range same but gain abs drops
// -.63 .00037 .64 .82 3.33 .000048 8400 34900 50000 11-23db d12
// -.63 .00037 .64 .85 3.45 .000048 8400 32400 50000 11-23db d12
// go for ideal Vdq and see what happens
// -.63 .00037 .55 .82 2.75 .000075 4600 30000 50000 14-24db d10
// what if we just insert a different jfet?
// -.73 .00051 .55 .82 2.86 .000103 3900 20700 50000 12-22db d10
// -.73 .00051 .53 .82 2.77 .000113 3400 19800 50000 12-22db d10
// can we raise the current and widen the gain range keeping Vdq same? no, Idq drops
// -.73 .00051 .62 .68 2.77 .000074 6100 30300 50000 12-24db d12
// -.73 .00051 .66 .60 2.77 .000059 8100 38100 50000 12-25db d13
// can we widen the gain range keeping Vdq same?, yes
// -.73 .00051 .78 .33 2.77 .000025 23000 90500 50000 13-29db d16
double Vdd = 5;
double Vgsc = -.73;
double Idss = .00051;
double Rv = 50000;
double Vgsq, Idq, Vsq, Vdq, Rd, Rs, gm, Av, Avv, Avs, Rvi, sc1, sc2;
if(argv[1]==NULL || argv[2]==NULL) { printf("usage: jfet sc1 sc2\n"); return; }
else { sc1 = atof(argv[1]); sc2 = atof(argv[2]); }
printf("\n");
printf("Vdd = %8.2lf Volts d supply voltage\n",Vdd);
printf("Vgsc = %8.2lf Volts d JFET g-s cutoff voltage\n",Vgsc);
printf("Idss = %8.6lf Amps d JFET Id saturation current\n",Idss);
Vgsq = sc1 * Vgsc; //SPECIFY for best gain under headroom constraints
Idq = Idss *sqr(1 - Vgsq/Vgsc); //law
Vsq = -Vgsq; //Vgq = 0 for common source
Rs = Vsq/Idq; //law
Vdq = sc2 * (Vdd+Idss*Rs)/2; //SPECIFY for headroom
Rd = (Vdd-Vdq)/Idq; //law
gm = (-2*Idss/Vgsc)*(1 - Vgsq/Vgsc); //law
Av = Rd/(Rs+1/gm); //law
Avv = Rd/(par(Rs,Rv)+1/gm); //law
Avs = Rd*gm; //law
printf("\n");
printf("Vgsq = %8.2lf Volts s quies. g-s voltage, hi |Vgsq| = hi gain, Vsq=|Vgsq|\n",Vgsq);
printf("Idq = %8.5lf Amps l quies. drain current, hi Idq = lo dist.\n",Idq);
printf("Rs = %8.0lf Ohms l source resistor\n",Rs);
printf("\n");
printf("Vdq = %8.2lf Volts s quies. drain voltage - be less than %4.2lf\n",
Vdq, Vdd - Vdd/( 2+ 1/(Rd/(par(Rs,Rv)+1/gm)) ));
printf("Rd = %8.0lf Ohms l drain resistor\n",Rd);
printf("\n");
printf("gm = %8.5lf Mhos l transconductance\n",gm);
printf("Av = %8.2lf l gain with Rs tween src & gnd (%5.1lf dB)\n",Av,20*log10(Av));
printf("Avv = %8.2lf l gain with Rs+Rv tween src & gnd (%5.1lf dB)\n",Avv,20*log10(Avv));
printf("Avs = %8.2lf l gain with short tween src & gnd (%5.1lf dB)\n",Avs,20*log10(Avs));
printf("\n");
if(0) {
printf(" Rv(Ohms) Av Av(dB):\n");
for(Rvi=Rv;Rvi>=0;Rvi-=Rv/20) {
Av = Rd/(par(Rs,Rvi)+1/gm);
printf("%8.0lf %8.2lf %8.1lf\n", Rvi, Av, 20*log10(Av));
}
printf("\n");
}
if(1) {
int qp=0,ip=0,i,len=20; double Vgpp=1;
double Vg, Vs, Vd, Id, Vo, Av, Vdq;
Vdq = Vdd - (Rd/Rs)*((-(-1 + 2*Rs*Idss*((1/Vgsc)))
- sqrt(sqr(-1 + 2*Rs*Idss*((1/Vgsc)))
- 4*(Rs*Idss/sqr(Vgsc))*(Rs*Idss)))
/(2*(Rs*Idss/sqr(Vgsc))));
printf("Vg = gate voltage driven by input signal\n");
printf("Vs = source voltage determined by negative feedback\n");
printf("Vd = drain voltage according to determined Vs\n");
printf("Av = (Vd-Vdq)/Vg (Vdq=%2.2lf)\n\n",Vdq);
if(qp) printf(" a b c ");
if(ip) printf(" Id totV ");
printf(" Vg Vs Vd Vo Av");
printf(" Id>=Idss(%2.5lf) Vgs>|Vgsc|(%2.2lf) Vs<0 Vd<Vs\n",
Idss,-Vgsc);
for(i=len-1,Vg=Vgpp*(-0.5 + (double)i/len);
i>0;i--,Vg=Vgpp*(-0.5 + (double)i/len)) {
// quadratic solution for Vs using JFET formula
// Vs = Rs * Idss * sqr(1 - (Vg-Vs)/Vgsc);
double a = Rs*Idss/sqr(Vgsc);
double b = -1 + 2*Rs*Idss*((1/Vgsc)-(Vg/sqr(Vgsc)));
double c = Rs*Idss*(1 - 2*Vg/Vgsc + sqr(Vg/Vgsc));
Vs = (-b - sqrt(sqr(b) - 4*a*c))/(2*a);
Id = Vs/Rs; Vd = Vdd - Id*Rd;
Vo = Vd-Vdq; Av = Vo/Vg;
gm = (-2*Idss/Vgsc)*(1 - (Vg-Vs)/Vgsc);
if(qp) printf(" %8.3lf %8.3lf %8.3lf ", a,b,c);
if(ip) printf(" %8.5lf %8.3lf ", Id, Id*(Rs+ 1/gm+ Rd));
printf(" %8.3lf %8.3lf %8.3lf %8.3lf %8.2lf ",
Vg, Vs, Vd, Vo, Av);
printf("%s", Id >= Idss ? " * " : " - ");
printf("%s", Vg-Vs > -Vgsc ? " * " : " - ");
printf("%s", Vs < 0 ? " * " : " - ");
printf("%s", Vd < Vs ? " * " : " - ");
printf("\n");
}
}
}
# gcc -lm -o jfet jfet.c; ./jfet .5 .95
Vdd = 5.00 Volts d supply voltage
Vgsc = -0.73 Volts d JFET g-s cutoff voltage
Idss = 0.000510 Amps d JFET Id saturation current
Vgsq = -0.36 Volts s quies. g-s voltage, hi |Vgsq| = hi gain, Vsq=|Vgsq|
Idq = 0.00013 Amps l quies. drain current, hi Idq = lo dist.
Rs = 2863 Ohms l source resistor
Vdq = 3.07 Volts s quies. drain voltage - be less than 2.80
Rd = 15149 Ohms l drain resistor
gm = 0.00070 Mhos l transconductance
Av = 3.53 l gain with Rs tween src & gnd ( 11.0 dB)
Avv = 3.66 l gain with Rs+Rv tween src & gnd ( 11.3 dB)
Avs = 10.58 l gain with short tween src & gnd ( 20.5 dB)
Vg = gate voltage driven by input signal
Vs = source voltage determined by negative feedback
Vd = drain voltage according to determined Vs
Av = (Vd-Vdq)/Vg (Vdq=3.07)
Vg Vs Vd Vo Av Id>=Idss(0.00051) Vgs>|Vgsc|(0.73) Vs<0 Vd<Vs
0.450 0.681 1.395 -1.674 -3.72 - - - -
0.400 0.645 1.588 -1.481 -3.70 - - - -
0.350 0.609 1.779 -1.289 -3.68 - - - -
0.300 0.573 1.969 -1.099 -3.66 - - - -
0.250 0.537 2.157 -0.911 -3.64 - - - -
0.200 0.502 2.344 -0.725 -3.62 - - - -
0.150 0.467 2.528 -0.540 -3.60 - - - -
0.100 0.433 2.711 -0.358 -3.58 - - - -
0.050 0.399 2.891 -0.178 -3.55 - - - -
0.000 0.365 3.069 0.000 nan - - - -
-0.050 0.332 3.244 0.175 -3.50 - - - -
-0.100 0.299 3.416 0.347 -3.47 - - - -
-0.150 0.268 3.584 0.516 -3.44 - - - -
-0.200 0.236 3.749 0.681 -3.40 - - - -
-0.250 0.206 3.911 0.842 -3.37 - - - -
-0.300 0.176 4.067 0.998 -3.33 - - - -
-0.350 0.148 4.218 1.150 -3.28 - - - -
-0.400 0.120 4.363 1.294 -3.24 - - - -
-0.450 0.094 4.501 1.432 -3.18 - - - -
#
Copyright (c)
2009
Robert Drury
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts.
See "GNU
Free Documentation License".
Disclaimer: This information may contain inaccuracies and is
provided
without warranty. Safety first when working with high
temperatures,
pressures, potentials, speeds, energies, various
tools and materials.
that