Help with one button relay input switching

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
I'm pretty new to electronics, but I've been building speakers with the help of you good people for years:D

I'm wondering if anyone can provide a little assistance here. I am trying to control input switching using relays and a single momentary push button. I've bought a relay input board off ebay that's pretty good. And I also have now purchased two flip flop modules that I can't get to work. The first was a negative trigger and the second a positive trigger.

These are what I have:

Positive trigger module-

3-10V 3-Way Flip-Flop Interlock Switch Circuit Module 1800mA for LED Relay Motor | eBay

Relay board-

Audio Signal Switching Selector Relay Board Signal Amplifier Switching Board | eBay

I fried the negative trigger out of frustration:rolleyes: because the board takes 10v or so to trigger the relays. And it looks like I might need multiple switches to use the positive trigger mod., but I can't even get that to work.

There will be three inputs total. This is a four channel preamp to use with my active speakers and it also has two stereo inputs to work with my passive speakers. So it has one four channel input and two two channel inputs. I've already gotten all this worked out.

It does work with the included rotary switch, but I only want one knob on the face if possible.

Sorry for the long post, but any help would be appreciated. Thanks!
 
The link you gave shows exactly the schematic.
Using 3 pushbuttons to control 3 relays.
If you want a single pushbutton to cycle through the 3 relays then you need a microprocessor.
Use an Arduino Nano and a ULN2003 chip to drive the relays.
Cost you peanuts and the programming is easy.
 
I see that thanks. I didn't seem to get that before I ordered it for some reason.
But even with three swirltches it doesn't work.
It seems to me based on the diagram that the relays would always be powered. So what switches? Q1,2and3? I can't figure out what those pins are for. One is always ground and the other two have about 2v on them.

Are you talking about something like figure 3?
Project 163

Would the arduino be the switching logic?

Thanks
 
I'm pretty sure this can be done with a 4017 CMOS decade counter chip with the master reset pin tied to the 'last' output pin you want to use (so Q3).

In fact typing just that into Bing brings up the circuit :)
My 1st project - To cycle through 7 LEDs with push button | Electronics Forum (Circuits, Projects and Microcontrollers)

Thanks for that. Sounds perfect. Do you know if it's latching? They didn't seem to know.
Also what socket would I use for the 4017? I'm totally new to using chips in projects.
Thanks
 
Administrator
Joined 2007
Paid Member
The 4017 will operate on 3 to 15 volts and the output will be similar to the supply but it would not drive most relays directly. For that you need a simple transistor interface. The relay would be active when the appropriate output goes high.

You would want the 16 pin DIP version and a 16 pin DIP socket. Not sure what you mean by non pcb mounting tbh :)
 

Attachments

  • Untitled.png
    Untitled.png
    9.4 KB · Views: 441
The 4017 will operate on 3 to 15 volts and the output will be similar to the supply but it would not drive most relays directly. For that you need a simple transistor interface. The relay would be active when the appropriate output goes high.

You would want the 16 pin DIP version and a 16 pin DIP socket. Not sure what you mean by non pcb mounting tbh :)

Thanks

Why won't it drive the relays directly? Is it because they are not latching? Or not enough current?

Not sure if it helps, but the board already has diodes for each relay plus a few other through hole parts- take a look at the link in the first post.

A 12v signal will currently drive the relays with no additional parts needed.

I honestly don't know what I mean by non pcb mounting either :eek: I'm just looking for the easiest way to deal with an IC without using a PCB. I already have discreet parts and modules all over the place.
 
Administrator
Joined 2007
Paid Member
Not enough current. They are logic level outputs that are not intended to directly drive loads consuming a lot of current (which would be just the same as any uP come to that). If you tried to run them directly then they would just pull the voltage on the output pin right down.

I saw the diodes across the relay coils, that is why I didn't include any on my little scribble :D

One transistor per relay is the simplest drive option.

You could easily make something like this using stripboard.
 
