New answers tagged

-1

Question My pizeo buzzer is no working, how to fix it? Answer (1) You seem to have connected Rpi's 40 pin header's 5V power to one end of the piezo, and one GPIO pin to other end of the piezo. It is worse than connecting a resistor in a similar way. Rpi GPIO cannot stand 5V, and might fry even you connect through a current limiting protect ...


-2

Question I am using Rpi GPIO 18 PWM control to dim a 7W AC LED lamp. (A) Why there is a weird dip at duty cycle 85%? (B) Why dimming not linear? (C) Why use PWM frequency 5kHz? (D) Why limit duty cycle to 86%? (E) Why LED not completely switch off at duty cycle 0% / to continue, ... Answer (1) Short Answers (A) There is ...


1

The pig s command sends servo pulses to the ESC. The servo pulses are sent at 50 Hz (i.e. 50 times per second) and the lengths are defined in microseconds. Duty cycle is not relevant to a servo. It needs a pulse width. If the software you are using only lets you specify a duty cycle you can convert between microseconds pulse width to a duty cycle ...


3

It is safe to connect a GPIO set as an INPUT to any voltage between 0 to 3V3 volts. It is safe to connect a GPIO set as an INPUT to a GPIO set as an OUTPUT. There is a risk in connecting together two GPIO both set as OUTPUTs. One may be set to 0V and the other to 3V3 which is in effect a short circuit. To mitigate the risk of setting two GPIO as OUTPUTs ...


1

Most EEPROM chips use either SPI or I2C to transfer data, check the docs for the chip you choose to find out which and connect to the appropriate bus on the Pi. From there it's a matter of sending the right commands on the right bus -- again the chip docs will help with this. There is, no doubt, many Python libraries to help with the commands (e.g. https://...


-1

Question The following two configurations work only one at a time: (1) L298N Driver 1 (D1) works with motor pair (M1a + M1b). (2) Similarly, D2 works with M2a + M2b. Answer There are a couple of possibilities, including: (a) Motor power too weak. The 5V power from Rpi4B's 40 pin connector (pins 2, 4) might have a problem driving 4 motors. ...


1

Is that GPIO configured to be an output? If it's an input, this error appears. Try # echo out >/sys/class/gpio/gpio17/direction to make GPIO17 an output. If you have this problem only sometimes, there may be another program running mangling your GPIOs.


1

What you have shown is NOT a "schematic", it is a layout diagram, but is too vague to determine exactly what you have (although we can guess), but seems unnecessarily complex. RPi_GPIO_Interface_Circuits shows output circuits which should work for your small motors. (The Driving a relay is most appropriate). If using a single transistor you should use a ...


0

The Answer by Joan is correct. But to clarify you can only use ONE serial interface on the GPIO. On all models with on-board WiFi the primary serial interface is connected to Bluetooth. The secondary interface has a few limitations (although for most uses these are not an issue). See How do I make serial work on the Raspberry Pi3 , Pi3B+, PiZeroW


2

The Pi has many hardware peripherals. The first of each type is labelled with a 0, if there are more than one of that type of hardware peripheral subsequent ones are named 1, 2, etc. The hardware peripherals may be multiplexed onto more than one group of GPIO. In your case you see TX 0 and TX 1 which indicates there are two hardware UARTs. UART 0 may be ...


2

There is a way that is called "Software serial" or "Soft UART". The project https://github.com/adrianomarto/soft_uart is doing precisely what you are looking for, you can install the soft_uart and use any GPIO as Rx/Tx. Software-based serial port module for Raspberry Pi. This module creates a software-based serial port using a configurable pair of ...


0

You could a USB to serial converter. That would let you connect the USB end to the Pi and the serial TX/RX/Ground end to the serial device. You can use (my) pigpio to bit bang a serial link on any spare GPIO. As long as the baud rate is 19k2 or less it should be fine. For Python the read is straightforward. Writing requires waves and needs more effort.


