Basic Electronics, Chapter 9: Challenge 2 solution (drivers, servos, steppers and relays) Formulas: driver loss P = V(drop) x I; motor share = (V - V(drop)) / V servo: pulse = 1.0 ms + angle / 180 x 1.0 ms; duty = pulse / 20 ms; angle = (pulse - 1.0 ms) x 180 deg / 1.0 ms A4988: Vref = I x 8 x Rs; DRV8825: Vref = I x 5 x Rs; steps per rev = full steps x microsteps; step frequency = rev/s x steps per rev relay coil: I = V / R, P = V^2 / R; switch loss: I^2 R (contacts), V x I (SSR) (a) Drivers at 1 A on a 6 V supply L298N: motor voltage = 6 - 2.2 = 3.8 V; driver heat = 2.2 V x 1 A = 2.2 W; share = 3.8 / 6 = 63 % TB6612FNG: motor voltage = 6 - 0.5 = 5.5 V; driver heat = 0.5 W; share = 5.5 / 6 = 92 % DRV8833: motor voltage = 6 - 0.36 = 5.64 V; driver heat = 0.36 W; share = 5.64 / 6 = 94 % For a battery robot below about 12 V use a MOSFET driver (TB6612 or DRV8833): the L298N wastes 37 % of the energy as heat and leaves the motor with 3.8 V. (The TB6612 is rated 1.2 A continuous: fine at 1 A, but stalling the motor would exceed it; the DRV8833 is 1.5 A RMS.) (b) Servo 30 deg: pulse = 1.0 + 30 / 180 = 1.167 ms duty = 1.167 / 20 = 5.83 % 120 deg: pulse = 1.0 + 120 / 180 = 1.667 ms duty = 1.667 / 20 = 8.33 % 1.72 ms: angle = (1.72 - 1.0) x 180 = 129.6 deg Three servos moving: 3 x 0.25 = 0.75 A. Three servos stalled: 3 x 0.65 = 1.95 A. The supply must be separate because 0.75 A to 1.95 A (with sharp spikes) is more than a board's 5 V pin or a USB port can give (about 500 mA), and the spikes and the dip in the supply voltage would reset the microcontroller. Use a 5 to 6 V supply (four NiMH cells or a buck converter) with 470 to 1000 uF next to the servos, and join only the grounds. (c) Stepper NEMA 17, 1.2 A per phase A4988, Rs = 0.068 ohm: Vref = 1.2 x 8 x 0.068 = 0.653 V (check: 0.653 / (8 x 0.068) = 1.20 A) DRV8825, Rs = 0.100 ohm: Vref = 1.2 x 5 x 0.100 = 0.600 V 1/8 microstepping of a 200-step motor: 200 x 8 = 1600 steps per revolution Step frequency at 120 rpm = 2 rev/s x 1600 = 3200 steps per second (a 3.2 kHz pulse train) 0.9 deg motor at 1/16: 400 full steps per revolution; 0.9 / 16 = 0.05625 deg per microstep (6400 microsteps per revolution) (the 1/16 figure for a 1.8 deg motor would be 0.1125 deg) (d) Relay and SSR 12 V relay, 400 ohm coil: I = 12 / 400 = 30 mA P = 144 / 400 = 0.36 W (too much for a microcontroller pin: use a transistor and a flyback diode) 8 A load: mechanical relay, contacts 0.05 ohm: P = 8^2 x 0.05 = 3.2 W (voltage drop 0.4 V) triac SSR, 1.2 V drop: P = 1.2 x 8 = 9.6 W (needs a heatsink; three times the loss) The SSR wins on life, silence and switching speed; the relay wins on heat and on the perfect off state. Checklist - A "continuous" current rating is for the running current: check the stall current too. - Servos: separate supply, common ground, a bulk capacitor, signal 50 Hz. - Stepper: set Vref with the motor disconnected or at rest, never connect a motor while the supply is on, 100 uF at VMOT. - Relays and SSRs: flyback diode on the coil, derate DC inductive contacts, never mains on a breadboard.