## Time Shifting and Scaling of Functions

We’ll begin with a square function, f(t), that has a an amplitude of 1, a start time of 2 seconds and an end time of 4 seconds.

Next, a time shift is demonstrated. Here our function is changed from f(t) to f(t-2). Notice that subtracting 2 from t in the function results in a positive shift of the graph.

In the next two graphs t will be scaled. Scaling t is not quite as intuitive as we may have expected. When we multiply t by 2, corresponding points of the function now occur at 1/2 the time they previously had. When we divide t by 2, each corresponding time on the graph occurs at a t that is now multiplied by 2. Notice that each of these factors directly affects the duration of the signal.

Scaling the amplitude has more intuitive results. If we multiply f(t) by 2, the amplitude of 1 is changed to 2. Multiplying f(t) by 1/2 results in an amplitude of 1/2.

Finally, multiplying t by -1 mirrors our function over the y-axis. Each time now occurs at its negative.

Example:

Here we will attempt to convert f(t) into 2*f(.5t+3). The graph of f(t) is shown below.

The easiest way to handle this type of problem without error is to manipulate the function one step at a time. First, I have converted f(t) into 2*f(t). Only the peaks are changed here (by a factor of 2).

Next, I convert 2*f(t) into 2*f( $\frac{1}{2}$ t). Notice how the $\frac{1}{2}$ actually expands our graph duration by a factor of 2 (from a 6 sec duration to a 12 sec duration).

Finally, we move from 2*f( $\frac{1}{2}$ t) to 2*f( $\frac{1}{2}$ t + 3). As shown in the discussion above, this is a time shift. Time shifts can be a little confusing because adding results in a negative shift of our graph. Try to think of it as our signal occurring 3 seconds earlier than before, reading from left to right on the graph. The easiest way to do this part is shift each x-intercept by 3 seconds (to the left, of course).

## Calculating Electron and Hole Concentrations in a p-n Junction

### Calculating hole and electron concentrations

Sometimes it can be complicated understanding and calculating hole and electron concentrations. My intent in this article is to briefly, but thoroughly describe what the variables used in these calculations mean and how to use them.

To begin I will introduce our variables

$n =$ concentration of free electrons (donors)
$p =$ concentration of holes (acceptors)
$n_i$ = number of free electrons and holes in a unit volume

### In thermal equilibrium(or no doping)

$n=p=n_i$ and, therefore $n \cdot p=n_i^2$

However, doping is common in most examples. To increase the concentration of free electrons, an element with 5 valence electrons is used (i.e. Phosphorous). The resultant material is said to be n-type. To increase the number of holes, an element with 3 valence electrons is used (i.e. Boron). The resultant material is said to be p-type.

This introduces subscript n’s and p’s along with our concentration of free electron and hole variables.

### n-type silicon:

$n_n =$ concentration of free electrons (in n-type silicon)
$p_n =$ concentration of holes (in n-type silicon)

### p-type silicon:

$n_p =$ concentration of free electrons (in p-type silicon)
$p_p =$ concentration of holes (in p-type silicon)

Note: The subscript indicates whether the material is n-type or p-type.

Calculations

Typically you first want to identify whether the material you are working with is p-type or n-type. This introduces two new variables. $N_D$ which refers to the concentration of donor atoms and $N_A$ which refers to the concentration of acceptor atoms.

### n-type silicon:

Here you will use the variables $n_n$, $p_n$, $n_i^2$, and $N_D$.

$n_n \approx N_D \quad \quad n_n \cdot p_n = n_i^2 \quad \quad p_n = \frac{n_{i}^{2}}{N_{D}}$

### p-type silicon:

Here you will use the variables $n_p$, $p_p$, $n_i^2$, and $N_A$.

$p_p \approx N_A \quad \quad p_p \cdot n_p = n_i^2 \quad \quad n_p = \frac{n_{i}^{2}}{N_{A}}$

In most cases $n_i^2$ and $N_D$ or $N_A$ will be given and you will be able to find $n_n$ or $p_p$. Then you will find $p_n$ or $n_p$ from the equations above.

## Important Amplifier Properties

### Isolation