0

Question I am using two transistors to drive two fans. Is the following circuit OK? Answer Looks OK. Learning Notes Circuit Analysis (1) Ib = 3V / 300R = 3000 / 300 mA ~= 10 mA. (2) Transistor current amplification factor (h(fe)) > 100. (3) Ic = Ib x 100 = 10mA x 100 = 1000 mA. (4) Motor resistance would limit Ic to << 1000 mA, possibly ...


-1

1) Take a multimeter and measure 5 volts on the fuse. Both fuse contacts should show the same value 2) Find the MxL7704 chip board and measure the output volts good video explanation for this: https://www.youtube.com/watch?v=Hunm5S94BaE Also, to avoid damage to the Raspberry Pi, use an additional separate power supply. If you accidentally shorted 3.3 ...


2

I can confirm that result with version 2.52 of wiringPi, setting the pulls does not work on the Pi4B. wiringPi is now deprecated. http://wiringpi.com/wiringpi-deprecated/ You could contact the author but do not expect a response.


0

Question And without boards, is it possible to solder two gpio wires into one? Answer Yes, I often do it, not soldering, but the following: (1) Strip two jumper wires, one longer than the other. (2) Twist two ends together, (3) Crimp to a duPont pin and insert it into female connector. But I almost never do it for joining two GPIO wire ...


0

If you are actually using GPIO0 (pin 27) this is actually SDA.0 which is used to control HATs and is marked reserved on official documentation. I believe on newer Pi models this I²C bus is also connected to on-board extenders so is used for other purposes, although this is not documented, expect the voltage on this pin to change unexpectedly. Use any ot ...


0

Use a diode with gpio(-) and relay input(+) if it doesn't work then reverse the diode connection. The gpio only supply 3.3 volt. Maybe this one will solve. While using nodemcu I faced the same problem.


0

Here is how it works in simple terms. Consider the following schematic. Applying a LOW to a lamps turns it on. It is sometimes referred to as "active low" signal. simulate this circuit – Schematic created using CircuitLab


1

Considering the hand-drawn schematics available at the product page linked in the question, it is clear that the circuit is "active low". That is, the coil of the relays is energized if the input is low. The controlled contacts however are two-way contacts so that it is possible to either break or make a contact when either energizing or de-energizing the ...


2

Yes, many relays are low-On, high-Off. It is normal.


2

Unless special consideration - not yet mentioned in the question - apply, I'd say: worry not, pick any pin that is free (i.e. not to be used otherwise, such as I2C or 1-wire if you chose to use those interfaces too). Check for the special function of GPIO pins e.g. here. I would pick pins to simplify pcb routing if possible. If using a library to control ...


0

gpzero has support for events, very much what you are looking for event-wise: from gpiozero import Button def pushed_17(): print("Don't push the button!") b = Button(17) b.when_pressed = pushed_17 From GPIO perspective the buttons don't really have properties other than the PIN they are assigned to: this way even if you had multiple buttons assigned ...


1

cameras: yes if USB webcams, no if CSI cameras (official rpi camera module) - you can only use 1 on a Pi, or 2 on a compute module LEDS: yes, easily (one per GPIO) LCD display: it depends on the protocol. Some displays are SPI, some I2C. With these protocols you can share some of the pins, but others you need unique pins, so you would need to work this out ...


-1

Question How to set up multiple I2C buses on Rpi3B+ and Rpi4B? Answer I often read forum discussions on setting I2C buses. I tried all for my Rpi3B+'s but all failed, perhaps my drivers or Rpi stretch was to updated. The guys saying it is OK never specified their os version or driver used. I tried again for Rpi4B and found that I could use at least ...


1

is the circuit inside the stepper motor basically like an LED in that all we are doing is supplying access to ground to get them to turn on? Yes. In an NPN transistor current flows from the collector, through the base into the emitter, i.e. it acts as a sink. In your circuit then, +5V from the Pi flows through the stepper motor controller, through the ...


