← flaviocopes.com

Electronics Basics: Analog vs digital

Published Dec 10 2020

We divide electronics into 2 big parts: analog and digital.

Everything in the natural world is analog.

Temperature, light, distance, speed, humidity, sound, everything is measured in a nearly infinite amount of values and precision.

Analog is natural. Digital, however, is artificial. Humans, in their ancestral quest to understand nature and create artificial systems and simulations, came up with the concept of digital measurements and values.

A digital representation can only assume 2 states: on or off. 1 or 0.

Representing basic values using only 0 and 1 values made it possible to solve complex problems in a simple way, and eventually led us to creating things like our computers, smartphones and the Internet.

We can combine multiple binary values to represent numbers that have more than 2 states. With 2 numbers we can define 4 states, with 3 numbers 8, with 4 numbers 16, and so on.

Then we use specific protocols and conventions to represent values.

For example we can represent decimal numbers using a series of bits:

1 can be represented as \[1\times2^0\]



10 can be represented as \[1\times2^1 + 0\times2^0\]



111 can be represented as \[1\times2^2 + 1\times2^1 + 1\times2^0\]



Leading zeros in a number can be dropped, or added if needed, because they do not mean anything on the left of the top left 1: 110 can be represented a 0110 or 00000110 if needed. It holds the same exact meaning, because as the system above explained, we are simply multiplying a power of 2 times zero.

Depending on the value we need to represent we need to have an adequate number of digits to represent enough numbers.

If we want to have 16 values, so we can count from 0 to 15, we need 4 digits (bits). With 5 bits we can count 32 numbers. 32 bits will give us 4,294,967,296 possible numbers.

64 bits will give us 9,223,372,036,854,775,807 possible numbers.

Here is a simple conversion table for the first 4 digits, which we can generate using just 2 bits:

Decimal numberBinary number
000
101
210
311

Here is a simple conversion table for the first 8 digits:

Decimal numberBinary number
0000
1001
2010
3011
4100
5101
6110
7111

If you notice, I repeated the above sequence, adding 1 instead of 0 in the series from 4 to 7.

Here is a simple conversion table for the first 16 digits:

Decimal numberBinary number
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
101010
111011
121100
131101
141110
151111


Check out my books 👇🏼

© 2023 Flavio Copes Flavio Copes using Notion to Site Notion to Site

Interested in solopreneurship?