TL;DR
- This is a 3.3V device.
- Output
- Maximum total of all pins 50 mA.
- Default 8 mA max per pin. (Returns to this configuration after reset.)
- Software configurable from 2 mA to 16 mA. Do not source or sink more than what you've configured.
- Don't drive capacitive loads.
- Input
- Threshold of 1.8V
- Maximum 0.5 mA
- Use a 6Kohm resistor to ensure that current from a 3.3V source cannot exceed 0.5 mA
- ( 3.3V / 6000Ω = .00055A )
References
from: http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29
GPIO voltage levels are 3.3V and are not 5V tolerant. There is
no over-voltage protection on the board - the intention is that people
interested in serious interfacing will use an external board with
buffers, level conversion and analog I/O rather than soldering
directly onto the main board.
This is easily handled with a bidirectional logic level converter.
from: http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/raspberry-pi/gpio-pin-electrical-specifications#rpi-gpio-input-voltage-and-output-current-limitations
GPIO pins set to input
These are 3.3 volt logic pins. A voltage near 3.3 V is interpreted as
a logic one while a voltage near zero volts is a logic zero. A GPIO
pin should never be connected to a voltage source greater than 3.3V or
less than 0V, as prompt damage to the chip may occur as the input pin
substrate diodes (shown as parasitic FETs in Figure 1) conduct. There
may be times when you may need to connect them to out-of-range
voltages – in those cases the input pin current must be limited by an
external resistor to a value that prevents harm to the chip. I
recommend that you never source or sink more than 0.5 mA into an
input pin.
As @ AutomatedMike noted in the comments, you can insure this with a 2 Kohm resistor per volt. ( 3.3V / 6000Ω = .00055A )
GPIO pins set to output
The Raspberry Pi's GPIO pins are quite versatile, and you can modify
many of their characteristics from software. You can turn on/off input
pin hysteresis, limit output slew rate, and control source and sink
current drive capability from 2 mA to 16 mA in 2 mA increments. These
properties are set for the GPIO block as a whole, not on a pin-by-pin
basis.
To prevent excessive power dissipation in the chip, you should not
source/sink more current from the pin than its programmed limit. So,
if you have set the current capability to 2 mA, do not draw more than
2 mA from the pin.
Source/sink current capability does not limit the current into or out
of the pin, but only specifies the maximum current for which the
output signal high/low voltage specifications will be met. If misused,
output pins can be damaged by excessive current irrespective of the
source/sink current programmed. After a reset, the RPi comes up with
the GPIO outputs set to 8 mA drive capability.
Current sourced by the outputs is drawn from the 3.3 V supply, which
can supply only 50 mA maximum. Consequently, the maximum you can
source from all the GPIO outputs simultaneously is less than 50 mA.
You may be able to draw transient currents beyond that limit as they
are drawn from the bypass capacitors on the 3.3 V rail, but don't push
the envelope!
Caution:
There are additional considerations for capacitive loads. You really should read the document that is heavily quoted here.