Administrator
Joined 2007
Paid Member
OK. Maybe that's why my current flip flop module isn't working. It's supposed to be able to drive relays directly though.

Any specific transistor I should use?

And is the rectangle in the schematic a resistor? Is that to set the output voltage?

Pretty much any small signal high gain NPN transistor would be fine such as BC546. The resistor limits the base current to the transistor. Absolute value depends on the supply voltage and transistor gain and so with 12 volts you would need something in the 5k6 region.

The idea is to get the transistor to operate as a switch, fully on or fully off. If we haven't enough base current then the transistor will still turn on, but not fully. That would mean some voltage would be 'wasted' across the transistor and the relay would not see the full 12 volts needed.
 
Hi, in response to post 4.
Yes, the Arduino provides the switching logic.
Fig 4 on the ESP page shows something similar with a PIC.
One button would cycle 1,2,3,1,2,3,...
Second button only if you want to cycle 3,2,1,3,2,1...
The ULN chip, exactly as ESP post 3. It does the same as Mooly's transistor in post 8 but drives up to 7 relays from 1 chip.
The Arduino would also work with the transistor switch.
 
Contact Bounce?

You may have bounce issues with a simple switch pulling the clock line up or down. No mechanical switch goes simply ON/OFF. They oscillate back and forth for a few milliseconds while the contacts are moving. Too fast for the eye to see but the clock line sees it as multiple button pushes.

A dirt cheap solution is a capacitor across the switch but you get what you pay for. it can still bounce or can have a lag.

Better is an active debounce circuit before the clock input. There are many examples on line.
 
Last edited:
Pretty much any small signal high gain NPN transistor would be fine such as BC546. The resistor limits the base current to the transistor. Absolute value depends on the supply voltage and transistor gain and so with 12 volts you would need something in the 5k6 region.

The idea is to get the transistor to operate as a switch, fully on or fully off. If we haven't enough base current then the transistor will still turn on, but not fully. That would mean some voltage would be 'wasted' across the transistor and the relay would not see the full 12 volts needed.


I have a bunch of 2N3906 transistors. Would that work in this application?

Also the circuit you drew, I'd need one for each of the inputs, correct? So, one resistor and one transistor for each relay I intend to switch?

Thanks
 
I have a bunch of 2N3906 transistors. Would that work in this application?

Also the circuit you drew, I'd need one for each of the inputs, correct? So, one resistor and one transistor for each relay I intend to switch?

Thanks

2n3904 is the npn version of that transistor.
Don't forget to put reverse biased diode across relay coil to stop back emf's blowing 2n3904.
 
You could but...

I have a bunch of 2N3906 transistors. Would that work in this application?

Also the circuit you drew, I'd need one for each of the inputs, correct? So, one resistor and one transistor for each relay I intend to switch?

Thanks

You can use PNP but then everything is backwards so to speak.

The emitter goes to VCC.

The collector goes to the relay coil (+ side if any)

The other side of the relay coil is grounded.

The base needs a low value resistor in the hundreds of ohms range and turns on the relay by taking that resistor to ground or below 0.6v, opposite of the NPN version where the relay turn on by taking the resistor to V+.

You should pull the base up to VCC with about 47K to make sure it stays off when expected to.

You still need the diode with the anode to ground and the cathode to the PNP collector.

If still using the 4017, now you need and inverter for each relay driver. Far better IMO to just buy some 2N3904's. They cost pennies.
 
Last edited:
Administrator
Joined 2007
Paid Member
I have a bunch of 2N3906 transistors. Would that work in this application?

Also the circuit you drew, I'd need one for each of the inputs, correct? So, one resistor and one transistor for each relay I intend to switch?

Thanks

Missed your reply yesterday.

As the others have said, the transistor has to be NPN for simplicity.

You could use two PNP's plus another resistor per relay but then you more than double the component count.
 

Attachments

  • Capture.JPG
    Capture.JPG
    54.7 KB · Views: 222
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.