Need help! Using the CD4067 for pushbuttons with led


I am trying to use the CD4067 to switch 16 push-buttons with builtin LED.

The buttons are not always activated. the leds are a indicator when the optocouplers are sensing something. then the arduino will turn on the led via the CD4067 after the led is lit, the push-button will be used for activating a relais, if the optocoupler is not sensing anything after or before the button is pushed the led will turn off or stay off.

So its just an indicator that the push-button can be used for switching a relais.
and your are allowed to use the relais

I have an schematic as attachment, this is for 1 button and led with its output and sensing node.
I want to use 1 in/output of the CD4067 per button with its led


Explanation is a trifle confused, but I gather when you say "optocouplers" you mean "opto-interrupters" and from your chosen pseudonym, this is for a model railroad.

A CD4067 is not really suitable for turning on a LED; you would be better using a MAX7219 to drive any number up to 64 with one chip (and more chips if you needed that).

Similarly, instead of using the combination of ULN2803s and the MCP23017, you could use the TPIC6B595s and chain more than 8 if you need to. Likewise, 74HC165s for the sensors. I2C is indeed inappropriate over a length of several metres, but simple serial clocked interfacing can be clocked at a low speed and if necessary, run over RS-485.

Using an Arduino MEGA2560 seems to be substantial "overkill" here - A Nano should be adequate. What else is involved?

The big big problem with that schematic is that the lines into and out of the boxes are not labeled. So we rely don't know how you wire it up.
So it is hard to say what is wrong. However as Paul says a CD4067 is not useful for lighting up LEDs.

The system is a firing system for fireworks. with it you can fire up to 64 pieces. in modules of 8 pcs per firing box.

The optocouplers are for detecting the ignitors when they are present and/or when they are successfully fired or not. the relays are for igniting the ignitors with high current. the ignitors are a copper wire that gets hot to ignite the fuse.

I do special effects for historical re-enactment WW2 as hobby and i have licence to fire small explosions or fireworks. mostly some firecrackers and smoke bombs are used. the simulating of grenade shells exploding or the impacts of machinegun on the ground.

The buttons in the schematic are used to see when a ignitor is connected and fired.
So when the system is in ARMED mode, the led1 of button1 go on when the ignitor1 is connected. after pushing the button, relais1 will switch power to the ignitor. if the ignitor is destroyed by firing the led will go out. if the ignitor is still intact, the led will flash, to know that we have a miss-fire.
In TEST Mode, the leds of the buttons will go on if a ignitor is connected and ready to fire, but the buttons are still deactivated. ARMED-GROUP Mode with 1 button you fire a series of 8. so button 1 will fire 1-8, button 2: 9-16, button 3: 17-24, and so on. ARMED-ALL will fire all ignitors connected in 1 button push.

So the control box will have 64 buttons en must be expandable, the firebox on the ground can fire up to 8 ignitors, so we need 8 fireboxes. all connected with 1 datacable for connecting the control module with the fireboxes, and a expansion connector for another set of buttons, for more fireboxes and ignitors

Thanks for the explanation but the so called schematics are just block diagrams. The trick with block diagrams or higharcal schematics to give them their Sunday name, is also to show a proper detailed schematic of each unique block. So that means a schematic of the Fire-Box, control box and keyboard.

Need to change the original topic!

OK, so we are talking about long cables here, I2C is immediately out of the question and the consideration is just what communications protocol to use.

You have not mentioned reticulation of the firing power, whether you expect the cables to convey it to each firing box or a separate battery for each. Cabling it - with an expectation of 10 Amps or more in some sections - is itself going to be troublesome and this impinges on the communication design if using the same cable (not the same wires).

This is way beyond the capabilities of 74LS4067s here, we have gone beyond your “XY Problem” into total system design.

You want to use the readily available eBay 8-relay modules - while not particularly suitable for mains power control, they should be fine for this and you do not want to assemble them yourself.

Essentially each firing module has 12 V for firing and needs 5 V for the logic control. This sounds like a good fit for a Pro Mini plus communications support. Using a serial communications protocol (RS-522) allows reliable checking of firing commands for safety. There should be enough pins available to sense the ignitor status though a 74LS4051 (not 4067) might be useful for expansion.

For the control box, a MAX7219 as previously explained, will manage 64 LEDs perfectly and a 64 button array (though there may be better ways of doing it) can be scanned with a 74HC595 or 74HC4017 - and requires a diode for every button. (Mike knows all about these things, having built them!)

And that’s just a start! :grinning: :grinning: :grinning: