How BeagleBone GPIOs Work
GPIO stands for general purpose input/output, which sums up what pins in this BeagleBone mode can do quite well: They can be either inputs or outputs for the vast majority of applications.
In the digital world of electronics, electricity happens in a binary way. In that sense, GPIO pins are either HIGH or LOW. In HIGH state, the pin is connected to 3.3 volts (V). In LOW state, the pin is connected to ground.
Saying that a pin is HIGH or LOW is equivalent to saying that it’s on or off. In computer science, these two states are often called true and false or 1 and 0. You use these designations to control the GPIOs. HIGH and LOW, dear reader, sum up the world of digital electronics.
Whatever you do in your computer is translated into a set of HIGH and LOW voltages along its hardware to carry out the task you requested. It’s beautiful how such complex systems can be designed through such a simple concept. The following sections give you a glimpse of what you can do with just HIGH and LOW.
For the Linux operating system (OS), everything is a file. Files are also how you control the GPIOs: by reading from and writing into files in the BeagleBone’s file system.
It’s important, useful, and insightful to understand how to control the GPIOs via a direct approach: manipulating those files directly from the command-line prompt.
If you’re acquainted with programming, you should know that you can control the GPIOs with any language that allows you to open, read, and write into files, such as C.
The figure shows the default GPIO pins. Besides those pins, the figure shows eight ground (GND) pins, two 3.3V pins, and four 5V pins; virtually, you can use these pins as power sources. Other pins labeled in the figure are useful in later chapters.
The pins that aren’t labeled in the figure are, by default, in a mode different from GPIO. Some of those pins can be put in GPIO mode, up to a total of 65 possible digital inputs and outputs. Doing so isn’t really necessary, though, as there are already quite a lot of pins set in GPIO mode by default.
The BeagleBone’s pins are rated at 3.3V, which means that connecting 5V to them could be extremely hazardous to your board — to the point of blowing up the processor and permanently ruining the board. You need to be extremely careful whenever you need 5V for some components in your circuit and make sure that 5V never reaches any of the BeagleBone’s pins.