Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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.

Filter by
Sorted by
Tagged with
173 votes
1 answer
479k views

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's user avatar
  • 3,908
126 votes
9 answers
338k views

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 ...
BitBobBang's user avatar
  • 1,261
112 votes
5 answers
254k views

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's user avatar
  • 10.9k
77 votes
5 answers
185k views

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: ...
spuder's user avatar
  • 1,163
63 votes
1 answer
176k views

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 ...
John's user avatar
  • 915
53 votes
10 answers
135k views

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 ...
JoeyCK's user avatar
  • 708
46 votes
6 answers
24k views

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 ...
John La Rooy's user avatar
39 votes
3 answers
25k views

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's user avatar
38 votes
1 answer
73k views

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 ...
SuperAdmin's user avatar
36 votes
3 answers
40k views

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 ...
Jason Whitehorn's user avatar
34 votes
5 answers
62k views

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 ...
akavel's user avatar
  • 1,216
33 votes
9 answers
3k views

Libraries for interfacing with the GPIO

What libraries are available for interfacing with the GPIO?
ramblinjan's user avatar
  • 4,030
32 votes
5 answers
68k views

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 ...
Aloha's user avatar
  • 7,156
32 votes
4 answers
34k views

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's user avatar
  • 7,605
31 votes
3 answers
9k views

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 ...
Alex L's user avatar
  • 7,605
30 votes
5 answers
61k views

What is a pull up resistor? What does it do? And why is it needed?

I have come across many simple circuits that show how to switch on an LED or something else. Pull up resistors are often mentioned. What do they do? Some GPIO pins require pull up resistors and others ...
Matthew Rohrich's user avatar
30 votes
3 answers
17k views

Can Raspberry Pi reliably bit bang a 9600 baud serial and is there example code?

I am wondering how feasible it is to use bitbanging to drive a 9600 baud serial via the GPIO pins on the Raspberry Pi. Obviously, Linux is not a terribly good platform for bitbanging, as there is a ...
Nakedible's user avatar
  • 1,521
29 votes
6 answers
189k views

GPIO Pinout Orientation RaspberyPi Zero W

I looked over various websites providing the pinout explanation, especially this . But I have trouble to figure them to the real rpi zero. I mean in the following image provides the pinout Information:...
Dimitrios Desyllas's user avatar
29 votes
6 answers
18k views

Can I use PATA cables for GPIO?

Raspberry's GPIO connector looks very similar to the old Parallel-ATA connectors. I do have several spare floppy/hdd PATA ribbon cables. Can I use these cables for GPIO? I know that GPIO has 26 pins, ...
asalamon74's user avatar
  • 4,058
29 votes
9 answers
25k views

How can I control an RC servo?

I'd like to control a small RC servo (5 V, 500 mA) from the GPIO pins via Python. Hardware What are the required electrical connections? Can I connect multiple servos to the Raspberry Pi?...
Alex L's user avatar
  • 7,605
29 votes
5 answers
33k views

Circuit to safely power-down Pi

I want to use my Pi as an XBMC server in the car. The XBMC docs say that you should always use the shutdown command before disconnecting the power. I've been thinking that it should be possible to ...
Nicholas Albion's user avatar
28 votes
2 answers
45k views

Power a 5V relay from GPIO pins

I have a bank of relays (5) that I'm looking to run from my Pi. I'm using 5V TE Connectivity relays, powered by Sparkfun's high power relay kits, which use a NPN transistor to trigger the relay. So ...
hightekjonathan's user avatar
26 votes
3 answers
42k views

Do I have to connect a resistor to my DHT22 humidity sensor?

I've just bought a DHT22 sensor to connect to my RPi but most tutorials mention there should be a resistor connected between the sensor and the GPIO pin. Is this necessary? Will it work without or ...
Abbie's user avatar
  • 373
25 votes
3 answers
108k views

Control Hardware PWM frequency

