13.2  Working at the bench

A circuit that is wired up in one go and switched on to see what happens usually does nothing, and then nobody knows why.

There may be one fault or five, in the wiring, the parts, the supply or the code, and every one of them hides the others. Instead we build the circuit in small steps, predict what each step should do, measure that it does it, and write the result down. When something fails, only the last small step can be to blame, and we can always go back to the previous state that worked.

The first chapters embed videos from Ben Eater’s playlist Digital electronics, which builds the same circuits on camera with a lab supply, a breadboard and a multimeter. Watch each video first, then do the experiment with our parts.

The breadboard

A breadboard holds parts and wires without soldering. Under each column of five holes lies a metal spring clip, so the five holes are connected to each other and to nothing else (Figure 13.2.1). Two parts are connected when one leg of each is in the same group of five.

Along the edges run the power rails, long strips marked + (red) and − (blue) where the supply and ground are distributed.

Figure 13.2.1: The connections inside a half-size breadboard. Each group of five holes in a column is one node. The gap in the middle separates the upper and lower halves, and each rail is connected along its length.

The long boards that carry the ESP32 later in this part have each rail cut in the middle. The red and blue lines along the rail break at the cut, and the left and right halves are separate rails until a short jumper joins them (Figure 13.2.2). Put four jumpers across the cut, one per rail, before the first circuit goes on a long board. On a board with no break in its lines, the continuity test of the meter shows whether the rail is cut all the same.

Figure 13.2.2: A long breadboard. Its rails are cut in the middle: the top rails are joined across the cut by two jumpers, the bottom ones are not, so each bottom rail is two separate halves.

Three mistakes account for most breadboard faults. A part with both legs in the same group of five is short-circuited and does nothing. A leg that went into the hole next to the intended one is connected to the wrong node (Figure 13.2.3). A leg that is too short, or a stranded wire that is not twisted, is loose and makes contact only sometimes. Push every leg in until it stops, and look at the board from straight above before switching on.

Figure 13.2.3: Two of the three mistakes. Left: both legs of the resistor are in strip 8, so its two ends are the same node. Right: the resistor ends in strip 22, but the LED’s anode went into strip 23.

The bench power supply

Every new circuit in this book is powered first from an adjustable bench power supply with a current limit, never straight from a battery. It has two knobs that a battery lacks. The voltage knob lets one supply stand in for every source the circuit will meet (Table 13.2.1), without waiting for a battery to run down. The current knob sets the highest current the supply will deliver, so a wiring mistake shows up as a lamp on the front panel and not as smoke.

Table 13.2.1: Sources the bench supply stands in for.
Source Voltage
USB charger 5 V
9 V battery 9 V
Car battery, nearly empty 11.8 V
Car battery, full 12.6 V

If you buy a supply for your own bench, buy one with both knobs; a fixed-voltage adapter or a supply without a current limit gives up these two advantages.

Set to 5.00 V and 30 mA, the two knobs make the supply a promise: at most 5.00 V and at most 30 mA. We draw this promise with the current \(I\) along the horizontal axis and the voltage \(U\) up the vertical one (Figure 13.2.4). The supply can only be at a point on the two thick lines. On the blue line the voltage is 5.00 V and the current anything up to 30 mA; on the red line the current is 30 mA and the voltage anything up to 5.00 V.

Where on these lines the circuit sits is decided by the load. A resistor obeys Ohm’s law, \(U = RI\): the voltage across it is its resistance times the current through it. In the same plot this is a straight line through the origin, steep for a large \(R\) and flat for a small one. The circuit sits where this line crosses the supply’s lines, the one point where the supply and the resistor agree on both \(U\) and \(I\). A 1 kΩ resistor at 5.00 V draws 5.0 mA, well under the limit, so the supply holds 5.00 V and the C.V. (constant voltage) lamp is lit.

Figure 13.2.4: The output of a supply set to 5.00 V and 30 mA. A load settles where its line \(U = RI\) crosses the supply’s lines: on the C.V. line for every \(R\) above 167 Ω, on the C.C. line below.The ring marks the current the load would draw at the full 5.00 V.

A 100 Ω resistor at 5.00 V would draw 50 mA, more than the promise allows. The supply then lowers its voltage until the current is 30 mA, which for 100 Ω happens at \(U = 100\ \Omega \cdot 30\ \text{mA} = 3.00\) V, and the C.C. (constant current) lamp lights instead. The change happens at the corner, where \(R = 5.00\ \text{V} / 30\ \text{mA} = 167\ \Omega\), and every smaller resistance lands on the red line. Even a short circuit, \(R = 0\), only moves the circuit to the bottom of that line, 30 mA at 0 V, which harms neither the supply nor the wire. The C.C. lamp is a warning: either the limit is too low for this circuit, or the circuit has a fault such as a short circuit.

