Go Down

Topic: CD4067 registering single applied voltage on multiple inputs?... (Read 1 time) previous topic - next topic

Aemornion

Hello everyone,

I just started using the CD4067 with an UNO, in an attempt to read a series of digital inputs.

This is a test bed, just for learning at this point.
So, just one CD4067, ill add more later.
I already got pretty much the exact same thing working with some LEDs but now im trying to expand my inputs, not my outputs.

The issue seems to be that if I apply +5V to one pin, it seems to register on the adjacent 5 or 6 pins surrounding that pin!!!  Which is not ideal at all for my application!
Very strange.
Has anyone had this problem before?

Here is my code

Thank you in advance for any help you guys can offer!!

Code: [Select]
/*
* CD4067 multiplexer attached as follows:
- address pin A: digital I/O 2
- address pin B: digital I/O 3
- address pin C: digital I/O 4
- address pin D: digital I/O 5
- input pin: digital I/O pin 6
- LEDs attached from each of the CD4067's output channels
to ground
*/

// put the address pin numbers in an array
// so they're easier to iterate over:

const int channel[] = {2, 3, 4, 5};
      int value ;

// the output pin channel (mux's input):


void setup() {
    Serial.begin(9600);
    pinMode(2,OUTPUT);  //A
    pinMode(3,OUTPUT);  //B
    pinMode(4,OUTPUT);  //C
    pinMode(5,OUTPUT);  //D
    pinMode(6,INPUT);  //Input
}

void loop() {
  // iterate over the 16 channels of the multiplexer:
 
  for (int thisChannel = 0; thisChannel < 16; thisChannel++) { 
   
    // chooses 0-15
    // set the channel pins based on the channel you want:
    // iterate over the number of pins you're using:
   
    for (int thisPin = 0; thisPin < 4; thisPin++) {
        // chooses channel array value 0,1,2,3 -> 2,3,4,5
        // calculate the state of this pin based on
        // its bit value in whichChannel:
        digitalWrite(channel[thisPin],bitRead(thisChannel, 3-thisPin));
    }
    value = digitalRead(6);
    Serial.print(thisChannel);
    Serial.print("-");
    Serial.println(value);
  }
   Serial.println(" ");
   delay(1000);
}

Grumpy_Mike

What is connected to the other pins?
If nothing then yes this will happen because they float.
If you are not using them and you don't want to use then connect them to a pull down resistor of 10K or less.

Aemornion

Thanks for the reply,

So its almost like a parasitic capacitance effect between each wire then?  Interesting.

I have all of the pins connected, With some #20 wires, to a set of Dip Switches I am using for testing., and then to +5V.
So i was selecting each input, via the dip switches.   
I will put some 10K's from the pins behind the switches to ground as you suggest tomorrow, see if that helps the situation and report back.

Thank you =)


Aemornion

Your suggestion solved my problem, thank you again =)

Go Up