Top Banner
Electronics Design Laboratory Lecture #4 ECEN 2270 1 Electronics Design Laboratory
27

Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Aug 19, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Electronics Design LaboratoryLecture #4

ECEN 2270 1Electronics Design Laboratory

Page 2: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Experiment 2 – Robot DC MotorPart A

• Measure DC motor characteristics

• Develop a Spice circuit model for the DC motor and determine model parameters based on experiments

• Validate the model: compare experimental and simulation results

Part B

• Design a speed sensor circuit (tachometer) that outputs voltage proportional to wheel speed

• Use LTspice simulations to verify and debug the design

• Build, test and demo the speed sensor circuit

Electronics Design Laboratory 2ECEN 2270

Page 3: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

DC Motor System

Electronics Design Laboratory 3ECEN 2270

IDC

wheel

-10 < VDC < +10 V

wheelshaft

51:1gear

Shaft Encoder+_

ENCADC Motor

Inputs: differential voltage VDC and motor current IDC

Outputs: Encoder signals with 50% duty cycle, fenc∝ ω

• DC voltages move the motor at some angular frequency.

• This angular frequency is translated into a frequency by a shaft encoder.

Page 4: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Experiment 2 Part B: Speed Sensor Circuit

Electronics Design Laboratory 4ECEN 2270

Goal: Convert frequency to voltage

• Encoder output pulses, frequency fenc [Hz] is proportional to speed

• It is hard to measure frequency, but easy to measure voltage so we want to translate fenc to a proportional voltage

Tenc = 1/fenc = 1/(Ke ω)

Min[Tenc] @ Max[fenc]

SlowFast

Encoder Pulses Desired Output

VMAX@Max(fenc)

0V@(fenc = 0)

(V)

(t)

Page 5: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Converting Frequency to Voltage

Electronics Design Laboratory 5ECEN 2270

EncoderPulses

Tenc = 1/fenc = 1/(Ke ω)

“One-Shot” Output

Vcc

0V

Vcc

0V

t

tTON (Independent of fenc!)

Pulse of width Ton generated at each rising edge of the encoder. Same frequency as encoder signal, but different average.

VENC

VOS

( )

OS

eONCC

ENC

ONCCOS

K

KTVT

TVV

=

==

AverageOutput Vcc

0Vt

Vspeed

Vspeed = average <VOS> = KOS ω

Page 6: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Converting Frequency to Voltage

Electronics Design Laboratory 6ECEN 2270

EncoderPulses

Tenc = 1/fenc = 1/(Ke ω)

“One-Shot” Output

Vcc

0V

Vcc

0V

t

tTON (Independent of fenc!)

Lower frequency means one-shot pulses further apart… average value is lower.

VENC

VOS

( )

OS

eONCC

ENC

ONCCOS

K

KTVT

TVV

=

==

AverageOutput Vcc

0Vt

Vspeed Vspeed = average <VOS> = KOS ω

Page 7: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Tachometer Block Diagram

Electronics Design Laboratory 7ECEN 2270

One-Shot Circuit

eencspeed Kfv =Shaft Encoder

Average Circuit

Page 8: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Tachometer Circuit

Electronics Design Laboratory 8ECEN 2270

One-shot

Average

Motor with Shaft Encoder

One-Shot

Circuit

EncoderAverage Circuit

Page 9: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

How to approach the analysis

(or design, or debugging) of a complex circuit

1. DON’T: dive right in and start writing a lot of loop and node equations

– You will make an algebraic mess and get nowhere

– When debugging: don’t just build the whole thing and turn it on, expecting it to work first time

2. DO: Break the circuit down into smaller functional blocks that can be separately understood

– First try to explain in words how each block works• Isolate sections that you don’t understand. Explain the ones you do

understand first.

– Get the first block to work before moving on to the next• Don’t try and solve it all at once!

Electronics Design Laboratory 9ECEN 2270

Page 10: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

3. DO: For each block, decide what you need to know, and what analysis will be feasible

– Identify the input and output signals

– Write simple equations • Develop additional constraints based on your understanding of how

the circuit is supposed to work

– Solve the equations for the element values; often there is more than one valid answer• Chose impedance levels so that currents and power consumption

are reasonable, e.g. mA not A

Electronics Design Laboratory 10ECEN 2270

Page 11: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Tachometer Circuit Blocks

Electronics Design Laboratory 11ECEN 2270