The lab has two supplies. Set each one up the same way every time.

Figure 13.2.5: The BASETech BT-305 (0 to 30 V, 0 to 5 A). The red display shows the current the circuit draws, the green display the output voltage. The lit C.V. lamp says that the supply holds the set voltage. Below are the CURRENT knob for the current limit, the FINE and COARSE knobs for the voltage, and the output terminals: black −, yellow earth, red +.

The VOLTAGE knobs (COARSE for large steps, FINE for the last tenths) set the voltage the supply tries to hold at its output. The CURRENT knob sets the current limit. The yellow terminal is connected to the mains earth; we leave it unused and take our ground from the black − terminal.

  1. Press OUTPUT so that the output is off, and disconnect the circuit. Turn the CURRENT knob to minimum.
  2. Switch on with POWER and set the voltage with COARSE and FINE while reading the green display. Set it to zero if we will raise it slowly.
  3. Set the current limit. Connect the red and black leads to each other with a short wire, switch the output on, and turn CURRENT until the red display shows the limit we want; the C.C. lamp is lit, since the short asks for more. Switch the output off and remove the wire.
  4. Connect the circuit, red lead to +, black lead to −, and switch the output on.
  5. Look at the lamps and the displays. C.V. and the expected current: carry on. C.C.: switch the output off and find out why.
Figure 13.2.6: The Velleman PS 613 (0 to 30 V, 2.5 A): voltage display on the left, current display on the right, the adjustable output at the red + and black − sockets, and the CURRENT LIMITED lamp above the power switch.

The PS 613 has one VOLTAGE knob, one CURRENT knob, and neither an OUTPUT button nor a C.V. lamp. Its CURRENT LIMITED lamp does the job of the C.C. lamp: dark while the supply holds the voltage, lit when the circuit asks for more than the limit. The fixed 12 V and 5 V outputs beside the adjustable one have no current knob, so we leave them alone until a circuit works.

  1. Disconnect the circuit and turn the CURRENT knob to minimum. The supply delivers current as soon as POWER is on, so the circuit stays disconnected until step 4.
  2. Switch on with POWER and set the voltage with VOLTAGE while reading the left display.
  3. Set the current limit. Connect the + and − sockets to each other with a short wire and turn CURRENT until the right display shows the limit we want; the CURRENT LIMITED lamp is lit, since the short asks for more. Remove the wire.
  4. Connect the circuit, red lead to +, black lead to −. Connecting it switches it on.
  5. Look at the lamp and the displays. CURRENT LIMITED dark and the expected current: carry on. CURRENT LIMITED lit: disconnect the circuit and find out why.

Some supplies show the current limit only while a button marked LIMIT or I-SET is held, and need no short circuit in step 3.

Both supplies show the current with a resolution of 0.01 A, so the 14 mA of an LED circuit appears as 0.01 and a few milliamperes as 0.00. Ben meets the same limit in his second video (“this isn’t the greatest ammeter”). The display is good enough to tell 10 mA from 100 mA and to catch a short circuit; when we need the milliamperes, we measure them with the multimeter, either in series (Measuring DC current) or as the voltage across a known resistor (the voltage budget).

A sensible current limit is a little above the current we predicted, e.g. 30 mA for an LED circuit that should draw 15 mA. If anything is wrong, the supply holds the current at the limit before a part is damaged. Batteries and USB chargers have no such knob, so a circuit moves to them only after it works on the bench supply.

The multimeter

The supply shows roughly what the circuit draws in total. The multimeter measures at each part of it: the voltage between two points, the current in a wire, the resistance of a part. The lab’s meter is the UNI-T UT131D of Figure 13.2.7.

Figure 13.2.7: The UNI-T UT131D. The black lead is in COM, the red lead in VmAµA, and the dial is on the 20 range of DC volts (V⎓). Clockwise from OFF at the top come DC volts, AC volts (V~), the non-contact voltage tester (NCV), DC current (A⎓), the diode and continuity test, and resistance (Ω).

The black lead always goes in COM, and the red lead in VmAµA for nearly everything: voltage, resistance, the diode and continuity tests, and currents up to 200 mA. The 10A MAX jack is only for larger currents, such as a motor, and for at most 10 s at a time.

The dial picks the quantity and the range. Each number on the dial is the largest value that position can show: at 20 on V⎓ the meter reads up to 19.99 V. We choose the smallest range above the value we expect, 20 for a 9 V battery and 2000m for the 1.9 V of an LED. When we cannot predict the value, we start at the highest range and step down; above the range the display shows an overload sign.

