Hey! Welcome to the second post on my series about how Wi-Fi works.

Make sure you read the first article before you dive into this one.

In the first article, you learned that radio waves are similar to water waves except they don’t need a *medium* to pass through. You also learned the basics of electromagnetism and how it applies to Wi-Fi technology.

Finally, we closed out the post with a tour of the frequencies allocated to Wi-Fi networks. I explained why the FCC gave us the 2.4Ghz and 5Ghz freqencies and finished up with a tour of the 802.11 Wi-Fi standards.

Today you’re going to learn one thing:

- How is data put on radio waves?

Then in Part 3 we’ll wrap up with Wi-Fi hotspots and Wi-Fi security.

Let’s do this yo…

## It’s all about data representation

It’s really interesting to think that as I sit here at my desk, several emails just passed through my body.

Someone probably sent a JPEG of a cat through my eye and I might have the song “Let it Flow” from Toni Braxton streaming through my heart.

*Wow.*

So exactly *how* does this happen?

Everything related to a computer can be reduced to a string of zeros and ones. It’s called binary and it’s the DNA of digital information.

Right now we’re talking about **data representation **and this branch of computer science is *positively fascinating to me*.

Here’s how it works. At its most fundamental level, **everything in your computer is a bit**.

It’s either *on* (1) or *off* (0).

So a single bit has two states: on or off and therefore can stand for two pieces of information.

Let that digest for a moment then keep reading.

A byte is just a collection of 8 bits. Since each bit represents two pieces of information how many pieces of information do you think a byte can stand for?

Just raise the number 2 to the 8th power. 2^{8} is equal to **256**.

So let’s start with using binary to represent text.

Let’s say everyone in the world agreed to represent the letter “A” by the numeric value 65.

The number 65 is in base 10. In other words, 65 is really equal to 5 ones and 6 tens. 5 ones + 6 tens gives you 65.

But remember computers think in binary *which is base two*.

In the decimal system, each digit place represents a power of 10. So 65 means 5 is in the ones place and 6 is in the 10s place.

The 5 is equal to 5 x 10^{0} and the 6 means 6 x 10^{1 }which is 60. So 60 + 5 equals 65.

If the number were *165* that would mean you have 5 in the ones place, 6 in the tens place and 1 in the hundreds place. Each digit is a factor of 10. Add up the whole shebang and you get 1 hundred + 6 tens + 5 ones = 165.

Easy enough.

That last section either bored you because it felt so rudimentary or captivated you because

like me, you love learning everything you can even if it’s basic.

Anyway, in base two, each digit is a *factor of 2*.

So there are two ways to convert decimals to binary.

- The mighty Windows Calculator
- Keep dividing the quotient by 2 ignoring the remainders until nothing is left

Let me show you what I’m talking about.

## Beautiful Binary

Hit the Windows logo key on your keyboard, type “calculator” and press **Alt** + **3** to open the *Programmer* calculator.

Then type in “65′ and click the radio dial next to **Bin** in the left side of the window to see the binary equivalent.

Alternately, the long way (but arguably more beautiful way) is to keep dividing the quotient by 2. If you don’t get a remainder that translates to a binary 0, otherwise it’s a binary one.

Then you just keep dividing the integer part of the quotient by 2 until you finish out the number. *What remains is your binary number.*

It sounds more complicated than it is.

For example, take the number 65 and divide it by 2. What do you get?

65 / 2 is 32.5. It has a remainder so put down a **binary 1** on your paper and only pay attention to the integer part of the quotient: **the 32**.

Now divide 32 by 2. It’s 16 with no remainder. So put down a **binary 0** on your paper.

Divide 16 by 2. It’s 8. So put down **another binary 0** on your paper.

Divide 8 by 2. It’s 4; again with no remainder so put down a binary 0 on your paper.

*Keep going.*

Divide 4 by 2. 4 / 2 = 2 so put down another binary 0 on your paper.

