The Raspbian OS comes out with the pre-installed Bash shell command to work with GPIO(General Purpose In/Out) pins. It is “/usr/bin/gpio” or “gpio” in short. This utility is written by Gordon Henderson. This command is very handy to start using GPIO port of raspberry pi and we don’t need to install any additional library (such as RPi.GPIO python lib). The output information of “gpio readall” is fairly too much for the newbies to understand it all and use properly. This article is going explain every field and its value.

The output on Raspberry Pi 2 looks like:

 

“Physical” column

This is the pin number on the connector. it is simply the physical number which is marked as the following picture. We can easily count its 40 pins without caring the functions.

RaspberryPi GPIO PINs
RaspberryPi GPIO PINs

“V” column

This indicates the voltage level of the pins. As you may notice, the “0/1” value is applicable for GPIO pins only, and leave blank for the rest. V=0 indicates the voltage level on the pin is LOW, the exact voltage value is 0V. In contrast, V=1 indicates the voltage level on the pin is HIGH, the exact voltage value is 3.3V.

“Mode” column

The “Mode” shows how the pin is being used. Here is the list of valid modes able to set for GPIO: in/out/pwm/clock/up/down/tri. However, you also see the “ALT[#]” listed in the Mode column. This ALT[#] indicates the GPIO pin is being used as alternative function – a specific function, not as general purpose function.

  • in: the GPIO pin is used as input without software-register-pull-up or software-register-pull-down. In this mode, if the pin is not connected to any reference point, the input state will be unknown (it is floated).
  • out: the GPIO pin is used as output, and without software-register-pull-up or software-register-pull-down. In this mode, if the pin is not connected to any reference point, the input state will be unknown (it is floated).
  • pwm: the GPIO pin is used as hardware Pulse-Width-Modulation mode which is square waveform generation. This mode is usually used to control DC motor speed or LED dimming. Keep in mind that only BCM 18 (or GPIO.1) supports PWM output mode.
  • clock: the GPIO pin is used as clock generater. The frequency of clock is driven from main crystal frequency of Raspberry Pi. Note that only BCM 4 (or GPIO.7) supports CLOCK output mode.
  • up: The GPIO pin is used as input with software-register-pull-up. In this mode, if the pin is not connected to any reference point, the input state will be HIGH (or 1).
  • down: The GPIO pin is used as input with software-register-pull-down. In this mode, if the pin is not connected to any reference point, the input state will be LOW (or 0).
  • tri: The GPIO pin is used as input without software-register-pull-down or up. In this mode, if the pin is not connected to any reference point, the input state will be LOW or HIGH.
  • ALT[#]: The GPIO pin is used as a special function. You can check the list of those special functions at this link.

“Name” column

This show the names of pins. The name hints us the functions of pins. It is also used as BOARD number when we use GPIO.BOARD mode. This uses P1 header pin numbering convention.

“wPi” column

This is simply a “GPIO”-removed text of “Name” column.

“BCM” column

This is the number of AMR peripherals. we use this number with “gpio” command. For example, “gpio mode 22 in” means that we use BCM 3 pin(Physical-15/Name-GPIO.73) as an input.

Understand “gpio readall” Bash shell command output on Raspberry Pi
Tagged on:     
Share This

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Subscribe

To download the latest tutorials

You have successfully download

Enter Email To Download

Join our mailing list to receive the latest Application for free from IoTBreaks.

You have Successfully Subscribed!

flash Raspbian to SDCard

Enter Email To Download

Join our mailing list to receive the latest Application for free from IoTBreaks.

You have Successfully Subscribed!

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!