Go Down

Topic: extenion for more knobs (Read 745 times) previous topic - next topic


hi again!
is there any way to connect more than 5 analog inputs (more than 5 pots)?
and does it require some advanced knowledge in electronics?


David Cuartielles


you can actually connect 6!! (from 0 to 5 there are 6 different addressable analog imputs)

anyway, you can use a multiplexer like the 4051 chip that will allow you to connect 8 inputs to one single one.



thats great!
i have found this:
so i have an idea of multiplexer :)
is it easy to integrate with normal version, on the board?
and what about programing side, will i see this new pots in software or i'll have to upgrade chip?
uhhh... so many quetions...



the extra inputs will not 'appear' to the arduino - you will have to write the code (or find code others have written) to work with the chip.

You will need to use some of the digital output pins to control the multiplexer so that you know which analogue input is being multiplexed onto the pin, and then read it to the relevent variable.




thnx for repy!
i understand the software side (i'm not a programer but i have a lot of experiance with action script), so i'll just have to write the code to work with this setup, that's nice.
did someone do that kind of setup and have some nice documentation? i'll apriciate it a lot!


Massimo Banzi

hello vedran

let's take the mc14067 (http://www.onsemi.com/pub/Collateral/MC14067B-D.PDF) as an example
this is an 16 channel analogue multiplexer. i've use this a lot of times.

connect pin 24 to 5V and 12 to GND. then connect a 10K resistor from 5V to pin 15.
this is powering the chip and enable the switch that lets you pick which input to read.

now connect pin 1 to analogue input 0.

now we need to tell the chip which channel we want to read. this is done by connecting 4 digital outputs to pins 10,11,14,13. By using a combination of digitalWrite commands you can set the input channel to read.

all the other 16 pins are inputs where you will connect up to 16 pots (or any analogue sensor)

the code will look like this:

for (i=0; i <16; i++) {
  write i in binary on 4 output pins
  this selectes the input

  val = analogRead(0)
  store val somewhere or send it on
  the serial port


now the cool part is that if you hook up one of these to each analogue input you can have 96!!!! analogue inputs

is this enough ?:))



thnx for explanation!
i think it's enough :)
arduino rules!
now i only have to wait for the board....



Aug 24, 2006, 11:03 pm Last Edit: Aug 24, 2006, 11:04 pm by woo_oow Reason: 1
im trying to use the multiplexer below.
my question is how to calculate binary numbers out of decimal chiffres.

hello vedran

let's take the mc14067 (http://www.onsemi.com/pub/Collateral/MC14067B-D.PDF) as an example
this is an 16 channel analogue multiplexer. i've use this a lot of times.

the code will look like this:

