The resting level
In silence SIGNAL rests at VCC minus the transistor's current through 1 kΩ, and that current is the transistor's gain times a fixed base current. The S8050's gain is graded anywhere from 120 to 400, so from 5V one board can rest near 1.6 V and another near 4.0 V. It is not half the supply. Measure it; never assume it.
Two lines of arithmetic
The 510 kΩ from VCC feeds the base. The base sits at about 0.65 V, so the current into it is what is left of VCC across 510 kΩ: about 8.5 µA from 5V, about 5.2 µA from 3V3. That part is fixed by the resistor.
The transistor multiplies it. The collector current is the base current times the transistor's gain, hFE, and it flows down through the 1 kΩ. So SIGNAL rests at VCC minus that current times 1 kΩ. With a gain of 250 from 5V: 250 × 8.5 µA is about 2.1 mA, which drops about 2.1 V across the 1 kΩ, and SIGNAL rests at about 2.9 V.
The gain is not one number
Slide the gain across the datasheet's range. The S8050's datasheet grades it from 120 to 400 in three bands, L, H and J, and the parts list for this board says only S8050, not which grade. So the resting level from 5V can be anywhere from about 1.6 V to about 4.0 V: roughly 325 to 815 on an Uno. From 3V3 it is about 1.2 V to 2.7 V.
These numbers are worked out from typical values, not measured. The datasheet grades gain at 50 mA and this board runs the transistor at 0.6 to 3.5 mA, where the gain is not quite the same, and the 0.65 V is a typical figure too. The range is the honest answer: the resting level is set by a part that varies, and nobody tuned it.
What the old page said
The page this book replaces said the output was centred near half the supply. It is near half only by coincidence, for one gain in the range. A sketch that takes 512 on an Uno as silence can be wrong by up to three hundred counts.
Room to swing
The resting level also decides how far a loud sound can swing SIGNAL before it clips. Upwards it can go to VCC, when the transistor turns fully off. Downwards it can go to a few tenths of a volt, when the transistor turns fully on. A board resting near 4 V has about a volt of room above and nearly four below, so a loud clap flattens on its top side first.
The same arithmetic gives the gain for small sounds: the collector current divided by 26 mV, times 1 kΩ. From 5V that is about 40 times for a gain of 120 and about 130 times for 400. The board with the lower resting level is also the more sensitive one.
When it does not work
No. From 5V the resting level can be anywhere from about 1.6 to 4.0 V, depending on the gain of the transistor your board happens to have. About 3.3 V is a transistor near the bottom of the S8050's H grade. What matters is that the level stays still in silence and swings when you clap.
A transistor's gain rises as it warms, so its current rises and the resting level falls a little. A sketch that measures the resting level once at start-up and then looks at the swing over short windows, as the later sketches do, does not care: the swing is measured from the window's own lowest to highest reading.
Expected. The parts list names the transistor as S8050 and no grade, and the grades span 120 to 400, so two boards can rest a volt or more apart. Treat the resting level as something each sketch measures for itself.
Not with a transistor inside the datasheet's range. The transistor would need a gain of about 560 from 5V, or 600 from 3V3, to pull SIGNAL to the bottom, well past the highest grade of 400. A board that rests at 0 V has a wiring fault: start with VCC.
What the three 100 nF capacitors let through, and why this block hears a clap better than a whistle.
Three filters →Edit this page — content/books/analog-microphone/the-resting-level.mdx
Questions about this product
See what other owners have asked, and read their solutions.
Analog Microphone
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.