and I am unable to configure the relay such that it can be triggered with an active high input. In the description it does mention you should be able to configure it for either one via the Jumper however I think the jumper is solely used for external power for switching the relays.
I’ve looked for reference designs and stumbled across a circuit that seems to be a 1:1 match on how the circuit is designed.
From this diagram, I think there isn’t a possible configuration to allow the input to be an active high to trigger the relay unless you connect 5V to JD-VCC, GPIO 0-3V to VCC and ground the inputs, but this doesn’t allow individual control for all the relays.
You are correct. To modify for active high you would have to modify the board.
There is an alternative, interface with another NPN transistor at the Otto input. Collector to “input”, emitter to ground and base to driving source vis a suitable resistor. That basically inverts the input source.
Andrew. Your suggested 2k will not do anything and you would have to hack the board to do this. The relay will draw an appreciable current and it would be highly unlikely for the transistor to pass enough until it is driven in a positive manner by some sort of base voltage. Having said that it would do no harm to have something like 10k 0r 20k to ground to make sure the transistor stays off. 2k would be a bit low I think compared to the 510Ω input resistor. I haven’t done any sums as the Otto device and transistor are unknown but I am assuming someone else has.
That would be correct Andrew and Bob that there technically should be a resistor connected to the Emitter but that means modifying the board and what not.
To clarify, the Otto input are the relay inputs correct? If that is the case, then the NPN transistor solution seems fit and I’ll simply have an inverting circuit before the input terminals on the relay board.
A quick simulation about signal inversion for future reference: the resistor values will change depending on how much current is needed to switch the relay:
That is the idea.
Leave out “V1” and “R1”. While that is the normal circuit arrangement for an inverter in this case the transistor collector load (R1 in your circuit) is the opto isolator Led and the 1000Ω resistor on the board so connect as I described above.
By the way, I missed on my “edit” read. Where you see “Otto” above read “opto”. This damned auto complete drives me crazy. Seems to think it knows more about what I want to type than I do.
Where did the 3.3V come from. I thought this relay board was a 5V device. Exactly which board is it. I have already had a say a couple of days ago about one of these boards using a relay rated to work at 3.75V and the board quoted to work at 3.3V but I don’t think that it was opto isolated so may not be the same as yours. But, when it says 5V it usually means 5V and using 3.3V could be a bit dodgy.
Not quite correct. The relay current is catered for by the on board transistor.
You are correct on removing V1 and R1, I forgot to account for the LED/1K resistor from the existing circuit via the diagram.
The 3.3V came from a generic GPIO output that I thought was possible to drive the relay from the product description (it is so far for one channel operation). Otherwise if you have had issues in the past with 3.3V, I will take your experience and use a Level shifter with NPN’s.
Again I should follow the circuit diagram more, my mistake to assume it’s the same as other designs.
Not so fast with level shifters.
I think I found the board you are using. It would appear the opto part of this can be operated by 3.3V but the relay side needs 5V. The small jumper is to operate the opto and relay from the same 5V supply. Remove to operate from separate supplies.
If using an interface transistor connect as described but connect transistor emitter to opto source (3.3V ???) ground. The board ground has to be connected to relay supply ground. If you want complete opto isolation DO NOT connect grounds together. If you think about it you will see that you can have complete isolation, The opto side has a complete circuit from supply back to its own ground and the same for the relay circuit.
While marked as a 5V supply voltage & input signals, we have found this to work fine at 3.3V
If this is what you are referring to it seems to be the same relay I had some words about a couple of days ago. The relay itself is guaranteed to operate at 75% of 5V which is 3.75V. It may or may not work at 3.3V but is not guaranteed. I notice you have noted 0.1V drop across the transistor on your circuit, presumably you measured this. This 0.1V has to be subtracted from the relay available voltage so that would leave only 3.2V available if using a 3.3V supply. A fair bit short of the required 3.75V required for guaranteed operation.
Core support staff have not yet commented on this reply so I don’t know what their thoughts are.
If you want to use 3.3V as a relay supply go for it but don’t be at all surprised if some relays work and some don’t. Doing this will be operating the relay itself outside its design range.
Another consequence not considered yet is the relay speed. If too slow and sluggish and is switching reasonably substantial current some contact arcing and burning could be expected with uncertain results.
The choice is yours.
I have not had issues with this. Simply I have not got any 3.3V devices and I probably would not consider operating with anything but 5V anyway. If the device says 5V that’s it. otherwise it would be quoted as 3.3V - 5.5V or something like that.
I’ll be only using 5V for the relay voltage (VCC) with the jumpers (JD-VCC) attached so there is no problem with that.
I think this is where the misunderstanding lies, what I meant was I was going to drive the relay’s logic with a GPIO 3.3V output i.e. Input 1-4 and connect the relays (VCC) to a 5V terminal but I’ll shift the logic to 5V based off the response you have given.
If you are going to do that you need to connect the grounds together.
Lets get this straight. You need interface transistors to do what your original query was ie; logic high activates the relay. you can drive the base of these transistors with 3.3V logic. That is OK. With the collector/opto isolator circuit you can fit the small jumper and operate this from 5V VCC or leave the jumper out and connect the board opto VCC to 3,3V (the other pin on the jumper connector. Fitting the jumper will be easiest as described above but you will have to connect the grounds together and you will lose the complete isolation provided by the opto device. That should not matter as you will still have relay isolation.
When all said and done you are probably not interested in kV of isolation anyway. You probably only want to switch something with a relay. I saw one recently which was very simple. Relay driven by a mosfet. No isolator frills and can be driven by 3.3 or 5V logic, high active. But the relay itself still needs 5V, but so simple, I will see if I can find it.
This is probably a better and easier one. This is only a single unit but there is a dual one available, just use 2.
Very simple. 5V relay supply, can be driven with 3.3V logic active high as you want. The one thing I did suggest was the inclusion of a 330Ω resistor in series with the logic input to limit the Mosfet charging current to a safe value.