Because one jack serves both volts and milliamperes, the dial alone decides what the meter is. On A⎓ it is close to a short circuit, and touching its probes across a battery blows its fuse. After every current measurement, turn the dial back to V⎓ or OFF. How to make each measurement, and why these rules hold, is in The multimeter.

The loop

Every step at the bench runs through the same five moves (Figure 13.2.8).

Figure 13.2.8: The five moves of one step. A measurement that disagrees with the prediction sends us back to the last checkpoint.
  1. Predict. Before switching on, write down what should happen: the LED lights, the current is about 14 mA, the voltage at this point is about 1.9 V. A prediction can be rough. Without one, we cannot tell a working circuit from a broken one.
  2. Change one thing. Add one part, move one wire, change one value in the code. Never two at a time.
  3. Measure. Use the multimeter, not the eye. An LED that “looks fine” may be carrying three times its rated current.
  4. Compare. Does the measurement agree with the prediction? A difference of a few percent is normal; parts have tolerances. A factor of two, or a sign the wrong way, means that the prediction or the circuit is wrong, and we find out which before going on.
  5. Record. Write the values in the lab log, and when a step is complete, mark it as a checkpoint.

The log is a notebook, paper or a file, with one entry per step. A table is enough:

Table 13.2.2: A lab log for the first steps of the LED circuit.
Step Change Predicted Measured OK?
1 LED on supply at 1.80 V dim, a few mA 2 mA, dim yes
2 supply to 1.90 V brighter, about 15 mA 16 mA yes
3 220 Ω added, supply 5.00 V 14 mA 13.6 mA yes, checkpoint

Each entry takes a minute. It pays off the first time a circuit that worked yesterday does not work today, because it tells us exactly what worked means. The loop feels slow the first time, but no method we know reaches a working circuit sooner, because almost no time goes into hunting for faults.

Checkpoints and rolling back

A checkpoint is a state of the circuit that we have measured and know to work. Each chapter in this part marks its checkpoints in a box like this one, here step 3 of Table 13.2.2:

NoteCheckpoint: example

The LED is lit from 5 V through 220 Ω. The supply shows 5.00 V and 0.01 A; the meter reads 13.6 mA in series, about 2.0 V across the LED and 3.0 V across the resistor. Photograph the breadboard and write the values in the log.

At a checkpoint we record what we need to rebuild that state: a photo of the breadboard from straight above (Figure 13.2.9), the measured values, and for code the Git commit (or a copy of the project folder).

Figure 13.2.9: A checkpoint photo: the LED and its 220 Ω resistor, taken from straight above so that every leg’s column can be read.

When a later step fails and we cannot see why within a few minutes, we go back. We undo the last change, or rebuild from the photo, and check that the checkpoint values return. The fault is then in the last change, and that change is small; we take it again, smaller.

When it does not work

Faults are found by measuring, not by staring at the wiring.

Four techniques cover nearly every fault in this book. We try them in this order, since each takes longer than the one before.

  1. Roll back to the last checkpoint, as above.
  2. Walk with the voltmeter from the supply towards ground, as in the voltmeter walk.
  3. Compare with a known-good copy. Build a second, identical circuit that works, or keep the one from the last checkpoint, and measure the same point in both, as in A signal is not a power supply.
  4. Swap one part. If the circuits differ, exchange one part (the LED, the resistor, a jumper wire) between the good and the bad circuit. If the fault moves with the part, the part is faulty. If it stays, the part is fine.

The datasheet

Every part we use has a datasheet, a document from its manufacturer that states what the part does and what it tolerates. Search for the part number (printed on the part, the bag or the shop page) followed by the word datasheet, and prefer the PDF from the manufacturer’s own website. How to read one is shown on the LED in Read the datasheet. A development board such as the ESP32 comes with a pinout as well, which we keep open whenever we wire to the board.

Before switching on

Read this list before every new circuit is powered for the first time.

  1. The supply is set (voltage and current limit) before it is connected.
  2. Every LED has a resistor in series, or the supply’s current limit is at or below the LED’s rated current. Its long leg points towards +.
  3. No part has both legs in the same group of five holes.
  4. Red goes to +, black to −, and every ground is connected to every other ground.
  5. The meter’s dial is on V⎓ or OFF, not on a current range, unless we are about to measure current.
  6. We know what the circuit should do, and we have written the prediction down.

Further reading

Ben Eater’s series on building an 8-bit computer on breadboards shows the step-by-step method at a scale of hundreds of wires.