A Hartley oscillator
A 2N3904 oscillator from a CDL netlist; transient start-up.
A common-base Hartley oscillator built around a 2N3904, whose model is read from 2N3904.lib with .include. The tank is the two 20 µH inductors L0 and L1, tapped at node n2, with C1; C2 feeds the tap back to the emitter. The netlist was written by a schematic editor in CDL, and uses .GLOBAL and the r=, c= and l= value forms. The transient analysis shows the oscillation building up from the dc operating point.
- v(vout)
Output
Reading .include file 2N3904.lib
* lib=examples cell=hartley view=schematic *
Transient Analysis Tue Sep 29 09:14:42 2026
--------------------------------------------------------------------------------
Index time vout n0
--------------------------------------------------------------------------------
0 0.000000e+00 1.200000e+01 1.464256e+00
1 1.000000e-09 1.200000e+01 1.464258e+00
2 2.000000e-09 1.200000e+01 1.464258e+00
3 4.000000e-09 1.200000e+01 1.464258e+00
4 8.000000e-09 1.200000e+01 1.464258e+00
5 1.600000e-08 1.200000e+01 1.464258e+00
6 3.200000e-08 1.200000e+01 1.464258e+00
7 6.400000e-08 1.200000e+01 1.464258e+00
8 1.280000e-07 1.200000e+01 1.464258e+00
9 2.280000e-07 1.200000e+01 1.464258e+00
10 3.280000e-07 1.200000e+01 1.464257e+00
11 4.280000e-07 1.200000e+01 1.464257e+00
12 5.280000e-07 1.200000e+01 1.464257e+00
13 6.280000e-07 1.199999e+01 1.464257e+00
14 7.280000e-07 1.199999e+01 1.464257e+00
15 8.280000e-07 1.200000e+01 1.464257e+00
16 9.280000e-07 1.200000e+01 1.464258e+00
17 1.028000e-06 1.200000e+01 1.464258e+00
18 1.128000e-06 1.200000e+01 1.464259e+00
19 1.228000e-06 1.200001e+01 1.464260e+00
20 1.328000e-06 1.200001e+01 1.464261e+00
21 1.428000e-06 1.200002e+01 1.464262e+00
22 1.528000e-06 1.200002e+01 1.464263e+00
23 1.628000e-06 1.200002e+01 1.464263e+00
24 1.728000e-06 1.200002e+01 1.464263e+00
25 1.828000e-06 1.200002e+01 1.464263e+00
26 1.928000e-06 1.200001e+01 1.464261e+00
27 2.028000e-06 1.200000e+01 1.464259e+00
28 2.128000e-06 1.199998e+01 1.464256e+00
29 2.228000e-06 1.199997e+01 1.464253e+00
30 2.328000e-06 1.199995e+01 1.464249e+00
31 2.428000e-06 1.199994e+01 1.464246e+00
32 2.528000e-06 1.199992e+01 1.464243e+00
33 2.628000e-06 1.199992e+01 1.464241e+00
34 2.728000e-06 1.199992e+01 1.464241e+00
35 2.828000e-06 1.199994e+01 1.464243e+00
36 2.928000e-06 1.199996e+01 1.464248e+00
37 3.028000e-06 1.200000e+01 1.464256e+00
38 3.128000e-06 1.200005e+01 1.464266e+00
39 3.228000e-06 1.200011e+01 1.464279e+00
40 3.328000e-06 1.200017e+01 1.464292e+00
41 3.428000e-06 1.200023e+01 1.464305e+00
42 3.528000e-06 1.200028e+01 1.464316e+00
43 3.628000e-06 1.200030e+01 1.464323e+00
44 3.728000e-06 1.200029e+01 1.464323e+00
45 3.828000e-06 1.200024e+01 1.464316e+00
46 3.928000e-06 1.200014e+01 1.464298e+00
47 4.028000e-06 1.200000e+01 1.464271e+00
48 4.128000e-06 1.199982e+01 1.464233e+00
49 4.228000e-06 1.199961e+01 1.464188e+00
50 4.328000e-06 1.199938e+01 1.464139e+00
51 4.428000e-06 1.199917e+01 1.464091e+00
52 4.528000e-06 1.199900e+01 1.464049e+00
53 4.628000e-06 1.199891e+01 1.464024e+00
54 4.728000e-06 1.199893e+01 1.464020e+00
55 4.828000e-06 1.199910e+01 1.464045e+00
56 4.928000e-06 1.199943e+01 1.464106e+00
57 5.028000e-06 1.199993e+01 1.464204e+00
58 5.128000e-06 1.200060e+01 1.464338e+00
59 5.228000e-06 1.200137e+01 1.464503e+00
60 5.328000e-06 1.200221e+01 1.464686e+00
61 5.428000e-06 1.200300e+01 1.464868e+00
62 5.528000e-06 1.200364e+01 1.465025e+00
63 5.628000e-06 1.200400e+01 1.465129e+00
64 5.728000e-06 1.200395e+01 1.465151e+00
65 5.828000e-06 1.200338e+01 1.465063e+00
66 5.928000e-06 1.200220e+01 1.464845e+00
67 6.028000e-06 1.200041e+01 1.464491e+00
68 6.128000e-06 1.199803e+01 1.464010e+00
69 6.228000e-06 1.199520e+01 1.463429e+00
70 6.328000e-06 1.199216e+01 1.462793e+00
71 6.428000e-06 1.198921e+01 1.462164e+00
72 6.528000e-06 1.198678e+01 1.461619e+00
73 6.628000e-06 1.198530e+01 1.461241e+00
... (1296 more lines)
The circuit: examples/hartley.cir
* lib=examples cell=hartley view=schematic * ******************************************************************************* * CDL netlist * * Library : examples * Top Cell Name: hartley * View Name: schematic * Netlist created: 03.Dec.2025 08:37:19 ******************************************************************************* *.SCALE METER .GLOBAL vdd! .GLOBAL gnd! R0 n0 gnd r=1k V0 vcc gnd dc 12 VV1 gnd 0 0 R2 vcc n1 r=10k .include 2N3904.lib C2 n2 n0 c=10n C0 n1 gnd c=10n L1 vcc n2 l=20u R1 n1 gnd r=2.2k C1 vcc vout c=2n Q0 vout n1 n0 2N3904 L0 n2 vout l=20u .control tran 100n 100u 0 plot vout print vout n0 .endc .END
Run it with spice hartley.cir, or open it with File › Load netlist in the Qt window. The plots and output above were made by util/mkexamples.py, which runs the deck in batch mode. All examples