New answers tagged

0

This warning also happens with inputs if you turn on the internal pullup: GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP) If you're doing that, just let it use the external one that's there anyway: GPIO.setup(3, GPIO.IN)


0

When set to PWM mode (i.e. internally connected to the PWM hardware) GPIO 12 and GPIO 18 are the same point electrically. Exactly the same signal will be transmitted to both GPIO.


0

If you are driving shift registers SPI will be the most efficient as you need to synchronise clock and data. PWM is pointless as you need to have a synchronised data feed. Using Python is not sensible if you need speed. You could bit bang both clock and data with a C library. I doubt you would reach 1.76 Mb/s but you'd be in the right order of magnitude. ...


0

Yes, you can actually hook up an analog electret mic and use Pi Pico's inbuilt ADC to convert to Digital values. Then you need to convert those PCM values to suitable PDM values which can be fed into the feature provider. Because it has DMA, no CPU cycles are wasted to access mic data from ADC. I read somewhere that we can sample up to 0.5 MHz using the ...


0

Ah, this is a very good program, so flexible to scale up. I would suggest the following changes. To scale up from 2 relays to 8 relays, change the following first statement to second: pinList = [10, 9] pinList = [10, 9, 8, 7, 6, 5, 4, 3] To change operation delay from two seconds to three seconds, say, change the following first statement to second. ...


0

No. The information is held internally within the DMA blocks but there is no method to get that information.


0

Do you want the script to start at start-up or at logon? These are very different moments. For example: I have Pi's to which I seldom logon. So, you've looked at rc.local, and it doesn't work. The rc.local way is as follows: Make sure /etc/systemd/system/rc-local.service exists and contains something like: Description=/etc/rc.local Compatibility ...


2

This happens occasionally when cron is used to start programs under the @reboot schedule. It happens because cron does not check that all required resources are available before starting the program/script you've specified. For example, if your program requires network resources, cron does not check that the network is available before starting your program. ...


0

GPIO 14 and GPIO 23 does go high for about 1 sec on reboot. GPIO 24 does not. PI3b+


1

This is somewhat of a workaround. It appears that at times the script can run before the pi has had a chance to boot up completely. Putting a sleep(30) just after my Imports fixed the issue. It ensures the logic of the script is executed after critical system functions are in place.


0

There are at least two problems with the level converter. It is not connected to the breadboard. It appears to be a loose fit over some header pins. It needs to be soldered to the header pins. The high and low +ve and -ve do not appear to be connected (if they are then SDA/SCL aren't connected).


0

My rain bucket was getting false triggers. It has a relatively long duration trigger so I just checked to see if the pin really went low. def countRain(rainPin): global totalRain global currentRain if (GPIO.input(rainPin) == False) : totalRain += .012 currentRain += .012 GPIO.add_event_detect(rainPin, GPIO.FALLING, callback=...


0

I don't think it is a good idea to drive the mototrs directly form the GPIO pins. It i s better tu use line direvers, Motor control hat etc. Because motors could draw more current when they startup and create problems. This is being said. What pins you'd connect them depends on the program. Please refer to them and see which GPIO pins you need to connect ...


0

docker run --rm --device /dev/ttyAMA0:/dev/ttyAMA0 --device /dev/mem:/dev/mem --privileged -ti python:2 /bin/sh apt-get update && apt-get install git-core sudo git clone https://github.com/WiringPi/WiringPi --depth 1 cd WiringPi/ ./build gpio readall


0

I will assume you are using the pigpio Python module. You are correct to say that hardware_PWM can not be used at the same time as wave_chain. I suggest you use the set_servo_pulsewidth method instead. This method can be used at the same time as wave_chain and is stable enough for servo operation.


0

Another option that will make multiple callback work together is to use threading and run the function with loop as thread: import threading def f_trigger(channel): threading.Thread(name='_thread_fireup_alarm', target=fireup_alarm, args=(channel,)).start() def fireup_alarm(channel): global alarm_cancel while alarm_cancel == False: ...


3

Callbacks are emitted by one thread. Each callback will therefore run to completion before the next is called. This is true for RPi.GPIO and all the other Pi GPIO Python and C modules that I am aware of. Treat callbacks as interrupts. Do the minimum possible before returning, e.g. set a flag to be picked up in the main thread.


2

I found an online simulator here, but you can't modify the hardware: https://create.withcode.uk/python/A3 https://fritzing.org/ has hardware and code, but I have not tried the coding yet. It costs about $9 but is worth it in my opinion. They also have the option to create and upload your schematics and will send you a PCB board (for a fee).


3

Just for reference, there are two well-known approaches for addressing multiple keys with fewer pins: voltage ladder if you have analog pins and key matrix if you have digital pins. The Pi itself has no analog pins, but if you use an ADC, it's possible to use some of its channels for buttons. Any non-standard wiring schemes are either suboptimal compared to ...


2

You could try something like the following - which will at least isolate buttons. Pushing the centre button will activate both inputs - the others a single input. Strictly no diode is required on the isolated buttons. simulate this circuit – Schematic created using CircuitLab


1

I was able to fix the pip3 install RPi.gpio with this: export CFLAGS=-fcommon pip3 install RPi.GPIO Source: https://www.raspberrypi.org/forums/viewtopic.php?t=289084


5

Sure, longer pins do exist: An alternative is to have male pins on one side and female pins on the other: Searching for "GPIO 2x20" in your favorite shopping site should give you similar results. In both cases, you may need an iron which is thin enough to go between the pins to make sure the solder flows evenly around each pin.


5

You might be interested in Stacking headers (eg: https://www.adafruit.com/product/85) Several boards all with stacking headers can be connected on top of each other, including to a breadboard at the bottom of the stack too. Photo example to illustrate, just an arbitrary google images result:


1

You can get extended headers - I use these on my Pico so it plugs into a breadboard but still has accessible pins. NOTE this will not let you use 2 HATs (as the pins would be inverted). The normal solution is to use extended headers on the HAT.


0

This instruction helped me https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/i2c-clock-stretching. Try to do this


3

There are really two parts to this question. Can you boot from floppy, and can you put an OS on a floppy. As to whether you can put an OS on a floppy, yes of course you can. Quite apart from the good old days of MS-DOS 3.1, CP/M, et al, I have written small OS that will run from a floppy, it isn't difficult. As an intellectual exercise or learning process, ...


1

Using the following wiring diagram: https://gpiozero.readthedocs.io/en/stable/recipes.html?highlight=distance#distance-sensor With the code from https://github.com/makertut/raspberry-hc-sr04 : (NOTE: code requires TRIG and ECHO to be swapped to match circuit) import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) TRIG = 24 ECHO = 23 print "...


1

You can only control two servos independently with the Pi's hardware PWM. GPIO 12/18 share a channel. GPIO 13/19 share a channel. The same settings apply to GPIO which share a channel. E.g. If servo1 is on GPIO12 and servo2 on GPIO18 they will get the same signal (same frequency, same pulsewidth). pigpio supports the hardware PWM features of the Pi. So you ...


Top 50 recent answers are included