Questions tagged [rpi.gpio]

rpi.gpio refers to the package name of a Python module for accessing the Raspberry Pi's GPIO pins. The module allows GPIO pins to be initialised, turned on, and turned off. It uses a functional programming style.

Filter by
Sorted by
Tagged with
125
votes
1answer
306k 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?
39
votes
4answers
54k views

Can I use Raspberry Pi in commercial production?

I'm quite new to Raspberry Pi. I recently started hacking my new RPI with raspbian and working on a video streaming project. I finished my prototype and things are ready for production. RPI is ...
18
votes
3answers
24k 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 ...
16
votes
3answers
81k 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 ...
16
votes
7answers
42k 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
2answers
17k views

What hardware do I need to turn Raspberry Pi into a TV remote controller?

I would like to control my TV using a Raspberry Pi. I would like my Raspberry Pi to act like a TV remote controller. What kind of hardware do I need to make it? Do I need something like IR emitter, ...
15
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 ...
13
votes
4answers
6k views

How to include RPi.GPIO in a python CGI script with lighttpd?

I've recently setup python to work with lighttpd via CGI (see here). But the minute I go to include RPi.GPIO, the script stops executing (I'm assuming because no HTML gets output), but there is no ...
12
votes
2answers
30k 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,...
12
votes
5answers
14k 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 ...
11
votes
1answer
2k views

Using additional GPIOs as digital I/O?

hopefully this question is rather simple but my quick googling did not find the answer. I know that the RPi has several GPIOs that I can use as well as specialized GPIOs (SPI, I2C, UART, etc). In my ...
8
votes
2answers
24k views

Toggling a GPIO pin set as output

I read here that I could toggle the state of a GPIO pin set to output in Python using the following command: GPIO.output(LED, not GPIO.input(LED)) where LED is the pin value. I can turn the LED on ...
8
votes
3answers
26k views

RPi.GPIO under Python 3

Raspberry Pi2 B, standard Raspbian. Using RPi.GPIO, V3 installed as: sudo apt-get install python-rpi.gpio python3-rpi.gpio On line import RPi.GPIO I get ImportError: /usr/local/lib/python3.2/...
7
votes
1answer
1k views

Raspberry Python Libraries

