Intro: Computers Are Dumb!
Objective: Overcome your fear of computers! If you can count to two, then you can master the basics of computers. If you think computers are smarter than you, you are wrong and I will prove it. For normal people, just follow the LOG: comments. Computers are dumb: comments tell you the computer’s point of view.
For theGEEKS, hackers, programmers, experimenters, and Arduinoites add the GEEK comments for a more detailed understanding of how computers work.
And don’t worry if you don’t understand some things. I’ve been working with computers for too long and sometimes ‘think’ like one.
LOG(Lazy Old Geek): Remember when you were maybe 3-4 years old and you learned to count up to 10? Well, I don’t. I am a Lazy Old Geek (LOG) and can’t remember back that far. But I could count to ten with my fingers. For a while, I was an instructor in computer technology.
Computers are dumb: Computers can only count to 1. Fortunately they start with 0. So they only know 0s and 1s.
GEEK Speak: The typical human (Non-Geek) numeral system is called decimal, 0-9. The computer numeral system, 0 and 1 is called binary.
LOG Irrelevant: Do you ever think about 0, zero? It is very important. Do you remember Roman numerals? They didn’t have zeros. Maybe that’s why they aren’t used anymore. Oops, I guess they still use it to number SuperBowls. Football fanatics, enough said.
The invention of zero was important. How else would you be able to numericalize your test score in Algebra or maybe sometimes your bank account.
Step 1: Binary Numbers in Computers
Computers are dumb: So I exaggerated a bit. Digital computers don’t know 0s and 1s, all they really know is off and on. Electrically, they really only understand no voltage or voltage. I like to visualize this as a light switch. (See picture) Little kids can understand a light switch. Either it’s off or on. So, simplistically, if there is a voltage there then it represents 1, if there is no voltage, then it is a 0.
LOG: This is like if I have a banana (See picture), I represent it on paper as the word ‘banana’. It is symbolic.
GEEK Speak: For a long time, in computers 0 volts symbolized 0 and 5 volts symbolized 1. While this is still true in some cases, sometimes 3.3V represents 1. And I am fairly certain that internally, some CPUs use even less like 1.8V?
Why: One reason is when you have voltage you have current, voltage and current means energy and energy means heat. So the more voltage you use the more heat is generated. Reducing the voltage means less heat.
Electrical Geek Speak: If you want to get technical, 0 and 1 are actually represented by ranges of voltages. Like 0 was 0V to maybe 1.25V and 1 was 3.75V to 5V. I used to remember what the ranges are exactly but don’t any more and don’t really care, any more.
Arduino: So Arduinos are computers. Since I am an Arduino user, I will often comment on Arduinos. They still use 0V and 5V representing 0 and 1.
Step 2: Languages
LOG: Humans that speak English use an alphabet of 26 letters. I won’t even get into Japanese which may have more than 10,000 letters (sort of). Humans combine these letters into words to create a language so there are millions of words. But humans can also learn several languages so just think of all the words a person could know.
Computers are dumb: Computers only know one language. It is called machine language. Machine language consists only of 0s and 1s.
Furthermore, a computer only knows one machine language. There are probably hundreds of machine languages but any computer knows only one, the one for the specific CPU (Central Processing Unit) that it uses.
GEEK Speak: Some of you technoGeeks will say: what about those other computer languages like Assembly, C and C++? (See picture) Doesn’t the computer understand them? The answer is no! The actual computer hardware understands only one machine language.
Those other languages were ‘invented’ by humans to make it easier to talk to computers. Humans made interpreters and compilers to translate C and others to that one machine language. Compilers and interpreters translate the English-like program to 0s and 1s for the machine language selected.
Arduino: Arduino users, when you click on the little arrow, this compiles the sketch to the machine language that Arduinos understand. (see picture). The other right arrow, compiles it and sends the machine code to the Arduino.
Step 3: Binary Numbers
LOG: How can computers do anything with just 0s and 1s?
Well, I will tell you but I’m going to have to do a little arithmetic review first.
Okay, let’s say you count up to ten. (See picture). There’s nothing significant with ten until you write it down. From 0 through 9 you have a different number but ten is not a different number. It is made up of two previous numbers 1 and 0. Now the 1 on the left doesn’t mean the same if it was by itself. Can you explain? Well, I’m a computer Geek. I can. It’s called positional notation. The 0 on the right is just a 0. The 1 on the left is 1 multiplied by 10 or 10 because it is in the second position. So as we all know if there was another digit, then it would be multiplied by 100. Positional notation means where a number is locate affects its value. Each position further left increases it value, in this case, by ten times.
Computers are dumb: They have no idea what 22 is. They don’t even understand that 10110 in binary represents 22.
Geek: Positional notation for binary numbers: For the curious, the right most digit value is 0 or 1. If next digit is 1 then multiplied by 2, the next by 2x2 or 4, then next is 2x2x2 or 8, etc. If there is a zero in a position then nothing is contributed to the total, all it is doing is marking the space so the next digit over has a greater value.
Some of you may have heard of something called a byte. A byte is eight 0s and 1s. A byte can contain 256 different values. A computer word has 16 bits so it can contain 65,536 different values.
Geek: Hexadecimal was invented by computer programmers to make it easier to talk to computers. Computers only understand binary but a big binary number is hard to read by normal human, But it is easy to convert to hexadecimal, which is a little easier to read than binary. E.g., A2C7 is a little easier to read then 1010001011000111 for most humans but both are numbers representing the same value which is 41,671 decimal.
Step 4: Computer RAM
LOG: So you may wonder what is RAM? RAM stands for random access memory. It can be some much more picturesque than it used to be. (See picture)
I like to think of memory as a post office full of mailboxes. (See picture) Hopefully, you know what a mailbox is. Each mailbox has a unique address and contains information (letters). A memory module is like a post office. It is a collection of binary numbers each of which has a unique address. To get the information you have to know the address, just like to get your letters, you have to know the box number.
Geek: Writing to memory is like the postman placing letters into the mailbox. Reading from memory is like you taking a letter out of the mailbox and reading it. One difference is that when a computer is turned off, the RAM information is lost.
Random access means the computer can select any address (randomly) and write to it or read from it.
Computers are dumb: Mailboxes can hold multiple letters with all different kinds of information. (Some of you Old readers, like me, may remember getting letters). Computer memory holds only binary numbers 0s and 1s (or no voltage and voltage) and only of a certain size. I had to look it up, modules like the one in the picture has 64 bits in each location. It doesn’t contain alphabet letters or pictures or sounds only 0s and 1s.
Geek: The pictured memory modules have 8Gbytes of data, which is 8 billion bytes which is 8 x 1,000,000,000. So if I understand this correctly since each location holds 64 bits or 8 bytes, then there are 125,000,000 memory locations.
Anyway, it’s a lot of locations but it’s still only 0s and 1s.
Geek: Okay, if you want to get technical. 8Gbytes of RAM usually refers to 8 x 1073741824 or 8 x 230. This is because hardware addresses are either off or on, binary so 30 address lines can access exactly 230 locations.
Geek: There is another type of memory called ROM. These are not very pretty. (See picture) But they have an important purpose. ROM means Read Only Memory. The difference is that the postman cannot change the contents of the mailbox, it can only be read. To a computer, it can only read the 0s and 1s in the ROM. They cannot be changed.
Arduino: The RAM and the ROM are actually in the Atmega chip, in many this is the Atmega328.
Step 5: What Do Those 0s and 1s Mean?
Computers are dumb: To the computer, they don’t mean anything. They’re just numbers. Let’s say in the RAM module at address 000000101 the number is: 1010101111001110000100100011010001010110.
LOG: To the average human it doesn’t mean anything, either. Even to a computer programmer/architect, it likely doesn’t mean much, though she might be able to figure out what it means. Even the computer doesn’t know what it represents but it does know what to do with it. Just like a human language with letters, those 0s and 1s can be combined into words that have meaning.
It could be just a big number like the national debt. (See pictures)
It could be part of a picture.
It could be an instruction to add two numbers (the last picture probably means nothing to you, but it gives you an idea of what a computer sees. The binary is converted to decimal for readability)
Example: We could say that 0 represents lights off or black and 1 represents lights on or white. Let’s take eight bits so 00000000 represents black and 11111111 represents white. So what does 10101011 represent? Well, it is going to be some shade of gray.
Let’s go a little further. Here is a close up picture of an LCD screen. There are probably thousands of these. It could be a computer monitor or a TV. You can actually see this if you use a magnifying glass. I can’t see it very well with my old eyes.
How it works: There are sets of three lights, red, blue and green, the primary colors. Each set of three is called a pixel. If just one, say red, is on then only red will be seen on the screen. Now if all of them are on, then that spot will actually will appear to be white because your eyes can’t separate the individual lights. The next picture is a color spectrum showing how blending different amounts of red, green and blue produce different colors. Now besides being on or off, each light can be turned on various amounts. The number varies per monitor/TV but for now, let’s just say there are eight bits per color or 256 different values. This will be the brightness of the pixel/screen.
Geek: So my computer memory locations contain 8 bytes (64 bits) of data. Each one could contain 2+ pixels of data. My laptop screen is 1280x800 pixels or about 1 million. So it might take about ½ million memory locations to contain the information for a full screen. That’s just a drop in the bucket out of 3Gbytes of memory.
Computers are dumb: So how does the computer know if the number:
1010101111001110000100100011010001010110 is the national debt or a burgundy pixel or instructions to add two numbers. The answer is: it doesn’t know or care. However it does know what to do with it. See next step.
Step 6: CPU
Computers are dumb: The CPU is the Central Processing Unit or the brains of the computer. The CPU knows what to do with machine language instructions. It doesn’t understand them; it just knows what to do with them.
One example of a CPU is the Intel i5 CPU. (See picture). The little silver square is the CPU. The other part is the fan. Remember I talked about heat? This is what dissipates that heat.
Arduino: The CPU for the Arduino is in that little black Atmega328 IC. (See picture) By the way that little black IC also contains the RAM and the ROM for the Arduino computer. Plus some other stuff.
Computers are dumb:Basic CPU process: The CPU has a pretty simply function. It goes to a specific memory address and takes the data in it. This data is treated as a machine language instruction, so the CPU does only what that instruction tells it to do. For example, if the instruction says to take the contents of the next two memory locations and add them and put them in a third location, it will do exactly that.
Geek: Computer addition is pretty simple. It has to be for a dumb computer. 0 + 0 is 0. 0 + 1 is 1. 1 + 0 is 1. 1 + 1 is 0 with a carry. This is like grade school addition but much simpler.
Geek: Now I’m not sure if standard PC instructions are 64 bits, one memory location long or may be 128. I don’t really care but with 64 bits you can have 18446744073709551616 different instructions. And trust me, they can be very complicating. This is something only a dumb computer could love.
Computers are dumb: Like I was saying, the computer has no idea what 1010101111001110000100100011010001010110 is or represents. It just blindly follows its instructions doing what they tell it to do without any knowledge if it is what was meant to be done. There is a special term BSOD (Blue Screen Of Death) which appears if something goes wrong. (See picture)
Geek: So you may wonder, how does the computer know where to start? Well, I’m going to (sort of) tell you. When the computer is first turned on, it always goes to a specific memory location. In the early days of computing, it was either the highest or lowest memory address. I have no idea what it is now or care. But it goes to a specific address. This address points to part of the ROM. By the way this ROM is called the BIOS (Basic Input/Output System). It first performs POST(Power On Self-Test) to see if the basic stuff is working. Then I believe it goes to the hard disk and loads the operating system, e.g., Windows, Linux. Once this is done, it will sometimes just sit there waiting for something like a mouse click to start a program.
Step 7: Hard Drive
Computers are dumb: So what is a hard drive? Well, a hard drive is just a big collection of 0s and 1s. It is similar to RAM in that it each data has an address. I don’t know or care what size data is stored. I think it varies depending on how it is formatted.
One difference is that data is organized into files with file names. The computer still only identifies them by 0s and 1s but to make it easier for humans, the operating system allows them to be sorted into files.
Like RAM, they can be written and read. Unlike RAM, when power is turned off, they do not lose their data. So the hard drive is semi-permanent storage.
Step 8: Motherboard
The motherboard is a big PCB (Printed Circuit Board) that holds the RAM, ROM, CPU and a bunch of other stuff. It’s kind of like the nerve system that ties everything together and the blood system which supplies the energy or power.
Computers are dumb: So I told a little fib. In most personal computers there is some circuitry that is not just 0s and 1s. Do you know what it is? Well, it isn’t an essential feature of the computer but it is the audio circuitry.
Geek: So all sounds and music are stored in RAM and the hard drive as 0s and 1s. The audio circuit contains something called a DAC. A DAC is a Digital to Analog Converter. Remember when I talked about 00000000 being black or 0 and 11111111 being white or 1? I also said that sometimes 1 is 5 volts? Well, let’s say the DAC puts out 0 volts for 00000000 and 5 volts for 11111111. so if the input was 10000000 then the output would be 2.5 volts. Believe it or not 10000000 is about ½ of 11111111.
SuperGeek: Okay, I’m going to get SuperGeeky. So a true analog signal can vary continuously through different voltages. The usual example is a sine wave (See picture) which is a single frequency like a ‘C’. In truth a computer cannot generate a perfect sinewave. It comes out like the stairstep shown in the picture. However the steps are so small, people cannot really distinguish the difference.
Full disclosure: Some audiophile purists claim they can hear the difference and will use only analog audio equipment. Who knows maybe it’s true.
Computers are dumb: So I may have told another little fib. Some personal computers also have a video output called VGA which is also analog and uses DACs as above. Most modern computers are going to DVI, HDMI and Display Port which are all digital, 0s and 1s.
Arduino: So Arduinos have ADCs in them which are Analog to Digital Converters. These do the opposite: taking an analog input and converting it to digital. They also have PWM, which means Pulse Width Modulation. Now technically this is a digital output in that it is 5 volt pulses. But the pulses vary in width and frequency so that they emulate an analog signal.
Step 9: Conclusions
Computers are dumb: Yes, they are. But they are really fast. And they almost never make mistakes. And they don’t get bored doing the same thing over and over again.