• For the biological subject, against electric shock from the amplifier’s power source(s)–or, how to not kill your patient while taking measurements!
• For the signal-to-noise ratio (SNR): isolation keeps the (60-Hz mains and other) noise out of the sensor pickup–and out of the amplifier input.

One simple way to isolate the input is to use an LED/phototransistor pair:

The sensor is connected to an LED, which outputs light of intensity proportional to signal voltage.

The light from the LED falls on a photodiode or phototransistor, which is biased in such a way that current only flows when light hits the device, and the current (and thus measured voltage) is proportional to light intensity.

Phototransistor output is to the amplifier.

The power circuitry for the amplifier is completely isolated from the sensor (electrodes etc.) Power supplies for the sensor use a transformer or battery, and the “ground” for the sensor side floats relative to the amplifier side (which should have ground connected to earth eventually.)

These devices are manufactured in one piece, so the frequency of light output from the LED is matched to the ideal absorption frequency of the phototransistor. However, there must be no electrical connection between the two sides of the circuit. More exactly, the impedance between the two circuits should be near a Teraohm ($10^{12} \Omega$).

## Single-Ended vs. Differential Input

• Referenced Single-Ended: two leads of sensor are + signal and earth (computer) ground. Note: to avoid ground loops, it is best to avoid connecting sensor earth to computer earth.
• Non-Referenced Single-Ended: two leads of sensor are + signal and – signal, which is connected through a bias resistor to earth ground.
• Differential: three sensor leads are available: + and – signal and (earth) ground.

The 4-BNC -to- DAQ-card lead you’ve probably used in a lab before is referenced single-ended: each of 4 sensors has available a signal wire, and the 4 sensors share a common ground wire. If the DAQ card is configured in Differential mode using this input lead, the signal gradually rises to a saturated level, as the DAQ card assumes a signal on the – differential input, which is in reality floating.

Problems with Single-Ended Input:

• Cross-talk: Because multiple signals share a ground wire, they also share some portion of the signal, so if only one input is connected that signal shows up, somewhat weakened, on the second input trace.
• Lack of isolation: using the ground wire as the negative signal lead means the subject and the amplifier are strongly coupled–and strong electric signals from the amplifier may travel to the subject. Also, stray noise (such as from the power mains) easily couples into the input.

Differential Input:

