[solved] Multiple analog inputs (not simultaneously) for sequencer

I'm new to electronics and I would like to build a sequencer with 16 (or maybe more) steps with a Arduino Mega 2560. It should be done with potentiometers. Each one representing a tone. Then I would also need some pots to regulate speed, direction and other things. So the 16 inputs are not enough. I thought about using multiplexing, but the fact that I do never read the 16 pots at the time but stepwise made me think about using transistors for switching for example 8 analog inputs between 16 pots, the leftover 8 pots would be enough for other purposes. Is it possible? Can it be done that way or am I completely wrong?

I thought about using multiplexing, but the fact that I do never read the 16 pots at the time but stepwise made me think about using transistors for switching

:wink: That would be multiplexing (but perhaps you are thinking if slower multiplexing).

Whether you do it fast or slow, an analog multiplexing chip is probably easier than separate transistors (and probably less likely to affect/alter your analog voltage).

FYI - There is one multiplexed ADC in the ATmega chip, but it's OK to add additional external multiplexing.

Yes, you could use a part like DG406 to switch 1 of 16 pots to an analog input.
http://www.digikey.com/product-search/en?k=dg406&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25
Pricey tho.
Or MCP3208 for fast ADC reads of 1 of 8 pots.
http://www.digikey.com/product-search/en?vendor=0&keywords=mcp3208&stock=1
Takes 24 clocks for a 12-bit read, see Figure 6-1 in the datasheet
http://www.digikey.com/product-search/en?vendor=0&keywords=mcp3208&stock=1
with SCK at 2 MHz.
1/2000000 * 24 = 12uS.
(vs 110uS with internal ADC, and some impact on the signal from the analog switch internal resistance)

Thank you both for your responses. I took a look to see what I could find from rescued parts I have here and I found those:

CD4053BE (http://www.ti.com/lit/ds/symlink/cd4051b.pdf)
MC14052BCP (MC14052BCP pdf, MC14052BCP Description, MC14052BCP Datasheet, MC14052BCP view ::: ALLDATASHEET :::)

Can it be done with one of them as well?

Can it be done with one of them as well?

Yes.

I took the MC14052BCP and have tried the following connections

X0 ... X3, Y0 - Y3 = pots
Vdd = 5V
Vss, Vee, INH = GND

Then i tryed playing with A and B by setting them to 5V and measured X and Y but it does not work as it should.

A verbal description of a circuit is not easy to follow please post a schematic of your circuit.

You don't seem to have anything connected to actually select the channel you want to read and there is no output connected back to an analogue Arduino input.

but it does not work as it should.

So how does it work, how do you think it should work?

Please read this:-
How to use this forum
It tells you how to ask a question here.

The IC has 4 "Input-pins" for 1 "output-pin" (could be inverted) and 2 "address-pins" for them. There are totally 8 inputs and 2 outputs (X, and Y) that can be addressed at the same time by A and B.

Then there is Vdd vor alimentation and 3 other pins that I do not understand fully:

Vss, Vee, INH (inhibit). I did set all of them to GND. I doubt this was correct, but I would like to power them completely from Arduino (5V or 3.3V)

I did it without Arduino first, just to see how and if the IC works. Of course I could have read the input and pritnted them to the serial monitor but I thought it would be easier just to use a voltmeter for that. I do "select" by providing 5V or 0V to the pins A and B (simulating the HIGH on an digital pin) as described above.

The pots are connected to 5V.

What I expect is when I set A and B to 5V, 5V to read the value of the pot connected to x3 on x and the value of y3 on y and so on like this:

A B X Y

5 5 x3 y3
5 0 x2 y2
0 5 x1 y1
0 0 x0 y0

Maybe this assumption is wrong.

Hum, doesn't look much like a schematic.

When you say A & B are at 0V is that actually connected to 0V ( it should be ) or is that just unconnected?

Vss should be ground. Vee is the negative most voltage you want the chip to switch, so connecting it to ground is fine so long as no negative signals are applied to the inputs.

Unused inputs should not not allowed to float, they should be connected to ground.

What I expect is when I set A and B to 5V, 5V .........

So what do you see? Have you checked the input pin is changing with the pot? What value are these pots?

but it does not work as it should.

Please cooperate and tell us how it does work?

When you say A & B are at 0V is that actually connected to 0V ( it should be ) or is that just unconnected?

Just unconnected in my case. :-[

I set the pots to 1,2,3,4 V and 1.2, 2.2, 3.2, 4.2 to see which one gets activated when plazing with A and B.

What I get is always the value of pot x3 for the x channel and the value of y1 on the y channel.

Just unconnected in my case.

Looks like that is your problem then. All inputs to this chip must be connected to either ground or 5V. You must not let ANY input float, and that includes the data inputs as well.

Looks like that is your problem then

Exactly, that was the problem and also unstable connections on the breadboard. Thank you very much for your help. :smiley: