One of the main advantages of the Raspberry Pi above "normal" computers is that you can directly access some of its GPIO facilities.
I only show the GPIO features of the Raspberry Pi A/B and the Raspberry Pi A+/B+, because I think the Raspberry Pi compute module is far too expensive for private use.
The main difference between the A/B and the A+/B+ series, what GPIO concerns, is the number of I/O pins, and thus also the number of header pins. The A/B series has only 26 pins, while the A+/B+ series has 40.
All GPIO pins use 3.3V logic and none of them are buffered.
This means that logic levels should be either close to 0V or close to 3.3V.
Any voltages below 0V or above 3.3V may damage your Raspberry Pi, in which case the main chip will die, or at least the GPIO pins of the chip will.
So be very careful with the loads and voltages you put on the GPIO pins.
These 2 pins are internally connected to the +5V input of the micro USB power connector S1.
This means that these 2 pins can be used as power input for the Raspberry Pi.
It also means that this power input is also protected by the Raspberry Pi's internal polyfuse, which is rated at 1 Ampere (2A on the A+/B+).
Please note that not only the Raspberry Pi's own consumption passes through this fuse. The power which goes to your USB devices will also add to it.
Beware that if you power your Raspberry Pi over its regular micro USB power input the power on these two pins is NOT fused by the internal polyfuse!
A total of 2 pins carry the internal +3.3V power. You can use this voltage to power your external I/O logic. Do not draw more than 50mA from these pins, as that is all the internal 3.3V regulator has to spare before over heating.
A total of 5 GND pins are available on the GPIO header on the model A/B, while the model A+/B+ has 8 GND pins. For low power I/O purposes it is all right to use just one pin, however its best to tie them all together if you have higher current I/O demands.
All I/O lines are labeled GPIOn, where n is the particular GPIO number which is to be used by the software on your Raspberry Pi. Some I/O lines serve multiple purposes. If, for instance, you want to use the UART, you can't use CPIO14 and GPIO15 for general I/O purposes.
Pins 3 and 5 can be used as general I/O pins, but also as I2C bus. Be aware that this I2C bus uses 3.3V logic levels. Modern I2C bus slaves can handle that nicely, but older devices will require 5V logic levels. This can easily be solved by using an I2C bus level shifter, as described in Philips AN10441.
Please note that there is a difference between Revision 1 and Revision 2 boards regarding these 2 I/O pins. See below.
Pin 7 is, apart from being GPIO4, also the 1-Wire bus pin. When used as a 1-Wire bus pin it will only have a passive high level. This means that you most likely can't power a 1-Wire sensor from the data pin, which would have been possible if you could switch the line active high during data conversion.
Pins 8 and 10 can be used as a UART interface. Remember that this UART interface also uses 3.3V logic only. You'll need a suitable RS-232 level converter to make these signals RS-232 compatible.
Pin 12 can be used as a PWM output, which can be used as a DAC output if a suitable low pass filter is used.
5 pins can be used as a SPI bus controller.
Apart from the common MOSI, MISO and SCLK pins there are two negative active Chip Enable pins.
So basically you can directly connect two SPI devices to the Raspberry Pi.
This SPI bus can be used to program an AVR processor for instance. Avrdude can then be used as programming software.
The idea behind these pins is to auto configure the Raspberry Pi when an official hat is mounted on the GPIO header. A hat is an expansion board, which fits on the GPIO header.
This is what the schematic has to say about these pins:
These pins are reserved for ID EEPROM.
At boot time this I2C interface will be interrogated to look for an EEPROM that identifies the attached board and allows automagic setup of the GPIOs (and optionally, Linux drivers).
DO NOT USE these pins for anything other than attaching an I2C ID EEPROM. Leave unconnected if ID EEPROM not required.
Unfortunately there are quite some significant differences in the GPIO configuration between the revisions 1 and revision 2 boards.
Sometimes this means that you may have to change or configure the software if you switch between one revision to the other.
At other times it simply won't work because of the limitations of the revision 1 board.
It is quite easy to see which version you've got. If the board doesn't have mounting holes, you have a revision 1 board. This only applies to series A or B. Series A+ and B+ are the same as revision 2, and don't have the limitations.
How can you tell what revision of the Raspberry Pi you've got in software? You could for instance run the following commands in python:
import RPi.GPIO as GPIO GPIO.RPI_REVISION
The output will be 1 for revision 1, or 2 for revision 2, or 3 for the Raspberry PI A+/B+.
This header is only available on the Raspberry Pi A/B revision 2.
So you'll be looking in vain for it on the revision 1 and A+/B+.
It provides 4 additional GPIO pins.
If you look at the Raspberry Pi board, just next to the P1 header, there is an unpopulated header called P5. You can add an 8-pin header there to get access to 4 more GPIO pins. Please note that P5 is supposed to be mounted on the bottom side of the PCB. Be aware that the pins are in mirror image if you do insist on mounting the header on the top side of the PCB. And that it will be very tough to squeeze both connectors on to P1 and P5 simultaneously.