I'm using the hardware PWM output with wiringpi. It provides the function pwmSetClock that should make it possible to change the frequency. (https://projects.drogon.net/raspberry-pi/wiringpi/functions/...
user1217949's user avatar
25 votes
3 answers
64k views

Can I get audio input through the GPIO

The Pi has a standard 3.5mm audio jack, but this cannot be used for audio input However, we've got a load of GPIO pins on various interfaces. Would it be possible to recieve analog audio into the Pi ...
ACarter's user avatar
  • 2,350
25 votes
4 answers
20k views

How can I control Lego motors?

I'd like to find a way to make my Raspberry Pi control some Lego motors, and as a bonus I'd like to make use of one or more optical sensors. Normally, Lego robotics make use of the Mindstorms "brick" ...
Salim Fadhley's user avatar
24 votes
7 answers
57k views

Getting more than 26 GPIO pins

I would like to be able to output 75 digital out signals from the Raspberry Pi. However it has only 26 GPIO pins. Precise timing is not critical as long as it is within 1 second. I need to be able ...
Scoop's user avatar
  • 2,679
24 votes
1 answer
30k views

DS18B20 not listed in /sys/bus/w1/devices

I'm starting work on a fermentation monitor using the Adafruit temperature sensing tutorial, a RPi B+ running Raspbian, a 4.7 kOhm resistor and a DS18B20 to which I've soldered male breadboard pins. ...
Grafton C.'s user avatar
24 votes
1 answer
32k views

Do all GPIO pins have a internal pull-up/pull-down resistors?

So question is: Does all Raspberrys GPIO have a internal pull-up/pull-down resistor which can be enabled from program, in my case Java language with PiJ4? I have Raspberry Model B+.
Redex's user avatar
  • 479
23 votes
5 answers
144k views

How to correctly install the python RPi.GPIO library

I downloaded RPi.GPIO 5.3a from here: https://pypi.python.org/pypi/RPi.GPIO I extracted the tar file, cd into the folder and ran: sudo python setup.py install It ran through a bunch of stuff and ...
FoamyGuy's user avatar
  • 439
23 votes
2 answers
20k views

How can I control a 12V motor? [duplicate]

