Multiplexing with 74HC4067

Coolness. Will test and return

Ok. I think i have a faulty multiplexer. Input one, of your read 4067 only reads 0 or 1. never in between. input 1-5 works fine, but the rest of the inputs dont work (6-15). Will wait till i get a new multiplexer, to experiment further with your node.


Thanks for the help so far!

test now, update 3.0.8

Fixed by a complete uninstall/reinstall of XOD. Multiplexer was fully functioning, turns out to be a XOD software error.

I have tried to find how to get this node to continuously read analog inputs between 0-15.

But I do not succeed.

How do I do that?

What node is “count-to-n”? I have tried to find that node.

count-to-n exists in marcoaita/malibrary — XOD. Go to XOD File > Add Library… to add this library to your local XOD

What does this node do?

image

I don’t understand, why the multiplexer node dose not include this?

The hole purpose of a multiplex chip that can read several analog inputs is that you can use that to read several analog inputs, and if can’t do that without downloading another library, seams a little strange to me.

I would at least add a 4067 node that is a little like analog read node. But with several inputs and outputs. Much simpler to understand.

User configure what inputs and outputs he wants to use and the node only read those.

But I will test this and se if it works.

Thanks for the help.

My dimmer project comes to a halt agian.

Flickering and not very nice experience with multiplex.

I thought this would be easy.

Control a copel of outputs with alot of pots, and I have not come to digital inputs yet.

Hey!

I have tried to connect analog multiplexer to itsy bitsy m0 Express, but get very irregular values when I try to read all ports. Plus the ports respond to potentiometer input even if I only connect a potentiometer.

I have no problem with this when I connect the analog inputs on itsy bitsy m0 Express.

I have googled and tried to find out if this has to do with software or hardware but I can not find a clear answer. If anyone has had problems with irregular multiplex values, I’m very curious.

I can also state that if I ignore using, “the node count-to-n” and only test one output consumption, I get pretty good value, smooth and nice. This makes me think it’s software related. Some are talking about floating pins?

This make me think I can’t have unconnected pins on the multiplexer and start using them with a dip switch as I was planing to have.

Her is a vido of my connecton, config and flickering:

I also get blinking everytime the node cykles?

Is that possible to solve?

Trying to read pins that are not connected to anything will usually give random/changing values. A bias or pull-up resistor is used to avoid this. If pin is not connected, you are basically reading the static build-up on the pin. For digital pins, it is pretty flexible what value resistor to use. For analog pins, you probably want to use a very high ohm resistor so it has minimal affect when reading “real” input. If you want an unused pin to read zero, you would connect it to ground using a resistor. If you want unused pin to read 1, you would connect it to V+ using a resistor. The resistor then drains any static build-up from the pin so it doesn’t constantly change.

XOD ships with lots of low-level building blocks. The multiplexer node you are using can be used without count-to-n; it just happens to the way you want to use the multiplexer node is easier to do using count-to-n. You could do the same thing using clock, count, and conditional node to reset count. Not everyone wants to just blindly cycle through all the multiplexer inputs, so count-to-n would not be helpful for everyone.

Libraries exist as an easy way for people to share extensions they have created that build on the low-level built-ins already provided so everyone can share in how the language is extended. If you don’t like how one person did it, you can use someone else’s solution, or create your own.

As for the flickering, we would need to know how your read-4067 node is coded. You might need to add ‘buffer’ nodes to remember the output values and hold them stead between updates. The watch node connected to C0 indicates the output does not change, but flickering of LED indicates it may be changing faster than watch node can update. Just a guess–perhaps the output is changing to zero when you start the read of C0, then updates to correct value when it is returned from multiplexer.

Solved it with a resistor on signal to ground, aperently you don’t need one for every input.

Signal from multiplexer goes to A4

count-to-n dose not work as intended in this case.

This smal test program have generated over 8000 lines of code.

Maybe to heavy to read fast?

What I want is to read all multiplex analog inputs in real time. How can I do that?

Analog read, reads in “real” time, and I don’t see any lag or flickering.

How fast can multiplex read?

It is not many problem left to solve but this is definitely a problem.

I have tested everything from 0.1 to 0.00001 read on the count-to-n nod.

If you have any solution I can test I am open.

Thanks

I have no idé, it looks like this at least:

The multiplexer is not “reading” the values. It is just selecting which values to pass through so that Arduino can read it. Analog reads are relatively slow…it basically does a binary search comparing voltage to approximate the input voltage. Doing that for multiple pins, one pin at a time is going to take some time. If you change your IN0-15 too fast, it will be changing mid-read. Maybe your input pin should just specify how many pins to read, and you should finish read of 1st pin, then read next until you have read enough pins, then pulse done. Done can be used to pulse UPD to start the next cycle to read as fast as possible. You are forcing a delay between each read by using count-to-n to select which output to update.

If you open read-4067, what does the code inside of it look like?