Bench and safety
Before any code moves a motor, the bench decides how much damage a mistake can do. Set the current limit before the output is on, know which instrument answers which question, and know what the arm does when the power goes away, because one day it will.
3 formulas · 5/5 checks pass · 18 sources · fact-checked and reviewed
Key ideas
The current limit is the setting that protects you
A bench supply in constant-voltage mode holds its voltage and lets the load draw what it likes, up to the current limit. A load that would draw more pushes it into constant current: the supply holds the current and lets the voltage fall. The crossover sits at (F1.02); any load below it gets the limit and no more.[1][2]
Logic analyser for timing, oscilloscope for shape
A logic analyser records ones and zeros on many lines at once and decodes protocols such as I²C, SPI and serial; it answers when and what was sent. An oscilloscope records the voltage itself and answers what does the signal look like: ringing, noise, a sagging rail. Sample a digital line at least four times its bandwidth (F1.03).[6][7][8]
A motor can push energy back into the supply
A spinning motor is also a generator. When its load drives it, or a driver slows it by applying less voltage than the motor's own emf (as a servo drive does when it decelerates), current flows back through the driver toward the supply; in a coasting H-bridge it returns through the transistors' body diodes once the emf exceeds the supply voltage. Most supplies can absorb very little of it, so the rail rises. TI's DRV8842 data sheet asks for bulk capacitors rated above the operating voltage to leave margin for exactly this.[3][9][10][11][12]
Cutting the power is a stop, but not a controlled one
IEC 60204-1, on the electrical equipment of machines, names three stop categories: 0, immediate removal of power; 1, a controlled stop and then power off; 2, a controlled stop with power kept on. A desktop arm is not built to it, but the words are useful. A switch that simply removes power gives a category 0 stop; categories 1 and 2 need the drives to bring the arm to rest under power first. After a category 0 stop, an arm that can be back-driven and has no brake falls.[13]
A driver has two ways to be off
Coast turns the bridge off: the driver stops driving, and any current left in the winding decays through the transistors' body diodes, so the joint is left largely free. Brake shorts the winding, which then resists motion in proportion to speed (F8.11). Braking slows a falling link; it cannot hold one still, because at zero speed the braking torque is zero.[9][14]
Formulas
The same entries as the formula sheet. Open an entry's details for its symbols and the checks behind it.
Electrical power
Symbols
Symbol Meaning Unit power W voltage V current A Where a bench supply switches from constant voltage to constant current
Ideal CV/CC supply with a resistive load. Loads below R_cross put the supply in constant current, and the output voltage falls to I_limit·R.
Symbols and checks
Symbol Meaning Unit load resistance at the crossover Ω voltage setting V current limit A - ✓ 20 ohm at 1 V / 0.08 A: predicted CV, Siglent observed CVobserved as stated
- ✓ 20 ohm: predicted current vs Siglent's measured 0.049 Aexpected 0.05 · got 0.049 · relative error 0.02within 5 %: resistor tolerance and lead resistance
- ✓ 10 ohm: predicted CC (R below 12.5 ohm), Siglent observed CCobserved as statedSiglent: the current 'stops at just below the current setpoint of 80 mA'
- ✓ spin-up with winding inductance: the clamp releases at (V - I_lim R)/K (rad/s)expected 70 · got 70.0001 · relative error 1.1×10⁻⁶agrees by construction once the current is steady; the run shows the inductance does not move it. Rotor inertia 1e-05 kg m^2 sets only how long it takes
- ✓ spin-up: the limit is reached within the first millisecondobserved as statedthe winding current rises with time constant L/R = 0.1 ms
Logic analyser sample rate
Rule of thumb for digital timing work, not a theorem. Nyquist (2×) is the floor for recovering a band-limited signal, not for resolving edges; more margin resolves timing better.
Symbols
Symbol Meaning Unit sample rate Hz bandwidth of the fastest signal (for a clocked bus, its clock frequency) Hz
Worked example: the first power-up of a motor, limit first
The illustrative motor behind module 08's braking check, with a winding resistance of 10 Ω and a torque constant of 0.1 N·m/A, on an ideal bench supply set to 12 V. The numbers below come from tools/robotics/verify.py, which also time-steps the spin-up.
Switch on, and watch the mode change
As the motor speeds up, its back emf adds to the the supply must provide at constant current. When the two reach the voltage setting, the supply can no longer hold the current, returns to constant voltage, and the current falls as the motor keeps accelerating. For this motor that happens at about 668 rpm. A time-stepped run that includes the winding's inductance releases the limit at the same speed, since the inductance plays no part once the current is steady.[3][15]
What the supply does as the motor spins up (no load, no friction) Motor Supply mode Output voltage Current At rest, or stalled constant current 5 V 0.5 A Speeding up constant current 5 V + 0.5 A Above 70 rad/s constant voltage 12 V falls as rises Read the display
Constant current during the first moments of a start is expected. Constant current while the shaft is not turning means a stall, a short or a wiring mistake: switch the output off and find out which. The limit has already capped the heating power while you do.
Set the limit for the worst case you can name, before the output is on. A fault then shows up as a lit constant-current indicator, with the heating power capped at a value you chose in advance.
Best practice
Set the voltage and the current limit with the output off.
The limit protects only what is connected after it is set, and a load plugged into a live output also takes the charge already on the supply's output capacitor. Connect with the output off, switch it on last, and off first.[10]
Start with the limit below the stall current, and raise it for a reason.
Stall current is and is easy to work out from the data sheet or a multimeter. Below it, a stall costs heat you have chosen, not heat the motor chooses.[15]
Keep a switch that cuts motor power within reach, separate from the computer.
A software stop needs the software to be working. A switch that removes power is a category 0 stop: crude, but it does not depend on the thing that may have failed.[13]
Know where the arm will fall before you cut its power.
An arm that can be back-driven and has no brake drops under gravity when power goes; shorting the windings only slows the fall. Keep hands, cables and anything fragile out of the space below it.[14]
Use the logic analyser to time the control loop.
If the loop runs on a microcontroller, toggle a spare pin once per cycle. The analyser then shows the loop's period and its jitter directly, with no clock to trust but its own.
Reach for the oscilloscope when the question is about voltage.
Supply sag under load, ringing on a long cable, a noisy sensor line: a logic analyser's digital inputs round these to ones and zeros and hide them.[7]
Questions
- The motor is rated for 12 V. Why limit the current at all?
- The rating is for running. Starting or stalled, the motor generates no back emf, so it draws , which for the motor on this page is 1.2 A and 14.4 W of heat. The limit decides how much of that a mistake can have.[3][15]
- Do I need an oscilloscope, or is a logic analyser enough?
- For timing and protocols, a logic analyser is the better tool and often all you need. Saleae, which makes logic analysers, says plainly that they do not replace an oscilloscope for signal integrity, high-bandwidth analog work, or voltages outside their input range.[6][7]
- What sample rate should I use?
- At least four times the bandwidth of the fastest digital signal (F1.03); for a clocked bus such as SPI, that means four times the clock. Saleae's rule for analog is at least ten times. More margin gives finer timing.[8]
- Why did the supply voltage jump when the motor stopped suddenly?
- If a driver was decelerating the motor under power (not by shorting its winding), or the load was driving it, the motor became a generator and pushed current back onto the rail, which most supplies can absorb very little of. This is why the DRV8842 data sheet asks for bulk capacitors rated above the operating voltage. With the motor wired straight to the supply, as in the example above, a sudden stall does the opposite: the current rises, and if it reaches the limit the supply drops into constant current and its voltage falls.[10][12][15]
- Will braking the motor hold the arm up if the power fails?
- No. A shorted winding produces torque in proportion to speed, so it slows a fall but cannot stop it (F8.11). And a driver needs power to brake: below its undervoltage threshold the DRV8833 disables all its circuitry, so it cannot short the winding at all. Holding a load without power takes something mechanical, such as a brake.[9][14]
- What should a bench supply for this have?
- Constant-voltage and constant-current modes with a limit you can set, and enough voltage and current for the motors you will test one at a time. A linear programmable supply such as Siglent's SPD1305X, with up to 30 V and 5 A, is one example of the type.[16][17]
Watch
- listed
Modern Robotics, Chapter 8.9: Actuation, Gearing, and Friction (opens in a new tab)[18]
Kevin M. Lynch · Northwestern University, Modern Robotics video series (YouTube)
Motors, gearing and friction from the course this project follows: what the controller will see through the motor.
Read
- read
Understanding Constant Voltage (CV) and Constant Current (CC) Modes in Regulated Power Supplies (opens in a new tab)[2]
B&K Precision, technical note, 5 June 2025
How a supply moves between constant voltage and constant current.
- read
SPD Constant Current (operating tip) (opens in a new tab)[1]
Siglent Technologies North America
A worked example of the crossover with two loads, from a manufacturer.
- read
What is the difference between a Logic Analyzer and an Oscilloscope? (opens in a new tab)[6]
Joe Garrison · Saleae blog, 21 December 2017
The difference between the two instruments, in a page.
- read
Stop Categories (UR20/UR30 user manual) (opens in a new tab)[13]
Universal Robots
The three stop categories of IEC 60204-1, as an arm maker states them.
- read
DRV8833 Dual H-Bridge Motor Driver, data sheet (SLVSAR1E) (opens in a new tab)[9]
Texas Instruments, 2011, revised 2015
A small motor driver's truth table, including its coast and brake states.
Sources
Numbered in order of first use on this page. read: checked against the claim. listed: exists and covers the topic, wording not checked. derived: worked out here and checked numerically.
- [1]read
SPD Constant Current (operating tip) (opens in a new tab)
Siglent Technologies North America
The supply stays in CV while the load draws less than the limit and switches to CC when it would draw more (worked example with 20 Ω and 10 Ω loads).
- [2]read
B&K Precision, technical note, 5 June 2025
When the load would draw more than the current limit, the supply switches from CV to CC, holds the current at the limit and reduces the voltage as needed.
- [3]read
University Physics Volume 2, §13.6 Electric Generators and Back Emf (opens in a new tab)
Samuel J. Ling, Jeff Sanny, William Moebs · OpenStax, 2016. CC BY 4.0
Back emf and Fig. 13.32
A turning motor generates a back emf that is zero at rest and rises in proportion to the motor's angular velocity.
- [4]read
University Physics Volume 2, §9.4 Ohm's Law (opens in a new tab)
Samuel J. Ling, Jeff Sanny, William Moebs · OpenStax, 2016. CC BY 4.0
Eq. 9.11 (V = IR)
Ohm's law, used for the current a back-emf drives through a shorted winding.
- [5]read
University Physics Volume 2, §9.5 Electrical Energy and Power (opens in a new tab)
Samuel J. Ling, Jeff Sanny, William Moebs · OpenStax, 2016. CC BY 4.0
Eq. 9.12 (P = IV)
Electrical power.
- [6]read
What is the difference between a Logic Analyzer and an Oscilloscope? (opens in a new tab)
Joe Garrison · Saleae blog, 21 December 2017
Logic analyzers are best for digital signals and protocols (I²C, SPI, serial), recording ones and zeros over time; oscilloscopes are best for analog signals, tracking voltage and how it changes.
- [7]read
Can These Products Replace an Oscilloscope? (opens in a new tab)
Saleae support
Saleae devices are logic analyzers with analog logging, of lower bandwidth than oscilloscopes and with fixed input range; a scope is still needed for signal integrity, high-bandwidth analog, small voltages at high resolution and voltages outside their range.
- [8]read
What Sampling Rate Should I Use? (opens in a new tab)
Saleae support
Sample digital signals at least 4× their bandwidth, analog at least 10×.
- [9]read
DRV8833 Dual H-Bridge Motor Driver, data sheet (SLVSAR1E) (opens in a new tab)
Texas Instruments, 2011, revised 2015
§7.3.2 Bridge Control and Decay Modes, Table 1 (H-Bridge Logic); §7.3.5.3 Undervoltage Lockout
A driver’s two “off” states: coast (outputs high-impedance; in fast decay the recirculation current flows through the body diodes) and brake (both outputs low, which shorts the winding). Below the undervoltage threshold (VM < 2.5 V) all circuitry in the device is disabled.
- [10]read
Power Supplies Can Absorb Power, Too (opens in a new tab)
Bob Zollo · Electronic Design, 1 February 2018
In most power supplies, some provision is made to discharge the output capacitor: a bleed resistor or an active down-programmer, the latter typically limited to about 10 % of rated output current. A supply that can also sink current is called two-quadrant. A device under test can itself be an energy generator.
- [11]read
How to Size a Power Supply for a Servo Drive (opens in a new tab)
ADVANCED Motion Controls, 2026
Every deceleration drives the load’s kinetic energy back through the drive onto the DC bus; with nowhere to go, the bus voltage rises until the drive faults on overvoltage. An unregulated supply is not built to sink reverse current; a shunt regulator can clamp the bus.
- [12]read
DRV8842 data sheet, Power Supply Recommendations (SLVSAB8G) (opens in a new tab)
Texas Instruments, 2010, revised 2016
§9.1 Bulk Capacitance Sizing
Bulk capacitors should be rated above the operating voltage to allow for cases when the motor transfers energy to the supply; without enough bulk capacitance the supply voltage moves with the motor’s current demands and dumps.
- [13]read
Stop Categories (UR20/UR30 user manual) (opens in a new tab)
Universal Robots
Stop categories as defined in IEC 60204-1: 0, stop by immediate removal of power; 1, controlled stop, then power removed; 2, stop with power maintained to the drives.
- [14]derived
Braking from a shorted winding (back emf, Ohm’s law, torque proportional to current)
F8.11, checked against an independent simulation of the coupled pendulum and RL circuit.
- [15]derived
Stalled and spinning motor on a current-limited supply
The illustrative motor behind module 08’s braking check (K = 0.1 N·m/A, R = 10 Ω, L = 1 mH): stall current and power from Ohm’s law, and a time-stepped spin-up from rest on a voltage source whose current is clamped at the limit, recording the speed at which the clamp releases.
- [16]read
SPD1305X Programmable Linear DC Power Supply (opens in a new tab)
Siglent Technologies NA, product page
Output 0–30 V, 0–5 A, 150 W; a programmable linear supply. (The page’s feature list also shows 16 V / 8 A figures that belong to another model.)
- [17]read
Siglent Technologies, April 2021 (copy hosted by SMU Physics)
SPD1305X: 30 V / 5 A, up to 150 W; constant-voltage and constant-current modes; output short-circuit and overload protection.
- [18]listed
Modern Robotics, Chapter 8.9: Actuation, Gearing, and Friction (opens in a new tab)
Kevin M. Lynch · Northwestern University, Modern Robotics video series (YouTube)
The book’s own video for §8.9: motors, gearing, apparent (reflected) inertia and friction models. Linked from the book site’s chapter 8 video list.