Gas station without pumps

2018 December 16

I may be self-publishing forever

Filed under: Circuits course — gasstationwithoutpumps @ 11:25
Tags: , , ,

Sigh, just as I’m finishing my textbook, I find out that publishers don’t want new textbooks. I did have one feeler from Springer, whose book prices are high and royalties low, and they wanted me to provide camera-ready copy. What were they going to do as publishers, other than keep almost all the money?

I have been self-publishing drafts of the text book in PDF format through LeanPub. I can sell the text for about $10 and make more money per book than if a publisher sold it for$80.  I have a new version that I tried to put up on LeanPub last Thursday, but I ran into a problem on their web site in changing the URL, and I’m waiting for them to fix it.  They were able to reproduce the problem and have told me that fixing it is a high priority, so I’ll probably be able to release the new version early this week (maybe 2018 Dec 17 or 18).

My big problem for the textbook is marketing (whether self-publishing or through traditional publishers)—how do textbook authors get other instructors aware of their book and willing to try it in a course?  Because my book takes a somewhat different approach to teaching electronics than the standard university course (which does about a year of applied math and circuits before doing any design), it isn’t a direct replacement for existing texts, but requires some redesign of curriculum.  That makes it an even harder sell, though I think that my design-early approach to teaching engineering is more in line with pedagogical research.

2017 January 7

Book draft 2017 Jan 7

Filed under: Circuits course — gasstationwithoutpumps @ 17:03
Tags: , , ,

I’ll be releasing an updated version of the Applied Electronics for Bioengineers text on LeanPub today.  I’ll probably raise the minimum price next week, to reflect the improved quality, but I’ll give people a few days to get the book at the old price.  (Remember that the LeanPub model allows you to get all future editions of the book free, as long as I continue publishing through them, so there is no reason to wait until a new edition comes out.)

I’ll list the changes in two sections: changes that were made since the October 2016 release, then changes that were made in the Oct 2016 release (because I don’t seem to have posted those to the blog).

Changes since October 2016

• Fleshed out assignment schedule and moved to Preface.
• Rearranged several of the early chapters (without significant content change) for better ordering of assignments.
• Added mention of Analog Discovery 2 to oscilloscope chapter, replaced some Bitscope traces with Analog Discovery~2 traces.
• Added bonus frequency response activity to pressure sensor lab.
• Added Lego-brick pictures for the optical-pulse-monitor lab.
• Revised all chapters and labs from the microphone chapter to the EKG lab (the second half of the course).  Many of the changes were minor revisions (typo fixes, indexing, changing to numbered exercises, spell check).
• Added exercises to the microphone chapter and moved some exercises from the microphone lab to the microphone chapter.
• Moved some of the oscilloscope introduction from the microphone lab to the sampling lab.
• Rewrote DC analysis of microphone to use function generator, rather than potentiometer, for variable voltage.
• Added R+L figure to loudspeaker chapter, rather than referring to impedance chapter.
• Moved inductor description to new chapter just before loudspeakers.
• Added RMS power exercise and R-L plot exercise to loudspeaker chapter.
• Moved some intro amplifier material from preamplifier lab to pressure-sensor lab, reflecting change in order of labs.
• Moved some instructions about color coding wiring from preamplifier to an earlier lab.
• Added mention of using earbuds instead of loudspeakers for preamplifier lab.
• Redid Miller plateau oscilloscope trace using Analog Discovery 2, using smaller gate resistor to get higher speed.
• Added cross-section of a power nFET (still needs to be redrawn)
• Fixed clipping on several schematics (the Vdd power symbol gets clipped if at the top of the schematic—a known bug in SchemeIt).
• Put inductive load in the single-nFET driver schematic, including flyback diode.
• Added explanation of why the crude model for computing slew rate is so far off.
• Removed most references to obsolete AOI514 nFETs (using NTD4858N nFETs instead).  This required gathering new data to characterize the transistors.
• Redid the section on open-collector outputs for LM2903 comparators.
• Added table of conductivity for NaCl solutions.
• Added section on 4-electrode conductivity measurements.
• Moved information about nulling ohmmeters when measuring resistance from electrode lab to loudspeaker lab.
• Reiterated some of the EKG safety info in the EKG lab.

Changes between April 2016 and October 2016

