You are on page 1of 16

Electronics Essentials

for 2.017/2.019

Massachusetts Institute of Technology, Subject 2.017


Reviewing Basics

• Kirchoff’s Voltage rule: voltages V at a node are the


same.
• Kirchoff’s Current rule: sum of currents i flowing into and
out of a node is zero.
• Analogy: Voltage is like fluid pressure, current is like
fluid volumetric flow rate. The wire is like a pipe.

• Resistor R: V = IR,
– Dissipation: Resistive Power P = I2R = V2/R Ohms, :
– Analogy: viscous losses in pipe flow
• Capacitor C: i = C dV/dt farads, f
– Analogy: a hydraulic accumulator
• Inductor H: V = L di/dt henries, h
– Analogy: inertia of water in a pipe

Massachusetts Institute of Technology, Subject 2.017


The Op-Amp

Two inputs (called inverting and non-inverting); one


output.
The output voltage is a HUGE gain multiplied by the
difference between the inputs.
V+ (supply)
Vinv
Vout
Vnon-inv
V- (supply)
Horiwitz’s & Hill’s golden rules:

a. The op-amp enforces (in proper use)

Vinv = Vnon-inv

b. No current flows into the device at either input

Massachusetts Institute of Technology, Subject 2.017


Example Op-Amp: Adding a Voltage Bias

R2
(V-Vinv)/R1 = (Vinv-Vout)/R2 and
Vinv = Vnon-inv Æ
R1 V+
V Vout VR2 = Vinv(R1+R2) – VoutR1 Æ
Vinv
Vnon-inv Vout = Vnon-inv (R1 + R2)/R1 – VR2/R1

V- Letting R1 = R2, then

Vout = 2Vnon-inv – V
Voltage bias useful for bringing
signal levels into the range of The circuit inverts the input V and
sensors. adds on 2Vnon-inv
The op-amp is discussed in detail
IF Vnon_inv is ground, then
by Horowitz and Hill, covering
Vout is just –V. This is just an
integrators, filters, etc.
inverting amplifier.

Massachusetts Institute of Technology, Subject 2.017


Serial Communications

• How to transmit digital information fast and reliably over


a few wires?
• Examples: RS-232, RS-485, etc. refer to pins & wires
• A minimal case of RS-232 (DB25 connector is full case):

– Asynchronous operation; both sides agree on BAUD rate


– Three wires: send (TX), receive (RX), ground
– No error checking! No flow control!

EXAMPLE using CMOS components:


Successive bits read at midpoints,

based on baud rate and on start bit 64 + 32 + 1 = 97 = ‘a’

leading edge
normally high 5V

Start bit

Stop bit

1 0 0 0 0 1 1 0
GND

1’s 2’s 4’s 8’s 16’s 32’s 64’s 128’s


(LSB) (MSB)
Massachusetts Institute of Technology, Subject 2.017
EXAMPLE: A GPS String

• Garmin GPS25 series – Smart embedded device!

• Similar to TT8’s interface with you – I/O strings are


passed through a serial port
• Reconfigurable through special commands
• Output at 1Hz
• String maintains exactly the same syntax: e.g.,

$GPRMC,hhmmss,V,
ddmm.mmmm,N,dddmm.mmmm,E,
000.0,000.0,ddmmyy,000.0,E,N,*XX<CR><LF>

Î 73 chars appear as one line:


$GPRMC,hhmmss,V,ddmm.mmmm,N,dddmm.mmmm,E,000.0,000.0,ddmmyy,000.0,E,N,*XX

Massachusetts Institute of Technology, Subject 2.017


How the TT8 Reads a TPU Serial Line

#define SERCHAN 0 // TPU channel for serial input comms

#define TSBUFSIZ 128 // buffer size for TPU serial channel, a factor of 2!

……

void main( ) {

int i ;

char c[TSBUFSIZ] ;

……

printf("Serial input port opened: %d ( check: should be %d ) \n",

TSerOpen( SERCHAN, // channel


MiddlePrior, // “middle priority” (advanced!)
INP, // configured as input
malloc(TSBUFSIZ+TSER_MIN_MEM), // allocate the buffer
TSBUFSIZ, // size of the buffer
9600, 'N', 8, 1 ), // comm. protocol
tsOK ) ; // (second item printed: “OK”)

for (i=0;i<TSBUFSIZ;i++) // get the chars from buffer as fast as you can!

c[i] = TSerGetByte(SERCHAN) ;

for(i=0;i<TSBUFSIZ;i++) // now print them out


Buffer: A data space where the
printf("%c",c[i]) ;

printf("\n") ;
port loads incoming data, or
}
accumulates outgoing data.

Massachusetts Institute of Technology, Subject 2.017


ASCII: American Standard Code for Information Interchange

Serial devices communicate using characters encoded into bits. This includes
upper- and lowercase letters, carriage returns and linefeeds, punctuation, etc.
Characters are not numbers! E.g.,
char c = ‘7’ ;
char d[2] = ‘92’ ;
int n ;
The numerical value of c is [0110111] (binary) or 55 (decimal).

