Questions tagged [gpio]

GPIO stands for General Purpose Input Output and can be used to receive and send digital signals to and from simple electronics from the Raspberry Pi.

GPIO stands for General Purpose Input Output and can be used to receive and send signals to and from simple electronics from the Raspberry Pi. Questions about software controller GPIO are also on-topic.

Introductory Questions

The following questions are introductory questions on subjects relating to the GPIO.

Make sure any external devices connect to these pins have matching voltage levels or you could damage your Raspberry Pi.

Mind the maximum current that GPIO pins can sink/source - both per pin and in total. Exceeding those limits could (permanently) damage the Pi.

3316 questions
171
votes
1 answer

What is the difference between BOARD and BCM for GPIO pin numbering?

When using the RPi.GPIO library in Python you have to call import RPi.GPIO as GPIO and then GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM) What is the difference between these two options?
mirams
  • 3,868
  • 4
  • 16
  • 22
125
votes
9 answers

How do I supply power through the GPIO?

I have seen some examples of people powering their Raspberry Pis by wiring a DC "barrel plug" style power supply to the 5V and GND GPIO pins. What considerations should be taken when doing something like this? Do I need to add any protective…
BitBobBang
  • 1,251
  • 2
  • 9
  • 3
110
votes
5 answers

Can I use the GPIO for pulse width modulation (PWM)?

Can I use the GPIO as a pulse-width modulation output? If so, how would I go about doing it and how many concurrent, distinct PWM outputs can I have?
berry120
  • 10,886
  • 10
  • 51
  • 62
76
votes
5 answers

What is the maximum current the GPIO pins can output?

What is the maximum amount of current that can be pulled from a single GPIO pin? Does the maximum current decrease if current is being pulled from multiple GPIO pins? From my research, I've found: An Arduino can pull 40 mA People on the forums…
spuder
  • 1,153
  • 1
  • 9
  • 14
57
votes
1 answer

What are the min/max voltage/current values the gpio pins can handle?

I want to start using the GPIO pins but I am worried about short circuits or using too much amperage and frying my raspi. What are the Min/Max Voltage and Current values rasppi can handle? What is the typical voltage and current? How sensitive is…
John
  • 855
  • 1
  • 8
  • 12
52
votes
8 answers

Access GPIO pins without root. No access to /dev/mem. Try running as root!

I've made a python script using the RPi.GPIO library. I need to run it without root but I get this error when running it with "python ./script.py": No access to /dev/mem. Try running as root! I've read in many places that you no longer need root…
JoeyCK
  • 698
  • 1
  • 5
  • 10
46
votes
6 answers

How to measure temperature?

What can I connect to the RPi to measure temperature? I think devices connected to the I²C or SPI would make most sense. Here is a question about DHT-22 and other 1-wire devices. But at this stage it seems that 1-wire is difficult on the RPi due to…
John La Rooy
  • 11,937
  • 9
  • 47
  • 74
39
votes
3 answers

What is the power on state of the GPIOs?

What is the state of the GPIOs when power is applied? eg High, Low, Hi-Z? Also does any OS change the state of any GPIOs when it loads? Hopefully not.
John La Rooy
  • 11,937
  • 9
  • 47
  • 74
38
votes
1 answer

Pros and Cons of a Pi Cluster?

I have seen a lot of posts asking how to build a "supercomputer" or cluster with Raspberry Pis, but I have found very little with the pros and cons of actually making a network of Pis. I am interested in building my own small cluster, but I have a…
SuperAdmin
  • 505
  • 1
  • 4
  • 9
37
votes
3 answers

Why is a resistor needed for LEDs?

While looking for a basic task to get familiar with the Raspberry Pi and its GPIO pins, I decided that driving an LED sounded simple enough. While investigating how to go about this task I've noticed that most instructions indicate to place a…
Jason Whitehorn
  • 489
  • 1
  • 4
  • 6
33
votes
5 answers

What SPI frequencies does Raspberry Pi support?

What SPI frequencies does Raspberry Pi support? Additionally: Are they all supported by the bootc.net SPI driver? Are there any additinal things I should be cautious about when trying to communicate with some other chip via SPI?
akavel
  • 1,186
  • 3
  • 11
  • 15
33
votes
9 answers

Libraries for interfacing with the GPIO

What libraries are available for interfacing with the GPIO?
ramblinjan
  • 3,990
  • 7
  • 33
  • 52
32
votes
4 answers

How can I use I2C to talk to sensors?

How can I talk to digital sensors over the I²C interface? Hardware: Which pins on the Raspberry Pi's GPIO can I use? Software: What I²C libraries are available?
Alex L
  • 7,585
  • 12
  • 42
  • 53
31
votes
3 answers

How can I use the GPIO pins as digital outputs?

I've read that the Raspberry Pi has a number of input and output pins. How can I switch them? (from Python?) What voltage logic? Do I need pull-up or pull-down resistors? Do I need to switch the pins from inputs to outputs? Which pins are…
Alex L
  • 7,585
  • 12
  • 42
  • 53
30
votes
5 answers

Why do the Pi GPIO pins use/give 3.3V and not 5V?

I know for a long time that people should NOT put more than 3.3V on the GPIO pins. They also give out 3.3V when high. I did some research and it seems no one really bothered asking. Almost all of them talk about the maximum current. If I am…
Aloha
  • 7,116
  • 1
  • 27
  • 52
1
2 3
99 100