• Added more background to first chapter (logarithms, picture of complex plane) and started chapter numbering at 1 instead of 0.
• Rearranged chapters for new lab order, with all the audio labs after the pressure sensor and optical pulse monitor.
• Updated information on using lead-free solder.
• Added a generic block diagram to lab report guidelines, and added definition of “port” to the block diagram discussion.
• Added subsection on Thévenin equivalent of voltage divider.
• Added section on series and parallel connections to resistance chapter, to reflect lower prerequisite expectations of course.
• Moved some gnuplot exercises into thermistor lab from sampling and aliasing, to reflect new lab order, also moved PteroDAQ installation instructions.
• Added picture of metal thermometer to thermistor lab.
• Added voltmeter connection schematic to DAQ chapter.
• Moved details of PteroDAQ out of DAQ chapter to separate appendix.
• Added potentiometer schematic and photo to resistance chapter.
• Split data acquisition from sampling and aliasing into separate chapters.
• Improved figure showing aliasing and Nyquist frequency.
• Added pictures for wire stripping and flying resistors to sampling lab.
• Added scaffolding for oscilloscope probe exercise.
• Hysteresis measurement changed to use function generator.
• Moved multi-stage amplifier discussion to beginning of amplifier chapter and beefed it up.
• Added introduction to differential amplifiers before instrumentation amps and op amps.
• Added pH meter block diagram to beginning of amplifier chapter.
• Moved discussion of clipping to the end of the instrumentation amplifier section.
• Added active low-pass filters to amplifier chapter.
• Added chapter on transimpedance amplifiers with section on log-transimpedance amplifiers and rewrote pulse-monitor lab to use logarithmic current-to-voltage conversion.
• Added discussion of absorbance of melanin, fat, and water to blood section.
• Moved the instrumentation amplifier internals to new chapter, before the EKG chapter.
• Simplified the sensitivity calculation for LEDs and phototransistors, making the exercise more productive.
• Added text to caption of microphone preamp photo.
• Moved loudness section from the amplifier chapter to the microphone chapter.
• Added notes at end of loudspeaker lab to improve student reporting of models.
• Added more safety information to EKG chapter
• Made all exercises be numbered, and changed most of the prelab questions into numbered exercises.
• Added equipment-needed lists to the beginning of each lab.
• Redrew several block diagrams using draw.io, and added captions to several figures to indicate what drawing tool was used.
• Changed caption formatting to be more distinctly different from body text.
• Cleaned up several schematics.

2016 October 16

Lagrangian mechanics for linear electronics

Filed under: Uncategorized — gasstationwithoutpumps @ 13:27
Tags: , ,

This post is a continuation of Having trouble learning Lagrangian mechanics, looking at electronic systems rather than mechanical ones.  Again, this is not intended as a tutorial but a dump of my understanding, to clarify it in my own head, and to get corrections or suggestions from my readers, many of whom are far better at physics than me.

For electronics, I’ll use charge $q$ as my coordinate, with current $i = \dot q$ as its derivative with respect to time.  In all but the simplest circuits, there will be multiple charges or currents involved, which I’ll distinguish with subscripts.

Some notation:

• $\mathcal{L}$ is the difference between kinetic and potential energy of the system.  The potential energy will be the energy stored in capacitors, $\frac{q^2}{2C}$, and the kinetic energy the energy in the inductors, $L\dot q^2/2$.  (Note: that is only self-inductance.  If we have mutual inductance $L_{12}$ between two inductors, we need to use $L_{12}\dot q_1\dot q_2 /2$ for the kinetic energy—I’m a bit confused by that, as we could have negative kinetic energy.  I rarely use inductors or transformers in my electronics, so I’ve not had to work out my confusion yet.)
• $\mathcal{P}$ is the power dissipated by the resistors in the system: $R{\dot q}^2/2$.
• $\mathcal{F}$ is the vector input to the system needed to make the energy balance work out.  By using charge for each coordinate, the units here will be volts.

With this notation, the basic formula is

$\frac{d}{dt}\frac{\partial \mathcal{L}}{\partial \dot q} - \frac{\partial \mathcal{L}}{\partial q} + \frac{\partial \mathcal{P}}{\partial \dot q} = F_{q}~.$

Let’s check the units:

• Potential energy: $\frac{\partial}{\partial q} \left(\frac{q^2}{2C}\right)= \frac{q}{C}$, which is indeed volts.
• Kinetic energy: $\frac{d}{dt}\frac{\partial L\dot q^2/2}{\partial \dot q} = L\ddot q$, which is also volts.
• Dissipated power:$\frac{\partial R{\dot q}^2/2}{\partial \dot q} = R \dot q$, which is again volts (Ohm’s Law).

Now all we need to do is to figure out which $q_i$ or $\dot q_i$ has to be associated with each component of the system, and what voltages the $\mathcal{F}_i$ correspond to.  I think that will be easiest if I have some specific circuits to work with.  Let’s start with a very simple one:

Simple RLC series circuit with a voltage source.

We can use a single coordinate, the charge on the capacitor, $q_1$, so that the current flow $\dot q_1$ is clockwise in the schematic. We get the Lagrangian $\mathcal{L} = L_1{\dot q_1}^2/2 - \frac{{q_1}^2}{2C_1}~.$ The power dissipation is $\mathcal{P}=R_1{\dot q_1}^2/2$, and taking the derivatives gives us $\mathcal{F}_1 = L_1 \ddot q_1 + R_1 \dot q_1 + q_1/C$, which is the voltage for the voltage source.

For electronics modeling, we often want to look at the ratio of two different voltages in a system, for example, the output of a filter relative to the input to a filter. How do we set that up? Let’s look at a very simple low-pass RC filter:

