Google searches have only yielded 5th grade level examples (“the modem talks between your ISP and your home network!”) or articles I would need a degree to understand. Can anyone provide an explanation that’s somewhere in between the two? I understand the fundamentals of how the Internet works, and how LAN works regarding a router and individual devices, but I’m curious to know more about the link between those.
The term “modem” is a contraction of “modulator-demodulator”.
If one wants to send/transmit a binary digit (zero or one) through a length of wire, one of the easiest ways to do that is to make the wire at some predetermined voltage for the zero symbol, and some other predetermined voltage for the one symbol, with respect to ground. This is known as modulation, more specifically voltage modulation. The voltages are arbitrary.
(Other forms of modulation include frequency modulation and phase modulation, which would work over wired or wireless/radio communication. The principles of modulation don’t care what kind of modulation it is, so this explainer will stick with wired voltage modulation even where practice would use something else.)
For an ideal wire, the voltage signal at the far end will be the same as the near end. A receiver can detect the voltage signal and check if it matches the voltage for the zero symbol, or matches voltage for the one symbol. Detecting and checking is known as demodulation. Symbols that go in one end can be detected at the far end.
Unfortunately, we can’t buy ideal wires; nobody has them in stock.
For our wires, physics limitations (such as but not limited to wire resistance) come into play and the voltage at the far end will be different than what we put in at the near end. However, a receiver can detect the voltage signal and decide if it is closer to the voltage for zero, or closer to the voltage for one, and use that to determine the symbol received. However, eventually the wire gets so long and resistance so high that we can’t tell the difference between the received voltage for zero/one.
One solution is to break the wire into two. We then insert an ideal amplifier at the half-way point, where we still have enough voltage signal to detect zero/one, and we make it “louder”. It might appear obvious that we can continue to divide the wire into segments with an ideal amplifier on each one to get any length of transmission.
Unfortunately, we can’t buy ideal amplifiers; nobody has them in stock.
For our amplifiers, each one makes the voltage signal “louder”, but also adds unpredictable noise. And the next one down the line both amplifies the desired voltage signal, but also the unpredictable noise, making both “louder”, before adding yet more unpredictable noise. So it is entirely possible that by the time we get to the far end, we have so much noise that the received voltage signal can no longer be reliably detected to be a zero/one symbol.
We can fix that by replacing amplifiers with custom repeaters. These custom repeaters know what voltage should be there for a zero/one symbol. Rather than simply making the incoming signal “louder”, they detect the incoming symbol, and then drive the predetermined voltage signal for that symbol, along with the unavoidable noise. But in this case, the noise received from the previous length has been eliminated.
So now we can send a zero symbol or one symbol reliably over a cable of any length, but what happens when we want to send more than one? We have to change the voltage for each new symbol.
There is a new physics issue here. No matter how rapidly we raise or lower the voltage signal on the near end of a wire segment, the far end of the wire segment will more slowly transition (ramp) from one voltage to the other. This causes issues for the repeaters, because during that transition, there is a time where the input is more or less in the middle, and it isn’t clear whether they are detecting a zero/one symbol. And noise from the repeater makes the symbol further ambiguous.
If we change the voltage once per minute, we’re fine because the receiver can simply check a couple times per minute and average the readings to safely determine a single zero/one symbol. But that sending frequency would require 100 years to send a single picture that would fill today’s screens.
So what happens if we change the voltage faster? Eventually we reach a physics limit what the wires can carry or what the repeaters can repeat, and the zero/one symbols start to blend into each other (a form of intersymbol interference.) This limiting frequency is the fastest we can change the symbols.
Some clever folks realized that instead of a two predefined voltages for the two symbols of zero/one, they could choose four predefined voltages for the four symbols of 00/01/10/11. This requires that each receiver (including the repeaters) is now more complicated and expensive because it must detect one of four voltages. We still have the practically the same limit for the fastest frequency to change the symbols. But at that same frequency, we are now sending twice as much data.
It is clear this can be extended to larger collections (constellations) of symbols, following the rules of 2^N. Three bits would have eight symbols, six bits would be sixty-four symbols. Each time we increase the number of bits transmitted per symbol, we get an increase in the data rate.
It would seem that data rate should be unlimited, except that our physics limitations make it really hard to reliably detect which symbol was received for high-order constellations. Our network of wire lengths and repeaters was chosen/tuned to work for only two symbols. When we try to put higher rate constellations of symbols into our network, we also have to replace all of our custom repeaters! We also have to shorten the wire lengths of each segment and increase the number of repeaters for the same distance.
It is also really difficult and expensive to design and build receivers that can detect higher rate constellations of symbols. [As of this writing Nov 2023, the highest order constellations of symbols planned are 12-bit (4096 symbols) but I’m not aware of any systems where that is widely deployed.]
Note that in practice, repeaters are not often used because, for the reasons listed above, they have to be replaced anytime you change the number of symbols used. So instead of repeaters, most networks use amplifiers with all of their difficulties.
A bit outside the scope of “How the f*ck does a modem work?” and moving more into the degree-required area, there is one more improvement that is notable. Some more clever folks realized that by slightly limiting the number of symbols that are sent, they can improve the reliability of the connection even if the channel of wires/amplifiers has a lot of noise and degradation.
To explain what they did, imagine a system of 6-bit symbols. We switch gears from voltage modulation to frequency modulation, so each symbol corresponds to a specific predetermined frequency. For explanation purposes, we choose those frequencies arbitrarily to be the highest 64 keys of those on a piano keyboard. If we play those frequencies into the channel and have someone with perfect pitch listening on the far end, we hope they are able to determine which of those 64 notes is being struck each time.
However, noise in the channel means that sometimes it will be ambiguous which note was used; e.g. it kind of sounds like middle F or maybe middle F-sharp/G-flat. If we prearrange that we will only play in the key of C-major, then some of the notes will not be used, but that makes it easier for the listener with perfect pitch (receiver) to guess which note it was. In the example above, middle F#/Gb is not part of the C-major scale, so the received note must be middle F. Resolving such an ambiguity of a received symbol based on probability following predetermined rules is named the Viterbi algorithm, named after one of the inventors.