1

Looks like you're using the physical pin numbers. All RPF documentation, settings and software (such as dtoverlay, gpiozero, etc) work with the BCM numbers. You can find these at pinout and elsewhere.


0

When you wire Tx directly to Rx for testing w/o anything that would add error like dongles it tells you how good the library really performs. Use GPIO 23 as Tx and GPIO 24 as Rx or other free GPIO on Raspberry Pi 3b+. This looks good in same order as the on board UART and it is practically next to it, just 3 pins to the right, with a GND pin at the right of ...


0

You don't have a DHT11, you have a module with a DHT11 and a resistor on it. There are several variants of these with different pinouts. Unless these are labelled, you need to figure out which pin on the connector goes to which pin on the DHT11. On my module the center pin is the V+ and the left the Data. (Yours looks similar, although the use a a Red wire ...


1

The DHT22 doesn't use a specific protocol, so it can be connected to any GPIO pin not used by another sensor. Assuming your second diagram showing the 26-pin header shows the pins used by your RF sensor as those in lighter green with a label, any of the darker green pins without a label should therefore be fine for the DHT22. As pointed out in a comment, +3....


1

power issue? 3b+ draws more than 3B


2

The GPIO is still working, it's the software refusing to continue without a warning unless you correct the condition causing the warning. Either do what the warning message says or add the following line at the (logical) end of your script. GPIO.cleanup()


0

Ignoring WiFi and Bluetooth wireless, there are four data interfaces on the Pi, SPI, I2C, and UART Serial, which it sounds like you're currently using with the TX and RX pins (and presumably ground), and USB. SPI, I2C, and USB all require one device to be a master, organizing communication, and one device to be the slave. Serial is bi-directional and ...


1

If you need more LAN interfaces, the best solution in terms of performance per dollar is to get several USB to LAN adapters. For low speeds (below 10Mbps), an SPI to LAN module can be used. Such a module can indeed be wired to GPIO SPI pins. You will want to check if a Linux driver is available before buying a module, since many of those are made for ...


0

Definitely NOT - for a start Ethernet uses galvanically isolated differential signalling.


0

No. There is no way software would be fast enough to handle the Ethernet protocol. You need dedicated hardware to handle the bus. https://simple.wikipedia.org/wiki/Ethernet


0

To comment on your new question the GPIO inputs are high impedance CMOS circuits and consume negligible power. You could (in principle) connect a 100 GPIO inputs to 1 output - although this would be poor practice because of capacitive loading. In fact, I would not use GPIO to connect multiple devices unless they are in close proximity and share a common ...


3

Finally, after fiddling around I am able to resolve the issue. As per the WiringPi setup guide to set the direction of a gpio u should use gpio mode 21 out This method works if you are using #!/bin/sh shell But if you want to use #!/bin/bash shell then you have to use gpio -g mode 21 out After, setting up the direction with use of '-g' I am ...


2

No problem. It is safest to introduce a resistor. Connect any Pi ground pin to any of the other Pi's ground pins. Connect any Pi GPIO pin to any of the other Pi's GPIO pins via a resistor (if you have one, anything between 300 ohms to 100 thousand ohms will do). Set the transmitting GPIO as an output and the receiving GPIO as an input. The resistor is ...


1

There is a kernel service gpio-poweroff which asserts a GPIO pin on poweroff but may not work on the Pi4. See https://raspberrypi.stackexchange.com/a/100125/8697 for details I just tried shutting down my Pi4, and as I suspected the 3.3V supply is off when in the low power state. The Pi4 puts the power management chip into a low power state when off - ...


2

Check out this post on the difference between sh and bash: https://stackoverflow.com/questions/5725296/difference-between-sh-and-bash In summary of key points, sh is really a standard and bash was originally an implementation of that standard that evolved to have a lot of extensions, some of which caused it to deviate from the standard. When you do #!/bin/...


Top 50 recent answers are included