The upper schematic shows the normal way to represent the low-pass filter. The lower schematic shows it with a voltage source and a voltmeter, with two loops (one of which has no current).

The potential energy is just $\frac{(q_1+q_2)^2}{2C}$, there is no kinetic energy (no inductors), and the dissipation is $R{\dot q_1}^2/2$. Taking the derivatives of the Lagrangian gives us
$\mathcal{F}_1 = \frac{q_1 + q_2}{C} + R \dot q_1$ and
$\mathcal{F}_2 = \frac{q_1 + q_2}{C}$.
In other words, we get the voltage at the voltage source and the voltage at the voltmeter. If we want to do anything with these equations, we need to recognize that the $q_2$ and $\dot q_2$ terms are 0 (modeling the voltmeter as a perfect infinite impedance), giving us the usual formulas for the input and output voltage, in terms of the charge on the capacitor: $v_{in} = \frac{q_1}{C} + R \dot q_1$ and $v_{out} = \frac{q_1}{C}$.

If we take Laplace transforms, we get $V_{in} = Q_1/C + RsQ_1$ and $V_{out}= Q_1/C$, which gives us the transfer function $\frac{V_{out}}{V_{in}} = \frac{1}{RCs + 1}$, as expected.  (Plug in $s=j\omega$ to get the usual format in terms of angular frequency.)

I could do another, more complicated example, but I think that the idea is clear (to me):

• Make a charge (and current) coordinate for each current loop in the circuit—including a dummy loop with current 0 wherever you want to measure the voltage.
• Set up the Lagrangian by adding terms for each inductor (kinetic energy) and subtracting terms for each capacitor (potential energy), and set up the power-dissipation functions by adding terms for each resistor.
• Take the appropriate derivatives to get the voltages.
• If needed, eliminate charge terms by using more easily measured voltage terms.

I don’t find this process any simpler than using complex impedances and the usual Kirchhoff laws, but it isn’t much more complicated.  It may be easier to use the Lagrangian formulation than setting up the equations directly when there are mutual inductances to deal with—I’ll have to think about that some more.

Of course, the big advantage I’ve been told about for Lagrangian mechanics is in electromechanical systems, where you model the mechanical part as in Having trouble learning Lagrangian mechanics and the electronic part as in this post, with only a conservative coupling network added to combine the two. It is in setting up the coupling network that I get confused when trying to model electromechanical systems, and I’ll leave that confusion for a later post.

2015 December 21

New tools and parts list for applied electronics

Filed under: Circuits course — gasstationwithoutpumps @ 16:41
Tags: , ,

I just finished making a new parts and tools list for the Spring 2016 offering of my applied electronics course.  The class doesn’t start until March, but I’m getting the parts list in early this year, so that the staff have sufficient time to buy and repackage everything before classes start.  I really want the parts and tools to be available on the first lab day (29 March 2016) this time.

I’ve spent a lot of time finding appropriate tools and parts at low cost, but the UCSC purchasing system may make it difficult, as they don’t allow the use of major sites like Amazon and AliExpress, which are often the only way to get low-cost items from China without doubling the price.

2015 November 5

Book draft 2015 Nov 5

Filed under: Circuits course — gasstationwithoutpumps @ 22:39
Tags: , , , , ,

I released an updated version of the Applied Electronics for Bioengineers text today.  This draft involved several changes:

• Added modifier for “resistor” at end of Section 5.1
• Changed “load resistor” to “bias resistor” in microphone chapter and lab.
• Fixed microphone schematics to use polarized microphones.
• Figure 11.2 changed to use only one differential channel on PteroDAQ.
• Brief explanation of RMS added to Section 3.2
• Small fixes to Chapters 9–16 and indexing terms added.
• Index cleaned up.
• 60Hz FM figure added to Chapter 14
• Updated power discussion in Sections 0.5, 12.3, 23.1
• Updated to include Teensy 3.2
• Major rewrite of Chapter 23 (Class D power amp)

I’m still not finished with the Class D chapter, but I managed to test today an H-bridge circuit using a 9V power supply, which could provide ±9v signals to a loudspeaker (the full 10W that the loudspeaker can take).  I did not actually drive the loudspeaker that far, but I confirmed that the H-bridge was providing the full voltage range for PWM and that I was getting clean signals at the loudspeaker for loudness I was willing to tolerate listening to.

I’m now convinced that an H-bridge design is a simpler approach to teach the students, as well as being more useful for students who go on into the “assistive technology: motor” concentration.  Modifying the H-bridge to use logic-level signals from the comparator but high voltages for the power FETs turned out to be quite simple.  I just added a small nFET and a couple of resistors to make an inverter with a small voltage swing on the output:

Q1 and the resistors R1 and R2 form an inverter for driving the pFET. Sizing R1 and R2 determines the voltage swing on the pFET gate (Q2) and how fast the turn on and turn off are. Of course, when Q3 is on, there is a current through it that is wasted (not delivered to the load), but I was able to keep that down to about 15mA.

Next Page »