So I picked up some 2n2222 and it worked a treat thanks.
I have the 5v from the PI connected to the VCC on the relay, is this the correct way?
Hi.wdezell wrote: ↑Fri May 17, 2019 5:44 pmAn excellent collection of useful information but in case anyone is interested it is possible to safely drive the Sainsmart 4-Relay board directly from the RPi without an intermediary circuit. The same probably holds true for the 5-relay board as well but I don't have one to test.
The Sainsmart relay board is a well-made but poorly documented piece of hardware. However, if you dig around on the Internet you can find its schematic (symbols only, no values for components). However, the inputs are opto-isolated and can be configured for direct 3.3V drive (RPi, Beaglebone Black, etc..). As-shipped it's in a 5V-drive configuration (Arduino, etc...).
To connect to the RPi do the following:
- Remove the JD-VCC jumper. Identify which of the two uncovered pins is connected to the VCC pin that's with the inputs. Store the jumper by sliding it back onto this pin.
- Connect the other uncovered pin to the RPi's 5V rail. This powers the relays.
- Connect the VCC pin adjacent to the inputs to the RPi's 3.3V rail. This powers the opto-isolators.
The relay board is negative logic. A GPIO low activates the relay. The RPi 5V rail is fed directly from the USB power feed and should be sufficient to energize all simultaneously. I have no insight on inductive kickback.
- Connect RPi GPIO lines directly to the desired Input pins.