New answers tagged

0

GPIO 19 will never be high and will not be a output unless you do something to make it so. All pins are initially configured as inputs with either pullup or pulldown; in this case GPIO 19 is configured as input with pulldown. NOTE again GPIO 19 is NOT a "PWM0 pin" and won't unless you configure it. You can configure a pin shortly after boot, using ...


0

You don't have to write ANY code to shutdown the Pi - the gpio-shutdown functionality is already in the kernel. You CERTAINLY don't need a second power source. NOTE this will NOT turn power off - the only way to do that is to turn the power off although there are devices which implement power control using external hardware. Also note that when shutdown ...


0

When using ubuntu, create the different groups (gpio is the specific for this question): sudo groupadd -g 123 spi sudo groupadd -g 124 gpio sudo groupadd -g 125 i2c Assign them to your user: sudo usermod -a -G spi $USER sudo usermod -a -G gpio $USER sudo usermod -a -G i2c $USER And create the file /etc/udev/rules.d/99-com.rules with the content: SUBSYSTEM==...


0

This does not answer your Question, but RPi.GPIO only has software PWM, which is not recommended for servos. My Pi.GPIO has hardware PWM, but if you want to use a servo you would be better to use pigpio which has explicit servo support.


1

Start again with a fresh install. Use raspi-config to enable serial. Use /dev/serial0 in your script.


0

I have done this before but I would not recommend doing it this way. sys/class/gpio doesn't support PWM on it's own, you can only write 1 or 0, ie "on" or "off" to a gpio pin using the sysfs gpio interface. PWM means writing on for a certain duration and then off for a certain duration and then repeating. You can implement this yourself ...


1

Off topic but it as quick to answer as not. The answer is no, you can not use software to set the position of a rotary encoder. A rotary encoder is purely an input device.


0

I stumbled across this Question and while Joan's answer is correct and her libraries (generally) use socket and pipe interfaces; there are a great number of programs (in C, Python and occasionally other languages) which directly access the Pi peripheral hardware - usually GPIO pins. Most programs use one of the libraries to access the hardware (just as most ...


0

Despite enhancing RPi.GPIO to meet my immediate needs for Python code, I still wanted a dynamic C library to control GPIO. (With the demise of WiringPi there is none available.) Building one from scratch is a daunting task, but while working on Pi.GPIO I realised that this already has the necessary C code to perform basic GPIO functions which only required &...


2

To use pwm, you need to use the pwm interface at /sys/class/pwm, not the gpio interface. Here is the relevant documentation. The startup would be something like export 1 > /sys/class/pwm/pwmchip0/0/export.


0

Yo. The physical interface and default modes are identical across all models with 40 pin headers. The BCM2711 SOC used on the Pi4 allows some pins to be configured in different modes which are unavailable on earlier models.


0

Your type identification is wrong. If the question is about the Pi2B versus the Pi4B then they have the same 40 pin header and pinout.


0

This has NOTHING to do with the Pi or GPIO. These lousy modules are unsuitable for use with the Pi (they are poor for Arduino). They can only be turned off by putting 5V on the inputs (or by setting GPIO to INPUT)! Using with the PI risks damage! NOTE there are hundreds of similar Questions by others who have problems with these. See Can you use a 5V Relay ...


0

All the GPIO are pulled high or low at power-up. GPIO 0-8 are pulled high to 3V3 the rest low to ground. The pulls are quite weak (about 50k). If you need a different default you need to add external pulls. See page 102 of datasheet for the default pulls. See pinout for the mapping of pins to GPIO.


1

You are probably looking for this table (notice the Header column ) Original documentation here https://projects.drogon.net/raspberry-pi/wiringpi/pins/


0

Two thingsI see is that the minimum frequency for a state machine is 2000 Hz and you only define side-set pin for instruction.side(XX) not normal pins.


1

I think the best method is to use a PWM HAT (Adafruit does one - but it seems not to work well with DC Servos) instead of using a RPi. This virtúally guarantees good timing and much less "strain" on the RPi.


0

Firstly you need to build the circuit described in the adafruit article that you linked. https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/overview Here is mine, connected to GND, GPIO12 and GPIO13: Then in the /boot/config.txt file you need to add an overlay entry to remap the audio: dtoverlay=audremap,pins_12_13 Then in 'sudo raspi-...


1

FYI, WiringPi got deprecated in 2019 and doesn't support Pi4-boards. So please keep this in mind when creating your projects if students would use such a board at home for instance. Pi4J version 1.3 (Java 8) and 1.4 (Java 11), provide a work-around for this: https://pi4j.com/1.3/install.html#WiringPi_Native_Library I would like to invite you to take a look ...


1

Generally Arduino GPIO are 5V and the Pi's GPIO are 3V3. If you directly connect 5V to a Pi GPIO you will eventually destroy the Pi GPIO and then the Pi. If you have a 3V3 Arduino you can directly connect the GPIO. I would advise a 10k resistor in series. You also need to connect a Pi ground to an Arduino ground. If you have a 5V Arduino you will need a ...


0

