Hot answers tagged

5

There is nothing wrong with the GPIO, it just can't supply enough current for your coil. If the coil has just 24Ω, at a 3,3V the GPIO would need to supply 137mA. This source at raspberrypi.org says that the maximum current it 51mA for all GPIOs together and 16mA per GPIO. You can connect the GPIO to a transistor that can supply the necessary 137mA.


3

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


3

From the picture of the wiring I dare say that there is no connection to the 12 V power supply. So the circuit is now just a switch and the solenoid. Without a voltage source the solenoid is not going to do much. From the product description you can tell that the operating contacts of all releays are not connected to anything - which is by the way the most ...


3

WARNING! NEVER put any kind of switch in the Neutral line (unless using a double pole relay). This would violate electrical wiring regulations. Putting a switch in the Neutral just makes the other side of the relay (and the rest of the circuitry) live when off. Go with https://www.amazon.com/dp/B07CZL2SKN/. They've been kind enough to provide the ...


3

Most relays are Active LOW - the relay is ON when the input is LOW and OFF when the input is HIGH. The specification for your relay board should state this.


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

The relay module you linked (which has limited documentation) states:- 12V 16-Channel Relay interface board, and each one needs 15-20mA Driver Current The Pi GPIO can (safely) sink up to 16mA - and if using all relays would overload an Arduino, and probably the Pi. Of course this assumes the Pi could even drive the opto-isolator, but if this has a series ...


2

CoderMike's Answer addressed the problems in your code, but if you are actually using the relay module pictured and have wired it in a similar manner there are more concerns. There are a number of similar (poorly-designed) relay modules on the market - they seem to infect ebay! They may work with Arduino (and TTL logic) BUT ARE A LOUSY DESIGN even for that ...


2

Firstly does the following turn your relay on then off? import RPi.GPIO as GPIO,time GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) GPIO.setup(7,GPIO.OUT) print('on') GPIO.output(7,GPIO.LOW) time.sleep(4) print('off') GPIO.output(7,GPIO.HIGH) You also need to add timeouts to your distance sensing code otherwise your code could get stuck in a while ...


2

Answer Remark: Just a quick and dirty answer. Perhaps more details later. Warning: no guarantee no nothing won't meltdown or blow up. I skimmed the datasheets and quickly concluded that there is 80% chance OK, for the following reasons: (1) Touch display is SPI, and relay is I2C, (2) I2C relay has well documented instructions to change ...


2

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

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.


1

You can power a small servo from the Pi provided there is spare power. You don't have to power it from the Pi. If you power it separately then you need to connect the servo's power supply ground and a Pi ground. Just connect the control line directly to a Pi GPIO. In summary for the servo + pin connected to power supply + - pin connected to power supply ...


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

Does the following turn on and off your relay accordingly? import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) RELAIS_1_GPIO = 18 GPIO.setup(RELAIS_1_GPIO, GPIO.OUT) while True: print('on') GPIO.output(RELAIS_1_GPIO, GPIO.LOW) time.sleep(2) print('off') GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) time.sleep(2)


1

Setting a GPIO pin has a latching behavior. That is when you set it, it stays that same value until you tell it otherwise. So in your if statement, just add an else clause to reset it low if the value read is <=600: if touch > 600: GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) print("moisture: " + str(touch)) else: GPIO.output(RELAIS_1_GPIO, GPIO....


1

OBSERVATION: I do not see a line of code / instruction to pull the GPIO back to low. If the observation is correct and this instruction is executed: GPIO.output(RELAIS_1_GPIO, GPIO.HIGH) How would the line GPIO return to a low state? Under what condition do you expect the GPIO to return to the low state? What happens if the instructions is changed to: ...


1

You have asked many questions - this site works best if you ask a single question (otherwise you will get lots of speculative answers, but often none from experienced users). To answer ONE of your questions it is important that we are able to shut down the pi safely! To safely shut down the Pi run the following command:- sudo poweroff To detect WHEN ...


1

In the second section of code: gpioConfig=[19] so i=19 j=1 and never increments newState=statuses['gpio1'] which gives 1 As newState == 1, GPIO 19 is only every set to HIGH


1

I want to create a system that has an internet connection via a mobile sim and allows owners of enabled telephone numbers to switch a relay by ringing the device sim. In this instance, you need a SIM card module. The system just tries to upload some log files which is not too large hence you can buy a GSM module and make a 2G connection to your RPi. ...


1

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.


1

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

"I think I fried my Raspberry Pi but I'm not sure?" - ALMOST certainly - see my answer to your other question https://raspberrypi.stackexchange.com/a/100014/8697


1

Question relay module has 12V power supply, ... have connected all the Rpi GPIOs relay board, ... connected 5V and 3.3V connections to the two 5V pins on the relay module (5V is being used to power the touchscreen display) , ... Run code, nothing happen, ... Answer It is not clear why you connect 3V3 power to 5V. And it is not clear if ...


1

1) substitute a relay for the button press - that way you don't need to worry about voltages, common grounds, pull ups, or pull downs. Eg https://www.instructables.com/id/Control-Any-Remote-From-a-Raspberry-Pi-and-Amazon-/ 2) Or find an HDMI switcher with a computer input, for example the ATEN HDMI switcher has an RS232 input. The button on the HDMI ...


1

@RalfFriedl is right, but I found some relays which are done for raspberry and arduino. https://www.youtube.com/watch?v=My1BDB1ei0E Now the circuit works. @joan do you think that this kind of relay will destroy the board?


1

I think the circuit you've illustrated is more complex than what is needed for simply driving a 12/24V relay. The primary considerations in using GPIO to control external devices are: GPIO has low output voltage (3.3 volts), GPIO has low drive current GPIO is fragile in the sense that it will not tolerate over-voltage I feel the optimal device for ...


1

All the relays turned on as soon as the pin they were connected to was set to out mode. This is because the RPi pins toggle between 0 and 3.3V, not between 0 and 5V. So, when you set the pin to 3.3V, there's still (5-3.3 = 1.7V) applied to the LED inside the opto-isolator. If that voltage is enough to turn it on, the relay will stay activated regardless of ...


1

Here's one of many solutions to this problem. It relies on you properly shutting down your Pi by running something like sudo shutdown or clicking a shutdown button on your OS. If you use sudo halt or sudo shutdown -h or simply unplug your Pi, this will not turn the relay off. Turning the Relay On at Boot You will need a script that turns the relay on. Most ...


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