Source: https://fullstackelectronics.com/experiments/12-the-swap

# Experiment 12: The Swap

Add two transistors and the timing parts of Experiment 1, connect the blocks in a loop, and take the generator away. The board then runs as a 555.

Experiment 11 finished the last block of the timer. The board now holds both comparators, the divider that sets their references, and the latch. Nothing connects them yet. In Experiment 9 the function generator made the ramp for the comparators, and in Experiment 11 it set and reset the latch. A timer must make its own ramp and its own S and R pulses.

The NE555 of Experiment 1 does this with a capacitor and two resistors outside the chip, and two transistors inside it. One transistor empties the capacitor, and the other drives the load. This experiment adds those two transistors, Q19 and Q20, and the resistors and the capacitor of Experiment 1. Then it connects the blocks in a loop, and the capacitor takes the generator's place. That change is the swap. The last section measures the board in the same way as the NE555 in Experiment 1. Figure 12-1 shows the loop. The parts in the dashed outline are the parts inside a 555. The pale boxes are the blocks that are already on the board.

![The timer drawn as one loop. A dashed outline, labelled Blocks inside the 555, holds the left part of the drawing. Inside it are four pale boxes: the divider, labelled R1 to R3, with outputs 2/3 and 1/3; the threshold comparator, Q1 to Q7, which takes 2/3 and THR; the trigger comparator, Q8 to Q14, which takes 1/3 and TRG; and the latch, Q15 to Q18. Also inside, in colour: the threshold comparator's output wire, labelled R, and the trigger comparator's output wire, labelled S, into the latch. The latch output Q goes through a 10 kilohm resistor to the base of Q19, and the latch output Q-bar goes through a 10 kilohm resistor to the base of Q20. The +5 volt line runs along the top from the divider, and the ground line runs along the bottom from the divider, with one ground symbol. Three wires cross the outline to the parts on the right, labelled Outside the 555. OUT, Q19's collector, goes to an LED and a 220 ohm resistor up to the +5 volt line. DIS, Q20's collector, goes to the join of RA from the +5 volt line and RB. RB goes down to the capacitor C, which goes to ground. Two wires from the top of C, labelled TRG and THR, join outside the outline and run back into it along the bottom: TRG up to the trigger comparator and THR up to the threshold comparator. Green numbered markers: 1 beside RA and RB, 2 on the R wire, 3 beside Q20, 4 on the S wire.](https://fullstackelectronics.com/experiments/img/12-loop.svg)

**Figure 12-1:** The timer as one loop. The dashed outline holds the parts inside a 555. The numbers match the steps in the section “How the loop runs”.

### You will need

- [ ] 2×2N3904 NPN transistor, for Q19 and Q20
- [ ] 4×10 kΩ resistor: one for each new base, and RA and RB
- [ ] 1×10 µF electrolytic capacitor, C
- [ ] 1×Red LED and 220 Ω resistor
- [ ] 4×Jumper lead, male to male, about 20 cm long
- [ ] The board from Experiment 11: both comparators, the divider and the latch
- [ ] Solid jumper wire, for the wires inside the 555
- [ ] Bench power supply: one output at 5.00 V with a 50 mA current limit (the 5 V supply in the steps), adjustable down to 4.50 V
- [ ] Oscilloscope with two probes, and a multimeter

## How the loop runs

Experiment 11 drove S and R from the generator. In the loop, the two comparators drive S and R, and the capacitor voltage drives both comparators. Call that voltage CAP. Follow Figure 12-1 through one cycle:

1.  Q is 1 and Q̄ is 0. Q20 is off, so current flows from +5 V through RA and RB into C, and CAP rises. Q also turns Q19 on, so the LED is lit.
2.  CAP rises above 2/3 of the supply. The threshold comparator's OUT rises, so R is 1. The latch resets: Q falls to 0, Q̄ rises to 1, and the LED goes off.
3.  Q̄ turns Q20 on. Q20 holds DIS, the join of RA and RB, near 0 V. C discharges through RB into Q20, and CAP falls. CAP is now below 2/3, so R returns to 0, and the latch holds Q at 0.
4.  CAP falls below 1/3 of the supply. The trigger comparator's OUT rises, so S is 1. The latch sets: Q rises to 1 and Q̄ falls to 0. Q20 turns off, C charges again and CAP rises above 1/3. S returns to 0, and step 1 starts again.

Each comparator's OUT is 1 only for a short time near its level. For the rest of the cycle both are 0, and the latch alone keeps the timer charging or discharging. Those are the two hold states of Experiment 11. C charges through RA and RB in series and discharges through RB alone. So the charge takes about twice as long as the discharge, and the LED is lit for about two-thirds of each cycle, as on the NE555.

## Two more transistor switches

The loop needs two parts that the board does not have yet: Q19 and Q20. Figure 12-2 shows them with the timing parts. Each one is the transistor switch of Experiment 3, with a 10 kΩ into its base, its emitter at ground and its load on its collector.

![Schematic with one +5 volt line along the top and one ground line along the bottom. Input Q comes in from the left through a 10 kilohm resistor to the base of Q19. A 220 ohm resistor and an LED run from the +5 volt line down to Q19's collector. A wire from the collector runs right to a terminal labelled OUT, hopping the RA wire. Input Q-bar comes in from the left through a 10 kilohm resistor to the base of Q20, hopping Q19's emitter lead. Q20's collector rises to a node labelled DIS. RA, 10 kilohms, runs from the +5 volt line to DIS. RB, 10 kilohms, runs from DIS down to a node with a terminal labelled TRG/THR on the right. C, a 10 microfarad electrolytic, runs from that node to ground. Both emitters go to the ground line.](https://fullstackelectronics.com/experiments/img/12-new-parts.svg)

**Figure 12-2:** Q19, the output buffer, and Q20, the discharge transistor, with RA, RB and C.

Q20 is the discharge transistor. In the NE555 it is the transistor on pin 7, DISCHARGE. Its collector goes to DIS. When Q̄ is 1, Q20 turns on and holds DIS near 0 V, so C discharges through RB. When Q̄ is 0, Q20 is off, and the current through RA continues through RB into C. Without Q20, nothing discharges C. It charges past 2/3 towards 5 V, R stays at 1, and the timer stops after the first charge.

Q19 is the output buffer. A buffer is a stage that drives a load, so that the circuit before it supplies only a small current. The LED and its 220 Ω hang from the +5 V line to Q19's collector. When Q is 1, Q19 turns on and the LED lights. By calculation the LED then takes about 13 mA, and Q supplies only Q19's base current.

Why not connect the LED to Q directly? A 1 on Q comes through Gate 1's 1 kΩ pull-up. With the LED and its 220 Ω on Q, the current comes through that 1 kΩ. By calculation the LED then takes about 2.5 mA, and the 1 on Q falls to about 2.5 V. In Experiment 2 the LED did the same to the CD4001B's Q: its 1 fell to about 2.6 V. The NE555 has a separate output stage after its latch for the same reason.

The LED lights while C charges, as on the NE555 in Experiment 1. The voltage at Q19's collector is the opposite way up from pin 3 of the NE555, because Q19 inverts. Call that collector OUT. OUT is near 0 V while C charges and high while C discharges. The board of Stage Four takes Q19's base from Q̄ instead, so that its OUT matches pin 3. On the breadboard the LED is the output, and it matches.

### Each output now drives two bases

Experiment 11 found that a 1 on Q or Q̄ is about 4.6 V, because the output also drives a base through a 10 kΩ. Now Q drives the bases of Q17 and Q19, and Q̄ drives the bases of Q16 and Q20.

1.  Each base sits about 0.7 V above ground and has its own 10 kΩ from the output. Two 10 kΩ in parallel act as 5 kΩ.
2.  With the 1 kΩ pull-up, 6 kΩ connect +5 V to the two bases. So the current is (5 V − 0.7 V) / 6 kΩ = 0.72 mA, and each base takes 0.36 mA.
3.  The 0.72 mA puts 0.72 V across the pull-up. So a 1 falls to about 5.00 V − 0.72 V = 4.3 V.

4.3 V is still far above the 1.10 V where a transistor switch from Experiment 3 finishes its change. The 0.36 mA is also enough for each new transistor. The onsemi datasheet for the 2N3904 gives a current gain of at least 100 at 10 mA, so Q19's 13 mA needs about 0.13 mA of base current. Q20 carries less than 1 mA. Experiment 11 warned that each extra base lowers the 1 again. With two bases on each output, the 1 stays near 4.3 V.

## Make room on the board

Figure 12-2 gave the circuit. On the board, the new parts go in two groups, as in Figure 12-1. Q19 and Q20 are inside a 555, so they go next to the latch. The LED, its 220 Ω, RA, RB and C are outside a 555, so they go further right. Wires on the board connect the blocks inside the 555, as in Experiment 2. Four jumper leads then connect the 555's pins to the parts outside it.

The wires need room. The latch moves two columns right, so columns 28 and 29 become free for the R and S resistors. The rail links in columns 38 and 39 move to columns 57 and 58, so that they stay at the right end of the circuit. The drawings now show 58 of the board's 63 columns. Figure 12-3 shows the board after these moves.

[![The breadboard drawn 58 columns wide, with both comparators and the divider faded. The two 1 kilohm ramp resistors and the 10 kilohm resistors of S and R are gone. In colour, the latch in columns 30 to 35. Gate 2, labelled Gate 2: Q17 and Q18, is in the upper block: Q17 at 30d to 32d and Q18 at 33d to 35d, with emitter jumpers from 30a and 33a to the outer top rail, a green jumper from 32b to 35b and a 1 kilohm pull-up from 35a to the inner top rail. Gate 1, labelled Gate 1: Q15 and Q16, is in the lower block: Q15 at 30h to 32h and Q16 at 33h to 35h, with emitter jumpers from 32j and 35j to the inner bottom rail, a green jumper from 30i to 33i and a 1 kilohm pull-up from 33j to the outer bottom rail. Two 10 kilohm resistors cross the channel, from 30f to 31e and from 35e to 34f. A green bracket above columns 28 and 29 is labelled free. At the right end, the rail links: a blue jumper at column 57 and a red jumper at column 58, labelled rail links.](https://fullstackelectronics.com/experiments/img/12-breadboard-room.svg)](https://fullstackelectronics.com/experiments/img/12-breadboard-room.svg)

**Figure 12-3:** The latch two columns right, and the rail links at the right end.

1.  **Switch off** the 5 V supply and the generator.
2.  **Remove the instrument leads.** Unclip both generator channels from R and S, and remove their black leads from the board. Remove both oscilloscope probes. The generator is not needed again in this experiment.
3.  **Remove the two 1 kΩ ramp resistors** from 13j and 20a. Each one protected a base from the oscillation that a long instrument lead caused in Experiment 7. The ramp now comes from C on the board.
4.  **Remove the 10 kΩ resistors of S and R** from 32a and 29j. They go back in a new place in the section “Connect the blocks”.
5.  **Move the rail links.** Move the red link from column 39 to column 58, and the blue link from column 38 to column 57. Each link joins the same two rails as before.
6.  **Move the latch two columns right.** Move each part of both gates two columns to the right, and keep it in the same rows. The top rail has no hole at column 30, so Q17's emitter jumper goes from 30a to the outer top rail at column 29. The two 1 kΩ pull-ups move too: Gate 2's from 33a to 35a, and Gate 1's from 31j to 33j. Each pull-up stays in the collector strip of its gate.

Move one part at a time, and check its new holes against Figure 12-3 before you move the next part.

Move each part to the right. A pull-up moved two columns left goes into a base strip. On my board Gate 2's pull-up went into 31a, Q17's base. Q17 then stayed on and held Q̄ at 0, so Q20 did not discharge C. At switch-on the LED flashed once and then stayed dark.

## Build Q19, Q20 and the timing parts

The latch now ends at column 35. Q19 and Q20 go two columns to its right, in columns 38 to 40, Q19 in the lower block and Q20 in the upper block. Their base resistors lie along a row, so that the wires from the latch can reach them along a row too. The parts outside the 555 go in columns 50 to 54, and columns 41 to 49 stay empty between the two groups. Experiment 13 adds the last block inside the 555 in those columns, so no part outside the 555 has to move again. Figure 12-4 shows the new parts.

[![The breadboard drawn 58 columns wide, with everything from Experiments 3 to 11 faded, the latch in columns 30 to 35. In colour, two columns right of the latch: in the lower block, Q19, a 2N3904, at 38h to 40h with its flat face towards the far edge, a blue jumper from 40j to the inner bottom rail, and a 10 kilohm resistor along row i from 37i to 39i, labelled 10 kilohms for Q19's base. In the upper block, in the same columns, Q20, a 2N3904, at 38d to 40d with its flat face towards the near edge, a blue jumper from 38a to the outer top rail, and a 10 kilohm resistor along row b from 37b to 39b, labelled 10 kilohms for Q20's base. Columns 41 to 49 are empty. In colour, right of them: a red LED crosses the centre channel from 50e to 50f, and a 220 ohm resistor runs from 50a to the inner top rail. RA, 10 kilohms, runs from 52a to the inner top rail. RB, 10 kilohms, runs along row b from 52b to 54b. A green jumper crosses the channel from 54e to 54f. C, the 10 microfarad electrolytic, lies along row g from 54g to 52g, and a blue jumper runs from 52j to the inner bottom rail. Under the board, a green bracket under columns 1 to 40 is labelled inside the 555, a green bracket under columns 41 to 49 is labelled free, and a green bracket under columns 50 to 54 is labelled outside the 555.](https://fullstackelectronics.com/experiments/img/12-breadboard-new.svg)](https://fullstackelectronics.com/experiments/img/12-breadboard-new.svg)

**Figure 12-4:** Q19 and Q20 next to the latch, inside the 555. The LED and the timing parts are outside the 555, right of the empty columns.

Check the polarity of C before you apply power. The stripe on the electrolytic marks its negative lead, and that lead goes into the ground rail. A reversed electrolytic can become hot or vent.

1.  **Fit Q19.** Put a 2N3904 in 38h, 39h and 40h, with its flat face towards the far edge. Its legs read collector, base, emitter from left to right.
2.  **Connect Q19's emitter to ground.** Fit a jumper from 40j to the inner bottom rail at column 40.
3.  **Fit Q19's base resistor.** Fit a 10 kΩ along row i, from 37i to 39i.
4.  **Fit Q20.** Put a 2N3904 in 38d, 39d and 40d, with its flat face towards the near edge. Its legs read emitter, base, collector from left to right.
5.  **Connect Q20's emitter to ground.** Fit a jumper from 38a to the outer top rail at column 38.
6.  **Fit Q20's base resistor.** Fit a 10 kΩ along row b, from 37b to 39b.
7.  **Fit the LED** across the centre channel. Put its anode, the longer lead, in 50e and its cathode in 50f.
8.  **Fit the 220 Ω** from 50a to the inner top rail, the +5 V one.
9.  **Fit RA.** Fit a 10 kΩ from 52a to the inner top rail.
10. **Fit RB.** Fit a 10 kΩ from 52b to 54b.
11. **Connect the two strips of column 54.** Fit a jumper across the centre channel from 54e to 54f.
12. **Fit C** along row g. Put its positive lead in 54g and its negative lead in 52g.
13. **Connect C's negative lead to ground.** Fit a jumper from 52j to the inner bottom rail at column 52.

Experiment 1 called the timing resistors R1 and R2. On this board R1 to R3 are the divider of Experiment 9, so the timing resistors take the names from the NE555 datasheet: RA and RB.

## Connect the blocks

The new parts are in place, and the blocks are still separate. First, wires on the board connect the blocks inside the 555: S and R from the comparators to the latch, and Q and Q̄ from the latch to Q19 and Q20. Rows c and g have no parts in them, because the transistor legs are in rows d and h. So the wires lie along those rows, under the transistor bodies. The 10 kΩ resistors of R and S cross the centre channel in the free columns 28 and 29, from the comparator's block to the latch gate in the other block. Figure 12-5 shows the wires.

[![The breadboard with everything faded except yellow wires and two 10 kilohm resistors. R: a yellow wire along row c from 11c to 28c, a 10 kilohm resistor across the channel from 28e to 28f, labelled R: 10 kilohms, and a yellow wire along row j from 28j to 31j. S: a yellow wire along row g from 16g to 29g, a 10 kilohm resistor across the channel from 29f to 29e, labelled S: 10 kilohms, and a yellow wire along row c from 29c to 34c. Q: a yellow wire along row g from 33g to 37g. Q-bar: a yellow wire along row c from 35c to 37c. Pills name the wires R, S, Q and Q-bar.](https://fullstackelectronics.com/experiments/img/12-breadboard-wires.svg)](https://fullstackelectronics.com/experiments/img/12-breadboard-wires.svg)

**Figure 12-5:** The wires inside the 555.

1.  **R, first wire:** fit a wire along row c from 11c, the threshold comparator's OUT, to 28c.
2.  **R's 10 kΩ:** fit it across the centre channel, from 28e to 28f.
3.  **R, second wire:** fit a wire along row j from 28j to 31j, Q15's base.
4.  **S, first wire:** fit a wire along row g from 16g, the trigger comparator's OUT, to 29g.
5.  **S's 10 kΩ:** fit it across the centre channel, from 29f to 29e.
6.  **S, second wire:** fit a wire along row c from 29c to 34c, Q18's base.
7.  **Q:** fit a wire along row g from 33g to 37g. The lower strip of column 37 holds the left leg of Q19's base resistor.
8.  **Q̄:** fit a wire along row c from 35c to 37c. The upper strip of column 37 holds the left leg of Q20's base resistor.

The blocks inside the 555 are now connected. A 555 connects to the parts outside it through its pins. Four jumper leads do the same here, and Figure 12-6 tags each one with the pin name:

- OUT goes from Q19's collector to the LED. On the NE555 this is pin 3, OUTPUT, with the opposite polarity.
- DIS goes from Q20's collector to the join of RA and RB. This is pin 7, DISCHARGE.
- TRG goes from C to the trigger comparator's input, Q8's base. This is pin 2, TRIGGER.
- THR goes from C to the threshold comparator's input, Q2's base. This is pin 6, THRESHOLD.

[![The breadboard with everything faded except four loose jumper leads, each tagged. Yellow lead OUT from 38j loops under the board and up into 50j. Green lead DIS from 40a arches over the top and down into 52d, left of RA. Magenta lead TRG from 54a arches over the top of the board and down into 20a. Magenta lead THR from 54j loops under the board and up into 13j.](https://fullstackelectronics.com/experiments/img/12-breadboard-leads.svg)](https://fullstackelectronics.com/experiments/img/12-breadboard-leads.svg)

**Figure 12-6:** The four leads from the 555's pins to the parts outside it.

1.  **OUT:** fit a lead from 38j, Q19's collector, to 50j, the LED's cathode. Route it under the board.
2.  **DIS:** fit a lead from 40a, Q20's collector, to 52d, the join of RA and RB.
3.  **TRG:** fit a lead from 54a to 20a. The upper strip of column 20 is Q8's base, the trigger comparator's ramp input.
4.  **THR:** fit a lead from 54j to 13j. The lower strip of column 13 is Q2's base, the threshold comparator's ramp input. Route it under the board.

The routes in Figure 12-6 keep the leads apart and clear of the parts. A different route works too, if each lead's two ends go into the correct holes.

## Switch on

All the connections of Figure 12-1 are now on the board. Set the 5 V supply to 5.00 V with a 50 mA current limit, and switch it on. Expect the LED to blink about five times a second and to stay on about twice as long as it stays off.

The LED lights as soon as the supply is on. At that moment C is empty and CAP is 0 V. That is below 1/3 of the supply, so the trigger comparator's OUT is 1 and S sets the latch. Q rises, the LED lights, Q20 stays off and C starts to charge. An empty capacitor is the condition that the trigger comparator detects, so the timer starts by itself.

### If the LED does not blink

Switch the supply off before you change anything. Then work through these checks:

- If the supply display shows CC (constant current), the board draws the full 50 mA. Look for a lead in a rail, or a reversed part.
- Check the LED's direction and the stripe on C.
- Check each wire against Figure 12-5 and each lead against Figure 12-6, one end at a time. A wire or a lead one hole off connects the wrong strip.
- If the LED stays lit or stays dark, switch the supply on again and measure CAP at 54h with the multimeter. The LED and CAP together show which part of the loop stops:
  - The LED stays lit and CAP is above 3.3 V, 2/3 of the supply. R does not reset the latch. Check the THR lead, the two R wires and R's 10 kΩ.
  - The LED stays lit and CAP is below 1.7 V, 1/3 of the supply. C does not charge. Check RA, RB and the stripe on C. Also check that Q20's base resistor is in the strip of the Q̄ wire.
  - The LED goes dark and CAP is above 3.3 V. C does not discharge. Check Gate 2's pull-up in 35a, Q20, its emitter jumper, its base resistor, the Q̄ wire and the DIS lead. The DIS lead must be in Q20's collector strip, column 40.
  - The LED goes dark and CAP is below 1.7 V. S does not set the latch. Check the TRG lead, the two S wires and S's 10 kΩ.

## Measure it as in Experiment 1

The board blinks at about the NE555's rate. The oscilloscope shows how close it is. Use the method of Experiment 1: channel 1 on the output, channel 2 on the capacitor.

| Oscilloscope channel | Tip or hook            | Ground clip                  |
|----------------------|------------------------|------------------------------|
| Channel 1: OUT       | 50h, the LED's cathode | Inner bottom rail, column 51 |
| Channel 2: CAP       | 54h, C's positive lead | Inner bottom rail, column 53 |

[![The finished board faded, leads included. A yellow ring on 50h is labelled OUT: channel 1 tip. A magenta ring on 54h is labelled CAP: channel 2 tip. Blue rings on the inner bottom rail at columns 51 and 53 are labelled channel 1 ground and channel 2 ground.](https://fullstackelectronics.com/experiments/img/12-breadboard-scope.svg)](https://fullstackelectronics.com/experiments/img/12-breadboard-scope.svg)

**Figure 12-7:** Oscilloscope channel 1 on OUT and channel 2 on CAP.

1.  **Switch off** the 5 V supply. Connect both probes as the table shows.
2.  **Match the probe settings.** Set the switch on each probe to 10×, and set Probe to 10X for CH1 and CH2.
3.  **Set the scales:** both channels at 1 V/div, DC coupling, and the timebase at 50 ms/div. Put both ground markers at the same height, near the bottom of the screen.
4.  **Set the trigger:** Edge, source CH1, falling slope, level 1.5 V. OUT falls at the start of each charge, so each sweep starts where a charge starts, as in Experiment 1.
5.  **Add the measurements.** In the Measure menu, add Period and −Duty for channel 1. −Duty is the share of each period that OUT is low, the time that the LED is lit.
6.  **Switch on** the 5 V supply.
7.  **Measure the turning points.** Press Cursors, select Manual and set the source to CH2. Put Y1 on the bottom of the capacitor trace and Y2 on its top.

Check that the cursor source is CH2 before you read a turning point. The cursor source is separate from the trigger source, and cursors on the wrong channel read the wrong trace. On my first build of this circuit both turning points read about 0.4 V low, by the same amount. The cursors were on channel 1. The circuit was correct.

![Oscilloscope with channels 1 and 2 at 1 volt per division and the same ground marker near the bottom, 50 milliseconds per division, triggered on channel 1 falling at 1.5 volts. The yellow trace, OUT, is near 0 volts for about 130 milliseconds and then near 3.6 volts for about 60 milliseconds, repeating. The magenta trace, CAP, rises in a slow curve while OUT is low and falls faster while OUT is high, between two dashed cursor lines. The cursor box reads Y1 1.56 volts, Y2 3.12 volts and delta Y 1.56 volts, source CH2. The measurements under the traces read period 192.59 milliseconds and minus duty 67.06 percent on channel 1.](https://fullstackelectronics.com/experiments/img/12-loop-5v.png)

**Figure 12-8:** OUT in yellow and CAP in magenta, supply 5.00 V. CAP turns at 1.56 V and 3.12 V, and the period is 192.59 ms.

Expect the capacitor trace of Experiment 1: a slow curved rise and a faster fall between about 1.67 V and 3.33 V. OUT is low during the rise and high during the fall. Its high is about 3.6 V, because with Q19 off only the probe's small current flows through the LED. The table compares the expected values with the NE555 of Experiment 1 and with my board.

| Measurement | Expected with nominal parts | NE555, Experiment 1 | My board  |
|-------------|-----------------------------|---------------------|-----------|
| Period      | About 208 ms                | 200.46 ms           | 192.59 ms |
| Frequency   | About 4.81 Hz               | 4.99 Hz             | 5.19 Hz   |
| LED on      | 66.7 %                      | 66.76 %             | 67.06 %   |
| CAP minimum | About 1.67 V                | 1.68 V              | 1.56 V    |
| CAP maximum | About 3.33 V                | 3.34 V              | 3.12 V    |

## What just happened?

The LED blinks as it blinked on the NE555 in Experiment 1. Twenty transistors on one breadboard now do the work of that chip: Q1 to Q7 in the threshold comparator, Q8 to Q14 in the trigger comparator, Q15 to Q18 in the latch, and Q19 and Q20. Each block came from its own experiment, from the transistor switch of Experiment 3 to the latch of Experiment 11, and each block was tested alone. This experiment connected them, and they run as one timer within 4 % of the NE555's rate.

No block on the board keeps time. The comparators compare, the latch holds one bit and Q20 switches. C sets the time, because its voltage takes time to change.

The divider sets the two turning points. CAP turns at about 1/3 and 2/3 of the supply, because each comparator compares it with a tap of the divider. My board turned at 1.56 V and 3.12 V. That is 0.12 V and 0.22 V below the NE555's 1.68 V and 3.34 V. Possible causes are the comparators' offsets and the divider's resistor tolerances. This experiment does not measure them separately.

RA, RB and C set the time between the turning points. The charge runs through RA and RB, 20 kΩ, and the discharge through RB alone, 10 kΩ. So the charge takes twice as long, and the LED is on for two-thirds of each period. The box “Where the 208 ms comes from” calculates the two times.

#### Where the 208 ms comes from

During the charge, CAP moves towards 5 V through RA + RB. Call the difference between the supply and CAP the gap. The charge starts with CAP at 1/3 of the supply, so the gap is 2/3 of the supply. It ends at 2/3, where the gap is 1/3. So the gap halves. Experiment 9 showed that the gap halves in 0.69 RC, whatever its size. The charge takes 0.69 × 20 kΩ × 10 µF = 139 ms.

During the discharge, Q20 holds DIS near 0 V, and CAP moves towards 0 V through RB alone. It falls from 2/3 of the supply to 1/3, so it halves too. The discharge takes 0.69 × 10 kΩ × 10 µF = 69 ms. One period is 139 ms + 69 ms = 208 ms, so the rate is 4.81 Hz, and the LED is on for 139 of every 208 ms, two-thirds.

The formula of Experiment 1 from the two times optional

Each time is one halving, and one halving takes $\ln 2$ times the time constant of its resistance and C:

$$t_{\text{charge}} = \ln 2\,(R_A + R_B)\,C \qquad t_{\text{discharge}} = \ln 2\, R_B\, C$$

Add the two times to get the period:

$$T = \ln 2\,(R_A + R_B)\,C + \ln 2\, R_B\, C = \ln 2\,(R_A + 2R_B)\,C$$

The frequency is one divided by the period. With $\ln 2 \approx 0.693$, one divided by $\ln 2$ is about 1.44:

$$f = \frac{1}{T} = \frac{1}{\ln 2\,(R_A + 2R_B)\,C} \approx \frac{1.44}{(R_A + 2R_B)\,C}$$

The share of the period that the LED is on is the charge time divided by the period. The $\ln 2$ and the $C$ cancel:

$$\frac{t_{\text{charge}}}{T} = \frac{R_A + R_B}{R_A + 2R_B} = \frac{20\ \text{k}\Omega}{30\ \text{k}\Omega} = \frac{2}{3}$$

My board ran at 5.19 Hz, 8 % above the 4.81 Hz that the nominal parts give. The NE555 ran 4 % above it. Experiment 1 named the causes that can move a rate by that much. They are the tolerances of the resistors and the capacitor, the switching levels and the measurement. On my board the turning points also add to the difference. They are 1.56 V apart, and the NE555's are 1.66 V apart.

## Change the supply

The calculation in the box “Where the 208 ms comes from” used only fractions of the supply. Experiment 9 showed that the taps keep their fractions when the supply changes. Experiment 9 also calculated that the time to climb from 1/3 to 2/3 of the supply stays the same at 4.50 V. That is the [ratiometric](https://fullstackelectronics.com/reference/glossary.html.md#ratiometric) property. On this board it is a measurement.

1.  **Lower the 5 V supply to 4.50 V.** Measure it with the multimeter on the outer bottom rail, the +5 V one. Keep the oscilloscope as it is.
2.  **Read the period and the turning points.** Expect the turning points to move to about 1.50 V and 3.00 V. Expect the period to stay close to its value at 5.00 V.
3.  **Set the supply back to 5.00 V.**

![The oscilloscope as in Figure 12-8, supply 4.50 volts. The yellow trace, OUT, is near 0 volts while C charges and near 3.1 volts while C discharges. The magenta trace, CAP, is the same sawtooth as at 5.00 volts, a little lower on the screen. The cursor box reads Y1 1.44 volts, Y2 2.84 volts and delta Y 1.40 volts, source CH2. The measurements under the traces read period 195.23 milliseconds and minus duty 66.73 percent on channel 1.](https://fullstackelectronics.com/experiments/img/12-loop-4v5.png)

**Figure 12-9:** The measurement of Figure 12-8 on a 4.50 V supply. CAP turns at 1.44 V and 2.84 V, and the period is 195.23 ms.

At 4.50 V, CAP has less voltage to cover between the two turning points. C also charges towards a lower supply, so it charges more slowly. By calculation the two changes cancel, so the rate depends only on RA, RB and C. On my board the turning points moved from 1.56 V and 3.12 V to 1.44 V and 2.84 V. The period changed from 192.59 ms to 195.23 ms, by 1.4 %, while the supply changed by 10 %. The LED is a little dimmer, because its current falls to about 11 mA.

## Three 555s, one rate

The same astable circuit now runs on three builds. Experiment 1 used the NE555, and Experiment 2 used catalogue chips. This experiment uses discrete transistors. Figure 12-10 shows the three captures with the same timebase, 50 ms/div.

[![Experiment 1, the NE555: the magenta capacitor sawtooth between cursors at 1.68 and 3.34 volts, and the yellow output, high while the capacitor charges. Period 200.46 milliseconds.](https://fullstackelectronics.com/experiments/img/01-scope-sawtooth.png)](https://fullstackelectronics.com/experiments/img/01-scope-sawtooth.png)

NE555, Experiment 1: 200.46 ms

[![Experiment 2, the LM393 and CD4001B with the output driver: the magenta capacitor sawtooth, and the yellow output, low while the capacitor charges. Period 198.89 milliseconds.](https://fullstackelectronics.com/experiments/img/02-scope-output.png)](https://fullstackelectronics.com/experiments/img/02-scope-output.png)

LM393 and CD4001B, Experiment 2: 198.89 ms

[![This experiment, discrete transistors: the magenta capacitor sawtooth between cursors at 1.56 and 3.12 volts, and the yellow OUT, low while the capacitor charges. Period 192.59 milliseconds.](https://fullstackelectronics.com/experiments/img/12-loop-5v.png)](https://fullstackelectronics.com/experiments/img/12-loop-5v.png)

Twenty transistors, this experiment: 192.59 ms

**Figure 12-10:** The capacitor in magenta and the output in yellow on the three builds. The NE555's output is high while C charges. The output driver of Experiment 2 and Q19 here invert it, so their output is low while C charges. Click a capture to enlarge it.

The table gives the rate of each, as I measured them.

| Build                                                    | Rate          |
|----------------------------------------------------------|---------------|
| NE555 (Experiment 1)                                     | 4.99 Hz       |
| LM393 and CD4001B, with the output driver (Experiment 2) | About 5.02 Hz |
| Discrete transistors (this experiment)                   | 5.19 Hz       |
| Formula, 10 kΩ, 10 kΩ and 10 µF                          | 4.81 Hz       |

The three builds agree within about 4 %. The comparison covers the astable rate with an LED load. Other modes and other loads need their own measurements.

## Quick check

Three questions on this experiment. They ask what holds the timer between the turning points, why the charge takes longer, and how the timer starts.

1\. CAP is halfway up its rise, and both comparators' OUTs are 0. C continues to charge because…

the latch holds Q at 1, so Q20 stays off

the threshold comparator holds R at 1 for the whole rise

Q19 supplies the charging current

S and R are both 0, which is the hold state of Experiment 11. The last pulse was on S, so Q stays at 1 and Q̄ at 0. Q20 stays off, and the current through RA and RB continues into C.

2\. The charge takes about twice as long as the discharge, because…

Q20 discharges C faster than RA can charge it

C charges through RA and RB, 20 kΩ, and discharges through RB alone, 10 kΩ

the threshold comparator is slower than the trigger comparator

Each phase halves a gap, and a halving takes 0.69 times the resistance times C. The charge has twice the resistance of the discharge, so it takes twice the time: 139 ms against 69 ms.

3\. At switch-on, C is empty. The LED lights at once, because…

Q19 is on whenever the supply is on

the threshold comparator resets the latch at 0 V

CAP is below 1/3 of the supply, so the trigger comparator's OUT is 1 and S sets the latch

0 V is below the 1/3 tap. The trigger comparator detects that, S sets the latch, and Q turns Q19 on. Q̄ keeps Q20 off, so C starts to charge.

## Before moving on

The board runs as a 555 astable, built from twenty transistors and tested block by block. The comparators drive S and R, the latch drives Q19 and Q20, and C drives the comparators. Q19 lights the LED while C charges, and Q20 discharges C through RB. All of it stays on the board. The NE555 has one more input, pin 4, RESET. A low on RESET stops the timer, whatever the capacitor does. [Experiment 13: The Reset Pin](https://fullstackelectronics.com/experiments/13-the-reset-pin.html.md) adds that input to the board.