Yea. Raspberry pi has 2 PWM outputs going to 4 pins. See https://pinout.xyz/pinout/pwm# for pinout.


1

The "one button ON-OFF" switch function has been built into the Raspberry Pi device tree since July, 2017. All that's really required is two pieces of wire, but a momentary push-button switch can be added if you wish - perhaps your "three pin switch" can serve in this role? One Button? Let me explain in the following schematic what is ...


4

pigpio supports DMA timed PWM on GPIO 0-31. This has restricted frequencies and resolution. http://abyz.me.uk/rpi/pigpio/python.html#set_PWM_frequency pigpio also drives hardware PWM on GPIO 12, 13, 18, and 19. This is more flexible and accurate. http://abyz.me.uk/rpi/pigpio/python.html#hardware_PWM There are different function calls for the two types of ...


1

As Milliways said, you (me) are using the Python GPIO library which uses software emulated PWM, not the hardware PWM. The easiest solution would be in you case to load the PWM overlay. dtoverlay pwm pin=12 func=4 Then export a new PWM channel echo 0 > /sys/class/pwm/pwmchip0/export You can now set the period and the duty-cycle: echo 40000 > /sys/...


2

RPi.GPIO only has software PWM - which by its nature is imprecise. pigpio has hardware timed PWM which is better (and also hardware PWM if you look hard enough). bcm2835 has hardware PWM and so does WiringPi (but it is deprecated). My clone of RPi.GPIO (Pi.GPIO) now has hardware PWM in the final stages of testing expected to be released in the next few days. ...


0

It is unclear what the reference to "a three-pin arcade switch" actually means. There is no need to write ANY code, as the kernel includes this functionality. You also don't need 3 connections. I include dtoverlay=gpio-shutdown,gpio_pin=21 in config.txt on all my Pi. This allows me to safely shutdown with a button connected to pins 39,40. Even if I ...


1

I use the following settings: dtoverlay=uart2 dtoverlay=uart3 dtoverlay=pi3-miniuart-bt enable_uart=1 They give access to uart2 (on GPIO 0 and 1) and uart3 (on GPIO 4 and 5). Bluetooth works, and the default UART on GPIO 14 and 15 is available as well.


0

The BCM2711 has 6 UART (of which 4 are usable on the Pi4). See How do I make serial work on the Raspberry Pi3 or later Raspberry Pi4 UART


0

To answer the Question you actually asked "Does GPIO 1 have to connect to an EEPROM?" No - I don't use HATs so there is nothing connected. It is possible to "prevent the firmware from trying to read an I2C HAT EEPROM (connected to pins ID_SD & ID_SC) at powerup" using force_eeprom_read=0. See https://www.raspberrypi.org/documentation/...


2

Q: "Is GPIO 1 functional for other purposes?" Yes, it is. Most GPIO pins on the RPi are functional for other purposes. You can see this in the 3rd party pinout guide, for example. Perusing the README file (/boot/overlays/README on your local filesystem, or in the GitHub repo) may give you additional insights into other uses for GPIO 1 available via ...


1

In my experience (up to & including the buster release), gpio works fine on the RPi 4B if you install the WiringPi 2.52 update after doing the usual WiringPi installation using apt-get.


0

The question is: How do you want to connect the keypad to the Raspberry Pi? You could either go via USB or via GPIO, the latter is more compact for hardware. Look for the CARDKB-MINI-KEYBOARD by M5Stack, it is very easy to integrate via I2C interface (four wires) and easy to use with Python reading out GPIO.


2

"What would be the correct way of using GPIOs on the CM4?" This is strictly opinion based, and thus off topic. The strict (Linux kernel purist) answer is to use gpiochip interface. Unfortunately this currently provides limited functionality and is a little tardy. Linux kernel purists consider ANY method of accessing hardware which bypasses the ...


0

I am not aware of anything special about GPIO 27 compared to GPIO 26 and GPIO 28 which may also be connected to the internal ADC.


1

You would probably be better served by using my lg archive of programs. C and Python are supported. The archive uses the new /dev/gpiochip interface rather than the deprecated sysfs interface used by wiringPi and RPi.GPIO. lg also has the advantage of being a generic Linux archive and is not tied to the Raspberry Pi.


1

That gpio utility is part of WiringPi which was deprecated. There is an unofficial mirror: https://github.com/WiringPi Are you planning on developing something in a language such as Python or C ? I use the RPi.GPIO library in Python: https://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/ Another Python library gpiozero simplifies things even more: ...


0

After some fiddling with pigs and piscope (thanks @joan!), I found that the third byte in the response contained the value returned from the device, not the first. Not sure if this is how the chip is supposed to behave or whether something else is configured wrong, but increasing the size of the buffer and using buffer[2] has worked for now. For others ...


0

A solution could be to set up the same callback for each pin of interest: for channel in channels_of_interest: # add rising edge detection on a channel GPIO.add_event_detect(channel, GPIO.RISING, callback=cb) The callback, which I denoted cb, has a single argument that represents the channel being triggered: def cb(channel): if channel == 18: ...


Top 50 recent answers are included