Now what’s 2 divided by 2? That’s 1, again with no remainder, so **put down another binary 0**.

*Now what’s 1 divided by 2*? That’s one half, clearly there’s a remainder there so put down a binary 1 on your paper and you’re done because there’s no integer part left in the quotient.

You should have 1000001.

And that my friend is the letter A in binary. Now remember a byte is a collection of 8 bits, so technically the computer sees the A as **01000001**.

That’s data representation for you and this same principal applies to *every kind of information that needs to be expressed as ones and zeros*.

For example, that cat JPEG that your buddy just sent to you via Snapchat just flew through your body as a radio wave encoded with a very specific pattern of 0’s and 1’s.

All images are really just a super big array of little dots called

pixels.

If you have a Full HD monitor set to its native resolution then you have 1,920 horizontal pixels and 1,080 vertical pixels. That’s where the term 1920×1080 or 1080 HD comes from.

So each pixel, each little dot, can be represented with two values:

- Location (where is it’s exact location on your screen?)
- Color

If you could unravel or stretch out all the pixels in your monitor as **one super long pixel necklace** you would have a list of pixels and each pixel could have a value expressing its location on the screen and its color (which is expressed as a numeric value just like the character “A” example I showed you earlier).

Now here’s the thing: modern monitors allow a 32-bit pixel depth. This means each pixel can be represented by 32-bits.

*Think about that.*

32-bits.

How many different colors can a single dot on your monitor be?

2 to the 32^{nd} power. Yup. **4.3 billion.**

Imagine a freggin’ crayon box with 4.3 billion colors in it. You’d have so many shades of the same color that you couldn’t even distinguish the differences

between thousands of colors.

Here’s the bottom line: whenever everyone agrees to allow certain bit patterns on certain systems to represent particular pieces of information you can represent almost anything in binary.

That’s the ultra condensed version of how data representation works.

## Getting ones and zeros on the wave

Can you think of a way you could use a radio wave to represent a one or a zero?

You just need a regular pattern in the wave, a predictable way to change either the height of the wave (the amplitude) or the number of humps that pass a given point in time (the frequency). Then you could represent a 1 by all the peaks in the wave and a 0 by all the troughs. Or you could keep the amplitude constant and vary the frequency.

Perhaps 2 humps that pass a point in one second could indicate a zero but 1 hump that passes that same point would be a one.

This is sort of how Wi-Fi is able to encode a message on a radio wave.

Technically it uses **Amplitude Shift Keying** (ASK) so it knows *exactly* which amplitude changes represents a one or a zero. Moreover, if you’re sending information using frequency changes you could use **Frequency Shift Keying** (FSK) so that both the sender and receiver know exactly which wave pattern variations represent ones and zeros.

You can also modulate data by shifting the *phase* too. Picture two identical waves with one on top of the other. The top is perfectly aligned with the bottom. If you nudged the bottom forward a little the peaks and troughs would no longer be in sync with the top. This is a phase shift and it’s another way to represent zeros and ones.

But here’s the point:

As long as you can

modulate(control the variations) the wave you can encode information on the wave.

And as long as the radio transmitter (the laptop, smartphone, Dropcam) and the radio receiver (the Wi-Fi access point) agree on what the zeros and ones mean (and there’s not much in the way to distort the signal) you’ll have no problem sending that picture of your cat to your co-workers through the air.

## The Bottom Line

Data representation and Wi-Fi modulation are actually dense, recondite topics. Entire tomes written on them. I’ve given you a superficial explanation because I just want you to have a basic idea how your cat gets in the air. (no I’m not talking about punting him silly)

We’ll explore the wonderful world of Wi-Fi hotspots and wireless security next. I didn’t want to rush into those topics without giving you the foundation for how it all works.

Hope you like it.

Stay tuned. I’ll unveil Part 3 tomorrow.

Pingback: How Wi-Fi works (Parts 3 of 3) - fixedByVonnie()