Hot answers tagged

7

The GPIO/BCM pin numbers refer to the GPIO numbers at the SoC (chip) level. 28 of them are routed from the SoC to physical pins in the board. They're presumably just routed in a sensible way in terms of PCB routing. They could have been abstracted in software but they never were, and there are various board layouts (Pi 1 original, Pi 1 rev 2 onwards, and ...


6

The Raspberry Pi is generally used with an operating system. The most common is the Linux based Raspbian. Linux is a multi-user, multi-tasking operating system. Many people may be using the Pi at any one time. My idle Pi has 120 tasks running currently. If all those tasks were allowed to access resources in an ad hoc fashion nothing would work. The ...


6

Short answer YES. The GPS module uses Serial = Yes you can do that with a Raspberry Pi https://www.raspberrypi.org/documentation/configuration/uart.md The RFID module uses SPI = Yes you can do that with a Raspberry Pi https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md And for the question about "How", there are a ton of ...


5

The datasheet you linked says exactly that about the ID_SD and ID_SC reservations: 5.1.1 GPIO Pin Assignments, page 9: These pins are reserved for HAT ID EEPROM. At boot time, this I2C interface will be interrogated to look for an EEPROM that identifies the attached board and allows automatic setup of the GPIOs (and optionally, Linux drivers). DO NOT USE ...


5

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 used back to inputs with no pull up/down, you can avoid accidental damage to your RPi by shorting out the pins. Note that this will only clean up GPIO channels ...


5

Optics To "narrow the beam" will likely require replacing the existing lens, or perhaps adding an "overlay" lens. However, if you do replace/augment the lens, it's not clear that will make the sensor less "jumpy". Here are some sources for Fresnel lenses that may help. Before shopping for optics, you should definitely make time ...


5

Typically, hardware features like PWM/interfaces/interrupts/etc are available on specific GPIOs by hardware. This has nothing to do with board layout but the chip's pinout. If you take a look at pin configurations of any MCU/CPU you'll find that they are numbered "arbitrarily" as well. In deed, the layouter of the board faces the same problem as ...


4

If you want to illuminate a distinct LED for each day you will need more GPIO. I suggest you add one or more I2C based port expanders such as the MCP23017. There are plenty of helpful tutorials showing how to use the chip with the Raspberry Pi.


4

Note I am deliberately answering my own question There are lots of detailed guides out there; this is an overview of the key points particularly with respect to using a Raspberry Pi as the host. Take apart the case and solder wires to the TX, RX and boot_sel2 soldering pads, and make an earth connection somewhere. Ensure the Raspberry Pi is not trying to ...


4

None of the GPIO pins are 'multiplexed' in the sense you mean. In other words, some of the GPIO pins have alternate functions, but these are functions that you maintain control of in your configuration, and in your code. You do not need to worry about the system commandeering a GPIO pin for some other purpose. There are many sources of detailed information ...


4

You do not understand the way GPIO work. You can control GPIO pins, setting High or Low, and the pins retain their state, even if the Pi is shutdown. When you remove the Pi power the pins become undefined. On re-applying power the GPIO pins are configured as INPUTS, with either a weak pullup or pulldown, which depends on the pin. The pins ONLY become ...


4

I would recommend a transistor - not only does it reduce the current required but it isolates the Pi from the relay which helps to ensure that the Pi is less likely to suffer damage. Is this just a relay that you plan to drive directly? Don't forget about the reverse EMF that occurs when the relay is de-energised - it will generate a high enough voltage to ...


4

All I can think of is the fan causes a power spike which temporarily drains power causing a voltage drop. I suppose you could sort of test that by using the script without the fan connected.


4

No. The hardware offers no support for such an operation. What you can do is write 0 to a set of bits in one operation (clear bits) and write 1 to a set of bits in another operation (set bits). You can not set some bits and clear others in the same operation. My pigpio library supports these functions. clear_bank_1 set_bank_1


4

First of all, test the LED by connecting it to 3V3 and GND to make it come on without needing code. Then move from 3V3 to a GPIO pin and make sure you know which pin you're connected to. Refer to pinout.xyz. Your gpiozero example is wrong. Running led.blink() in a loop is repeatedly starting the loop but never giving it chance to cycle. You can either create ...


