how best to use momentery switches to control relays?

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

shabtek

Well-known member
Joined
Jun 8, 2005
Messages
2,404
Location
midwest usa
for now 48 momentary switches (1 contact NC, 1 NO) with lamps to switch 48 relays.

I was going to make flip-flops with 4p2t relays to drive the relays and lamp.
that is a lot of parts and wiring.
Microcontroller seems better and allows for future expansion, such as global on/off.
Any opinions on how best to do this?:
mux/demux chips or voltage dividing ladder into an adc?
or someting else?
 
This is what I use on our 3 switch boards (initially designed for mic pre front ends)
http://www.expataudio.com/expatshop/index.php?act=viewProd&productId=6

There's an MSP430F2002 running some relatively simple code, that debounces the switch input, and toggles the LED on / off.
The same 3V3 output that's switching the LED also switches an output.

From there, I use one of the relay cards I've made, which has a simple PN2222 transistor to switch 12V into the circuit.
http://www.expataudio.com/expatshop/index.php?act=viewProd&productId=11

For 48, that might be a little harder.
I suggest that what you might do is use SN74AHC595's (serial to parallel shift register) to clock your outputs. (you'll need 6 of them).
For inputs, I think SN74AHC165 might do the trick, however, you'll have to poll the inputs and compare with the last reading, or use another poll of the switch, shared with all the other switches to trigger a "read from all switch inputs" routine.

Good luck..

/R



 
With 48 switches best to go with microcontroller.

However, I have a microcontroller based remote control with up to 255 relay outputs with global on/off. The TX board has LCD with keypad which communicates with the master RX board which has 8 outputs. After that there is a slave RX board with 8 outputs which cascades giving a total of up to 256 outputs. It has both IR and I2 comms. I can supply you the boards and the programmed micros if it is of interest.
 
48 inputs is a lot even for a micro...  you might look at charlieplexing the switches to cut down on the number of data lines required.

http://electronicdesign.com/article/analog-and-mixed-signal/novel-switch-interface-scheme-reduces-microprocess.aspx

Even after reading the switches, you still have to pulse 1 of 48 relays...

regards, Jack

 
Handling it all with one micro might be a little much. 48 buttons (plus ones to clear all etc) plus another 48 for the relays may become a little much.

I would be tempted to use I2C expanders for this along with a small micro.

keeping track of 48 out bits is 3x16bit words. should be easy.

It's the inputs that I struggle with, as you need to trigger an interrupt from any of them.
Some I2C expanders have a "interrupt generator" that'll generate an interrupt for the host microcontroller based on a change on any of the inputs.
http://focus.ti.com/docs/prod/folders/print/pcf8574a.html is an example.

You should still be able to handle a switch debounce in the microcontroller, by adding a delay between the time the interrupt from the expander comes in, and when you read in the values from the expanders.

If I2C isn't your flavor, and SPI is, then you could use an SN74HC165 on the input, and generate a microcontroller interrupt externally. I'm working on a basic schematic for this.

/R

 
Hey! I did not mean to compete. It is just an idea.

48 inputs is a lot for anything but it depends what the input devices are. If a keypad can be accommodated then micro is your best friend. This is what I have.


TX and master RX boards hard wired on this particular job but as I mentioned before it has the IR option too.  First press the number then press On/Off to turn the channel on and off. alternatively press the up and down key to toggle the channels and press On/Off. There is also All On/All Off for global on and off. Anyhow, I actually made a mistake. The RX boards have 16 outputs. 15 connected on the picture. The expansion connection is on the right hand side. Cascade a slave RX you have 32 outputs and so on.

remote1.JPG







 
SAhib, lovely job there!

I wish I had a link to that black and white animation of the guy applauding.
How long did the hardware and software take to develop?
 
Hi Rochey,

Not very long. The whole thing was completed in a couple of weeks beside other things running at the same time. I do not do the programming. I provide the psuedo code and I have two highly experienced programmer friends who do it for me. 
 
Thanks for the discussion folks.
I want to use these momentary switches to control mic pre front ends (pad,+48, polarity)...push on, push again for off...It will never be in a state of all on and speed is not really critical.
I have some pic chips so may go this way with latching flip flop>mux>pic>demux.

 
You don't really give much information on your application.

If you are going to turn pad, +46 and phase on/off  it sounds like you want to control 16 mic amps. I am also assuming that you want to control these from a single set of push buttons. In which case you'll have three inputs, plus two more for channel selection. May be another one for global on/off.

In which case your application will not be any different than my controller.

As an idea;

Take a 1RU case as the main controller (provided that we can find a suitable keypad for it), house my TX board with three RX boards with 16 output each in it. Incorporate 16 x 4 pin type connectors of your choice at the back, each of which would be 3 x on/off output and V+ to control the relays.

Done.
 
Yeah Sahib, it is 16 pres, 3 switches each.
48 switches and 96 relays as the moment.
2pole relays on the amp pcb and 4pole off board to do switching of on-board relays and lamps inside switches.

