Skip to main content

Posts

Showing posts with the label electronics

Draw a Common Emitter Amplifier with SchemDraw on Python3.7

I tried to draw a common emitter amplifier by using SchemDraw package in Google Colab Notebook. I installed SchemDraw version=0.14 by pip in Colab Notebook. This version is not latest. The latest version(=0.15) probably has some ploblem. pip install schemdraw==0.14 The version of Python in the notebook kernel is 3.7. It came up against a diffculty. In Python 3.7. or earlier the Walrus operator := is not available. import schemdraw print('Schemdraw',schemdraw.__version__) !python --version # Schemdraw 0.14 # Python 3.7.13 Sample codes in the SchemDraw Gallary are written with the Walrus operator. For instance the code below is one in the gallary and dose not work in the Colab Notebook. import schemdraw import schemdraw.elements as elm # Discharging capacitor with schemdraw.Drawing() as d: d += (V1 := elm.SourceV().label('5V')) d += elm.Line().right(d.unit*.75) d += (S1 := elm.SwitchSpdt2(action='close').up().anchor('b').label('$t=0$...

Draw high-quality electrical circuit schematic diagrams with Schemdraw in Python

Here I will draw electrical circuit diagrams with Schemdraw in Python. Schemdraw is a Python package for producing high-quality electrical circuit schematic diagrams. Circuit elements are added, one at a time, similar to how you might draw them by hand, using Python methods. Installation Schemdraw can be installed from pip using pip install schemdraw The schemdraw module "schemdraw.elements" is used for drawing circuit elements. It contains Basic Elements pre-defined for use in a drawing. import schemdraw import schemdraw.elements as elm You can create with using a schemdraw.Drawing and add elements using 'add'method or '+=' poperator. with schemdraw.Drawing() as d: d.add(elm.Resistor()) d.add(elm.Capacitor()) d += elm.Diode() Save figure to a file. Using the with block the drawing is displayed and saved as exiting the with block. The filename is assgined by parameter file in schemdraw.Drawing() like file='my_circui...

Oscillation Frequency for RC Phase-Shift Oscillator

Oscillation Frequency for RC Phase-Shift Oscillator Oscillation Frequency for RC Phase-Shift Oscillator ¶ In the pahse-shift oscillator the feedback circuit is three cascaded RC secrions. For simple design the capacitors and resistors in each section have the same value R and C. Fig. RC Phase-Shift Oscillator ¶ Calculate the Oscillation Frequency ¶ At each capacitor and resistor the currencies are $ \begin{aligned} i_1 &= j\omega C\,(v_1-v_a)\\ i_2 &= \cfrac{v_a}{R}\\ i_3 &= j\omega C\,(v_a-v_b)\\ i_4 &= \cfrac{v_b}{R}\\ i_5 &= j\omega C\,(v_b-v_2)\\ i_6 &= \cfrac{v_2}{R}\\ i_7 &= \cfrac{v_2}{R_i} \end{aligned} $ Kirchhoff's Current Law gives $ \begin{aligned} i_1 &= i_2+i_3\kern 2em&\dots(1)\\ i_3 &= i_4+i_5&\dots(2)\\ i_5 &= i_6+i_7&\dots(3)\\ \end{aligned} $ Eq.(1) becomes $ \begin{aligned} &j\omega C...