4

You are confusing wiringiPi numbers with GPIO numbers. The sysfs interface uses GPIO numbers. The highlighted GPIO is GPIO 26 (wiringPi 25). GPIO 25 is connected to pin 22. See https://pinout.xyz/


4

If you're using RaspiOS 32 with the latest 5.10.11 kernel then you have /boot/overlays/spi0-1cs.dtbo and /boot/overlays/spi1-1cs.dtbo Those free up the second CS pin. There's even an option to free up the MISO pin if you're doing send-only SPI transfers. From /boot/overlays/README Name: spi0-1cs Info: Only use one CS pin for SPI0 Load: dtoverlay=spi0-...


3

The Question: Why is a resistor even needed, and how would you know what ohms it should be? The Short Answer: A resistor is not needed. The parameter of primary importance is the current to be passed through the LED, and that value is obtained from the forward current (IF) rating in the spec sheet (Example). However if a resistor is used, its value is ...


3

The FIRST thing you MUST do in interconnecting 2 devices is ensure they have a common reference (incorrectly called Gnd - as the Pi will float wrt Ground). It is also recommended to join Gnd FIRST - before making any other connection. It is acceptable to directly connect 2 GPIO, but it is prudent to use a series resistor (~1kΩ) to protect the GPIO in the ...


3

This is an excellent opportunity to explore using a multiplexer or MUX. A multiplexer/demultiplexer uses only as many GPIO pins as you need bits to define an address (plus power and control). Since you have, at most, 31 days in a month, you can use 5 bits to count to 32 (or 0..31). I've used the CD74HC4067 in a package like this one with an Arduino UNO to ...


3

GPIO 3 Physical pin 5 (also 3) have on-board 1.8kΩ pullups and are intended for I²C so will be HIGH unless pulled down. I suggest you use a different pin. I have some reservations about what you are proposing. You should include some protection - a 1kΩ series resistor at least. I would omit the 3.3V regulator and substitute a resistive divider - ...


3

Only for the completeness: first check your connection as shown at What is the correct way to connect serial console on RPi4 Model B?. But I believe you are right. As I see you are experimenting with the 64 bit version of the Raspberry Pi OS in addition with an init ramdisk. First you should verify that your serial console is working as expected. Download ...


3

Probably found an answer thanks to @joan 's answer. It seems like RPi.PWM can only do software PWM, but the fan requires hardware PWM to run as smooth as possible. To do hardware PWM on any GPIO pin, the pigpio daemon has to be executed, and controlled by Python. Therefore, pigpio has to be installed first and configured to be started on boot (systemd). ...


3

Your previous program run must have exited but left GPIO pins in use. The next run of the program is warning you that it is reassigning pins that are in use. If you execute GPIO.cleanup() before the program exits then it won't happen.


3

No - there is no way to do this on an RPi without additional hardware. Neither the question, not the referenced documentation provide the magnitude of this sine wave. Without that information the additional hardware required can not be determined. EDIT: The OP has found some specifications on the amplitude of the sine wave output from the ac generator in the ...


3

The Answer to the Question you actually asked is quite simple. dhcpcd is a generic service which is applicable to ANY Linux distribution. It is NOT specific to the Pi, has no knowledge of the Pi hardware, and thus has NO code which could interrogate the Pi hardware. It would be possible to write some code to re-configure dhcpcd when a GPIO pin changes state, ...


3

The direct way would be something like this: This will work for most purposes. With these currents, you can probably use a 2N3904. If your power consumption is larger, you may want to look at relais cards. Or for breadboard users:


3

6V motors usually work fine with 5V (other than the fact that they run at 80%..85% of it max speed). However, powering a motor from the Pi is only possible for very small motors, which have stall current that the Pi can provide without a significant voltage drop. Even toy motors are often rated for 2A stall current or more, which can easily reboot the Pi ...


3

The documentation states i2c_vc Set to "on" to enable the i2c interface usually reserved for the VideoCore processor (default "off") The 2nd I²C interface is reserved for HATs (and also probably used for GPIO extension - although this is undocumented)...


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