diff --git a/LM7805/index.html b/LM7805/index.html index 334b5bc..fb2d15e 100644 --- a/LM7805/index.html +++ b/LM7805/index.html @@ -435,8 +435,7 @@ if (!diagrams.length) { return; } - const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.5.0/mermaid.esm.min.mjs")).default; - const parser = new DOMParser(); + const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.2.3/mermaid.esm.min.mjs")).default; mermaid.initialize({ maxTextSize: 100000, @@ -452,52 +451,39 @@ let _nextMermaidId = 0; function makeMermaidImage(svg) { - const img = document.createElement("img"); - const doc = parser.parseFromString(svg, "image/svg+xml"); - const svgEl = doc.querySelector("svg"); - const { maxWidth } = svgEl?.style || {}; - const firstTitle = doc.querySelector("title"); - const firstDesc = doc.querySelector("desc"); - - img.setAttribute("src", `data:image/svg+xml,${encodeURIComponent(svg)}`); - if (maxWidth) { - img.width = parseInt(maxWidth); - } - if (firstTitle) { - img.setAttribute("alt", firstTitle.textContent); - } - if (firstDesc) { - const caption = document.createElement("figcaption"); - caption.className = "sr-only"; - caption.textContent = firstDesc.textContent; - return [img, caption]; + const img = document.createElement('img'); + const maxWidth = svg.match(/max-width: (\d+)/); + if (maxWidth && maxWidth[1]) { + const width = parseInt(maxWidth[1]); + if (width && !Number.isNaN(width) && Number.isFinite(width)) { + img.width = width; + } } - return [img]; + img.setAttribute('src', `data:image/svg+xml,${encodeURIComponent(svg)}`); + return img; } async function makeMermaidError(text) { - let errorMessage = ""; + let errorMessage = ''; try { await mermaid.parse(text); } catch (err) { errorMessage = `${err}`; } - const result = document.createElement("details"); - result.className = 'jp-RenderedMermaid-Details'; - const summary = document.createElement("summary"); - summary.className = 'jp-RenderedMermaid-Summary'; - const pre = document.createElement("pre"); - const code = document.createElement("code"); + const result = document.createElement('details'); + const summary = document.createElement('summary'); + const pre = document.createElement('pre'); + const code = document.createElement('code'); code.innerText = text; pre.appendChild(code); summary.appendChild(pre); result.appendChild(summary); - const warning = document.createElement("pre"); + const warning = document.createElement('pre'); warning.innerText = errorMessage; result.appendChild(warning); - return [result]; + return result; } async function renderOneMarmaid(src) { @@ -507,41 +493,30 @@ const el = document.createElement("div"); el.style.visibility = "hidden"; document.body.appendChild(el); - let results = null; - let output = null; + let result = null; try { const { svg } = await mermaid.render(id, raw, el); - results = makeMermaidImage(svg); - output = document.createElement("figure"); - results.map(output.appendChild, output); + result = makeMermaidImage(svg); } catch (err) { parent.classList.add("jp-mod-warning"); - results = await makeMermaidError(raw); - output = results[0]; + result = await makeMermaidError(raw); } finally { el.remove(); } parent.classList.add("jp-RenderedMermaid"); - parent.appendChild(output); + parent.appendChild(result); } void Promise.all([...diagrams].map(renderOneMarmaid)); });
diff --git a/UA78L05/index.html b/UA78L05/index.html index 77e7d67..dc6f30c 100644 --- a/UA78L05/index.html +++ b/UA78L05/index.html @@ -417,8 +417,7 @@ if (!diagrams.length) { return; } - const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.5.0/mermaid.esm.min.mjs")).default; - const parser = new DOMParser(); + const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.2.3/mermaid.esm.min.mjs")).default; mermaid.initialize({ maxTextSize: 100000, @@ -434,52 +433,39 @@ let _nextMermaidId = 0; function makeMermaidImage(svg) { - const img = document.createElement("img"); - const doc = parser.parseFromString(svg, "image/svg+xml"); - const svgEl = doc.querySelector("svg"); - const { maxWidth } = svgEl?.style || {}; - const firstTitle = doc.querySelector("title"); - const firstDesc = doc.querySelector("desc"); - - img.setAttribute("src", `data:image/svg+xml,${encodeURIComponent(svg)}`); - if (maxWidth) { - img.width = parseInt(maxWidth); - } - if (firstTitle) { - img.setAttribute("alt", firstTitle.textContent); - } - if (firstDesc) { - const caption = document.createElement("figcaption"); - caption.className = "sr-only"; - caption.textContent = firstDesc.textContent; - return [img, caption]; + const img = document.createElement('img'); + const maxWidth = svg.match(/max-width: (\d+)/); + if (maxWidth && maxWidth[1]) { + const width = parseInt(maxWidth[1]); + if (width && !Number.isNaN(width) && Number.isFinite(width)) { + img.width = width; + } } - return [img]; + img.setAttribute('src', `data:image/svg+xml,${encodeURIComponent(svg)}`); + return img; } async function makeMermaidError(text) { - let errorMessage = ""; + let errorMessage = ''; try { await mermaid.parse(text); } catch (err) { errorMessage = `${err}`; } - const result = document.createElement("details"); - result.className = 'jp-RenderedMermaid-Details'; - const summary = document.createElement("summary"); - summary.className = 'jp-RenderedMermaid-Summary'; - const pre = document.createElement("pre"); - const code = document.createElement("code"); + const result = document.createElement('details'); + const summary = document.createElement('summary'); + const pre = document.createElement('pre'); + const code = document.createElement('code'); code.innerText = text; pre.appendChild(code); summary.appendChild(pre); result.appendChild(summary); - const warning = document.createElement("pre"); + const warning = document.createElement('pre'); warning.innerText = errorMessage; result.appendChild(warning); - return [result]; + return result; } async function renderOneMarmaid(src) { @@ -489,41 +475,30 @@ const el = document.createElement("div"); el.style.visibility = "hidden"; document.body.appendChild(el); - let results = null; - let output = null; + let result = null; try { const { svg } = await mermaid.render(id, raw, el); - results = makeMermaidImage(svg); - output = document.createElement("figure"); - results.map(output.appendChild, output); + result = makeMermaidImage(svg); } catch (err) { parent.classList.add("jp-mod-warning"); - results = await makeMermaidError(raw); - output = results[0]; + result = await makeMermaidError(raw); } finally { el.remove(); } parent.classList.add("jp-RenderedMermaid"); - parent.appendChild(output); + parent.appendChild(result); } void Promise.all([...diagrams].map(renderOneMarmaid)); });
diff --git a/XL741/index.html b/XL741/index.html index d3b6d52..8b3c244 100644 --- a/XL741/index.html +++ b/XL741/index.html @@ -427,8 +427,7 @@ if (!diagrams.length) { return; } - const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.5.0/mermaid.esm.min.mjs")).default; - const parser = new DOMParser(); + const mermaid = (await import("https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.2.3/mermaid.esm.min.mjs")).default; mermaid.initialize({ maxTextSize: 100000, @@ -444,52 +443,39 @@ let _nextMermaidId = 0; function makeMermaidImage(svg) { - const img = document.createElement("img"); - const doc = parser.parseFromString(svg, "image/svg+xml"); - const svgEl = doc.querySelector("svg"); - const { maxWidth } = svgEl?.style || {}; - const firstTitle = doc.querySelector("title"); - const firstDesc = doc.querySelector("desc"); - - img.setAttribute("src", `data:image/svg+xml,${encodeURIComponent(svg)}`); - if (maxWidth) { - img.width = parseInt(maxWidth); - } - if (firstTitle) { - img.setAttribute("alt", firstTitle.textContent); - } - if (firstDesc) { - const caption = document.createElement("figcaption"); - caption.className = "sr-only"; - caption.textContent = firstDesc.textContent; - return [img, caption]; + const img = document.createElement('img'); + const maxWidth = svg.match(/max-width: (\d+)/); + if (maxWidth && maxWidth[1]) { + const width = parseInt(maxWidth[1]); + if (width && !Number.isNaN(width) && Number.isFinite(width)) { + img.width = width; + } } - return [img]; + img.setAttribute('src', `data:image/svg+xml,${encodeURIComponent(svg)}`); + return img; } async function makeMermaidError(text) { - let errorMessage = ""; + let errorMessage = ''; try { await mermaid.parse(text); } catch (err) { errorMessage = `${err}`; } - const result = document.createElement("details"); - result.className = 'jp-RenderedMermaid-Details'; - const summary = document.createElement("summary"); - summary.className = 'jp-RenderedMermaid-Summary'; - const pre = document.createElement("pre"); - const code = document.createElement("code"); + const result = document.createElement('details'); + const summary = document.createElement('summary'); + const pre = document.createElement('pre'); + const code = document.createElement('code'); code.innerText = text; pre.appendChild(code); summary.appendChild(pre); result.appendChild(summary); - const warning = document.createElement("pre"); + const warning = document.createElement('pre'); warning.innerText = errorMessage; result.appendChild(warning); - return [result]; + return result; } async function renderOneMarmaid(src) { @@ -499,41 +485,30 @@ const el = document.createElement("div"); el.style.visibility = "hidden"; document.body.appendChild(el); - let results = null; - let output = null; + let result = null; try { const { svg } = await mermaid.render(id, raw, el); - results = makeMermaidImage(svg); - output = document.createElement("figure"); - results.map(output.appendChild, output); + result = makeMermaidImage(svg); } catch (err) { parent.classList.add("jp-mod-warning"); - results = await makeMermaidError(raw); - output = results[0]; + result = await makeMermaidError(raw); } finally { el.remove(); } parent.classList.add("jp-RenderedMermaid"); - parent.appendChild(output); + parent.appendChild(result); } void Promise.all([...diagrams].map(renderOneMarmaid)); });
@@ -691,7 +651,7 @@

Full and simplified schematic

@@ -1385,9 +1345,10 @@

Input stage

@@ -1603,7 +1564,7 @@

Input offset and open loop gainVcc vcc 0 15V Vee vee 0 -15V -Vin vin 0 0 +Vin vin 0 DC 0 AC 1 Rd1 vin in+ 1 Rd2 in- 0 1 @@ -1613,7 +1574,7 @@

Input offset and open loop gain.include ua741.cir -.options savecurrents +* .options savecurrents ''') ng.cmd('dc vin -1m -200u 0.1u') @@ -1632,7 +1593,7 @@

Input offset and open loop gainInput offset and open loop gainInput offset and open loop gain

-
ng.cmd('alter vin -565.7u')
+
ng.cmd('alter vin DC -565.7u')
 print_op()
 
-
ng.cmd('alter vin -565.7u') +
ng.cmd('alter vin DC -565.7u') print_op()
@@ -1899,6 +1860,141 @@

Input offset and open loop gain

+
+ +
+ +
+
+ +
+ +
@@ -2085,7 +2181,7 @@

Measure with multimeter diff --git a/index.html b/index.html index c4cfdf5..0375b30 100644 --- a/index.html +++ b/index.html @@ -184,5 +184,5 @@

Shuo Chen's notes on various topics< diff --git a/sitemap.xml b/sitemap.xml index 20970fb..4a4eb79 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,122 +2,122 @@ https://chenshuo.com/notes/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/LM7805/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/UA78L05/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/XL741/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/bugs/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/dsp/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/git/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/lcc/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/links/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/lua/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/mem/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/reed-solomon/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/ssl/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/tl431/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/kernel/callgraph/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/kernel/changes/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/kernel/data-structures/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/kernel/docs/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/kernel/epoll/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/kernel/eventpoll/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/kernel/file-descriptor-table/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/kernel/profiles/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/kernel/reuseport/ - 2024-04-21 + 2024-04-24 daily https://chenshuo.com/notes/kernel/study/ - 2024-04-21 + 2024-04-24 daily \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index d7936ba..719e2e0 100644 Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ diff --git a/tl431.md.bak b/tl431.md.bak new file mode 100644 index 0000000..283a025 --- /dev/null +++ b/tl431.md.bak @@ -0,0 +1,229 @@ +# TL431 + +Comments and discussions: + +In this post, transistor = BJT, however, base currents are ignored by default. + +## Bandgap voltage reference + +See "How a bandgap reference works" section in + +The thermal voltage \(V_\mathrm{T} = \dfrac{kT}{q}\) is proportional to absolute temperature (PTAT). \(V_\mathrm{T} \approx 25.8\mathrm{mV}\) at room temperature (27°C, or 300K). + +> Ref. + +\(V_\mathrm{T}\) has a positive temperature coefficient of about 86.2μV/°C. + +> \(\dfrac{V_\mathrm{T}}{T} = \dfrac{k}{q} = \dfrac{ 1.380649\times 10^{-23}}{1.602176634\times 10^{-19}} \approx 8.62 \times 10^{-5}\mathrm{V/K}\) + +Therefore, we usually need \(10\ln 10 \cdot V_\mathrm{T}\approx 23V_\mathrm{T}\) to cancel out the tempco of one \(V_\mathrm{BE}\), which normally has a negative tempco about -2mV/°C. + +> \(10 \ln 10 \times 86.2 \approx 23 \times 86.2 = 1.983\mathrm{mV/°C}\) + +The actual tempco of \(V_\mathrm{BE}\) is related to \(V_\mathrm{BE}\) itself, its first order approximation is \(\dfrac{V_\mathrm{BE0} - V_\mathrm{g0}}{T_0}\), see formula in + +[Ebers–Moll model](https://en.wikipedia.org/wiki/Bipolar_junction_transistor#Ebers%E2%80%93Moll_model): +\(I_\mathrm{E} \approx I_\mathrm{S}\exp \dfrac{V_\mathrm{BE}}{V_\mathrm{T}}\), equivalently +\(V_\mathrm{BE} = V_\mathrm{T}\ln \dfrac{I_\mathrm{E}}{I_\mathrm{S}}\). + +[Reverse saturation current](https://en.wikipedia.org/wiki/Saturation_current) \(I_\mathrm{S}\) is directly proportional to the emitter-base junction area of a transistor, which we just call the *area* of the transistor. + +If we set different emitter currents of two transistors, +we will get two different \(V_\mathrm{BE}\), +their difference is called \(\Delta V_\mathrm{BE}\), +\(\Delta V_\mathrm{BE} = V_\mathrm{T}\ln\dfrac{J_1}{J_2}\). +\(J\) is current density, directly proportional to emitter current \(I_\mathrm{E}\), + inversely proportional to its area. + +## The internal schematic + +![TL431](media/tl431a.png) + +Resistor valuess are taken from official TI datasheet . + +The resistor and transistor numbering follows [SPICE model by Eugene Dvoskin](https://www.audio-perfection.com/voltage-regulators/linear-regulators/accurate-tl431-model-development-analysis-and-evaluation/). + +Transistor \(Q_{11}\) is drawn in dashed lines, as it is off in normal operation mode. +IIUC, it acts like a diode to shutdown the output when `Ref` is connected to `Anode`. + +## Analysis + +Ignoring base currents, assuming \(\beta\gg 1\). +As we will see in the next section , we can actually estimate that \(\beta\approx 120\). + +For the following analysis, we assume area ratio of \(Q_6:Q_2:Q_3\) being \(1:3:6\), taken from [The TL431 in loop control](https://powersimtof.com/Downloads/Papers/The%20TL431%20in%20loop%20control.pdf) by Christophe Basso. +Eugene Dvoskin's SPICE model (at the end of this page) uses a different ratio (\(0.5:1.2:2.2\)) though. + +![TL431](media/tl431b.png) + +> To show a larger image, right click and then "Open image in new tab". + +1. There are 11 transistors in total, \(Q_{11}\) is normally off, so we need to analyze 10 BJTs only. +1. It's easy to see that \(Q_9\) and \(Q_{10}\) form a Darlinton pair, it's the output stage. +1. It's also easy to recognize that \(Q_7\) and \(Q_8\) is a [current mirror](https://en.wikipedia.org/wiki/Current_mirror), if we assuming they have the same area. (In Ken Shirriff's schematic below, their areas are different, though.) +1. The rest of 6 transistors \(Q_1\dots Q_6\) are tangled together, let's analyse them in parts. + +**Notation**: + +* \(V_\mathrm{BE1}\) denotes the Base-Emitter junction voltage of transistor \(Q_1\) +* \(V_\mathrm{Q2B}\) denotes the base voltage of transistor \(Q_2\). +* \(V_\mathrm{Q3E}\) denotes the emitter voltage of transistor \(Q_3\), which is also known as \(\Delta V_\mathrm{BE}\). +* It's obvious from the schematic above, \(V_\mathrm{Q3C} = V_\mathrm{Q5B}\). +* \(I_\mathrm{B6}\) denotes the base current of transistor \(Q_6\), which equals to currents on \(R_6\), \(I_\mathrm{R6}\). +* \(V_\mathrm{R3}\) denotes the voltage across resistor \(R_3\), whish is \(9 \Delta V_\mathrm{BE}\), assuming \(I_\mathrm{C3}\approx I_\mathrm{E3}\). +* \(I_2\), \(I_3\), \(I_1\) are currents on \(R_2\), \(R_3\), \(R_4\), respectively, \(I_1 = I_2 + I_3\) as shown in the full schematic above. +* Ignoring base currents, \(I_2 = I_\mathrm{C2} = I_\mathrm{E2}\), \(I_3 = I_\mathrm{C3} = I_\mathrm{E3}\), \(I_1 = I_\mathrm{C1} = I_\mathrm{E1}\). + +## Calculation + +The reference voltage can be divided into 4 segments, from base of \(Q_1\) to ground: \(V_\mathrm{REF} = V_\mathrm{BE1} + V_\mathrm{R4} + V_\mathrm{R3} + V_\mathrm{BE5}\). + +**First**, we consider \(Q_2, Q_3\) and resistors connected to them, it's easy to find \(I_2 = 3I_3\). + +1. Assuming \(V_\mathrm{BE2}=V_\mathrm{BE5}\approx 0.65\mathrm{V}\), +\(V_\mathrm{R2}=V_\mathrm{R3}\). + +2. \(I_2 R_2 = I_3 R_3\), so \(I_2 = \dfrac{R_3}{R_2}I_3 = 3I_3\). +3. \(\Delta V_\mathrm{BE} = V_\mathrm{BE2} -V_\mathrm{BE3} = V_\mathrm{T}\ln 6\approx 46.3\)mV, given that the area of \(Q_3\) is \(2\times\) of \(Q_2\). +4. \(V_\mathrm{R3} = \dfrac{R_3}{R_1}\Delta V_\mathrm{BE} = 9\Delta V_\mathrm{BE}\), assuming \(I_\mathrm{C3}\approx I_\mathrm{E3}\). +5. The current on \(R_4\) is \(I_1 = I_2 + I_3 = 4I_3\), so \(V_\mathrm{R4} = \dfrac{4 R_4}{R_1}\Delta V_\mathrm{BE} = 16.4\Delta V_\mathrm{BE}\) +6. Sum of voltages across \(R_3\) and \(R_4\) is \(V_\mathrm{R3} + V_\mathrm{R4} = (9+16.4) \Delta V_\mathrm{BE} = 25.4\Delta V_\mathrm{BE}=25.4\ln 6 V_\mathrm{T}\approx 45.5 V_\mathrm{T}\approx 1.174\)V. +7. Tempco of \(V_\mathrm{R3} + V_\mathrm{R4}\) is \(45.5 \times 86.2\) = 3.922 V/°C, cancelling out negative tempco of \(V_\mathrm{BE1} + V_\mathrm{BE5}\), which is \(\dfrac{V_\mathrm{BE1} - V_\mathrm{g0}}{T_0} +\dfrac{V_\mathrm{BE5} - V_\mathrm{g0}}{T_0}\) +8. In theory, \(V_\mathrm{REF} = 2V_\mathrm{g0}\) when its tempco is zero. + +\(R_4\) is critical, it controls both \(V_\mathrm{REF}\) and its tempco, I guess that's why it shows 3 decimal places in the datasheet (3.28kΩ), while other resistors has only 2. + +Estimating \(\beta\) for fun. It's rough estimation, so we use rounded values, like 1.2V, instead of 1.174V for \(V_\mathrm{R3} + V_\mathrm{R4}\). + +1. Assuming \(V_\mathrm{BE1}=V_\mathrm{BE5}=0.65\)V for now. +2. Sum of voltages across \(R_3\) and \(R_4\) is \(V_\mathrm{REF} - V_\mathrm{BE1}-V_\mathrm{BE5} = 2.5-2\times 0.65 = 1.2\mathrm{V}\) +3. The total resistance across the aforementioned 1.2V is \(R_4 + R_2/\!/R_3 = 3.2 + 2.4 /\!/ 7.2 = 3.2+1.8 = 5\)kΩ +4. The current on \(R_4\) is \(I_1 = \dfrac{1.2}{5} = 0.24\)mA, so +\(I_\mathrm{E1} = 240\)μA, +5. The current on \(R_4\) is \(I_1 = I_2 + I_3 = 4I_3\), so \(I_3 = I_1/4 = 60\)μA, and \(I_2 = 3I_3 = 180\)μA. +6. The datasheet says typical \(I_\mathrm{REF}=I_\mathrm{B1}=2\)μA, so we estimate \(\beta + 1 = I_{E1}/I_\mathrm{B1} = 240/2 = 120\). + + +![TL431](media/tl431dc1.png) + +The voltages and currents shown in above schematic are from SPICE simulation. + +**Second**, we add \(Q_4\dots Q_8\) into the picture, omitting \(Q_9\) and \(Q_{10}\) for now. + +It's safe to assume that all \(Q_4\dots Q_8\) share the same (emitter) current, because \(Q_7\) and \(Q_8\) form a current mirror, and it sets the currents of \(Q_4\), \(Q_5\), and \(Q_6\) to be all the same. + +We will show that the current is 60μA for \(Q_4\dots Q_8\), same as emitter current of \(Q_3\). + +1. \(V_\mathrm{Q2B} \approx V_\mathrm{Q6B}\), because \(I_\mathrm{B6}\) is less than 1μA, so voltage drop on \(R_6\) is less than 1mV. +2. Area of \(Q_6\) is 1E, area of \(Q_2\) is 3E, with the same base voltage, \(I_\mathrm{E2} = 3 I_\mathrm{E6}\) +3. We already knew that \(I_\mathrm{E2} = I_2 = 3I_3\), so \(I_3 = I_\mathrm{E6} = I_\mathrm{E3} = 60\)μA. In other words, \(Q_6\) has same current as \(Q_3\). +4. Due to current mirror made of \(Q_7\) and \(Q_8\), \(Q_4\) and \(Q_5\) mirrors the current of \(Q_6\). (But, see the note below.) +5. In conclusion, 6 transistors \(Q_3\dots Q_8\) all have the same current as \(Q_3\), when balanced, that is \(I_3=60\)μA. + +Although this conclusion matches the simulation of the next section, there is an **unsolved puzzle**: the current mirror of \(Q_7\) and \(Q_8\) is supposed to copy \(Q_7\)'s current to \(Q_8\), but not vice versa. However, the analysis above assume current of \(Q_6\), \(I_\mathrm{E6}\), is set by \(V_\mathrm{Q2B}\), then mirrored in \(Q_4\) and \(Q_5\). +Is this reasonable? My explaination is that the feedback of output stage will bring the circuit into the balanced state, where \(I_\mathrm{E4} = I_\mathrm{E6}\). (\(I_\mathrm{C6} = I_\mathrm{C8} - I_\mathrm{B9}\)) + +The following diagram shows what we have analyzed so far. + +![TL431](media/tl431dc2.png) + +The voltages and currents shown in above schematic are from SPICE simulation. + +**Third**, let's calculate the required \(I_\mathrm{S}\), just for fun. + +Recall that \(V_\mathrm{REF} = V_\mathrm{BE1} + V_\mathrm{R4} + V_\mathrm{R3} + V_\mathrm{BE5} = 2.50\)V, in order to get \(V_\mathrm{R4} + V_\mathrm{R3} = 1.2\)V, we need \(V_\mathrm{BE1} + V_\mathrm{BE5} = 1.3\)V. + +There are at least two ways to achieve that, given that \(I_\mathrm{E1} \approx 4 I_\mathrm{E5}\): + +1. Area of \(Q_1\) is \(4\times\) of \(Q_5\), so \(V_\mathrm{BE1} = V_\mathrm{BE5} = 0.65\)V. + * \(I_\mathrm{E5}=I_\mathrm{S}\exp\dfrac{V_\mathrm{BE5}}{V_\mathrm{T}}=60\)μA + * \(I_\mathrm{S}\exp\dfrac{650}{25.8} = 60\times 10^{-6}\) + * \(I_\mathrm{S} = 0.6865\)fA, this is for \(Q_5\) + * for \(Q_1\), its \(I_\mathrm{S1} = 4 I_\mathrm{S} = 2.746\)fA. +2. Area of \(Q_1\) is the same as \(Q_5\), +so \(V_\mathrm{BE1} = V_\mathrm{BE5} + V_\mathrm{T}\ln 4\approx V_\mathrm{BE5}+35.8\)mV. + * \(V_\mathrm{BE5} = (1300 - 35.8)/2 = 632\)mV, \(V_\mathrm{BE1} = 668\)mV + * \(I_\mathrm{S}\exp\dfrac{632}{25.8} = 60\times 10^{-6}\) + * \(I_\mathrm{S} = 1.379\)fA + * for \(Q_1\), its \(I_\mathrm{S1} = I_\mathrm{S} = 1.379\)fA. + +In the SPICE model, we set \(I_\mathrm{S} = 1.0\)fA for NPN transistors. + +**Fourth**, the feedback loop. + +TODO: write this part. + +## Simulation + +Simulating the following circuit using NgSpice in Python Jupyter. + +![TL431](media/tl431dc3.png) + +SPICE netlist and results are in , +view in [Google Colab](https://colab.research.google.com/github/chenshuo/notes/blob/master/notebooks/TL431.ipynb). + +![TL431](media/tl431c.png) + +> To show a larger image, right click and then "Open image in new tab". + +**DC Gain** + +It's about 60dB from simulation, higher than 55dB as stated in TI's datasheet. + +**Dynamic Impedance** + +It's 0.14Ω from simulation, lower than 0.2Ω as stated in the datasheet. + +## Another schematic by Ken Shirriff + + + +> The resistances on the official schematic above are very different from what can be seen from the die. + +Note: the transistor and resistor numbers in the following schematic match Ken Shirriff's post, don't be confused with results above. + +![TL431](media/tl431ken.png) + +> To show a larger image, right click and then "Open image in new tab". + +Here's brief analysis of its DC operating point, ignoring base currents. + +1. Assuming \(V_\mathrm{BE4}\approx V_\mathrm{BE6}\approx 0.65\mathrm{V}\) +1. Voltage drops on \(R_2\) and \(R_3\) are approx the same. \(R_2 = R_3\) and \(V_\mathrm{R2}\approx V_\mathrm{R3}\), so \(I_2\approx I_3\). +1. The area ratio of \(Q_4\) and \(Q_5\) is \(0.9:7.2\), so voltage on \(R_4\) is \(\Delta V_\mathrm{BE} = V_\mathrm{T}\ln \dfrac{7.2}{0.9}= V_\mathrm{T}\ln 8\approx 53.6\mathrm{mV}\) at room temperature. + +1. Assuming for \(Q_5\), its \(I_\mathrm{C5} = I_\mathrm{E5} = I_3\), so voltage on \(R_3\) is \(\dfrac{24}{3.4}\Delta V_\mathrm{BE}\) + +1. Voltage on \(R_1\) is \(I_1 R_1 = 2 I_3 R_1 = 2 \dfrac{R_1}{R_4}\Delta V_\mathrm{BE} =\dfrac{2\times 25}{3.4} \Delta V_\mathrm{BE}\). + +1. In total, \(V_\mathrm{REF} = V_\mathrm{BE6} + V_\mathrm{R3} + V_\mathrm{R1} + V_\mathrm{BE2} = \dfrac{2\times 25 + 24}{3.4} \Delta V_\mathrm{BE} + V_\mathrm{BE6} + V_\mathrm{BE2} = \dfrac{74}{3.4} \Delta V_\mathrm{BE} + 2V_\mathrm{BE} \) + +1. The PTAT portion \(\dfrac{74}{3.4} \Delta V_\mathrm{BE} = 21.765\times\ln 8 V_\mathrm{T} \approx 45.26 V_\mathrm{T}\), which should be in right amount to cancel tempco of two \(V_\mathrm{BE}\). + +1. Assuming \(R_1 + R_2/\!/R_3 = 5\mathrm{kΩ}\), +so that \(I_\mathrm{R1}\approx 240\)μA. With \(I_\mathrm{REF} = 2\)μA, we have \(\beta = 120\). + * \((25+\dfrac{24}{2})R=5000\), \(R = 135Ω\) + * \(R_1=3.38\mathrm{kΩ}\) + * \(R_2=R_3=3.24\mathrm{kΩ}\) + * \(R_4=460\mathrm{Ω}\) + +1. TODO: analyse the current mirror of gain 0.5, made of \(Q_8\) and \(Q_9\). + +## SPICE model by Eugene Dvoskin + + + +Simulating the following circuit using NgSpice in Python Jupyter. + +![TL431](media/tl431ed1.png) + +, view in [Google Colab](https://colab.research.google.com/github/chenshuo/notes/blob/master/notebooks/AnalogCircuits.ipynb#scrollTo=e59f94ac-a62b-4332-b1f6-9154db064b26). + +Scroll down to "TL431 Regulator" section. + +![TL431](media/tl431ed.png) + +The Vref can be tuned to 2.495V by changing R4 to 3.22kΩ. + +μA +kΩ