Phys 253 - Lecture 3 Power circuits how to control your motors Noise and Shielding
Digital-to-Analog Conversion PWM 2
D/A Conversion and power circuits When would you like to produce an output signal that is more than just on or off? (e.g. brightness of light, speed of a motor, current through electric heater, etc. ) Analog Outputs Digital-to-Analog Conversion (DAC): 10110011, 01010101, V t Two simple schemes we will use in 253 (of many possible schemes) 1. Resistor ladders (combine multiple digital outputs into one analog output) 2. Pulse Width Modulation (turn one digital output on and off at high frequency) 3
D/A conversion: Resistor ladders (binary weighted DAC) An op-amp summing circuit V out = - (50k / R) * 1.0V 4
D/A conversion: Pulse Width Modulation (PWM) This scheme uses a digital output to produce an analog voltage by digitally controlling the % of time that the output is high. The TIME AVERAGED voltage produced can therefore be almost continuously variable. T pulse Duty cycle = T pulse /T pwm 5V 0 t T pwm 5
D/A conversion: PWM PWM Duty Cycle Average voltage: 0 V 0 0% t 5V 0.25 * 5 V = 1.25 V 0 25% t 6
D/A conversion: PWM PWM Duty Cycle 5V Average voltage: 2.5 V 0 50% t 5V 4.75 V 0 95% t 7
D/A conversion: PWM PWM Duty Cycle 50% 0 t Average voltage: 2.5 V Must be low-pass filtered to be used as an analog output To avoid ripple, low-pass filter at f << f pwm. Note that this can place a severe limit on the output bandwidth. Resolution is limited by minimum switching time of the digital output. 8
High-Current Circuits and Motor Control 9
Discrete devices: Transistors Transistors are semiconductor devices used to amplify a signal (e.g. small current/voltage to large current/voltage). In Phys 253, we use transistors as switches to turn on and off larger amounts of current. Two major types of transistors: Bipolar Junction Transistors MOSFETs 10
Discrete devices: BJT Bipolar Junction Transistors 11 Diagrams courtesy of: University of St. Andrews, St Andrews, Fife KY16 9SS, Scotland
Discrete devices: BJT Bipolar Junction Transistors b ~ 20-100 or more + 12 Diagrams courtesy of: University of St. Andrews, St Andrews, Fife KY16 9SS, Scotland
Discrete devices: BJT Bipolar Junction Transistors 13
Discrete devices: BJT Bipolar Junction Transistors 14
Build a circuit that : Discrete devices: Transistors (NPN) Uses a 3904 (NPN) transistor to light a lamp Check: when the 3904 is turned on, the Base-Emitter voltage should be ~ 0.7V Limit the current into the base!! Note: arrange the 3904 so the emitter voltage to ground does not change when the lamp is lit (it needs to be stable as a reference for the base voltage)
Bipolar Junction Transistors Typical circuit (NPN): When S1 is closed, lamp lights up. I B = (5-0.7)/1k = 4.3 ma = 30 I c = (30)4.3 ma = 130 ma V BE = 0.7 V V CE = 0.3 V Discrete devices: Transistors (NPN) + V2 5V S1 I B R1 1k + + - V BE V1 5V R2 100 L1 Q1 2N3904 I c Checking V BE is a quick way to test a transistor. If V BE >> 0.7 V, the transistor is dead. 16
Discrete devices: Transistors (PNP) Build a circuit that : Uses a 3906 (PNP) transistor to light a lamp Check: when the 3906 is turned on, the Base-Emitter voltage should be ~ 0.7V Note: arrange the 3906 so the emitter voltage does not change when the lamp is lit (it needs to be stable as a reference for the base voltage)
Typical circuit (PNP): Discrete devices: Transistors (PNP) Bipolar Junction Transistors When S2 is closed, lamp lights up. S2 R2 1k V BE - + V1 5V Q1 2N3906 I B + L2 R1 100 I c 18
Discrete devices: FETs Field Effect Transistors Gate voltage either ENHANCES or DEPLETES the conduction channel. JFET = Junction FET MOSFET = Metal Oxide Semiconductor FET MOSFETS have an insulating layer at gate so draw less current. Current passing from source to drain now controlled by VOLTAGE at the gate 19 (rather than by CURRENT into the base as in a BJT).
R8 10k Discrete devices: FETs R1 Field Q3Effect Transistors Q4 MTP2955 MTP2955 R7 There are FOUR 100 kinds of MOSFETs: 10k R2 100 B-2 Q8 Q5 HB-1 Enhancement Mode: 2N3904 N type 2N3904 P type Q7 2N3906 R6 100 R5 10k + V gs - I d HB-2 M1 HUF 75321 Q1 MTP3055 Q2 MTP3055 2N3906 R8 10k R7 100 Q6 Q8 2N3904 V gs + - R3 Q3 100MTP2955 R4 10k IRF5305 I d M1 Q4 MTP2955 Q5 2N39 Increasing V gs increases I d. Q7 2N3906 2 Depletion : Increasing V gs decreases I d R6 100 Q1 20 Q2
21
Discrete devices: MOSFETS Build a circuit that : Uses a MOSFET to light a lamp Note: no current is required to flow into the gate to switch on or off the MOSFET
Discrete devices: MOSFETs Enhancement: N type P type R7 100 S1 R8 10k L1 HUF 75321 MTP3055V R8 10k R7 100 S1 Q3 MTP2955 IRF5305 L1 23
Discrete devices: MOSFETs If after closing S1 (and turning on the LED) we cut the circuit at the red line: 1. The LED will stay lit 2. The LED will go off R7 100 S1 L1 HUF 75321 MTP3055V R8 10k 24
High current and inductive loads Digital Outputs do not provide sufficient current to drive anything other than output signals to other electronics. Digital outputs can be amplified to turn on devices that require high currents. Mechanical/solid-state relays or Transistors can be used as electrically-controlled switches BJT used as a switch for load L1 V1 5V R2 100 Electromechanical relay L1 + V2 5V S1 R1 1k Q1 2N3904 25 Image from CMU - http://www.vialab.org/bioe_1010
Example - High current and inductive loads Eg. Load with 4 stages Electromechanical Relay V1 5V Relay coil current at 5 V ~ 80 ma 5V R2 100 L1 LM311 sinks up to 50mA 3904 rated to 200 ma Dout 5V U1 LM311 R1 1k Q1 3904 + V2 5V S1 R1 1k RLY1 Q1 2N3904 R2 100k R3 100k Spike suppression diode (used in parallel with any inductive loads) 26
Discrete devices: BJT Bipolar Junction Transistors 27
LM311 comparator Example of a data sheet LM 311 can only sink a limited amount of current 28
Power output: H-bridges The above circuits work for loads where current only travels in one direction how to get current to travel FORWARDS and REVERSE? Image from wikipedia (H-Bridge) 29
PWM on the TINAH Motor Outputs LED4 LED8 LED3 LED7 LED2 LED6 LED1 LED5 The TINAH Board has a built-in software to generate a PWM signal, and hardware to use the PWM signal to power a small motor (max 9V, ~600 ma) either forward or reverse. TINAH motor output schematic +5V 1Kx5 LEDs indicate current direction H-Bridge Chip (SN754410NE) +5V 9V regulated Direction signal Output header strip note how the pins are grouped J4 1 2 3 4 5 6 7 8 9 10 11 12 16 8 Vs Vss U10 1 3 cs1 out1 2 6 in1 7 4 out2 in2 SN754410NE 11 9 out3 cs2 14 10 out4 in3 15 in4 gnd 6 4 5 1213 U9b 74HC04 U9c 74HC04 PWM signal (Enable) 3 5 12 1Q 9 2Q 6 15 3Q 16 4Q 5 5Q 6Q 2 7Q 19 8Q
TINAH motor outputs from data sheet of on-board H-Bridge 31
PWM: TINAH motor outputs TINAH/Wiring : motor.speed(0,700); turn on motor 0 at ~70% duty cycle: H motor Red trace V 10V L Blue trace Intermediate voltage during high-z state t 32
PWM regulated power vs. high-power TINAH board uses a regulated 9V for each H-bridge (L78S09CV), which remains constant under load increased repeatability. Some motors used in Phys 253 can use higher voltages and currents (e.g., 1.5 A) which cannot be achieved by the TINAH Board H-bridge chip outputs directly use additional circuitry to control an external H-bridge R8 10k R7 100 Q3 MTP2955 Q4 MTP2955 R1 10k R2 100? HB-2 R10 33k Q7 2N3906 Q8 2N3904 M1 Q5 2N3904 Q6 2N3906 HB-1 R9 33k R6 100 Q1 MTP3055 Q2 MTP3055 R3 100 R5 10k R4 10k TINAH Board H-Bridge interface circuit External H-Bridge 33
Power output: H-bridges Need to connect TINAH motor outputs to H-bridge inputs: Build an interface circuit for doing this H To H-Bridge input t V 10V 3V L 10k to 50k TINAH Motor Output Comparator level USE 5V FROM TINAH Board!!! (do not use voltage divider, since value decreases with decreasing battery voltage) t 34
35 Power output: H-bridges HB -1 HB -2 STOP (BRAKE) lo lo FORWARD hi lo REVERSE lo hi NOT ALLOWED hi hi R10 33k R9 33k HB-2 HB-1 M1 Q7 2N3906 Q8 2N3904 Q6 2N3906 Q5 2N3904 Q4 MTP2955 Q3 MTP2955 Q2 MTP3055 Q1 MTP3055 R5 10k R6 100 R8 10k R7 100 R4 10k R3 100 R2 100 R1 10k Q1 HUF75321 Q2 HUF75321 Q3 IRF5305 Q4 IRF5305
36 R10 33k R9 33k HB-2 HB-1 M1 Q7 2N3906 Q8 2N3904 Q6 2N3906 Q5 2N3904 Q4 MTP2955 Q3 MTP2955 Q2 MTP3055 Q1 MTP3055 R5 10k R6 100 R8 10k R7 100 R4 10k R3 100 R2 100 R1 10k H/L L L/H ON/OFF L/H ON/OFF ON/OFF H/L ON/OFF OFF H OFF OFF OFF H Q1 HUF75321 Q2 HUF75321 Q3 IRF5305 Q4 IRF5305
Design credit: Scott Lawson
Noise and Shielding
Shielding and grounding How to keep your low-level signals from being contaminated by noise: E E =0 E ~ 0 everywhere inside a grounded conducting shell (with no charge inside the shell). We take advantage of this to shield circuits and wires carrying sensitive signals: circuit shield A/D or amplifier
Ground loops: Shielding and grounding Improper grounding can lead to noise of its own: circuit shield amplifier Area of antenna t B A TINAH Ground loop Sources of B, E: AC, Lights: 60, 120,180, Hz Motors: ~ white noise PWM to motors: PWM freq. +harmonics
Shielding and grounding Motor driver I =.1A IR detector V out R = 0.1 ohm + What is the minimum noise amplitude on Vin? TINAH V in 1) 0 V pp 3) 10 mv pp 2).1 V pp 4) 1 mv pp
Shielding and grounding More bad grounding: Improper grounding can lead to noise of its own: V=10 mv! Motor driver Remember that all wires are also resistors. I =.1A I =.1A V=0 IR detector R = 0.1 ohm Grounds should be routed to a single point.
Shielding and grounding Proper grounding: Improper grounding can lead to noise of its own: V= 0V Motor driver IR detector Remember that all wires are also resistors. I =.1A V=0 R = 0.1 ohm Grounds should be routed to a single point. High-current returns should be separate from ground if possible.
Minimizing noise sources: Shielding and grounding High-current, high frequency signals are the worst offenders: The wires running to your motors are a great example of this. B t B I = 1A I I n B I cos t I I sin t n PWM current t High frequency components! This makes db/dt large and increases EMF coupled to other loops. B t A
Minimizing noise sources: Shielding and grounding High-current, high frequency signals are the worst offenders: The wires running to your motors are a great example of this. B Net enclosed current ~ 0 I = 1A Pair and twist current carrying wires to cancel B! Twisting signal wires also reduces area for inductive coupling.
Power conditioning Keep your power lines clean of high frequency oscillations: High-current, high frequency loads in your circuit can propagate voltage fluctuations in your power lines. Put a 10 or 100 pf capacitor from power to ground every 1 of circuit board for digital circuits. Possibly less frequently for lower speed analog circuits Use a separate power source for your high current, fluctuating loads, or filter and regulate power from such a source before using it as power to op-amps etc.. To motors 12 V 7805 Clean 5V for circuits