Raspberry Pi Board B GPIO Header

Raspberry Pi GPIO Header

The general-purpose input / output, also known as GPIO, refers to a physical electrical port, which can have many alternate functions, including input or output function configured through software. Microcontrollers and microprocessors usually employ such electrical pins, and the Raspberry Pi P1 socket comprises of 17 such pins. This socket has two rows of thirteen pins with a 2.54 mm pitch.

GPIO Pin

Each pin has an internal pull-up and pull-down resistor, which is set through software. In addition, each pin has current output setting, and threshold voltage settings, configured by programming the necessary registers through software.

Configuring for Input or Output

Each GPIO pin requires configuration as either input or output before it may be used. Each pin has a bit associated with it in the data direction register, and setting this bit as either 1 or 0 sets it for either input or output mode. A Python command such as “GPIO.setup (11, GPIO.OUT)” sets the bit for pin 11 for output mode.

There is also an output register, and each physical pin has a bit associated with it in this register. Simply changing the state of the bit controls the electrical state of the physical pin. Setting the bit to 1 makes the pin produce +3.3 V, and setting it to 0 makes it produce 0 V.

There is also an input register, and each physical pin has a bit associated with it in this register as well. The state of the bit in this register indicates the electrical input to the pin. Therefore, if there was +3.3 V present at the pin, then the bit in the register will be 1. Reading a physical input simply involves reading the state of the bit in this register.

CMOS Voltage Levels

The Raspberry Pi is a 3.3 V system and the GPIO pins operate at 3.3 V logic levels. There is a lot of internal circuitry associated around each pin; however, it has no protection if you were to feed 5 V to it.

Current Limitations

A very important parameter is the amount of current one may draw from a GPIO pin, and there does not seem to be any clear information regarding this. The most obvious value is 3 mA as a default. However, each pin has a drive current setting with a maximum limit of 16 mA, which suggests, a limit. The drive current setting is the amount of current you can draw and yet still maintain logic voltage levels, however this is not a limit, and the pin will happily let you draw more current.

The current for each GPIO pin comes from the +3.3 V rail, and the absolute maximum allowable current drawn from the +3.3 V rail is 50 mA, therefore, the total current including the current drawn by all the GPIO pins should not exceed this.

Blinking an LED

After getting the Raspberry Pi working with Linux, I decided to do what any self respecting Brit in UK would do, which is to convert this high-tech, state-of-the-art, top-secret ARM 11 core processor, with a high-speed 1080p resolution GPU, into a toy that blinks an LED.

There does not seem to be much information on the Internet about the basics of interfacing to these pins so I have decided to write this article. As usual, the first step is to gather all the facts and information about this interface.

The GPIO pins are actual physical pins on the Broadcom processor, routed to the edge of the PCB to a header socket, and these pins operate at CMOS voltage levels of 3.3 V. There is no buffer circuitry or any kind of protection and the tracks lead directly to the header socket. In this case, they are not in any particular order, and appear to be a set of random pins from the first 32-bit GPIO register.

The first step is to figure out how the Broadcom processor GPIO pin numbers map to the pin numbers on the P1 header socket. This means looking at the circuit diagram and tracing each GPIO track.

This Article Continues...

Raspberry Pi Board B GPIO Header
Raspberry Pi GPIO Header Pinout
GPIO Header Pin Mapping
Raspberry Pi GPIO Header Pin Protection
Raspberry Pi GPIO Pinout
Raspberry Pi GPIO Interfacing and LED Blinking
Raspberry Pi GPIO Interface Circuit
Raspberry Pi Motor Controller

Related Articles

Easy Raspberry Pi GPIO Projects
The Cambridge Boffin: Raspberry Pi GPIO Buffer Project
GPIO Cable Raspberry Pi
Raspberry Pi Pinout