for (i=0; i <16; i++) {
 write i in binary on 4 output pins
 this selectes the input

 val = analogRead(0)
 store val somewhere or send it on
 the serial port



This tutorial on bit masks might help: http://www.arduino.cc/en/Tutorial/BitMask


this will help!
i just worked with a FOR loop but i think this works better



Mar 24, 2007, 08:23 pm Last Edit: Mar 25, 2007, 08:24 pm by spanky Reason: 1
so to get 16 digital outputs with the MC14067 (i'm controlling lots of motors, separate power/logic), rather than digital inputs. i assume we're connect to pins 10,11,13,14 on the multiplexer but to where on the arduino?

i would guess one has to connect to pins 9, 10 or 11 on the arduino?  (though it'd be so much nicer for organizing to connect to 4 with 12 outpus, than 3 with all 16, to get 48, which may be the max.)

thanks a bunch


Jun 07, 2007, 11:04 am Last Edit: Jun 07, 2007, 11:04 am by macario Reason: 1

Thanks for the info, I have a little doubt: how does one tells the pin 1 from the 24 of the multiplexer?  ::)


multiplexing is putting together analog signals into one channel, and de-multiplexing is divvying an analog signal to multiple channels.  most of the info on this page (and in searching the web all over) is about multiplexing.  the components that de-multiplex are primarily also multiplexers (set to a different mode), so folks use the one word to refer to both things, but rarely talk about anything but the one word.  what a mess.  however, this may be what you're looking at?  somebody please correct me where i'm wrong, but this is what i've culled ...

one thing is that addressable latches, work almost identically but have the added ability to remember the values.  to see why that's even a cool thing though, download any data sheet on multiplexers.  they all wok pretty much the same.  and the pins for addressable latches are also pretty much the same.

an example, a multiplexer/latch that allows for 8 output/channels (which i found pretty common and cheap) has 16 pins, and needs 3 digital + 1 analog from the microconroller or arduino.  (note the arduino only can run a max of 3 of the 8 channel latches, before running out of outputs).  8 pins (in ther middle, for no apparent reason) send out PMW or analog like you'd expect.  1 pin (why the 4th one?  who knows.) gets one analog value.  3 more pins determine, in binary with digital on/offs, which output channel gets that value.

here's a diagram for turning (encoded) servos to 1 of five middle positions using a latch.  often the mode values will also decide if multiplexers act like de-multiplexers.  so look at the data sheets.

but for this application, there are "motor drivers" that (from what i've heard) will work a lot better.  they generally plug in to serial ports and also power/ground the motors (i've seen ones for servos and steppers).  these are generally much more expensive ($60-$200 rather than .50-4 bucks) but often control 20 motors.  (which might avoid some spaghetti wiring with the arduino)  most servo "brains" can also just be used with LEDS, solenoids, etc.  there aren't many options for actuators, so this may be a better way to go for you?  good luck.


Jun 08, 2007, 08:08 am Last Edit: Jun 08, 2007, 08:13 am by macario Reason: 1
Thing with arduino is that lets a lot of people with no previous involvement with electrons play with wires but it can get very frustrating when you don't know what you are doing as is my case. So please can anyone post some pictures of how to connect the 14067B to the arduino? newbies will apreciate that.

Here's how i connected it, for some reason is not working:

I just have red, black and white wire and light is not good so it may not be clear, tomorrow I will take another one with better lighting.

As Massimo posted I've connected the pin 24 of the 14067B to 5V, a green 10K resistor from 5V to pin 15 (what's the difrence between brown and green resistors?) and digital pins 2 to 5 of my arduino to pins 10, 11, 13, 14 of the 14067.

Is that configuration right?

heres my code:

Code: [Select]

byte mask = 1;
byte serialOut;
byte i;
int val;

void setup()
 //Declare the pins used for controlling the multiplexer as inputs
 for (i = 2; i < 6; i++){
   pinMode(i, OUTPUT);  
   digitalWrite(i, LOW);
 Serial.print("Ready to go");

void loop()
 for (i = 0; i < 16; i++) {
   val = readAnalogM(0, i);
   if (i == 0 ) Serial.println(val);

int readAnalogM( int analogIn, int channel ){
     analogIn - board's analog pin conected to the output of a multiplexer
     channel - multiplexer channel being read, 0 to 15
   //We are using the pins 2 to 5 labeled serialOut to comunicate with the multiplexer
   serialOut = 2;
   //Get binary form of the channel and send it through serialOuts
   for ( mask = 1; mask < 16 ; mask <<= 1 ){
      if ( mask & channel ) {
        digitalWrite( serialOut++, HIGH );
      } else {
        digitalWrite( serialOut++, LOW );
   return analogRead( analogIn );

If i understood right i have to send the binary number for the multiplexer port i want to read to the multiplexer pins labeled A, B, C and D but that makes me wonder:

how does the multiplexer tells when I finish sending a port number and started sending another? does that has to do with the INHIBIT pin? the resistor from 5V to pin 13 has to be a brown one? what am I doing wrong?

Hope someone can help me to work it out..



Jun 08, 2007, 08:19 am Last Edit: Jun 08, 2007, 08:25 am by macario Reason: 1

well now it's working, I've just disconected the inhibit pin (number 13) from the resistor that went to 5V, but unless I am reading port 0 it behaves erratically. shall I leave it disconnected?

Go Up