Skip to main content
25 votes
Accepted

GPIO: Warning Channel already in use

This code helped me get rid of the warning (the "finally" part at the end): import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) # Broadcom pin-numbering scheme GPIO.setup(6, GPIO.OUT) # ...
user1231247's user avatar
20 votes
Accepted

Where are the uarts on the raspberry pi 4?

The preliminary Pi4 datasheet shows there are 6 UARTs. UART GPIO 0 14/15 1 14/15 2 0/1 3 4/5 4 8/9 5 12/13 Given that UART 0/1 are both connected to the same GPIO you can only use ...
joan's user avatar
  • 71.3k
14 votes

Where are the uarts on the raspberry pi 4?

As Joan has stated only 1 of UART0/1 is accessible (UART0 /dev/ttyAMA0 is connected to Bluetooth on later model Pi). There are additional UART on the Pi4. Raspberry Pi4 UART is a more up to date ...
Milliways's user avatar
  • 60.7k
13 votes

Can we use other GPIO pins as I2C

The whole point of I2C is it is a bus. You can therefore connect multiple I2C devices to the same GPIO provided they have different I2C device addresses. If the devices share an address which can't ...
joan's user avatar
  • 71.3k
13 votes
Accepted

How fast can GPIO pins toggle?

There are some benchmarks from Henner Zeller's repository on GitHub which claimed that directly outputting data to the GPIO could achieve up to 65.8 MHz on a Raspberry Pi 3 (not B+, mind, but I ...
Aurora0001's user avatar
  • 6,336
13 votes

gpiozero Button.when_pressed

It is possible to use parameters with callback functions. See e.g. Documentation for button.when_pressed This can be set to a function which accepts no (mandatory) parameters, or a Python ...
Dirk's user avatar
  • 3,541
11 votes

Is there any built in LED connected with GPIO pin?

Yes, it is possible to control the built-in leds. Green LED is easier. According to here, though it is probably Pi 3 specific, since it didn't work for my Pi 4: In the terminal: sudo echo 1 > ...
Botspot's user avatar
  • 1,779
9 votes

Debouncing buttons with RPi.GPIO -- too many events detected?

As @joan points out, the bouncetime parameter in RPi.GPIO does almost exactly the wrong thing: it means when your switch bounces, you'll get the very first event, but that may not actually be ...
larsks's user avatar
  • 653
9 votes

Is there any built in LED connected with GPIO pin?

though it is probably Pi 3 specific, since it didn't work for my Pi 4 It works on the 4 as well, you just need to set the right trigger. The instructions that you provided are not applicable to the 4 ...
icuwopcui's user avatar
9 votes
Accepted

Error installing RPi.GPIO in virtual environment

It looks like the latest release does not support Python 3.9 but the alpha releases do: https://www.piwheels.org/project/RPi.GPIO/ You can install the alpha version with: pip install rpi-gpio --pre
ben_nuttall's user avatar
  • 2,461
7 votes
Accepted

connecting common anode rgb led

