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
28 votes
2 answers
44k 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
125 votes
9 answers
332k 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,251
76 votes
5 answers
181k 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,153
2 votes
1 answer
11k views

What are the Electrical Specifications of GPIO pins?

What are the Electrical Specifications of GPIO pins; current limits and voltage levels?
Milliways's user avatar
  • 58.7k
4 votes
1 answer
5k views

How to use Arduino devices with Raspberry Pi?

I bought "RFID RC522" & "GY-NEO6MV2", and I need a useful guide for both of them in order to use them with Raspberry Pi 3 Model B. I also want to know if there is a guide or a course for using ...
Abdulkader's user avatar
7 votes
4 answers
36k views

Raspberry Pi 3 model B "dtoverlay=gpio-shutdown"

To my /boot/config.txt on Raspberry Pi Model B I added: dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up Right now nothing happens when i shorten GPIO#3 with ground. What else needs to ...
madneon's user avatar
  • 509
7 votes
4 answers
18k views

Is the gpio readall command compatible with RPi 4?

It's already a while since I got my Pi 4, but never used the gpio readall command until yesterday. I have run into an interesting error. pi@raspberrypi:~ $ gpio readall Oops - unable to determine ...
Jakub Bláha's user avatar
6 votes
3 answers
15k views

Controlling Raspberry Pi GPIO with c and Python

I was searching for C and Python Libraries which support Pi4.
Milliways's user avatar
  • 58.7k
58 votes
1 answer
168k 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
  • 865
52 votes
8 answers
127k 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
  • 698
1 vote
1 answer
2k views

How to tap / tee / fork / stack the Rpi GPIO pins covered / blocked by a HAT / pHAT / bonnet?

I have a blinkt pHat that covers the entire GPIO pin array and I'm trying to trigger changes to the LED array after an external prompt. I expected to use a momentary switch connected to the GPIO pins, ...
user3.1415927's user avatar
110 votes
5 answers
251k 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
3 votes
2 answers
1k views

Run the program in the laptop and use the raspberry gpios, PWM to control servos

I'm working with face tracking and I want to activate some servomotors depending the motion of my face. For facetracking I'm using, an usb cam, opencv and dlib. Now results the raspberry can't run my ...
Lleims's user avatar
  • 210
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
3 answers
105k 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
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
8 votes
1 answer
4k views

GPIO callbacks in any language

I know the linux kernel has a language agnostic GPIO interface through /sys/class/gpio which can be manipulated with echo, cat, etc. How can this be used to create event driven callbacks ...
goldilocks's user avatar
  • 58.5k
6 votes
2 answers
22k views

Raspberry Pi 4 B GPIO boot and shutdown button(s)

I've been doing some research on power buttons for the Raspberry Pi, but I'm having quite a hard time finding information. Right now, I have button working on GPIO5, and when I connect it to the ...
are_end's user avatar
  • 169
12 votes
2 answers
34k views

Controlling many LEDs with few GPIO pins

I successfully completed my hardware "hello world" using this guide: http://www.raspberrypi-spy.co.uk/2012/06/control-led-using-gpio-output-pin/ Now I'd like to move on to bigger and brighter things,...
SkyNT's user avatar
  • 223
1 vote
3 answers
2k views

Rpi UART control IR Remote HDMI switch problem

I've been reading about how to use the GPIO to toggle a button on a thing I've taken apart. It's like this: Amazon I watched a video of a guy using an opto-coupler, what are the basics here? I'm ...
Quinn Finney's user avatar
23 votes
2 answers
19k 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
14 votes
1 answer
12k views

Raspberry pi GPIO input pins give random values

I've been playing a lot with the Raspberry Pi lately. But I have a problem. When I set up an input pin to check whether electricity is sent to it or not, it gives me rather unstable answers. A few ...
Gustaf's user avatar
  • 141
4 votes
2 answers
10k views

How to check if SPI is enabled and functional on Raspi 3b+?

I have run raspi-config and enabled SPI and also verified that /boot/config.txt contains the line: dtparam=spi=on However, when I run lsmod | grep spi I get the following: spidev ...
glenneroo's user avatar
  • 145
2 votes
4 answers
1k views

program my robot with python

initially my question was about how to fix my code. You informed me that usage of that python class will not work with my setup of one motor. I agree and I want to instead use the GPIO library to ...
thecanmanisback's user avatar
2 votes
1 answer
13k views

I2S Recording combined with I2S Playback

I have a Raspberry Pi Zero and I am using the Adafruit I2S MEMS Microphone together with the ADAFRUIT I2S 3W CLASS D AMPLIFIER BREAKOUT - MAX98357A. I did follow the two respective tutorials and I ...
Besi's user avatar
  • 854
1 vote
2 answers
1k views

How can Rpi use a matrix key pad to read multiple, up to 256 keys / buttons?

