4

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 ...


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

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 ...


3

It's possible that this might mirror something I was doing a couple of years ago and I preface this with the observation that I don't believe that it was good practice, but I didn't find a way around it, so I welcome any correction. The issue (in my case) was that running a python program that accessed the GPIO pins required root access. If you are going to ...


3

though it is probably Pi 3 specific, since it didn't work for my Pi 4 It works on the 4 as well, you just need to set the right trigger. The instructions that you provided are not applicable to the 4 or just incorrect. This will tell you what triggers you have available: cat /sys/class/leds/led0/trigger To enable manual control on a 4, do: echo gpio |...


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

The stated question is regarding contact bounce. However, the data presented in the question does not reflect contact bounce - contact bounce does not repeat over the 100msec & 300msec durations presented in the text of the question. Let me try to be clear: The data provided does not rule out contact bounce, but the issue described by the data is not due ...


2

Answer: Yes. There are several ways this can be done. The method used will depend upon the characteristics of the load connected to the relay's contacts. Background: As @OyaMist has stated, "the actual relay state may differ from its nominal state". From a distance, when the relay state must be known, we are reduced to making a simple assumption; i.e. "...


2

I have finally found a Python library with documentation gpiozero I recommend this to anyone attempting to manipulate GPIO with Python. Just to clarify I also highly recommend the pigpio Python module which has more functionality.


2

Here is what comes to mind first, but maybe there are other ways. Using FIFO file, arecord tool and using python here, something like this must be possible. :


2

A little poking with Google suggests this is a permissions problem. I don't have an instance of Apache running on a Pi, but it runs as user www-data on Debian. If that's the case, try sudo adduser www-data gpio, reboot or restart Apache, and test.


2

Yes, as long as the signal is 3V3 compatible. You could use the Pi's UART RX pin (pin 10, GPIO 15) and the standard Linux serial software. That will handle standard baud rates (say up to 1 Mbps). Alternatively you can use a general GPIO (any other GPIO on the extension header) and software serial. That should be good up to 19k2 bps or so.


2

On the first RPi : In a first terminal : (create FIFO) mkfifo /tmp/audio.fifo.pi1 In a second terminal : (Write datas into FIFO) arecord /tmp/audio.fifo.pi1 readfifo-writeUART.py : pyserial short-intro #!/usr/bin/python # readfifo-writeUART.py import serial def do_work(data): with serial.Serial() as ser: ser.baudrate = 19200 ser....


2

Thank you all for your help in diagnosing this. Relay was faulty, swapped for one of the same make and model and now its working with the test provided by Coder Mike, as well as my original script.


2

The module you have includes a resistive sensor and a comparator which produces a 1-bit value (0 or 1). There's nothing you can do to get a more detailed signal from that module. There are two main approaches which allow to read analog values from resistive sensors with devices which don't have analog pins, such as raspberries. External ADC: simulate this ...


2

It is inadvisable to mix libraries. You can control a servo with https://gpiozero.readthedocs.io/en/stable/recipes.html#servo See https://gpiozero.readthedocs.io/en/stable/api_output.html#servo for documentation of the servo class. NOTE that gpiozero, by default uses RPi.GPIO GPIO Zero builds on a number of underlying pin libraries, including RPi....


2

Executive Summary Helping to understand the OP's AI (OpenCV!) robot car code. / to continue, ... Contents 1.0 Answer 1.1 motor, led python modules summary 1.2 server, run python modules summary 2.0 References 3.0 Appendices 4.0 Schematic (L298 Motor Driver) / to continue, ... 1.0 Answer 1.1 - Walking through low level (GPIO, DC motor) functions ...


2

Question How can Rpi python read a SPI MFRC255 RFID/NFC tag? Short Answer Part 1 - Introduction to I2C and SPI NFC/RFID Chips and Modules Part 2 - Setting up SPI MFRC522 Module Part 3 - Troubleshooting SPI Software and Hardware using Loopback Part 4 - Using Rpi4B buster Python 3 and Mfrc522 library to read NFC Tag I have successfully installed ...


2

Using software PWM for a frequency of 30 kHz is ambitious on the Pi. I would use hardware PWM (available from GPIO 12, 13, 18, 19). See http://abyz.me.uk/rpi/pigpio/python.html#hardware_PWM


2

I doubt you will reliably be able to read NEC IR signals with RPi.GPIO. The combination of Linux scheduling and GPIO interrupt handling and Python will likely conspire to miss transitions. I suppose that is something you will have to find out for yourself by trying. My pigpio Python module will capture the data. See the following examples. http://abyz....


2

The code you have should be fine. I'd expect the resulting sleep to be within 1% of n the majority of the time (getting more accurate for larger values of n). If you are seeing 2 times n it suggests something like: your system is exceptionally busy or the circuit you are driving has a large amount of capacitance to overcome or some other program is ...


2

I expect in reality the final state of the GPIO is pretty random. As you don't do a cleanup GPIO 17 will be left as an output. Its level will remain at whatever it was when the sleep elapses and RPi.GPIO terminates. The final level may appear stable over successive runs for a variety of reasons. E.g. in a perfect world the sleep will elapse at exactly ...


2

I'm not sure if this is the best/cleanest answer but you could have annother button called Autonomos mode off which you would press before you press the sensor off relay on. That button would have go to a different script in that directory that you would call stop.py. fileObject = open("isAutonumous.txt", "w") fileObject.write(0) ...


2

Try connecting the wire to another Pin like Pin 11. Then run one of these: gpiozero: from gpiozero import Button from time import sleep button = Button(17) # The 11th Pin is GPIO 17 while True: if button.is_pressed: # Your code here sleep(0.2) RPi.GPIO: import RPi.GPIO as GPIO from time import sleep butPin = 17 GPIO.setmode(GPIO....


2

You could use a breadboard to create a "bus" for distribution of the RPi's +5V (or +3.3V) power to your "add-ons". You should understand which sockets/holes on the breadboard are common before you get too far along with this. You should also keep in mind when patching connections from the RPi's GPIO pins that many of these pins are "...


2

The RPi.GPIO module only runs on the Raspberry Pi. You will have to create your own dummy copy if you want to develop on another computer.


2

I have written several GPIO Python modules. They each implement a "proper" debounce. pigpio set_glitch_filter lgpio gpio_set_debounce_micros rgpio gpio_set_debounce_micros


2

Your Question is misleading. Debounce settings work for their intended purpose (short term contact bounce), but this is not really your problem. Incidentally if you wanted to test bounce you couldn't have found a better "switch" to generate it - proper switches are designed to minimise bounce, although relay contacts are notorious for bounce. What ...


1

In my case the current from my power supply to the relay module was not sufficient at 1.0 amps. I swapped it out with one rated at 2.0 amps and that got my relays switching. Thank you all.


1

You cannot just tie Chip Select (CS) to ground. In SPI the CS pin not only tells the receiving device to listen but also synchronizes the communication. SCK sends pulses to separate each bit. But after powering on the slave IC might be in an undefined state regarding the communication to know it is not in the middle of a message. Thus requires a transition ...


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