Of course one of the purposes of the “Introduction to Digital Computers” video series is to create a series of videos which describe how computers work from a transistor level–and starting with NPN transistors so in theory you could build this yourself.
Because the idea is that I want computers not to be this strange abstraction where below some level there are these theoretical things called “CMOS transistors” which we can’t lay our hands on or touch or feel.
I also based my abstraction of a transistor in part using the sets of equations derived from Balajee Seshadri’s explanation of a transistor starting with the idea of a resistor. The graph in the first video is mathematically derived from these equations, using certain resistor values and a transistor with a β of 100, like the 2N3904 transistor.
I even went through and built the gates, which is in a subsequent video.
But in the process of building a transistor array which can create a full adder circuit from 2N3904 transistors, I noticed a mistake in my video.
And I’m wrestling with how to fix this bug.
See, the entire explanation of a transistor relies on the following circuit:
Now this circuit has the nice property that it amplifies the input voltage Vin to the voltage Vout–but the output voltage is inverted from the input voltage. That is, the higher the input voltage, the lower the output voltage–as the transistor switches on, the voltage that would go to Vout goes to ground instead.
When you graph this, it looks something like this:
That is, as the input voltage (blue) ramps up, the transistor eventually switches on. This drives the current to ground, which causes the output voltage to descend more rapidly than the input voltage.
My error was to reverse this. Because I didn’t want to have to deal with inversion in the graph (because this is an introduction video, ‘natch), I flipped the circuit around and drew the following diagram:
But the graph is incorrect.
It turns out in the real world the behavior of the output when you flip the transistor and the resistor pair is not as graphed.
This was generated by iCurcit for the Macintosh, and it matches what I’ve seen on a voltmeter in the real world. The top (red) line indicates the input voltage. The bottom (yellow) line represents the output voltage with the circuit at the top.
And the purple line is the output voltage of the circuit I showed in the “Introduction to Digital Computers” video.
Essentially what happens is until the transistor hits it’s switching voltage (for the 2N3904, 0.7v), the output remains zero. Then when the transistor activates, the output current rises roughly at the same rate as the input voltage–to reach a maximum of around 4.3v assuming a 5v rail.
The best explanation I have for this is to think of a transistor as a gate across a sluice of water: the water pressure flowing to the base opens the gate allowing water to flow from the collector to the emitter. The water at the base then flows out the emitter. The problem is if you block the emitter, the water pressure at the base lowers (remember Voltage = Current * Resistance), which then causes the gate not to open as wide.
This leaves me with a dilemma, and I suspect what I’ll be doing is redoing all the animations for the video and posting a new version with the corrected graph. But it’s truly annoying I didn’t catch this before, and I apologize for the error.