Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

115
votes
1answer
279k 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?
101
votes
9answers
248k 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 ...
93
votes
5answers
206k 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?
59
votes
5answers
114k 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: ...
44
votes
6answers
23k 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 ...
34
votes
2answers
20k 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.
33
votes
1answer
58k 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 ...
29
votes
5answers
55k 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 ...
29
votes
7answers
2k views

Libraries for interfacing with the GPIO

What libraries are available for interfacing with the GPIO?
29
votes
1answer
89k 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 ...
29
votes
5answers
27k 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 ...
28
votes
2answers
30k 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 ...
28
votes
4answers
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?
27
votes
3answers
14k 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 ...
25
votes
9answers
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?...
25
votes
2answers
8k 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 ...
24
votes
6answers
15k 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, ...
23
votes
5answers
41k 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 ...
23
votes
3answers
51k 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 ...
23
votes
5answers
41k 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 ...
22
votes
2answers
15k 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 ...
21
votes
1answer
23k 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. ...
20
votes
3answers
60k 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/...
19
votes
4answers
4k 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 ...
19
votes
7answers
44k 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 ...
19
votes
4answers
16k 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" ...
18
votes
4answers
27k 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 ...
18
votes
9answers
33k 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 ...
17
votes
3answers
22k 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 ...
17
votes
2answers
27k 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 ...
17
votes
1answer
10k 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+.
16
votes
6answers
39k 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 ...
16
votes
3answers
20k 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 ...
16
votes
5answers
4k 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?
15
votes
3answers
76k 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 ...
15
votes
4answers
58k 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 ...
15
votes
2answers
6k 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 ...
15
votes
2answers
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'...
14
votes
2answers
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 ...
14
votes
4answers
14k 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 ...
14
votes
2answers
7k views

Can I use a One Wire File System through the GPIO?

I have installed owfs (under debian) just to realise the initial setup (1wire) works only through the USB port. owfs is short for One Wire File System. It's a standard for low end sensors, but I'm ...
14
votes
3answers
1k 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 ...
13
votes
1answer
2k views

What are the usage of extra available holes in model B

Despite some research on the web, I cannot find the options available from these "opportunity" holes on the Rpi. I probably do not use the proper words to identify them. What is the name for this ...
13
votes
3answers
9k views

Maximum current on each GPIO pin for Raspberry Pi 3 Model B

Anyone knows what's the maximum input/output current for the individual GPIO pins? Perfectly fine if someone is able to point me to the Broadcom BCM2837 datasheet, which I for some reason, cannot ...
13
votes
2answers
8k 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 ...
13
votes
5answers
14k views

Can I use a DHT22 as a temperature sensor for my Pi?

Is it possible to use a cheap temperature sensor such as the DHT-22 with the Raspberry Pi? I have found Arduino drivers for this and many similar things, and would be comfortable porting the code to ...
12
votes
2answers
3k views

Why are there 8 ground pins on the Raspberry Pi?

On the image below the pin layout is shown for the Raspberry Pi and it can be seen that there are 8 GND pins for only 2 5V + 2 3.3V pins. What is the purpose?
12
votes
5answers
13k views

Can I read the amount of light?

I'm not sure how to say it, but I would like to read the 'amount of light' with my Raspberry Pi. By the 'amount of light' I mean a number between 0 and 100 (for instance) where 0 is no light/dark and ...
12
votes
2answers
890 views

Should GPIO pins 13 and 14 be soldered together?

I just bought a new Model A+ board, and noticed that the GPIO pins 13 and 14 (board pins 21 and 23) are soldered together on the backside. This was not the case with my previous A+ board: see the two ...
12
votes
3answers
4k 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 ...