555 One-shot

Low-pass filter

Motor – Solved in Part A

Trigger

Solved

One-Shot

Circuit

Encoder

Average Circuit

Page 12: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

555 One-Shot: Inside the “555 Timer”

OutputBufferComparators

DischargeTransistor

SR-Latch

Comparator

SR-Latch

Buffer

=

−+

−+

VVV

VVVV

inin

CCinin

out0

inout VV =

S R Q Q̅

0 0 Q Q̅

0 1 0 1

1 0 1 0

1 1 X X

• Output Q dependent on “set input” S, and “reset input” R.

• Output changes on rising edge of input signal.

• Logic level 1 corresponds to a voltage of Vcc.

• Output voltage equals the input voltage.• Buffers are used to ‘strengthen’ signals.

The buffer is able to drive large currents.

• Output depends on relative value of both inputs.

• Commonly used to detect signal level

Vcc

0V t

Electronics Design Laboratory 12ECEN 2270

Page 13: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

555 One-Shot

Electronics Design Laboratory 13ECEN 2270

Inputs: Encoder pulses with 50% duty cycleOutputs: Fixed on-time pulseThings we want to know:• How does this circuit generate the ton

pulse?• How long is ton, and how should we

choose R2 and C2?

Page 14: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

555 One-Shot Solution

Electronics Design Laboratory 14ECEN 2270

• One-shot timing

– ton: must be shorter than shortest Tenc

– Design output pulse ton to set duty cycle at maximum frequency

– Want ton as long as possible, try to achieve ton = (0.9)MIN[Tenc]

CC

CRt

CC VeV on

3

