Button inputs cd74hc4067

Trying to fully understand what I need to interface the cd74hc4067 chip to a pro micro. This is a small section of the schematic but it is functionally the same just with three chips and 38 buttons. Ive made button boxes before however it wasn't viable here and im completely new to multiplexers. TIA let me know if more info is needed

Edit solder pads on the right are named with corresponding pro micro pins

Edit 2:

After looking at this pic

It looks like something like this could work connecting com and vcc with a 1k resistor as shown here

Would a simulator reference (with examples) help? CD74HC4067/README.md at main · Droog71/CD74HC4067 · GitHub

Button wiring looks okay. I take it you want the LED on all the time in all of them. Pulling up the SIG output, sure. Wire the 4 address pins in parallel across the 3 devices, and simply enable the mux you want to read.

Ill look through them!

The 1K is not needed. Just set the Arduino pin connected to the SIG pin of the mux to INPUT_PULLUP mode.

You can connect 38 buttons with no multiplexers.

Yes they are backlighting buttons. also which schematic is good 1st or 2nd one?

Please post a link to the specs.

Okay so I had wondered if I could just use the internal pullup. So I can use the 1st schematic and just enable the pullup in the pin and be good? And yes I know i could have just done a button matrix but its a very space restrictive project and it wasnt quite feasible. It barely all fit on the pcb Im making as it is.

1 Like
  1. internal pullup is weak. But you can always add one resistor later, so go with it.
  2. Can't see a matrix taking more room than a random array, but we're not looking over your shoulder.

Honestly I think I set on using them and didnt think it through but now I may see the point, as currently 38 traces plus ground just for signal when I could do say 4 rows 10 columns for a total of 14 wires and now im just sad cause i just did alot of work for nothing hahaha. Then i just need diodes per button to prevent ghosting....heavy sigh. Also ive already used the library and am familiar for my other controls, why do I hurt myself......well this was a fun realization :joy: nix the MUX back to the button matrix. Thanks for the help guys but yeah, thats life I guess

Why complicate things. Only a few lines of code are needed.
This simple sketch is for two 74HC4067. You can take mux2 out if needed.
Leo..

// 74HC4067 mux boards
// switches between mux input and mux ground, with 10k pull up to mux VCC
const byte controlPin[] {4, 5, 6, 7}; // control pins s0-s3
const byte mux1Common = 8;
const byte mux2Common = 9;
bool switchState[32]; // 0-31

void setup() {
  for (byte i = 0; i < 4; i++) pinMode(controlPin[i], OUTPUT);
}

void loop() {
  for (byte i = 0; i < 16; i++) { // channels
    for (byte s = 0; s < 4; s++) digitalWrite (controlPin[s], bitRead(i, s)); // set four control pins
    switchState[i] = digitalRead(mux1Common); // 0-15
    switchState[i + 16] = digitalRead(mux2Common); // 16-31
  }
}

Ive already converted the PCB design to Matrix, honestly adding the mux was complicating things haha

Topic closed as @summit_60 has abandoned the CD74HC4067-based approach discussed here and created a new topic dedicated to discussion of the new matrix approach:

1 Like