Posts: 20
Joined: Sat Feb 10, 2018 10:54 am

Re: How to wire a Raspberry Pi to a Sainsmart 5v Relay Board

Tue Feb 13, 2018 10:16 pm

mahjongg wrote:
Mon Feb 12, 2018 12:03 pm
Don't know the BC529B, but yes a BC546 would work too, in fact almost all small NPN transistors will work.
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?

User avatar
Posts: 72
Joined: Thu Aug 09, 2012 10:06 am
Location: Hull, East Yorkshire
Contact: Website

Re: How to wire a Raspberry Pi to a Sainsmart 5v Relay Board

Wed Feb 21, 2018 11:07 am

I know this is an old thread, but I'm looking for some clarity as I keep reading conflicting things. :shock:

I'm trying to power a Sainsmart Optoisolated Relay (there's 2 of them on the board). I'm using the normally closed function. I just want to be able to apply a signal to one of the pins to turn the relay off. (or rather the device by pulling to the 'Open' function of relay)

The relay is 'SainSmart 2-Channel 5 V Relay Module Board for Arduino PIC AVR DSP Electronic Relay Module MCU' from Amazon - (https://www.amazon.co.uk/gp/product/B00 ... UTF8&psc=1)

I am trying to power the relay from the RPi3, using the 5v and 3.3v. 5v as the JD-VCC, and 3.3v as the VCC (as per this guide) - https://github.com/foosel/OctoPrint/wik ... m-your-RPi

Now, this is where I'm confused as what I have seen written here that says leave the jumper between (JD-VCC and VCC)
I am using a transistor the BC548B NPN transistor that I picked up at Maplins. I've tried applying a 1k pulldown resistor, however upon reading this is for 'Active High' and this relay is 'Active Low'

Should I be using a 2.2k resistor and a 10k resistor (as shown in one of the earlier posts in this thread).

So my questions are:
- Do I leave or remove the jumper from the relay board?
- Are the resistor values still the same for RPi3 and the BC548B transistor?

Any clarity (quick yup or otherwise) would be greatly appreciated before I got and source additional parts.
Looking for where to start - try Kernel Panic - http://goo.gl/EEQ5J

Posts: 3304
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: How to wire a Raspberry Pi to a Sainsmart 5v Relay Board

Sun Feb 25, 2018 7:44 pm

So most of these relay boards are designed to work off 5V and trying to drive them off 3.3v does not always work without moding the relay board.

Seeing you intend to use a transistor to interface the pi to the relay board my advice would be remove the 3.3v connection to the relay board.
replace the jumper between vcc and jd-vcc and connect 5V the relay VCC pin

Then connect your transistor circuit like this

if you find the relay does not switch on reliably change the 2.2K resistor on the base for 1K resistor.

your relay board will now be active high.
Please only ask questions in the forum I will not answer questions sent to me directly via PM
Remember we want information.......................no information no help
The use of crystal balls & mind reading is not supported

Return to “Interfacing (DSI, CSI, I2C, etc.)”

Who is online

Users browsing this forum: No registered users and 14 guests