What a Wire Can Hold

A telegraph office with an operator's hand on a brass key, a sounder and two battery jars on the desk, and one wire running out through the window along poles into the dusk.
A telegrapher at the key: one wire, with the line's circuit made and broken by hand.

Telegraph lines, bits and the Dallas 1-Wire protocol

Three things to spend

A wire holds exactly as many bits as its receiver can tell apart, and that number depends on three things: how many lines there are, how many states each can show, and how many moments get read.

Telegraph engineers worked this out by hand between the 1830s and the 1870s, long before Claude Shannon gave the quantity a unit in 1948. They bought lines, states or time according to what each one cost. Wire over distance cost the most, so they converged on a single line and spent time instead.

Dallas Semiconductor's 1-Wire bus, built for small sensors and memory chips, reaches the same single line for a different reason: it saves pins, not miles of wire. The two systems look alike on an oscilloscope, and they even share a way of telling one symbol from another. They differ in who keeps time and where the power comes from.

One line, one moment

A single telegraph line at a single moment holds one bit, provided the receiver knows it is being spoken to.

The line is a circuit: a battery, a long wire, a relay or sounder at each station, and usually the earth as the return path. A key makes or breaks that circuit, so current is either flowing or it is not. That is one distinction, and one distinction is one bit.

The catch is that silence is ambiguous. No current could mean a deliberate zero, a line with nothing to say, a cut wire or a flat battery. So a bare on-or-off line can carry a bit, but it cannot tell the receiver that a bit is being carried.

Telegraphers met this problem in two ways:

The first answer comes back in 1-Wire, which rests its line high and treats every low as an event.

More lines, more states, more time

Capacity multiplies across the three resources: N lines, each showing k distinguishable states, read over T moments.

bits = N × T × log2(k)

That is a ceiling. The code decides how much of it to use, and historical telegraphs often used far less, on purpose.

The formula is older than the bit, and it came out of the telegraph. Harry Nyquist, writing on telegraph speed in the Bell System Technical Journal in 1924, gave it as W = K log m, where W is the speed and m is "the number of current values". Ralph Hartley generalised it in 1928 to H = n log s, for n selections from s symbols, taking as the measure of information "the logarithm of the number of possible symbol sequences". Shannon's paper of 1948 builds on "the important papers of Nyquist and Hartley", and credits the word bit to John Tukey.

SchemeLines (N)States per line (k)Moments (T)CeilingActually used
One on/off line1211 bit1 bit
Edison's quadruplex (1874), one direction1412 bits2 bits
Baudot's five-unit code (1870s)1255 bits5 bits
Five parallel on/off lines5215 bits5 bits
Cooke and Wheatstone's five needles (1837)5317.92 bits4.32 bits (20 letters)
Sömmerring's electrochemical telegraph (1809)352135 bits5.13 bits (35 symbols)

The last two rows show the gap. Sömmerring gave each symbol its own wire, the code now called one-hot: trivially easy to read and ruinous in wire. Cooke and Wheatstone moved exactly two needles at a time, so they pointed at a letter on a grid and the clerk needed no code book. Current went out along one needle's wire and back along the other's, giving 5 × 4 = 20 ordered pairs.

The quadruplex shows what extra states can do. Edison used two independent properties of the current, its direction and its strength, so one wire carried two bits at once, and a balanced circuit let it do so in both directions. The limit on this route is noise: every added level asks the receiver for a finer judgement, and long wires on wet poles leak. The Shannon–Hartley theorem later put a number on that limit, C = B log₂(1 + S/N): a line's capacity grows with its bandwidth, and only with the logarithm of its signal-to-noise ratio.

Five parallel lines and five moments on one line both come to five bits, so the formula alone cannot choose between them. Cost chooses. Five wires cost five times as much to string, while five moments cost only a longer wait, and over a hundred miles that decides it. Cooke and Wheatstone themselves went from five needles to two and then one within a few years.

The problem of the clock

Spending time instead of wire creates a new cost: both ends must agree on when one moment ends and the next begins.

A second line carrying a clock would settle it, and modern chip buses such as SPI and I²C do exactly that. On a telegraph route that meant paying for another wire, so the industry looked for ways to keep time on the line it already had. It found three, in rough historical order:

  1. A trained ear (Morse). The sender's hand sets a unit: in International Morse a dot is one unit, a dash three, the gap inside a letter one, between letters three, between words seven. The line is binary, but the meaning sits in the durations, so the listener recovers the rhythm continuously and tolerates a drifting hand. At 25 words per minute a dot lasts about 48 ms.
  2. Machines in step (Baudot). Rotating distributors at each end turned together, with correction signals to hold them in phase. Every character took five equal slots, and several operators could share a wire by taking turns. This was fast and expensive to keep aligned.
  3. Start and stop (teleprinters). The line rested in one state, and a start pulse tripped the receiver's cam to run through one character on its own motor. A stop pulse brought it to rest again. The clock only had to hold for one character, so a cheap motor would do, and every UART still works this way.

The pattern is that resynchronising more often lets you use a worse clock. Baudot's machines had to stay aligned for long stretches, while a teleprinter resets every character. 1-Wire takes this to its limit by resetting on every bit.

Dallas 1-Wire

1-Wire puts signalling, timing and the chips' own power on one data line plus a ground.

