External PS for multi Relay board without JD-VCC with RPi GPIO's

Discussion in 'General Electronics Chat' started by rfeyer, Jun 4, 2016.

  1. rfeyer

    Thread Starter Member

    Aug 24, 2014
    126
    0
    Hi all,
    I searched the internet for a relay board which operates Active HIGH, instead of active LOW as most the relays have.
    I found this one: http://www.ebay.com/itm/201315038108?_t ... EBIDX%3AIT

    However, upon it's arrival noted that it only has VCC and ground, no JD-VCC.

    My question: Can I connect an external power supply to VCC and ground and still use the RPi GPIO's to control the relays?

    I have been told by the seller of the board that I can, without additional info.

    So, does this make sense:
    Rpi gnd to relay board ground
    rpi Gpio to board input
    External PS 5v to VCC
    external ps gnd to board ground

    And, if it does, would it be better to have the external PS 5V pos lead to the inputs of the relay board, interrupted by a 2N222 transistor, which is then fired up by the RPi GPIO output?

    I am obviously not an electronic genious, so this may make no sense at all. I don't want to 'try and fry' :)

    Rainer
     
  2. dl324

    Distinguished Member

    Mar 30, 2015
    3,235
    619
    What is this?
    What voltage are the GPIO's? What is it driving?
    Seems reasonable. A schematic or block diagram would be helpful.
     
  3. rfeyer

    Thread Starter Member

    Aug 24, 2014
    126
    0
    I gave it a shot in drawing a block diagram - I don't have a specific program, so this is obviously crude, hope this helps. I made two choices, one giving direct GPIO input into the relay board, the other with a transistor for protection. I don't know if it is needed or correct, hoping to get info, TY

    Also, by JD-VCC I am referring to the switch normally on multi relay boards allowing external PS vs VCC jumped which would use the microcontrollers PS.

    upload_2016-6-4_12-21-28.png
     
  4. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,795
    830
    I assume in the first and upper picture you intended to connect GPIO to one of the relay boards input pins? Notwithstanding the other requests for data.
     
  5. rfeyer

    Thread Starter Member

    Aug 24, 2014
    126
    0
    I did intend to connect the GPIO to the relay input board - I am not sure what it means: 'Notwithstanding the other request for data.'?

    Which option would be safer - 1st or 2nd? Or are both incorrect?
     
  6. dl324

    Distinguished Member

    Mar 30, 2015
    3,235
    619
    What voltage are the GPIO's? What voltage does the relay board consider HIGH?

    Presumably the relay board inputs are driving a transistor; but it could be the relay coil (for lack of details).

    Neither of your proposed connections are correct. In the first, the relay board inputs aren't connected to anything. In the second, the transistor isn't connected correctly. There would be a base resistor and the transistor would invert the signal from the GPIO. If you're going to invert the GPIO signal, you could have used the LOW active relay boards that were more readily available.
     
  7. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,507
    2,368
    The link shows a choice of active hi or low, also there is an inversion via the relay contacts of N.O. or N.C.
    Max.
     
  8. rfeyer

    Thread Starter Member

    Aug 24, 2014
    126
    0
    TY both,
    so, as the first drawing goes - yes, I did forget to draw the GPIO to Relay board connection - I inteded to do this. Otherwise, would it be correct?
    for the second: I was not thinking of inverting the signal, I was meaning to allow the 5V signal from the PS to be directed to the relay board - the transistor acting as a switch being activated by the GPIO.
    I beleive the GPIO's have 3.3v. Also, they apparently can handle something like 15-20 mA (going by memory).
    AS I am reading about relays, the common believe appears to be that the RPi can NOT drive multiple relays at the same time, hense, burning out the relay.
    So, I am really just trying to use a relay board which does not have JD-VCC and not burn up the RPi (RaspberryPi)
    Max - you are correct - there is High or Low activation choice!
     
  9. rfeyer

    Thread Starter Member

    Aug 24, 2014
    126
    0
    Would both/ either of these be correct?
    upload_2016-6-4_18-42-19.png
     
  10. dl324

    Distinguished Member

    Mar 30, 2015
    3,235
    619
    The first connection will work if the relay board treats the minimum high output voltage from your microcontroller as a HIGH. Without more information regarding the relay board, I assume control signals are assumed to be 5V CMOS logic levels which (looking at a random CMOS 4xxx datasheet) is a minimum of 3.5V for HIGH and a maximum of 1.5V for LOW.

    The second connection still has problems. No base resistor for the transistor, and the way it's connected, the control voltage getting to the relay board will be reduced by the base-emitter drop; so even worse than the first connection.

    If you give the HIGH and LOW logic level voltage range and the current requirement, you'll get better answers.

    Regarding the number of relays a RPi can drive depends on how the relays coils are being energized. A good design would have transistors on the relay board driving the coils. If those transistors are MOSFETs, you could drive many. If they're BJT's, fewer.
     
  11. rfeyer

    Thread Starter Member

    Aug 24, 2014
    126
    0
    Dennis,
    TY tons! That helps.

    So, the first, without transistors, will not need additional protection for the RPI - correct?

    as for the second drawing, I truly do not have any additional information on the relays - nothing came with it, and the link provided above is all I have.
    I you believe the first drawing will work, I will try it and hope I don't fry the RPi.

    If you believe the second would be more secure, with proper resistor (can I assume 1k), then I will try to understand what you mean by adding transistors to the relay board - I thought that as what I was trying to do?

    Again, I understand some but not much of electronics but keep learning month by month

    Rainer
     
  12. dl324

    Distinguished Member

    Mar 30, 2015
    3,235
    619
    I don't know if it will work and it definitely does not provide any protection for the RPi. What will the RPi tolerate in terms of an overload/short. You'd think that GPIO's would have more protection than other I/O's.
    You could try tracing the PCB to see what's between the inputs and the relay coils.

    If you want to drive the relays with HIGH active signals, you're going to need to level shift your 3.3V signal to 5V. If the board is configured for LOW active, you could drive directly with your GPIO's; but pull-ups may be needed to insure off condition.

    Tracing the board so we know what we're dealing with would limit the need to speculate.
     
  13. rfeyer

    Thread Starter Member

    Aug 24, 2014
    126
    0
    Dennis,
    The RPi has a 3.3V and 5V choice, but again I have read it can only handle around 20mA.
    I did a good amount of searching on how to trace a relay board, and, with the vast amount of information available, none could teach me how to trace.
    What information would tracing give? A change of amperage when High vs Low? I do have a multimeter and could possibly determine this.

    Rainer
     
  14. dl324

    Distinguished Member

    Mar 30, 2015
    3,235
    619
    Set it to 5V.
    Read below.
    Making a schematic by tracing connections would show you what you're trying to drive and allow you to make informed decisions regarding the best way to drive the inputs, and, potentially, protect your GPIO's without affecting correct operation.

    If the inputs are driving logic level MOSFETs, you could drive all of the inputs on the relay board with a single GPIO. Ditto if they're driving the bases of darlingtons. If they're driving the bases of BJTs, you would be more limited. How much would depend on the current required to drive the transistors into saturation.
     
  15. rfeyer

    Thread Starter Member

    Aug 24, 2014
    126
    0
    I am not sure if this is what you are looking for or if this helps:
    schematic.png
     
Loading...