I am currently working with a Raspberry Pi (Model B+) and have some experience with Arduino (and it's derivates). Now, there are three Libs for GPIO access with Python for the Pi: WiringPi (...
6
votes
5answers
20k views

How to blink LEDs on/off continually, while continuing execution of a script?

I've connected red and green leds via GPIO and I can successfully switch them on/off using RPi.GPIO - now I'd like to: start an led blinking on/off every 1 second have the script continue its ...
6
votes
5answers
50k views

How to connect a graphic card to Raspberry pi?

I want a way to connect a graphic card like nvidia or amd to raspberry pi do you think has a way to do that?
6
votes
4answers
13k views

Global name GPIO is not defined errors on WebIOPi

I have Raspberry Pi 2 Model B v1.1 (NOOBS v1.4.2 Raspbian loaded), and I installed WebIOPi 0.7.1 to use it in order to blink a LED on attached to GPIO24 and GND by WebIOPi page. While I tried to use ...
6
votes
2answers
7k views

Flow meter Raspberry circuit and problem receiving pulses

I am trying to connect a flow meter YF-S201 to Raspberry Pi B+. It has three wires --> Red -> 5V --> Blac -> Ground --> Yellow -> Signal I have a doubt with the cicuit, The flow meter works in 5V ...
6
votes
2answers
545 views

Will the GPIO return data that is accurate out to .001 seconds?

Does anyone know how close I can measure time I would like to measure an event accurately to the thousands of a second?
6
votes
0answers
1k views

Running RPi on Solar Panel and battery [closed]

I’m quite new in electronic projects and so my basics are quite limited. I've been reading a lot regarding this topic (refer to the title) and I’m currently planning to buy the suitable Solar Panel, ...
6
votes
2answers
8k views

GPIO pins are always HIGH

I recently have started delving into using the GPIO on my raspberry pi and when I got to the input section of adafruit's tutorials I noticed something wrong. For some reason when I execute the python ...
5
votes
1answer
5k views

Can we use other GPIO pins as I2C

I would like to connect multiple I2C devices to my Raspberry Pi. Can I do that? What do i need to take care? Also is there any library which will output I2C on other GPIOs?
5
votes
3answers
4k views

Display IP Address on Character Based LCD

I need to know the IP address of my raspberry pi. I need to do this with a Character LCD display. So here's what I have done so far. I can display text on a HD44780 based 16x2 LCD connected to my ...
5
votes
4answers
2k views

“Blinking” relay by toggling pins between input and output

Edit for searches: This question is about using a 5v relay with Raspberry Pi GPIO pins that outputs 3.3v. There are a number of great questions below, read them through to understand whats going on. ...
5
votes
4answers
9k views

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

How do I make a device tree overlay which turns GPIO 7 on my Raspberry Pi Rev 2 Model B to a HIGH OUTPUT pin? EDIT: I require the pin to be this way as early as possible. That is why I am thinking of ...
5
votes
1answer
64 views

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

I have read that limits may be programmed for the output current of GPIO pins. However, after reading several online versions of Broadcom's data sheet for the SoC, I've found nothing to corroborate ...
5
votes
1answer
3k views

Can you connect multiple GPIO pins, to one ground pin?

I'm questioning whether connecting multiple GPIO pins (which to my knowledge are 3 volts), to one ground pin, is going to damage my Raspberry? I want to connect GPIO pins to breadboard, pass the ...
5
votes
1answer
620 views

I need to control 8 LED's but I can only control 3? [helpful pictures attached]

I'm very new to electronics in general, but I want to build a small project where I can individually control (from a GPIO pin) 8 LED's. From what I understand, each GPIO pin on the Pi (Pi2 model B V1....
5
votes
1answer
762 views

How to Check GPIO pins simultaneously?

Can you give me an idea on how to check the statuses of specific GPIO pins if it is HIGH or LOW? My project is all about checking the statuses of GPIO pins (6 GPIO pins). I want to check all of the ...
5
votes
2answers
8k views

GPIO - RuntimeWarning: This channel already in use, continuing anyway

I was trying to run a motor using the Pi. It was working fine before when I was executing using a Python script. Later I installed WiringPi and tried to execute the GPIO using shell script and it ...
5
votes
2answers
2k views

Simulate GPIO pins

I would like to do some simulation of the Raspberry's GPIO pins, e.g. for automated testing and developing the scripts on another host that is not the RPi. Are there any existing tools/scripts(...
5
votes
3answers
12k views

RF24 communication with Arduino

I have been trying for ages to work this problem out and can't figure it out. I have two nrf24 transceivers, one connected to the raspberry pi and the other connected to an Arduino. My code for the ...
4
votes
4answers
16k views

gpio library on windows while developing

I am new to Python so maybe this is not an appropriate question. I am working on a project on Python that will use GPIO functionalities of the raspberry Pi. Right now, I am developing the python code ...
4
votes
3answers
18k views

Plug a 5 V fan to GPIO 1 and 2

Regarding to the following picture, I understand that I can plug a 5 V fan by plugging it in between pins 1 and 2. Is this right (+ on 1 and - on 2?)? My need: Plug a 5 V fan to run all the time the ...
4
votes
3answers
9k views

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

I'm using RPi.GPIO to handle events from a simple pushbutton. Pushing the button connects the associated GPIO pin (4) to ground. I would like to trigger an event when the button is released (e.g., ...
4
votes
3answers
50k views

PHP to execute Python scripts for GPIO

I found this code somewhere, that can execute Python scripts from PHP. I've installed apache2 on the Pi and I'm able to access the PHP script. But when I press the HTML buttons, nothing happens! :( ...
4
votes
3answers
4k views

I am getting ghosting/bouncing on my digital input

I am meassuring data pulses from my electrical meter, giving me one pulse per Watt used. I have 4 electrical meters connected to my Raspberry Pi model B. I have connected them directly like this (no ...
4
votes
1answer
8k views

Why can't I turn on an LED through Python?

I have an LED connected to pin 11 on the Raspberry Pi header, (also known as BCM/GPIO pin 17, and GPIO0). I have installed the Raspberry Pi Python library according to these instructions. Attempt 1 ...
4
votes
2answers
5k views

Getting feedback from a hall sensor with Raspberry Pi

This is my first Raspberry Pi project and I'm a Python newb. I've got a geared motor + driver + separate power supply (for the geared motor) + hall sensor. I know the "physics" and the way ...
4
votes
2answers
2k views

Raspberry Pi camera doesn't work only displays red light

When I run my code, I get this error: No data received from sensor. Check all connections, including the Sunny one on the camera board The red light on the camera module glows, but doesn't ...
4
votes
2answers
15k views

How to trigger GPIO event using an active infrared sensor

Trying to get an active infrared sensor to trigger an event on a GPIO pin. I'm using python and the RPi.GPIO library on an RPi model B. Some background info, not sure how relevant it is, but I'm a ...
4
votes
2answers
2k views

Compute module 3 ttyAMA0

just got my hands on the new CM3, flashed a fresh raspbian image on it and noticed ttyAMA0 is not there (it has been used for bluetooth since raspberry pi 3). the only way to get it back is to change /...
4
votes
5answers
5k views

PiFM not working for me

I followed the steps found here & consulted this site. But I just get complete silence on 100.1 or other frequencies. No sound at all. Please tell me what it means. I really want to see & use ...
4
votes
1answer
60 views

How to Monitor GPIO Input Indefinitely Without Recursion

I actually joined StackOverflow to ask this question because I wasn't sure it was RPi specific, but as I was thinking about how to form the question, I realized it might be GPIO specific (for some ...
4
votes
2answers
3k views

GPIO pins not changing value

I have a raspberry pi zero and I am trying to change the gpio pin values. I tried using RPi.GPIO with python and the gpio command from wiringpi but I am unable to change the value for any of the pins. ...
4
votes
8answers
12k views

how to turn on and off an led with only a tactile button

I'm a beginner to the raspberry pi and python. I want the pi to act like a flip flop to the led so that when i push the button once, it will turn on and if I push it again, it will turn off and so on....
4
votes
2answers
579 views

What type of motor and speaker would be suitable for a DIY: Making a Pi-powered baby mobile?

My neighbor is having his first child shortly, and in the spirit of "it's never too early to learn programming/electronics" we feel the child should have access to a Raspberry-Pi of his/her own. ...
4
votes
3answers
5k views

Thermostat using wireless relay

I want to create a thermostat with my Pi to control (also remotely) my heating boiler, using python if possible. Unfortunately I don't know much about electronics, so I'm asking your help just to ...
4
votes
1answer
2k views

Failed RPi.GPIO installation on OS X

I am creating a server for the Raspberry Pi and I am partially writing the code using OS X. I need the RPi.GPIO module to make my script run, (even if I don't use it). After calling pip3 install RPi....
4
votes
1answer
678 views

PWM dc motor using L293D weak sound

This is the problem: using this tutorial and Adafruit_Python_GPIO libs when start pwm and step up with DutyCycle and frequency I hear a weak sound from motor but unfortunely it doesn't move. Wiring ...