# Multiplexing with 74HC4067

**URL:** <https://forum.xod.io/t/multiplexing-with-74hc4067/1302>\
**Category:** Uncategorized\
**Created:** [November 1, 2018, 12:20pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302 "2018-11-01T12:20:30Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![the19thbear](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@the19thbear](https://forum.xod.io/u/the19thbear)\
**Post date:** [December 26, 2018, 6:19pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/41 "2018-12-26T18:19:49Z")

</div>

Coolness. Will test and return

---

<div class="post-metadata">

**Author:** ![the19thbear](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@the19thbear](https://forum.xod.io/u/the19thbear)\
**Post date:** [December 26, 2018, 8:01pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/42 "2018-12-26T20:01:01Z")

</div>

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.

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/c7f5dd67a2f7b2aabd9d59194145fe4e24f06d88.png)  
Thanks for the help so far!

---

<div class="post-metadata">

**Author:** ![cesars](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@cesars](https://forum.xod.io/u/cesars)\
**Post date:** [December 26, 2018, 8:43pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/43 "2018-12-26T20:43:50Z")

</div>

test now, update 3.0.8

---

<div class="post-metadata">

**Author:** ![the19thbear](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@the19thbear](https://forum.xod.io/u/the19thbear)\
**Post date:** [December 29, 2018, 4:18pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/44 "2018-12-29T16:18:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jacob-wiqvist](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jacob-wiqvist](https://forum.xod.io/u/jacob-wiqvist)\
**Post date:** [July 5, 2022, 10:09am UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/45 "2022-07-05T10:09:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jacob-wiqvist](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jacob-wiqvist](https://forum.xod.io/u/jacob-wiqvist)\
**Post date:** [July 5, 2022, 5:22pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/46 "2022-07-05T17:22:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 5, 2022, 6:28pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/47 "2022-07-05T18:28:00Z")

</div>

count-to-n exists in [marcoaita/malibrary — XOD](https://xod.io/libs/marcoaita/malibrary/). Go to XOD File \> Add Library… to add this library to your local XOD

---

<div class="post-metadata">

**Author:** ![jacob-wiqvist](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jacob-wiqvist](https://forum.xod.io/u/jacob-wiqvist)\
**Post date:** [July 5, 2022, 6:46pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/48 "2022-07-05T18:46:40Z")

</div>

What does this node do?

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 5, 2022, 7:08pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/49 "2022-07-05T19:08:33Z")

</div>

![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/c/c9c5dc53b91b5cc150705690ba0b3b669484f647.png)

---

<div class="post-metadata">

**Author:** ![jacob-wiqvist](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jacob-wiqvist](https://forum.xod.io/u/jacob-wiqvist)\
**Post date:** [July 5, 2022, 7:31pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/50 "2022-07-05T19:31:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jacob-wiqvist](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jacob-wiqvist](https://forum.xod.io/u/jacob-wiqvist)\
**Post date:** [July 5, 2022, 8:17pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/51 "2022-07-05T20:17:32Z")

</div>

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.

[![](https://img.youtube.com/vi/L8w7cvTLSYI/maxresdefault.jpg "Multiplex with XOD is a chalange!") ](https://www.youtube.com/watch?v=L8w7cvTLSYI)

---

<div class="post-metadata">

**Author:** ![jacob-wiqvist](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jacob-wiqvist](https://forum.xod.io/u/jacob-wiqvist)\
**Post date:** [July 6, 2022, 8:32am UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/52 "2022-07-06T08:32:31Z")

</div>

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.

> **[Introducing ItsyBitsy M0 Express](https://learn.adafruit.com/introducing-itsy-bitsy-m0/adapting-sketches-to-m0)**
>
> ItsyBitsy M0 Express is only 1.4" long by 0.7" wide, but has 6 power pins, 23 digital GPIO pins (12 of which can be analog in, 1x analog out, and 13x PWM out). It's the same chip as the Arduino Zero and packs much of the same capability as an...

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:

[![](https://img.youtube.com/vi/lMH4WUoKyFw/maxresdefault.jpg "Flickering analog values with multiplexer 74HC4067") ](https://www.youtube.com/watch?v=lMH4WUoKyFw)

I also get blinking everytime the node cykles?

Is that possible to solve?

[![](https://img.youtube.com/vi/UPqQy034iLQ/maxresdefault.jpg "Flickering output?") ](https://www.youtube.com/watch?v=UPqQy034iLQ)

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 6, 2022, 7:53pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/53 "2022-07-06T19:53:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 6, 2022, 7:59pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/54 "2022-07-06T19:59:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 6, 2022, 8:07pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/55 "2022-07-06T20:07:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jacob-wiqvist](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jacob-wiqvist](https://forum.xod.io/u/jacob-wiqvist)\
**Post date:** [July 6, 2022, 8:11pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/56 "2022-07-06T20:11:39Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/c/c4e28cf239d04d74be011951b469ab1f04d3c4b8.jpeg)

Signal from multiplexer goes to A4

---

<div class="post-metadata">

**Author:** ![jacob-wiqvist](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jacob-wiqvist](https://forum.xod.io/u/jacob-wiqvist)\
**Post date:** [July 6, 2022, 8:21pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/57 "2022-07-06T20:21:55Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/8/8d2cf42960a072c1a51d8d5c25c4f57cd1ecfb18.jpeg)

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

---

<div class="post-metadata">

**Author:** ![jacob-wiqvist](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jacob-wiqvist](https://forum.xod.io/u/jacob-wiqvist)\
**Post date:** [July 6, 2022, 8:23pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/58 "2022-07-06T20:23:45Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/8/8d2cf42960a072c1a51d8d5c25c4f57cd1ecfb18.jpeg)

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 6, 2022, 8:33pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/59 "2022-07-06T20:33:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [July 6, 2022, 8:33pm UTC](https://forum.xod.io/t/multiplexing-with-74hc4067/1302/60 "2022-07-06T20:33:51Z")

</div>

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

[Previous page](https://forum.xod.io/t/multiplexing-with-74hc4067/1302.md?page=2)

[Next page](https://forum.xod.io/t/multiplexing-with-74hc4067/1302.md?page=4)