Connect the common anode pin to 3.3 volt and each of the other pins to a GPIO (add a current limiting resistor between the LED and the GPIO pin. To Light one of the colors set the corresponding GPIO ...
Steve Robillard's user avatar
7 votes

RPi.GPIO not found in virtual environment

The problem is that you don't have the GPIO module installed in your virtual environment. To correct this, run the following from within your virtual environment: for Python 2 pip install RPi.GPIO ...
Steve Robillard's user avatar
7 votes
Accepted

Is the gpio readall command compatible with RPi 4?

As far as I am aware it should work provided you download and install the latest version of wiringPi. http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/ cd /tmp wget https://...
joan's user avatar
  • 71.3k
7 votes
Accepted

RPi.GPIO Cleanup() only specific pins?

See RPi.GPIO documentation. Cleanup At the end any program, it is good practice to clean up any resources you might have used. This is no different with RPi.GPIO. By returning all channels you have ...
joan's user avatar
  • 71.3k
7 votes

Install GPIO problem

You can't install RPi.GPIO on Windows. If you want to mock GPIO calls on a PC, try gpiozero which has a mock pin interface: https://gpiozero.readthedocs.io/en/stable/api_pins.html
ben_nuttall's user avatar
  • 2,461
6 votes

How to correctly install the python RPi.GPIO library

Another potential cause could be because the RPi.GPIO library has C bindings and therefore need to have python-dev installed in order to compile correctly when installing. Make sure you've got the ...
adam's user avatar
  • 161
6 votes
Accepted

Is there a GPIO current limit function available, and where is the documentation?

Yes. The definitive source for RPi hardware documentation is the Raspberry Pi Foundation. The Foundation updated their published documentation to include programmable GPIO current limits recently (Jan,...
Seamus's user avatar
  • 22.4k
6 votes

How can Rpi SPI python read the MFRC522 RFID / NFC module?

Question How can Rpi python read a SPI MFRC255 RFID/NFC tag? Short Answer Part 1 - Introduction to I2C and SPI NFC/RFID Chips and Modules Part 2 - Setting up SPI MFRC522 Module Part 3 - ...
tlfong01's user avatar
  • 4,735
6 votes

What is the proper way to debounce a GPIO input?

The stated question is regarding contact bounce. However, the data presented in the question does not reflect contact bounce - contact bounce does not repeat over the 100msec & 300msec durations ...
Seamus's user avatar
  • 22.4k
5 votes

How to connect a graphic card to Raspberry pi?

I originally flagged this as being, possibly seriously, Off-Topic but technically there is a further method that make it possible to connect a graphics card to the RPi and have the latter generate ...
SlySven's user avatar
  • 3,621
5 votes

How do I make a device tree overlay for just a single GPIO?

Either I'm blind, or the whole concept of device tree overlays is very badly documented. Here is what I've found: Install prerequisites: sudo apt-get update sudo apt-get install raspi-gpio device-...
rudolfbyker's user avatar
5 votes

GPIO 02 and 03 seem always high when used as an input (with pull down resistors attached)

GPIO 2 and 3 are special in that they have hard wired 1k8 pull-up resistors to 3V3 fitted on board. That's to allow their use as I2C bus 1 (I2C requires pull-ups for SDA/SCL for proper bus operation)....
joan's user avatar
  • 71.3k
5 votes

GPIO: Warning Channel already in use

You can safely ignore the warning. As the message says add GPIO.setwarnings(False) to the start of your script to disable warnings. GPIO.cleanup() sets any GPIO you have used within RPi.GPIO to ...
joan's user avatar
  • 71.3k
5 votes
Accepted

Getting feedback from a hall sensor with Raspberry Pi

I did an experiment using a Hall sensor with magnets connected to a motor shaft. Detail and code are available at https://www.raspberrypi.org/forums/viewtopic.php?p=632413 You should be able to ...
joan's user avatar
  • 71.3k
5 votes
Accepted

RPI GPIO Ports default on?

Yes, it is normal. GPIO 0-8 have their internal pulls to 3V3 enabled at boot. That will allow enough current to flow to dimly light a LED.
joan's user avatar
  • 71.3k
5 votes
Accepted

I can't get RPI.GPIO working

You are correct the RPi GPIO module does come preinstalled on recent versions of Raspbian, and is almost certainly already installed. The problem is that the name of the Library is wrong. Change ...
Steve Robillard's user avatar
5 votes
Accepted

Differences in GPIO between Raspberry Pi 2 B and 3 B

It basically depends on what aspect you are looking at. The pins of all with 40pin headers (B+, Pi2, Pi3) are identical. The functions which are allocated to the pins differ slightly. The Pi3 has a ...
Milliways's user avatar
  • 60.7k
5 votes
Accepted

How to set a GPIO pin to default HIGH before setting it to output?

As suggested by anonymoose's comment and RPi.GPIO's documentation RPi.GPIO module basics setting a pin to output allows to specify an initial value: To set up a channel as an output: GPIO.setup(...
5 votes

Have I fried my input functions?

There are at least two ways to test your GPIO. Both programs should be run with nothing connected to the expansion header. wiringPi's pintest utility pigpio's gpiotest utility gpiotest is slightly ...
joan's user avatar
  • 71.3k
5 votes
Accepted

"Blinking" relay by toggling pins between input and output

The problem The problem is that your relay board is designed to run at 5V, but your Pi's GPIO is 3.3V. The relay is a 5V relay, so the power supply needs to be 5V, but you can alter the design of the ...
Edward's user avatar
  • 961

Only top scored, non community-wiki answers of a minimum length are eligible