But because the ASCII characters ‘0’,’1’,’2’,’3’,’4’,’5’,’6’,’7’,’8’, and ’9’ occur in

order, making simple conversions is easy:

n = c – ‘0’ ;
assigns to n the actual number 7. The ASCII character that goes with 7 is
known as BEL – on many machines this will ring a bell if it is sent to the screen
as a character! – printf(“%c”,n) ;

How to turn d[2] into a number?


n = 10*( d[0] - ’0’ ) + ( d[1] - ’0’ ) ;

Massachusetts Institute of Technology, Subject 2.017


Pulse Width Modulation

• A Regular Waveform
Volts Vpeak

PWM period Pulsewidth


• PWM frequency (Hz) = 1 / PWM period
• Duty cycle = Pulsewidth / PWM period
• PWM frequencies typically range from 100Hz into MHz
• Duty cycles can be used from 0 – 100%, although some systems
use much smaller ranges, e.g. 5-10% for hobby remote servos.
• The waveform has two pieces of information: Period and
Pulsewidth, although they are usually not changed simultaneously.

Massachusetts Institute of Technology, Subject 2.017


Some PWM Uses

• The Allure: very fast, cheap switches and clocks to approximate


continuous processes. Also, two-state signal resists noise corruption.
• Sensors: PWM period is naturally related to rotation or update rate:
Hall effect, anemometers, incremental encoders, tachometers, etc.
• Communication: PWM duty cycle is continuously variable Æ like an D/A
and an A/D.
• Actuation: At very high frequencies, physical systems filter out all but
the mean; i.e.,

Veffective = duty_cycle * Vpeak

Image removed for copyright reasons.


High frequency Propellers on a large ship.
switching is the
dominant mode
for powering
large motors!

Massachusetts Institute of Technology, Subject 2.017


Field Effect Transistor (FET)

• Like a “valve”, that is very easy to open or close. When


FET is open, resistance is low (milli-Ohms); when FET is
closed, resistance is high (mega-Ohms or higher)
drain _ +
Load
• Typically three connections:
gate
– Gate: the signal; low current
– Source: power in
_ Supply
– Drain: power out source +

• N- and P-type junctions are common, and involve the


polarity of the device. (N is shown)
• Extremely sensitive to static discharge! Handle with
care.
• MOSFET: modern FET’s capable of handling higher
power levels.
Massachusetts Institute of Technology, Subject 2.017
Bipolar Control with a MOSFET H-Bridge

drain _ drain _
+ +
Load Load
gate gate
N-channel P-channel

_ Supply Supply _
source + source +
MOSFET turns on when Vgate > Vsource MOSFET turns on when Vgate < Vsource

Vs To make flow UL to LR,

s s set A = GND and D = Vs

g A B g
P1 P2
d d To make flow UR to LL,
load Set B = GND and C = Vs
d d
g g
N1 N2
C D Connect A and B to Vs with pull-up resistors;
s s
Connect C and D to GND with pull-down resistors;
Control all four gates explicitly

Massachusetts Institute of Technology, Subject 2.017


The Basic DC Brush Motor

Vector relations:
Torque W ÍÎ (coils)(flux density)(current i), force = current x flux
or, in a given motor, field = velocity x flux
W = kt * i where kt is the torque constant
i
But the motion of the coils also induces a

voltage in the coil, the back-EMF:


S N
eb = kt * Z YES, that’s the same kt

And the windings have a resistance R: WZ


eR = R * i

Summing voltages around the loop,


Vsupply = eb + eR

Massachusetts Institute of Technology, Subject 2.017


Properties of the DC Brush Motor

• No-load speed:
W = 0 Æ i = 0 Æ Z = V / kt
• Zero-speed torque (BURNS UP MOTOR IF SUSTAINED):
Z = 0 Æ eb = 0 Æ i = V / R Æ W= kt V / R
• Power output:
Pout = WZ = i eb Æ Pout = i ( V – Ri )
• Efficiency:
K= Pout / Pin = WZ/ i V Æ K=1-iR/V

Z Point of maximum power: W = kt V / 2 R


Z = V / kt
Pout

dZ/dW = - R / kt2 W = ktV/R


W

Massachusetts Institute of Technology, Subject 2.017


Incremental Encoders for Control

• What is the position of the motor?


• Take advantage of cheap, fast counters Æ make a large

number of pulses per revolution, and count them!

• Advantages of the incremental encoder:


– High resilience to noise because it is a digital signal
– Counting chip can keep track of multiple motor turns
– Easy to make – phototransistor, light source, slotted disk
slots
• Two pulse trains required to discern direction: quadrature

A 5V

B 5V

Massachusetts Institute of Technology, Subject 2.017


Stepper

Motors

Switched coils at

fixed positions on

the stator attract

DC Voltage
permanent
Rotor with
magnets at fixed
SN S permanent N S
positions on the
magnets
rotor.

Smooth variation

of switching leads

to half-stepping
Stator
and micro-

stepping

OFF
Encoder still
ON
recommended!
DC Voltage

Massachusetts Institute of Technology, Subject 2.017

You might also like