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
13
votes
5answers
15k 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 ...
13
votes
1answer
3k views

Zero-crossing activated relay

How could I go about programming a switch (based on solid-state relay or a triac) that triggers on zero-crossing power? For these not familiar with the subject: Switch 230V power on, when the sine ...
12
votes
6answers
87k 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:...
12
votes
2answers
4k 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
26k views

GPIO Pin Explanation

My Pi 2 kit came with the following GPIO pin reference card. In addition to showing all of the 5V, 3.3V, GND, and GPIO pin numbers, it has additional information on some of the GPIO pins like TXD, ...
12
votes
3answers
22k views

Why cleanup the GPIO pins?

When running a program in Python, why would I want the cleanup command when using the GPIO's?
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 ...
12
votes
2answers
913 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
1answer
10k 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 ...
12
votes
5answers
13k views

GPIO-UART-to-Arduino communication

I have been trying with no luck to get the Raspberry Pi talking to an Arduino. I am using a 3.3 V-to-5 V converter to swap voltages. I did put an LED on the UART TX pin, and it looks like it ...
12
votes
2answers
22k 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?
11
votes
2answers
5k views

Loop doesn't work unless I use 'print'

This code does not turn the led on and off. import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(21,GPIO.OUT) for number in range(0,10): GPIO.output(21,...
11
votes
3answers
9k views

Can I use the 3.3v pin instead of the 5v pin?

I am using a HC-SR04 ultrasonic sensors, and I don't have enough 5V pins on a Raspberry Pi, and I don't want to buy an expander. So is it possible to use the 3.3V pins on some of the sensors? What ...
11
votes
3answers
12k 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 ...
11
votes
2answers
5k views

Compare and contrast Python GPIO APIs

I'm just starting with Pi and want to program GPIO in Python. So far I've come across five libraries: WiringPi-Python RPi.GPIO RPIO gpiozero pigpio Before I commit time to learning one, I want to ...
11
votes
5answers
14k 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: ...
11
votes
2answers
14k 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 ...
11
votes
1answer
13k views

Does short-circuiting GPIO pins damage the Raspberry?

Does accidently connecting the wrong GPIO pins damage the Raspberry Pi or is there some protection like a fuse?
11
votes
4answers
2k views

Is it possible to use the GPIO to program a PIC?

I'm referring to the PIC microcontrollers, specifically the 16f and 18f series - could the GPIO be used in this way? If so, how?
11
votes
4answers
26k 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 ...
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 ...
11
votes
2answers
9k views

How to install node.js with GPIO

I am trying to install node.js on my Raspberry Pi as well as GPIO. I am running a brand new install of Debian Jessie I could get nodejs v.0.10.29 installed. No matter what I do, this is pretty much ...
11
votes
3answers
4k views

Precautions to be taken while using the GPIO pins

As a newbie to the Raspberry Pi and electronics in general, I would like to start hacking around with the GPIO pins but any tutorial around the Internet warn me about frying the Pi one way or the ...
10
votes
3answers
9k views

Pi Camera - how to create a flash?

I have a need to take photos with the Pi camera, but to illuminate the subject. The subject will be 1m or so away, but will be in total darkness most of the time. Therefore, I need a flash of some ...
10
votes
3answers
948 views

Powering Pi from Ni-MH batteries

I would like to power my RPi2 from the 5V GPIO pin via 4 Ni-MH rechargeable batteries (4.8V) but I'm afraid about peak current. Can it somehow produce more than 2.5A? Should I use a fuse to limit that ...
10
votes
3answers
9k 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, ...
10
votes
2answers
11k views

Which GPIO pins are usable without any modifications?

I've found that many of the GPIO pins are not usable on a stock installation of Raspbian with gpio-admin. For example, I wired up a relay to GPIO 21 only to find after some debugging that it didn't ...
10
votes
1answer
2k views

If I power my Pi from GPIO, can I detect that it's not being powered by USB?

I'd like to create a backup power solution for my Raspberry Pi, and I'd like a notification to come up that the Raspberry Pi is running on this backup power. This notification has to tell me that ...
10
votes
4answers
10k views

12V device to a Raspberry Pi

For my school engineering project, I have a coin acceptor device which I would like to link to the Raspberry Pi. However the device requires 12V in power. I have an idea of what to do to power the ...
10
votes
5answers
5k views

How to wire a stepper motor?

I recently bought one of these stepper motor and driver boards - and I cannot find any documentation how to connect it to the Raspberry Pi - I'm attempting to use the AdaFruit tutorial and while I'...
10
votes
1answer
1k views

Is it possible to communicate with i2c devices via the GPIO? [duplicate]

Is it possible to communicate with i2c devices via the GPIO? Also, are there any existing drivers or libraries that make this possible from Python?
10
votes
2answers
13k views

RPi as a Sound Level Meter?

For my daughter's science fair project (Computer Science and Math category), she'd like to use the RPi to go around and measure whether different loud sounds are above the threshold of pain and are ...
9
votes
3answers
3k 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 ...
9
votes
1answer
12k 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?
9
votes
2answers
17k views

What's the right way to run a python script as a daemon (service) in raspbian (or debian)?

I'd like to use my Pi as a home thermostat, with the control loop running in a python script. I want to run it as a daemon on raspbian (debian) at startup. There's an example bash script in /etc/init....
8
votes
2answers
14k views

Driving PWM output frequency

After many hours of fruitless searching and reading, I still didn't have a complete understanding of how and why to output specific frequencies from the hardware PWM pin on the RPi without using ...
8
votes
2answers
8k views

GPIO library for C

I want to utilize the GPIO pins on my Raspberry Pi 2, but I'd rather not use Python since I personally dislike the language. However, I cannot seem to find any information regarding the use of C, only ...
8
votes
3answers
5k views

How does the Raspberry Pi differentiate between multiple expansion boards?

I am just getting started with using the GPIO on the Raspberry Pi for various projects. There are many breakout boards for the RPi and many of those have pins in order to stack boards on top of each ...
8
votes
3answers
2k views

Cambridge University Raspberry Pi Operating system development Guide Questions

I'm a high level app developer (C#, python) and I'd like to get my hands dirty with low level embedded application development. Cambridge University has posted a series of tutorials teaching you how ...
8
votes
3answers
7k views

How to detect whether there is voltage between two points via GPIO?

I'd like to detect whether an external device is switched on or off. I found two pins where there should be 5V between in the first case, but the voltage may vary a bit and I don't wont to break the ...
8
votes
2answers
7k views

How to use Java to read/write data to/from the header pins?

I just got Java running on my Raspberry Pi which took a lot more screwing around than i had hoped. I want to be able to read/write data to/from the header pins from Java. How can I do this? Do I need ...
8
votes
2answers
2k 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 ...
8
votes
3answers
1k views

Custom recovery partition

I am working on a project where upgrades to the Raspberry PI will over HTTP, and the Raspberry PI will not be directly accessible (cannot just swap cards). I would like to have a partition setup like ...
8
votes
6answers
17k views

Reed switch wiring

Working my way through a garage door project. I purchased a few of these but I'll be danged if I can find a consistent answer on how they're wired to a Rpi. My thought was just start hooking it up ...
8
votes
1answer
6k views

Reading GPIO states using C

I've implemented this example to familiarize myself with basic GPIO programming in C. The code demonstrates how to write to GPIO pins but does not explicitly state how to read the state of pins. I ...
8
votes
8answers
21k views

PWM input in Raspberry Pi

Is there a way to read a PWM signal from the pins on Raspberry Pi? I tried googling it, but I only found PWM output, and not input.
8
votes
1answer
1k views

Locked (Atomic) Register read/write

I'm coding something using direct control of GPIO, there are some good resources around for this, such as http://elinux.org/RPi_Low-level_peripherals#GPIO_hardware_hacking ; the process involves open("...
8
votes
5answers
12k 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 ...
7
votes
3answers
2k views

What components would I need for my Pi to safely detect a 12V automotive circuit on GPIO?

I'm rather new to logic circuits and I'm trying to figure out which component I need to complete my project. I'm attempting to make a backup/reverse camera. When I shift into reverse, 12V is sent to ...