I've yet to build up the off board portion 'cause it seems like it may not be the best solution.
mail


...complicated with 96 caps that will eventually need replacement and limited future expansion.there has got to be a solid state solution that works better.
 
looking at plan to use micon;
i need 15 or 16 i/o lines to monitor 48 ins and drive 48 outs.
that is with using 3x16:4 mux and 3x4:16 demux.
My micon has only 8 i/o
could do some tricky programming to make them bidirectional...

could buy 48 latching eao switches
edit: not at $20 a piece...the momentary ones cost me less than $1 each; that is how they got fit into this equation.
 
Shabtek,

What is your 16 mic-amps exactly? Are they part of a mixer? Or have you got 16 independent mic-amps that you wish to automate?

48 push buttons (switches ?) controlling 96 relays. So 48 relays are going to take the on/off duties for the pad, +48 and phase and the other 48 are going to control lamps inside the switches. Is that correct? (By the way you can turn the lamps on/off with a transistor, you don't have to use relays for this.)

If the push buttons are located in groups of 3 on each mic-amp then why bother with micro etc? Three flip-flops on each mic-amp and off you go.  

But if you are going to control the mic-amps remotely then it is a different issue. If you are thinking of a small remote control box on your desk then the easiest would be to use micro again. There are PICs with 50-60 I/Os. That handles the push buttons. This will be your Tx module.

After that you can have two options.

The first one would be as I explained above. Say a 1RU Rx unit with 16 x 4 pin connector outputs. Each mic-amp connects with an individual cable.

The second one would be that you will have a cascadable Rx module in each of the mic-amps. So if the module is addressed, it takes the command and executes it. If it is not then passes the data to the next. This is much more complicated.

If you go with the first option I can supply you with one of my master Rx and two slave Rx modules with the command protocol. All you will need to do is to program your Tx micro and you are done.

I'll also see how I can modify my Tx so that we keep the IR communication. And make your life easier.




 
thanks Sahib.
It is 16 channels in 1 box (fabio 312 pcbs). Pretty standard stuff. I am making it difficult by using these momentary lighted eao pushbutton switches (because they look nice).
Each of the 3 input functions (pad,48,pol) has a 2p2t relay. I was going to use the below flip flop circuit to drive each relay. this flip-flop circuit requires a dedicated relay (coil and set of contacts)---i've got 4p2t relays for this;one of the poles would drive the indicator lamp in the switch.

I was thinking it would be nice to have a PIC chip involved for future expansion...maybe have a line-in mode where all mic input relays are de-energized.

3 schmitt triggers followed by flip-flops on each channel will probably be the best option. I am not sure how to drive both the relay coil and the panel lamp.
I know how to pull up/down to drive the coil but not sure about the best way to drive the filament. another relay contact is what I would use but I'm sure there is a more elegant transistor switch that would not waste energy/heat.
 
If all you want to do is create a digitally contolled mic pre, with toggled in/out, then you might consider some of the digital mic pre fe's over at expat audio.

Sorry for the shameless plug. :)
Just thought that it'd be the fastest way to resolve the issue.
 
48 relay outputs and 48 switch inputs is a minimum 96-pin chip.

Since no stock controller has 96 I/O pins, you mux to a whole lot of 16-24 pin chips. You are just adding wires.

If you put a few more contacts on each relay, you should be able to do it all without any Silicon. Pre-1980 elevators did an amazing amount of logic with just clever relay-rigs.
 
Paul, thanks for the reality check. honored by your presence.
who would have ever expected to see Otis referenced here?
 
> a few more contacts on each relay

I had to retire to the throne room to find the logical flaw.

Same as flip-flops. You get a race condition. The relay just chatters. You need a second relay ("clocked logic") or a time delay ("Mickey Mouse logic").

Since such functions are available 2 to 6 in a 14-pin chip, use one debounced flip-flop per button/relay. That seems more direct than muxing in, scanning, and muxing out. Also it suggests one chip per channel, instead of wires running all across 16 channels to a central brain and back. Also a single failure means a 15-track day instead of a down-day.
 
This has been around so long, Noah probably used it to toggle the poop-pumps on the Ark.

You get three per 13-cent chip; no waste in your three-fer application.

A disadvantage is that neither side of the button is common; 2 more wires per channel.

The '4069 will drive very small relays and dim LEDs; you may need buffer. You could wire 5 of the 6 inverters in parallel as the output stage; needs a whole chip per relay.

A diode plus 1K resistor forcing the left side up/down should give remote ("global") off/on.... I think. Verify before going to work.

Grotesque static charges at the button could zap the CMOS. For the type button you describe, that seems unlikely. A 100K-1Meg resistor right AT the left inverter input pin should withstand most abuse.
 

Attachments

  • button-4069.gif
    button-4069.gif
    4.5 KB

Latest posts

Back
Top