2)1( 22/=−

− ( )3ln22CRton =

Page 15: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Tachometer Circuit Blocks

Electronics Design Laboratory 15ECEN 2270

555 One-shot

Low-pass filter

Motor – Solved in Part A

Trigger

SolvedSolved

One-Shot

Circuit

Encoder

Average Circuit

Page 16: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Trigger circuit

Electronics Design Laboratory 16ECEN 2270

The set pulse needs to terminate before it is time to reset the latch. But the datasheet for the 555 timer specifies a minimum pulse width of 1 µsec.

Equivalent circuit

ttrig

Inputs: venc(t), square wave from encoder

Outputs: Set pulse going to latch

Things we want to know:• How is f related to the ground speed of the

wheels? (left as exercise for students)• How does this circuit generate the set

pulse?• How long is ttrig, and how should we choose

R1 and C1?

Page 17: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Trigger Circuit Analysis: Preliminaries

Electronics Design Laboratory 17ECEN 2270

Characteristics of silicon p–n diode

3k15

k5 CCCC

VVV =

=+

VVV cenc 51 +VVV cenc 51 + • D1 acts as a switch, creating two equivalent circuits depending on

VENC + Vc1 = VTRIG = V(-)

• Equivalent circuit ‘B’ is solved visually. All nodes have known voltages!

• Equivalent circuit A is unknown.‐ Inputs: Venc

‐ Outputs: VTRIG

A B

Page 18: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Trigger Circuit: Waveforms

Electronics Design Laboratory 18ECEN 2270

D1 does not allow TRIG > VCC

so vC1 = 0

ttrig

B A B

Page 19: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

•Using the Laplace transform…

•Now use partial fraction expansion to take inverse Laplace transform; the result is:

• The trigger circuit comparator causes the set pulse to end when vC1 = VCC/3, at time t = ttrig. Hence:

• Solving for ttrig

Trigger Circuit: Solution

Electronics Design Laboratory 19ECEN 2270

•Assume t = 0 at the falling edge of Venc

•Redraw the equivalent circuit in the time domain…

•Or with the Laplace transform…

• Then solve for capacitor voltage Vc1

• ttrig is the time at which Vc1 = V+

( )11/

1 1)(CRt

CCCtrigeVtv

−−=

3)1( 11/ CCCRt

CC

VeV trig =−−

=

2

3ln11CRttrig

( )11/

1 13

)(CRt

CCCC

trigCtrigeV

Vtv

−−==

Page 20: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Tachometer Circuit Blocks

Electronics Design Laboratory 20ECEN 2270

555 One-shot

Low-pass filter

Motor – Solved in Part A

Trigger

SolvedSolved

Solved

One-Shot

Circuit

Encoder

Average Circuit

Page 21: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Low-Pass Filter Circuit

Electronics Design Laboratory 21ECEN 2270

Input: Pulse-width-modulated signal OUTOutput: “speed” signal having a DC value proportional to f

Things we want to know:• How does this circuit operate on the

pulse-width-modulated OUT signal to produce the speed signal?

• How should we choose R3 and C3?

Page 22: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Low-Pass Filter Circuit: Analysis

Electronics Design Laboratory 22ECEN 2270

The pulse-width-modulated signal OUT(t) can be represented by Fourier analysis as a DC component V0 plus a sum of sinusoids called harmonics:

The harmonics have frequencies that are integral multiples of the fundamental frequency f. The DC component is given by the average value:

We want to attenuate the harmonics (frequencies above DC) and leave the DC component untouched.

The amplitude spectrum is a plot of the harmonic amplitudes vs. frequency:

Page 23: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Filter design

Electronics Design Laboratory 23ECEN 2270,

The effect of the R3–C3 filter on each individual harmonic can be found by phasoranalysis of the circuit: use phasors to solve the circuit and find how the amplitude of a sinusoid is changed by the circuit, as a function of frequency.

We want to choose R3 and C3 so that the filter passes the DC component and any very low-frequency variations that occur as a result of the changing speed of the robot. But we want the filter to reject the components of OUT at the fundamental frequency fand its harmonics. So the filter should have a transfer function (i.e., the ratio of its output voltage amplitude to its input voltage amplitude, vs. frequency) that looks like this:

Use phasor analysis to solve for the transfer function of the R3–C3 filter. Select appropriate values for R3 and C3.

Page 24: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Phasor Analysis of LPF

Electronics Design Laboratory 24ECEN 2270,

𝑉𝑜𝑢𝑡

𝑉𝑖𝑛=

1𝑗𝜔𝐶

(𝑅 +1

𝑗𝜔𝐶)

𝑉𝑜𝑢𝑡

𝑉𝑖𝑛=

1

1 + 𝑗ω𝑅𝐶

Voltage divider with impedances –Replacing capacitor by its impedance, 1/(jωC)Solve for the ratio of phasors Vout/Vin

Multiplying by jωC/jωC leads to

• As frequency ω increases, jωRC increases• As denominator becomes greater, Vout/Vin becomes smaller• Therefore, higher frequency signal voltage components are attenuated• Another way to look at this--reactance Xc = 1/ jωC approaches zero with higher

frequencies which appears as a direct short with all voltage across R and none at Vout

Page 25: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Frequency Response of 1KHz LPF

Electronics Design Laboratory 25ECEN 2270,

𝑉𝑜𝑢𝑡

𝑉𝑖𝑛= 20 log

𝑉𝑜𝑢𝑡

𝑉𝑖𝑛

Bode plot: Magnitude of phasor ratio Vout/VinPlot log of frequency on x axisPlot log of magnitude in decibels “dB” on y axis

-3 dB down point @ fc = 1kHz corner frequency

Page 26: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Filter Design with Fc

Electronics Design Laboratory 26ECEN 2270,

𝑓𝑐 =1

(2π𝑅𝐶)

Corner frequency, fc --3dB (1/2 power point) occursFrequencies equal to and greater than corner frequency are attenuated

Corner frequency is defined as:

Design low pass filter for Lab 2 -• Decide what frequencies to preserve and set corner frequency to just above the

limit.• Remember, the lower the corner frequency, the slower the system response time• Pick an available capacitor value for C3 and calculate the necessary R3 from the

corner frequency equation above.• Pick the closest available resistor value to calculated value.

Page 27: Electronics Design Laboratory Lecture #4ecee.colorado.edu/ecen2270/lectures/Lecture04.pdf · trig. Hence: •Solving for t trig Trigger Circuit: Solution ECEN 2270 Electronics Design

Summary of

Time Constants in the Tachometer circuit

• R1, C1

– 1ms < ttrig << ton

– C1 >> capacitance at node TRIG

– R1 >> Rencoder

• R2, C2

– Set ton to determineoutput voltage of speed sensor at maximum speed (based on VCC and duty cycle)

• R3, C3

– Low-pass filter PWM output; determines voltage ripple on the speed sensor output voltage

– R3*C3 >> lowest expected PWM period

– R3*C3 < desired response time of the speed sensor (e.g. << 1 sec)

Electronics Design Laboratory 27ECEN 2270

R1 & C1

R2 & C2

R3 & C3