0

I have read quite a few threads regarding this same subject with varying answers.I plan on using the relay to turn on and off a 3d printer.I have read a few threads stating that the 3.3v from the Raspberry will have issues triggering the relays and that a few resistors,diodes and transistors will be needed to ensure safe and trouble free operation.I read a response on here by a user named Gerben and he states

You don't need any additional hardware.

The board uses active low optocoupler to switch on the relay. But since the Pi is 3.3V, when the Pi put a pin high (3.3V). But if the relay board is powered by 5v, this 3.3V is still 1.7V lower, and the optocoupler will (apparently) trigger.

To fix this you can just remove the jumper that connects JD-VCC to VCC. Next connect 5V to the JD-VCC pin, and connect 3.3V to the VCC pin. If you look at the schematic on sainsmart you'll see that VCC is only used to power the led inside the optocoupler. While JD-VCC is used to activate the relay. Originally the jumper connected JD-VCC to VCC so both would be 5V.

Another option would be to set the GPIO pins to INPUT when the relay needs to be turned off. This will prevent any current from flowing (where it did when you'd set it to 3.3V). To activate the relay, set the GPIO pin to OUTPUT and LOW

Third option would be to add a resistor between the GPIO pin and the IN of the board. You'd have to find a suitable value that will disable the optocoupler when 1.7V is applied, but not too high that it won't work on 5V.

I would just like to know what is the correct way to wire this for safe operation of the relay and Pi?Here are a few pics of the parts I am talking about and the schematic that has the transistors and other odds and ends.

[Sainsmart Relay[1] Adafruit Converter Schematic

Converter data sheet

Here is a link to his the thread where he chimed in.He seems to know quite a bit but I figured I would ask and maybe things have changed.The relay has no data sheet that I can find.I also posted the link to adafruits pdf of the logic converter.

The other thread regarding the relay

  • As asked, this is unanswerable. Post links to gerben's post and the specification of the devices (pictures are useless). – Milliways Oct 24 '17 at 6:08
  • Possible duplicate of Logic converter for relay module or extra resistors and transistors? – MatsK Oct 24 '17 at 12:23
  • @Milliways I guess this schematic should work as it's from 8-relay version from the same producer i.stack.imgur.com/xmruD.jpg – Mark Oct 24 '17 at 12:42
  • @TonyG please see this answer, there is an explanation to almost exactly same problem electronics.stackexchange.com/a/18939/156122 – Mark Oct 24 '17 at 12:44
  • Thank you I have found a few solutions but since I am new to all of this I didn't know whether to take them at face value.I knew one of them or a few had to work but you get soo many solutions and contradictions online it's hard to know what is what.Thanks – TonyG Oct 24 '17 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.