Driving 2 relays from 1 PIC

Started by Marmoset123, March 21, 2018, 07:23:07 AM

Previous topic - Next topic

Marmoset123

Hi,

I've built this relay bypass system from Coda Effects and it works like a dream, but I'm trying to work out how to modify it to switch 2 relays (for a stereo reverb I'm making based on the FV-1 chip).

How should I go about doing this? I'm out of my league here :-[

I tried just wiring it up to both relays but the relays don't switch. My guess is I don't have enough current at the moment but I don't know how to resolve this.

Also I am using EC2-5NU relays as I couldn't get the NA5W-K. They seem to work fine for switching 1 channel though.

Thanks for the help.

Jamie




Here's the Coda Relay Bypass schematic


and the details for my relays (it's the 5v version)


potul

Hi

You ALWAYS need a relay driver. It's a bad idea to drive the relay directly from the PIC

You can use a dedicated IC or just build it using a transitor.

Mat

Marmoset123

Thanks for the reply. Would something like a ULN2003 work?

If I want to have 2 relays switch on and off at the same time can I just attach 1 output of the PIC to 2 inputs of the ULN2003? Or will in need a microcontroller with more outputs?

Cheers

antonis

#3
Quote from: potul on March 21, 2018, 07:49:33 AM
just build it using a transitor.
What Mat said..
(adding "s" between last word's "i" & "t" ..)

"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

potul

Quote from: jamierichards1234 on March 21, 2018, 09:00:48 AM
Thanks for the reply. Would something like a ULN2003 work?

Yes, an ULN2003 will work. But if you only have 2 relays, maybe you would prefer to build it using discrete components. Like this:



There are multiple variants around the web.... just look for "relay driver"

Quote
If I want to have 2 relays switch on and off at the same time can I just attach 1 output of the PIC to 2 inputs of the ULN2003? Or will in need a microcontroller with more outputs?

If you need the 2 relays to always turn on/off together, yes. You can attach one output of the PIC to two inputs of the ULN2003.


potul

Quote from: antonis on March 21, 2018, 09:09:34 AM
Quote from: potul on March 21, 2018, 07:49:33 AM
just build it using a transitor.
What Mat said..
(adding "s" between last word's "i" & "t" ..)
haha, good catch.  :icon_mrgreen:

antonis

#6
Using Zener for less than 30mA (140mW) relay "kick-back" should be an overkill, don't you agree Mat..??  :icon_wink:
(an ordinary diode like 1N4001 should be just fine..)

Also, OP should be warned for phase invertion of the above driver..
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

GibsonGM

Would a relay driver such as the above still function if the transistor was set up as a buffer - taking the output from the emitter, and therefore the output would not be phase inverted? 
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

Marmoset123

Thanks for all the replies, just breadboarding it up now

antonis

#9
Quote from: GibsonGM on March 21, 2018, 09:32:48 AM
Would a relay driver such as the above still function if the transistor was set up as a buffer - taking the output from the emitter, and therefore the output would not be phase inverted?
Placing "would" between "above" & "still" and omiting question mark at the end of the paragraph, should form a true & correct statement..!!

The "synchroneous" relay activation depends on relay's NO/NC type..
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

GibsonGM

Where is the Duck, it's Riddle Time!!   :) 
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

R.G.

Just to add to the possibilities, a small signal MOSFET, something like a 2N7000, can be driven with its gate connected directly to the PIC's pins. In this setup, the MOSFET doesn't need any other gate components as its gate is always driven to 0 or V+ by the PIC, and protected by the PIC's pin protection setup.

The logical polarity of the driving signal on PIC projects can be changed with a single instruction in the programming. This makes the internal polarity of the "on" signal in the PIC a lot less of a concern. It's a single instruction to flip it to what you want.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

antonis

#12
Quote from: R.G. on March 21, 2018, 10:06:36 AM
Just to add to the possibilities, a small signal MOSFET, something like a 2N7000, can be driven with its gate connected directly to the PIC's pins. In this setup, the MOSFET doesn't need any other gate components as its gate is always driven to 0 or V+ by the PIC, and protected by the PIC's pin protection setup.
I'm not aware about PIC internal protection (actually, I know nothing about PICs other than they can be programmed.. :icon_redface:) so I can't say if direct coupling is safe or not..

But for "delicate" CMOS logic, a coupling resistor (of 1k, say..) could prevent MOSFET Drain-Gate capacitance to couple the coil's inductive transients back to CMOS driver..
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

potul

Quote from: antonis on March 21, 2018, 09:25:18 AM
Using Zener for less than 30mA (140mW) relay "kick-back" should be an overkill, don't you agree Mat..??  :icon_wink:
(an ordinary diode like 1N4001 should be just fine..)

Also, OP should be warned for phase invertion of the above driver..

sure, I just copy-pasted the first image I found referring to a transistor relay driver. In fact I have never used a zener here, always standard diodes.