I would like to control (switch) some 12V DC motors using the GPIO pins. I do not have (or want to use) an expansion board. Nevertheless, I think this should be possible using a transistor switch (and ...
Darren Wilkinson's user avatar
22 votes
3 answers
34k views

Why are some GPIO pins HIGH when the Raspberry Pi boots up?

I have an easy circuit wired up, with an LED connected to pin 18 on the BOARD reference. I run a simple program to put pin 18 to HIGH, which turns the LED on, and then a couple of seconds later, I set ...
Viktor Raspberry's user avatar
21 votes
4 answers
9k views

How often to reboot raspberry and is it even necessary

If you have a raspberry on some location and it must run a python script "forever" (a year, maybe two, without me being on location), how often should I reboot it? I know people are keeping them alive ...
Rok Dolinar's user avatar
21 votes
3 answers
50k views

Why cleanup the GPIO pins?

When running a program in Python, why would I want the cleanup command when using the GPIO's?
Human's user avatar
  • 1,198
21 votes
7 answers
58k views

Multiple temperature sensors with a Raspberry Pi

I have seen plenty of examples for using one temperature sensor with the Raspberry Pi, however, how can I multiplex 5-6 temperature sensors to a Raspberry Pi? I want to read the temperature from ...
jc303's user avatar
  • 313
20 votes
9 answers
47k views

Use Raspberry Pi to control PC's power switch

Can I use the Raspberry Pi's GPIO pins to make the Raspberry Pi act as a switch? I would like to shut down, boot up and reboot my computer via hardware remotely. My idea was to take the PS_ON# pin ...
d3rrial's user avatar
  • 303
19 votes
3 answers
118k views

GPIO: Warning Channel already in use

gpio.py:5: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings. GPIO.setup(8, GPIO.OUT) That is what I get after I run: import RPi....
LilVinny's user avatar
  • 440
18 votes
4 answers
82k views

How to know the input voltage on Raspbian?

I have a unattended raspberry with a power supply for many device. Raspberry has lately restarts and I think that may be caused by a under voltage. Is it possible to check the input voltage for ...
crossmax's user avatar
  • 303
18 votes
5 answers
5k views

Do I need to use a ribbon cable for GPIO?

I haven't gotten my R-Pi yet, otherwise I would've just tried it, but do I need a ribbon cable to use GPIO or can I just connect a bunch of wires from the pins to a solder-less breadboard?
ohblahitsme's user avatar
17 votes
3 answers
32k views

How to Run pigpiod on boot

In order to use pigpio Module in Python (remote GPIO for Raspberry Pi ), pigpiod has to be loaded to memory on each RPi. what is the right way to to it ? during Ubuntu's boot or a part of Python's ...
guyd's user avatar
  • 578
17 votes
4 answers
17k views

How can I use more GPIO ports on the Raspberry Pi?

I am currently planning a project for a course at school which involves using the Raspberry Pi - however I'm worried that I will not have enough GPIO connectors for the inputs and outputs that I will ...
ChaoticPanda's user avatar
17 votes
2 answers
10k views

Pi as a USB client

I am looking for a way to have the Pi act as a USB client and masquerade as a flash drive. I have seen lots of suggestions, however most of them are old (1+ years) by now and vague/incomplete - I ...
user2813274's user avatar
  • 1,289
17 votes
2 answers
8k views

How do I read a button through the GPIO?

I considered myself out of this sort of beginner level stuff a long time ago, but I guess I'm not as smart as I thought I was because I seem to be having an exceptional level of trouble with it! So I'...
Michael's user avatar
  • 171
16 votes
2 answers
12k views

What advantage does the Pi-Face addon board bring to the Raspberry Pi?

I have come across the Pi-Face addon board and am wondering what additional capabilities this unlocks for the Raspberry Pi. From the website: The 'added value' we want to provide is the hardware ...
darryn.ten's user avatar
  • 1,476
16 votes
4 answers
70k views

Receive FM Radio on Raspberry Pi

I want to feed the FM radio signals to raspberry pi. Having a basic understanding of electronics, I figured out that a FM receiver and an ADC is required. Now I need help on how to proceed with the ...
krthkj's user avatar
  • 163
16 votes
3 answers
2k views

How do I connect my printer to the serial GPIO pins?

I've purchased a Mini Thermal Printer from Adafruit. The documentation states: This printer is ideal for interfacing with a microcontroller, you simply need a 3.3V to 5V TTL serial output from ...
Jivings's user avatar
  • 22.5k
15 votes
6 answers
21k views

GPIO: Why wire button to ground rather than +3.3v?

In most examples I've seen of wiring buttons to GPIO inputs, the button is wired so that when closed, a circuit is completed between the pin and ground, producing a low input on the pin. A pull-up ...
howard10's user avatar
  • 253
15 votes
5 answers
24k views

How can I wire this SD card reader to RaspberryPi?

I need to add a second SD card reader to my Raspberry Pi for the project www.samplerbox.org (the RPi will be embedded in a box, so I need a user-SD-card reader). Here is what I would like to use (it ...
Basj's user avatar
  • 782
15 votes
3 answers
5k views

Can I connect a 16x2 LCD screen to the 5V GPIO?

From what I've seen of articles and videos online, everyone seems to be using the 3.3V GPIO pin. I have an LCD screen which requires a 5V power supply and I wondered whether it would be safe to use ...
Mark Ingram's user avatar
15 votes
2 answers
12k views

What are the different clock sources for the general-purpose clocks?

I'm trying to generate a clean 11.289 MHz clock signal from the general-purpose clock, GPCLK0 on GPIO4. The suggested route is to use the 19.2 MHz crystal as the source, which seems to work ...
Dog Ears's user avatar
  • 2,027

1
2 3 4 5
68