I’m talking a lot about DAQ cards, these are very important when working with A/D systems and analog and digital filters.  If you are not familiar with these, go do a little light reading.  Hopefully this is making enough sense to get the concepts across.  The DAQ card comes with a finite number (16, in our case) of analog input ports (channels), each with paired input pins: a signal (ACH#) and a ground (AIGND). All the analog input ground pins are tied together on the DAQ card. In differential mode, the analog input ports are paired, so channel 1 uses AICH0 as +, AICH8 as -, and the ground wires for the pair are tied together as the reference ground. Thus a 16-channel DAQ card has only 8 channels in differential mode.

• Because no channels share leads, cross-talk is reduced. The DAQ card has high common-mode rejection, so if the – input leads are tied to ground (simplest configuration), channels will not interfere because the cross-talk is common to both + and – inputs.
• The ground lead cannot be isolated from the input electrodes without causing the DAQ circuitry to saturate, so the DAQ card itself does not provide isolation.

## Wiring a DAQ card in Differential Mode:

The figure is adapted from Fig. 4.6, p. 4-15, of the NI 6024E (DAQ card) User Manual, and illustrates the appropriate connections for differential input to the card. Recommended values of R+ and R- depend on the impedance Rs (in series with Vs) and coupling of the source signal Vs:

R+ and R- provide bias current return paths. Bias currents result from not-quite infinite input impedance to the DAQ, and if not balanced the noise they represent will not be common to both + and – inputs, and thus won’t be rejected. However, R+ and R- load down the source with an equivalent 2R+, which will decrease gain if R+, R- are too low. If R+, R- are too large, they will produce a DC offset at the DAQ input.

## Bandwidth

Bandwidth is a critical parameter in determining the type of amplifier needed. Often a bioamp has adjustable bandwidth; typical applications have both low-pass and high-pass adjustable filters.

Typical Bandwidths of Biological Signals: (Table from Webster Fig 6.16, p. 259.)

(Electro-oculogram: signal from electrodes placed either side or above and below the eye. Linearly proportional to angle of gaze; DC signal)

## Noise Reduction

Can be either or both analog and/or digital. If digital, it is done by post-processing collected data. If analog, wiring of the printed-circuit board, handling of wires on the bench, and internal circuitry are all details to consider carefully.

## Protective Shielding

For equipment, against transient large signal sources–includes grounding the outer case of the equipment and surge protection, as well as isolation.

## Power Supplies

AC (mains) with rectification and usually transformer isolation. Subject to power failures, risk of electrocution.
Battery: provides its own isolation. Limited lifetime and undesirable behavior just before failure.

## Specialized Amplifiers

### Lock-in Amplifier

(www.lockin.de)If the signal source is mostly at a single frequency but is very weak and/or subject to a great deal of noise, a lock-in amplifier can be used to extract the signal. In biological cases the single-frequency property of the signal is most-often externally generated, by applying a single-frequency excitation in one way or another.

Theory:

Signal source S(t) = A cos(ω1t + θ1) + B cos(ω2t + θ2)

Reference signal R(t) = C cos(ω1t)

Product S(t)R(t) = AC cos(ω1t) cos(ω1t + θ1) + other terms in cos(ω1t) and cos(ω2t)

= AC/2 (cos(2ω1t + θ1) + cos(-θ1) ) + other terms in cos(ω1t) and cos(ω2t)

Integrating over an even number of cycles of the reference signal reduces all terms in ω1 to zero, so the displayed signal is proportional only to the amplitude of the component of the signal source at the reference frequency.

To get the reference frequency into the signal source various means are employed: one may have to excite the subject (nerve, membrane…) at the reference frequency, or one may already know the source has a dominant resonance; alternatively one may look at each of several spectral components in the source signal piecemeal, by tuning the reference frequency.

### Pre-Amplifier

high input impedance, moderate gain, high CMRR. Often differential input and isolation. May include DC offset control, gain control switches, and/or calibration signal.

### Chopper-stabilized Amplifier

removes thermal DC drift from a (very-low-frequency or DC) signal by using negative feedback and chopping the low-frequency signal at a frequency above the amplifier’s high-pass limit (effectively, this is frequency modulation). The signal can be reconstructed by demodulation after amplification; noise signals at both high frequencies and those below the chopper frequency are rejected.

This post was made using some old class notes, a DAQ card user manual and just some good old knowledge.  I know this is not a traditional engineersphere.com lesson, it is more of an ‘informative read’ for the avid electrical engineer interested in biomedical applications.  Enjoy 🙂

## Amplifiers – Part I

This post is about amplifiers, how they work, and common applications. I will cover several operational amplifier configurations, and situations where each might be useful. This is part I of II for general discussion about amplifiers. Enjoy!

### Definition of an amplifier

Definition (for Bioinstrumentation): Circuit that makes a small signal, usually voltage but occasionally current or power, big enough to do something useful–including excite an output mechanism.

### Common amplifier uses:

• Biological measurements of small signals
• Audio engineering: a large current is needed to drive speakers
• Wireless communications: far from originating antenna, signal is very weak and must be
amplified to be useful.

### Secondary amplifier applications:

Many amplifiers are also filters, preferentially amplifying some frequencies over others

• Don’t want to amplify noise along with signal
• Only interested in low- or high-frequency portion of signal
• Active filter provides amplification as added bonus

### Common Mode Rejection Ratio (CMRR)

ratio (usually in dB) of the amplifier’s common-mode gain to its differential-mode gain. Common-mode signals are input signals common to both + and – inputs and are usually unwanted noise–60-Hz, thermal, etc; differential signals are applied to only one input.

### Gain

voltage out over voltage in, or current out over current in. May be given in dB.  Bioamp requirement: often adjustable; should be 1000 or greater, should be calibrated.

### Input Impedance

what the input source sees as its load working into the amplifier: if the entire amplifier circuit were modelled as a resistor, what would be the value of the resistor? Typical bioamp: Rin = 10MΩ–signal source need not provide much current.

### Output Impedance

same as input impedance but from the output end: model the entire amplifier as a source, and this is its internal impedance. Bioamp requirement: Ro << Rload.

### Frequency Response

over what range of frequencies is the gain constant? Graphically illustrated with a Bode plot of gain vs. frequency.

### DC offset

usually an amplifier has an operator-adjustable DC offset knob, to null out any offset associated with non-ideal amplifier or sensor behavior. A DC offset signal results in an incorrect reading unless removed or filtered out (high-pass filter).

### Operational Amplifier:

basis for most instrumentation-related amplifiers, cheap, readily available, easy to work with. “Operational” = good for mathematical operations (+, -, log, …)

### Meanings and advantages:

• equal input voltages –> within the limits of external power supplies, an op amp outputs whatever current is needed to drive the two input voltages equal. Result is that the output voltage follows the input, scaled by a large gain.
• infinite input resistance means the op amp never loads down the source, even if the source cannot supply much power.
• zero output resistance means the op amp is an ideal voltage source, with output voltage independent of whatever load impedance it must work into.
• infinite open-loop gain means the amplification properties of a circuit containing an op amp are independent of the op amp internal properties.

Carr and Brown go through several common op-amp configurations and show how to derive their voltage gains. Suffice it for now to know that if you want to build an amplifier, an op amp is a good place to start.

### Common op-amp circuit configurations:

• Inverting and non-inverting amplifiers
• Summing and difference amplifiers
• Integrating and differentiating amplifiers
• Log and anti-log amplifiers
• Instrumentation amplifier
• Low-pass filter
• High-pass filter
• Band-pass and notch filters
• Buffer (voltage follower, or unity-gain buffer)

### Op-Amp Equivalent Circuit

This schematic illustrates the important properties of the op amp, and of any amplifier. It can also make it easier to understand circuit operation.

Note the open-circuit inputs– Rin = infinity. The
output voltage supply is a dependent voltage
source. Also, since the gain A is infinite, v2 – v1
must be zero to get a finite output.

### Difference (Differential) Amplifier

Example: derive the gain relationship for the basic differential amplifier shown, assuming U1 is ideal and Vin = V2 – V1.

To get equal gain of both V1 and V2, set R2/R1 = R4/R3. Then Vo = R2/R1(V2-V1).

To get a high gain, R2 >> R1, but to get high input impedance R1 (and/or R3) should be large, making R2 and R4 even larger…Result: high gain and high input impedance are difficult to achieve together.

### Instrumentation Amplifier

A difference amp with input buffer/gain stages to increase input impedance and gain. To analyze, realize that the same current must flow in R5, R6 and R5 (since no current flows into the op amps). Set R1=R3, R2 = R4; then Vo = G1* (v3(U1) -v2(U1)), where G1 = R2/R1 = gain of second (differential) stage.

Gain of input stage is 1 + 2*R5/R6 = G2. Overall gain is G1*G2. Making R6 a potentiometer allows compensation for inequalities in the two R5s, as well as for variable gain of the entire circuit.

Overall Gain: A practical difference amp can have a gain of 100, so it is not hard to get an overall gain of 10,000 from an instrumentation amp.
Input Impedance: equal to that of the op amps U1 and U2–very large. Use FET-based amps for extremely high input impedance
Output Impedance: close to that of the op amp U1–very small: the amp will provide whatever current is needed to maintain the output voltage regardless of load impedance.

Equal resistors: in practice one cannot buy matched discrete resistors; however it is fairly easy to manufacture them within an integrated circuit. Monolithic diff-amps are available.

### Non-idealities of amplifiers

Gain:  TANSTAAFL–you cannot have gain without a power supply to provide it. Real gain is limited by the external power  supplies (+/- 12 or 15 V, for op amp circuits) Exceeding the limits of the power supply results in Saturation, or “hitting the rail”.

Output impedance: a zero output impedance means the circuit will provide whatever current is needed to maintain the requested output voltage. Practically, however, an op amp can only provide some 20mA, meaning RO is negligible only for RL>>15V/20mA = 750 Ω.

Frequency dependence: to avoid oscillation or saturation, circuitry must often be added that limits the bandwidth of an amplifier.
• To keep DC offset signals (from polarizing electrodes, for example) out of the amplifier, a high-pass filter is used to cut off DC (and lower-frequency ac) signals.
• If the load to be driven contains substantial capacitance, the current output limit again becomes a problem, limiting gain at high frequencies, where capacitors look like shorts.

Input bias current: real op amps do have non-zero input currents, which produce voltage drops at the input–another source of DC offset. This source can be minimized by using FET op amps.

### Impedance Bridge

Often the measurand is the relation between voltage and current (one applied, the other a response) rather than a biologically generated source. An example in Carr and Brown uses a wire heated by an applied current as an airflow sensor:  air flow from a breathing patient cools the wire, changing its resistance. Similarly, a voltage applied to a membrane induces a current flow; the ratio of voltage to current is a resistance. Such relations are best measured using a Bridge, and if the bridge is made solely of resistors it is called a Wheatstone Bridge.

Usually drawn as a diamond, this configuration of resistors is “balanced” when V+ – V- = 0. If Rtest then varies a little, a differential amplifier across V+ and V- will register a potential difference proportional to
the change in Rtest.

The impedances can have capacitance and/or inductance associated with them, in which case the bridge can measure both energy storage and  resistive loss in an element.

A return path to ground for (DC) bias currents is automatically provided by this circuit to prevent saturation.

Well there you have it, a few common amplifier configurations and some useful terms pertaining to them.  Remember important concepts such as amplifier saturation, Input Impedance, Output Impedance, and Gain.  A solid understanding of these concepts is sure to impress somebody!  Amplifiers  part II will continue to elaborate on more fun amplifier concepts.

References: References: Carr and Brown ch. 7; Webster chs. 3, 6; Neamen, Electronic Circuit Analysis and
Design (McGraw Hill, 2001) ch. 9

## Solving a System Equation

### Why do we need to solve system equations?

Often during a course you will need to be able to solve a system equation for its roots.  These roots can be complex, distinct, or repeated.  These problems usually arise when working with linear systems or differential equations.  A system equation is formatted as follows:

### How to solve a system equation

For example purposes, I will solve a system equation with complex roots.  A system equation with complex roots as a function of $\lambda$ will appear in the following format (if it does not, you need to manipulate your equation to be in the form):

$Q(\lambda) = (\lambda - \alpha - j\beta)(\lambda - \alpha + j\beta)$

Roots: $\lambda = \alpha \pm j\beta$

So we have $y_{0}(t) = C_{1}e^{(\alpha + j\beta)t}+C_{2}e^{(\alpha - j\beta)t}$

which also equals $y_{0}(t) = Ce^{\alpha t}cos(\beta t + \theta)$

so your first step is to look at your equation and determine your roots, then write out your $y_{0}(t)$ equation with constants.

Example $\frac{d^{2}v}{dt^{2}} + 4\frac{dv}{dt} + 4v(t) = 0$ with initial conditions $V(0) = 3v$ and $V^{1}(0) = -4v$

$Q(\lambda) = \lambda^{2} + 4\lambda + 4 = 0$ $(\lambda + 2)(\lambda + 2) = 0$ $\lambda_{1} = \lambda_{2} = -2$

so now we can write our $y_{0}(t)$ equation as follows:

$y_{0}(t) = C_{1}e^{-2t}+C_{2}te^{-2t}$

In order to solve for $C_{1}$ and $C_{2}$ we need to use our initial conditions.  To evaluate the first derivative initial condition, we must first take the derivative of our $y_{0}(t) = C_{1}e^{-2t}+C_{2}e^{-2t}$ that we just found.

$y_{0}^{1}(t) = -2C_{1}e^{-2t} - 2C_{2}*t*e^{-2t} + C_{2}e^{-2t}$

evaluating this equation with t = 0 and the response equal to -4v, we get this: $-4 = -2C_{1} + C_{2}$

evaluating our $y_{0}(t)$ equation with t = 0 and the response equal to 3v, we calculate $C_{1} = 3$

Using these two equations, we calculate our constants:

$C_{1} = 3$ and $C_{2} = 2$

Fill these into our $y_{0}(t)$ equation to determine the final result.

$y_{0}(t) = 3e^{-2t}+2te^{-2t}$

Now you know how to solve this common differential equations and linear systems problem, determine characteristic roots and modes, and write system equations. 🙂