unstable 4067 values

Hi everybody,
i'm working with a 4067 16 port multiplexer from Texas Instruments and i'm having a troubled time here.
If you want i can paste my code, but basically all i'm doing is looping all input pins using the 4 control pins (a,b,c,d) and read the value on a input pin in my arduino.
For my project i needed more than 12 digital pushbuttons, that's why i went for the 4067. Obviously i'm using ONLY digital pushbuttons (so i'm not mixing analog/digital) and i'm reading the output pin from the 4067 on one arduino digital pin.
Everything seems to work ok when i'm using only one button - but as soon as i add 2 or 3 the whole thing becomes a total mess. Every keypress will fire up all the other pushbuttons simultaneously and i can't get a clue of why this is happening.

For example: if i am looping thru 3 different ports (say 2, 3, 4) but only 1 pushbutton is actually connected (say, on port 2), what values should i get from ports 3 and 4? It should always be a 0, right? Well, i get all +5v - just as if i pressed all the buttons at the same time.

In any case, the pushbuttons are attached with the pull-up method (if i'm not making confusion) - that is, when i press the button the link is DOWN (+5v is sent), otherwise 0. More generally, i'm trying to make my own MIDI controller. Every pushbutton outputs a different midi note. But what i get is that when i push one button, all the notes are sent at the same time.

Finally the question is: has anybody noticed such an "instability" on the 40xx MUX or is it just my software doing something wrong? By request i will paste the code if necessary. Please help! I'm totally stuck here...

hi

do you have

  • a .1uf capacitor across the power supply pins on the multiplexer chip?
  • pull -up or pull-down resistors on the multiplexer inputs?

You need both :slight_smile:

D

do you have

  • a .1uf capacitor across the power supply pins on the multiplexer chip?
  • pull -up or pull-down resistors on the multiplexer inputs?
  1. I don't have any capacitor whatsoever! Didn't find anything about that in the datasheet!
  2. i have used a 220ohm resistor for each pushbutton in a pull-up way (so that default is 0 and press is +5v)

Can u explain better about the capacitor? Where should i put it? Thanks!

Hi,
I never used an 4067 but did you consider timing-problems?

The arduino will loop quite fast through the input adress bits, maybe too fast for the 4067?
The effect could be that the common input has not been updated by the time you read the input value.

Just a guess, put a small delay into your code and see if that helps.

Eberhard

I never used an 4067 but did you consider timing-problems?

Hi,

in fact i also suspected it could be something like that - i added different delay values (from 20ms up to 100ms) but it didnt really solve the problem.

So, do you think it could be a problem with an unstable voltage supply? Is arduino's 5v totally stable? Or should i put a 5v stabilizer (don't know the precise word, sorry) so that i'm sure the voltage is ALWAYS a precise 5v?

Or, again, is it that i'm not using a capacitor as suggested above?

Thanks

How did you connect your pull up / down resistors ?

EDIT:

It's not a good idea to put a 5V regulator in front of the 4067 if you are using the 5V from the Arduino board. A regulator needs 2 - 3 Volts more than it's output to work. So feeding a 5V regulator with 5V from the Arduino board would not give you a 5V output.

The 5V output from the Arduino board is already regulated, so it should be OK.

How did you connect your pull up / down resistors ?

Ehm... i should put a pic, but i'm not home now. So let me try to explain:

i have a pushbutton with 4 pins. 2 per side:

gnd
|
|
|
220Ohm Resistor
|
| |

  • PB -

| |
| |----- to 4067 input pin
|
+5v

Makes sense?

hi

go and look at the button tutorial, it shows the correct way to wire a button. 200 ohms is too low, it will work but you are wasting a lot of current. use 4K7 or 10K instead. Also you need to use a multimeter to see which pins are connected when you press the switch... I am pretty sure the way you have it is wrong.

This is how to do it:

+5
|
|
10K Resistor
|
|
-------- to multiplexer input
|
0
| button
0
|
|
ground

PS: the capacitor goes across the 4067 between +5 and GND. It's not in the datasheet because it is an assumed design practice to bypass logic power supplies with a capacitor!

hi

go and look at the button tutorial, it shows the correct way to wire a button. 200 ohms is too low, it will work but you are wasting a lot of current. use 4K7 or 10K instead. Also you need to use a multimeter to see which pins are connected when you press the switch... I am pretty sure the way you have it is wrong.

This is how to do it:

+5
|
|
10K Resistor
|
|
-------- to multiplexer input
|
0
| button
0
|
|
ground

PS: the capacitor goes across the 4067 between +5 and GND. It's not in the datasheet because it is an assumed design practice to bypass logic power supplies with a capacitor!

Is this wiring schema going to be a pull up or down? I mean, is the normal state HIGH or LOW ? I need it so that when i press the button i get a HIGH and LOW when not.
Then, i will try to change the resistors as you suggested! And well, i didnt know about the good practice of capacitors cause i'm a total noob when it comes to electronics. So thank you for helping!

I will try and report.

Anyway, does anybody agree that the picure in the button tutorial is far than self-explanatory???

?! Can you tell where is that resistor actually connected?

Mmm... maybe it's just me..

All credit to the person that took the time to post a pictorial tutorial, but the image is difficult to understand - I made that same observation when I first got my NG, I spent quite a while looking at. There are quite a lot of pictures that leave much to the imagination, but remember it's contributed on the goodwill of others, for free. You could try enhancing it in photoshop, increase the contrast keeping the brightness at its current level - that might help.

I traced the pins, it (appears) it's not connected, the hole where the pin looks to be heading into, is empty, and the shadow cast doesn't go as far as the hole.

All credit to the person that took the time to post a pictorial tutorial, but the image is difficult to understand - I made that same observation when I first got my NG, I spent quite a while looking at. There are quite a lot of pictures that leave much to the imagination, but remember it's contributed on the goodwill of others, for free. You could try enhancing it in photoshop, increase the contrast keeping the brightness at its current level - that might help.

Yes man i totally agree! My total respect goes to them who took their time to help newbies like me! And thank YOU for tracing the resistor, i think you should submit this picture to the tutorial creator, it's way more clear than the current one.

Thanks a lot!

PS: the capacitor goes across the 4067 between +5 and GND. It's not in the datasheet because it is an assumed design practice to bypass logic power supplies with a capacitor!

Its probably not the culprit here. :stuck_out_tongue:

Its common practice but it should work without it.

All credit to the person that took the time to post a pictorial tutorial, but the image is difficult to understand - I made that same observation when I first got my NG, I spent quite a while looking at. There are quite a lot of pictures that leave much to the imagination, but remember it's contributed on the goodwill of others, for free. You could try enhancing it in photoshop, increase the contrast keeping the brightness at its current level - that might help.

Yes man i totally agree! My total respect goes to them who took their time to help newbies like me! And thank YOU for tracing the resistor, i think you should submit this picture to the tutorial creator, it's way more clear than the current one.

Thanks a lot!

No worries, the pic's there if they want to download it.

Hey by the way -
i came home yesterday and verified my connection.
Truth is that i did exactly as YOU pointed out... so my previous diagram was totally wrong. (memory sucks)
So i can assure my wiring was perfect as you showed here...

What's my problem? Bad 4067? No capacitor? Need for a volt stabilizer?
Arghh!!!
Frustration on the way...

Did you try to use a 10k pull up resistor in stead of the 220 Ohm ?

Did you connect all 16 pins on the 4067 to a switch + pull up resistor ? Sometimes leaving some pins "floating" (not connected to anything) can be the cause of strange problems with CMOS IC's.

Did you try to use a 10k pull up resistor in stead of the 220 Ohm ?

Did you connect all 16 pins on the 4067 to a switch + pull up resistor ? Sometimes leaving some pins "floating" (not connected to anything) can be the cause of strange problems with CMOS IC's.

  1. No, i havent tried the 10k's - i'll buy some today and try again.
  2. I actually haven't. I thought - if i'm looping only through SOME of the 16 pins i shouldn't care about the others since i'm not really using them... am i wrong?

Some CMOS IC's don't like floating input pins and strange things can happen. you can just try to connect the unused pins to ground. Then they should just read 0 when you read them from the Arduino board. You don't have to read them, but try to ground them.