The name is generous in the way "single-wire telegraph" was: there is a return path, here a ground wire instead of the earth. A pull-up resistor, typically 4.7 kΩ, holds the line high, and each device can only pull it low through an open-drain transistor. In normal signalling nobody drives the line high, so devices cannot fight.

A slave can run with no power pin at all. It charges a small internal capacitor while the line is high and lives off that charge during lows. This is why the line must stay high most of the time, and why idle high is more than a convention.

Every exchange starts the same way. The master holds the line low for at least 480 µs as a reset, then releases it, and each slave answers with a presence pulse of 60 to 240 µs. After that, bits move in slots of 60 to 120 µs, and only the master ever begins one:

On a write, the slave looks at the line roughly 15 to 60 µs after the falling edge, and that edge restarts its timer. Its oscillator therefore only has to hold for one slot, which is why a tiny chip with a poor clock can take part. An optional overdrive mode runs about ten times faster on the same principle.

Addressing is built into the silicon. Each device carries a factory-set 64-bit ROM code: an 8-bit family code, a 48-bit serial number and an 8-bit CRC. The Match ROM command selects one device, and Search ROM discovers all of them by walking a binary tree, one bit position at a time.

The search relies on the fact that a low from any device beats a high from all the others. At each position every remaining slave sends its bit and then the complement of that bit, and the master reads two values:

The master then writes the bit it wants to follow, and slaves holding the other value drop out until the next reset. A whole 64-bit address costs three slots per bit, and the bus finds its own population.

Telegraph line, the letter A

          dot      gap              dash
on     +--------+        +------------------------+
       |        |        |                        |
off  --+        +--------+                        +-----
         1 unit   1 unit           3 units

1-Wire bus, four time slots

        write 1          write 0              read 1           read 0
high ---+   +------------+                  +-+   +------------+        +------
        |   |            |                  | |   |            |        |
low     +---+            +------------------+ +---+            +-=======+
                 :                :                :                :
        low 1-15 µs      low 60-120 µs        stays high       slave holds low

The colons mark when the receiver samples: the slave on a write, the master on a read. The = stretch is the slave holding the line low, inside a pulse the master began. The drawing is not to one scale: a Morse dot at 25 words per minute is about 48 ms, a 1-Wire slot about 60 µs.

A 1-Wire write is a dot or a dash inside a fixed frame: the slave ignores the pulse's length and looks once at a set delay.

What 1-Wire inherits, and what it changes

1-Wire keeps the telegraph's single line, its pulse-length symbols and its dominant state, and replaces the human operator with a master that owns all the timing.

Three things carry over:

The changes matter more:

PropertyTelegraph lineDallas 1-Wire
ConductorsOne wire per circuit, earth returnOne data line, one ground
Idle stateCurrent flowing (American closed circuit)Line high through a pull-up
Who starts a symbolWhoever is sendingAlways the master
SymbolRun lengths, read by earFixed slot, sampled at a set delay
ResynchronisedContinuously, by the listenerAt every bit's falling edge
RateAbout 21 signalling units a second at 25 words per minute, carrying roughly 10 bits/s of textRoughly 16 kbit/s on the line at standard speed
AddressesCall signs assigned by people64-bit codes set at the factory
Finding stationsEveryone knows the circuit listBinary search over the wire
Receiver powerLine for the relay, often a local battery for the sounderThe line itself, if parasitic
ErrorsAn operator asks for a repeatCRC, then the master retries
ReachHundreds of kilometres, with relaysAs much as 200 m, with one sensor

The last row hides a shared limit. Both systems are held back by the time it takes to charge a wire's capacitance through a resistance. Kelvin's law of squares described this for submarine cables, where signalling speed fell with the square of the length. On 1-Wire the same physics appears as the pull-up's struggle to bring the line back high before the next slot.

Closed-circuit telegraph: stations in series

line battery --- station A --- station B --- station C --- earth plate
     |           key closed    key closed    KEY OPEN           |
     +- - - - - - current returns through the earth - - - - - - +

1-Wire bus: devices in parallel

+V -- pull-up --+-----------+-----------+------ data line
                |           |           |
              master     slave 1     slave 2
             released   released   PULLING LOW
                |           |           |
----------------+-----------+-----------+------ ground

Series and parallel are duals here: the loop shares current and the bus shares voltage, and in each, one station can overrule all the others.

The same bargain

The telegraph and 1-Wire made the same bargain, giving up wires and paying in time, and they differ mainly in who was asked to pay.

The telegraph paid with skilled people. A good operator was a clock, a decoder and an error corrector, which is why one wire could work at all. 1-Wire pays with a master that does all the thinking and a slot rate that is low by the standards of a chip. Its slave can be cheap enough to fit in a sensor, or a steel button on a key ring, because the master carries the burden the operator used to carry.

The arithmetic never changed. A line still holds what its receiver can tell apart, multiplied across lines, states and moments. What moved between 1837 and 1-Wire was the answer to a practical question: which of the three is cheapest here, and who has to keep time?

Sources

Free to read

Alfred Vail, The American Electro Magnetic Telegraph (Lea & Blanchard, Philadelphia, 1845). It surveys every electric telegraph known in 1845, from one wire to each letter to Morse's single wire. Read it free at Project Gutenberg.