I would like to build an organ pedal board and use Raspberry Pi as signal processor. The pedal board will have 32 inputs, one for each key. I am planning to use magnetic sensors (like A3144), which, ...
Ionică Bizău's user avatar
172 votes
1 answer
467k 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,878
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
  • 11.9k
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
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
12 votes
3 answers
42k views

How to output audio signals through GPIO?

Is there any way to output audio signals through GPIO and is there any disadvantage with this way?
Van Tr's user avatar
  • 324
10 votes
3 answers
10k views

Creating halt/wake button?

I have rigged up a wake-from-halt button using pins 5 and 6. These two pins, when connected, will reset power and reboot from halt. I want to use this same button, if I can, to run a command that, ...
Ryan McClure's user avatar
6 votes
4 answers
9k views

How can I control the red LED again

I just acquired the latest Pi-3. In the Pi B+ and Pi 2 it was possible to access both the red and green LED through /sys/class/leds/led0 and /sys/class/leds/led1. After setting up the Pi 3, I have ...
John Smith's user avatar
  • 1,251
5 votes
1 answer
5k views

Do I need a current limiting resistor in series with a magnetic door sensor?

I'm building an alarm system and I'm using a magnetic door sensor, conected to ground and a pin of the gpio set up with an internal pull-up resistor. As far as I know, this means that the pin will be ...
jotadepicas's user avatar
4 votes
2 answers
6k views

What happens to the GPIO voltage after shutdown?

I don't have a Raspberry Pi laying around at the moment and I would like to detect if my Raspberry Pi is shuted down. My Idea is that maybe after the Pi shutted down the Voltage at the 3V3 pin will ...
Freygeist's user avatar
1 vote
1 answer
954 views

How to use a stackable Rpi relay HAT to control 220V AC mains power?

So I want to wire two DHT22 sensors (5V) to a Pi and also control a lightbulb with 220V. As a plus this should be very compact and I don't want to solder or use breadboards/jumper cabling. I looked ...
duenni's user avatar
  • 111
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
  • 11.9k
37 votes
3 answers
39k 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
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,595
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
15 votes
5 answers
23k 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
  • 772
11 votes
2 answers
19k views

PiGPIO Library Example for Bit-Banging a UART

The PiGPIO library http://abyz.me.uk/rpi/pigpio/index.html mentions that one of it's features is "software serial links using any user gpio". I take this to mean that you can use it to generate a ...
PhilBot's user avatar
  • 371
11 votes
3 answers
17k views

LIRC won't transmit (irsend: hardware does not support sending)

I’m trying to control an IR HVAC unit in my house with a Raspberry Pi 2 and an infrared shield (see here: http://bit.ly/29iC0lr). I followed the instructions on the IR shield product page with tips ...
gq9000's user avatar
  • 151
10 votes
6 answers
18k views

How can I turn an GPIO to its alternate function?

I want to use the altenate function of GPIO 4 namely the GPCLK0 function. How can one set a GPIO to its alternate function? Many alternate functions are summarized here: elinux-wiki The best would ...
user61664's user avatar
  • 209
9 votes
3 answers
4k views

GPIO pin voltage is too low to energize relay

I am trying to toggle a small relay on and off. I have connected a GPIO pin and GND directly to the relay. I can hear the relay clicking, when I set the GPIO pin to HIGH. However, the relay only ...
Andreas's user avatar
  • 193
9 votes
1 answer
19k views

What are the ID EEPROM pins and what can they be used for?

I understand that it's a type of ROM, but is there more to it? How can it be used for?
Diogo Magalhães's user avatar
9 votes
2 answers
3k views

How to detect what kind of HAT or GPIO board is plugged in - if any?

I am setting up some Raspberry Pis for use in demos to colleagues, in order to show off capabilities of the Pi itself, and of some of the add-on boards that are available. I would really like to be ...
Clare Macrae's user avatar
4 votes
3 answers
9k views

Multiple GPIO Buttons vs Matrix Keypad

I've seen a tutorial here that shows me how to do this: But what I want to do is like this: I want to have multiple buttons and distinguish between them. The graphic I painted depicts the desired ...
user96931's user avatar
  • 729
4 votes
3 answers
4k views

How long to wait after shutdown to cut power

I am working on a problem that seems to be fairly popular with the Raspberry Pi community. In essence, I am designing a circuit that will utilize a DS3231, a 555 timer, and a load switch to cut power ...
nichollsg's user avatar
  • 153
3 votes
2 answers
2k views

Rpi3B SSD1306 OLED I2C Interface Problem

I know there are similar questions, but none of them helped me out. I have a Raspberry Pi 3 Model B Rev 1.2 and Raspbian 10 installed. I try to connect an 0.91" Oled display (Hardware Details) which ...
bernhardh's user avatar
  • 141

1
2 3 4 5
9