4017 sequencer for wave shield

Hi fellow arduinerds!

I purchased the Wave Shield from Adafruit a while ago and now I want to make a proper sampler out of it.
So I thought of the simplest way to build a sequencer for the shield and came up with this - I want your feedback concerning the practical application of this circuit, and code help would be much appreciated! (I am still very new to compiling code)

My idea is: if the 4017 sends out a HIGH for each step (that being f.i. 5V), then this could be sent through a resistor/potentiometer and further to an analog input on the arduino.
This voltage could then be divided into the desired amount of samples to choose from on the card.
So if I want to trigger 1 of 4 samples: 0-1.25V is 'sample 1', 1.26-2.5V is 'sample 2', 2.51-3.75V is 'sample 3', 3.76-5V is 'sample 4'.

Is it possible to do it this way? Can the "HIGH" output from the 4017 IC be scaled through a pot.meter this way?
And concering the code, I thought of just using the template for the "6 pushbuttons" sketch and fiddling around.

Looking forward to your replies!

Regards,
Paleorama

You probably don't get what you intended. Let's say Q1 (pin 2 of the 4017) goes HIGH. I guess you're intention was that then the value of the second pot (in your drawing from the left) is "read" and can be accessed by the Arduino. This is not the case because the position of ALL the other pots is also relevant for that value because you connect them all through and then to GND. An array of diodes after the pots may help you get what you want.

The intention is just to get a reading of whatever pot getting a HIGH, so the corresponding sample can be called. All the other pots are getting 0V - can you explain why you think the diodes will help? Aren't they just making sure the electrons are "pushed" or "pulled" in a certain direction?

But thanks for replying anyways!

If an output is not high it is low. Therefore the pots not being addressed are in parallel with the ones being addressed. So changing any pot is going to affect all the readings.
A diode will stop this back feed.
Anyway that is the theory, it is the wrong way of going about things. You need a data select chip, at 4051 to switch the analogue value of one pot to the output.
Also wave shields do not take analogue inputs anyway.

Grumpy_Mike:
…the pots not being addressed are in parallel with the ones being addressed. So changing any pot is going to affect all the readings.
A diode will stop this back feed.

So if I change the value of one pot, it’ll set all the other pots to the same value?

Grumpy_Mike:
You need a data select chip, at 4051 to switch the analogue value of one pot to the output.

Are you sure you get my idea with this? I just want the 4017 to send a HIGH to the pot, the pot is putting a given resistance to this voltage, the voltage is read by the arduino. When the next output of the counter comes through the next pot with it’s setting, the new resistance is being read. It doesn’t matter which pot it reads, as long as the right resistance is being applied and read.

I might be the total dork here, but I’ll just give it a shot and rest my case and make sure you get my idea. :expressionless:

Grumpy_Mike:
Also wave shields do not take analogue inputs anyway.

Well mine does, I am using one right now to adjust the sample rate:

while (wave.isplaying) {
potval = analogRead(0);
if ( ((potval - lastpotval) > HYSTERESIS) || ((lastpotval - potval) > HYSTERESIS)) {
putstring("pot = "); Serial.println(potval, DEC);
putstring("tickspersam = “); Serial.print(wave.dwSamplesPerSec, DEC); putstring(” → ");
newsamplerate = wave.dwSamplesPerSec;
newsamplerate *= potval;
newsamplerate /= 1023; // we want to ‘split’ between sped up and slowed down.
if (newsamplerate > 24000) {
newsamplerate = 24000;
}
if (newsamplerate < 1000) {
newsamplerate = 1000;
}
wave.setSampleRate(newsamplerate);

Serial.println(newsamplerate, DEC);
lastpotval = potval;
}

I am basing the hypothesis of this technique (multiple buttons, with a unique resistor value, through a single analog input)

I'm a little confused but I gather you have all the pot wipers connected together to a single analog input?

That will not work as you affectively have various combinations of resistors in parallel to both virtual GND and virtual 5v (the 4017 outputs).

Ditch the 4017, connect all pots to 5v and GND, run the wipers to a 4051 and select the pots in sequence.

If you can't afford the two extra pins this requires add a counter to drive the 4051 address pins.


Rob

Aha, so I read my 8 pots through the mux from 3 digital ins on the arduino, and make some code read the pot values from the mux?
I have some 4051's lying around here by incident. Maybe I should try making a 16 step sequencer by cascading them.

But I still want a 555 to drive the clock of the sequence, and what will determine which step to read if I ditch the counter?
I know this could be done in numerous ways but I just imagine I would still need some sort of counter for the steps.

so I read my 8 pots through 3 digital ins

Close, you still use a single analog in for the pot values but you need 3 digital outs to control the mux.

But I still want a 555 to drive the clock of the sequence, and what will determine which step to read if I ditch the counter?

Run the 555 output to an external INT pin and use an ISR to set the current channel on the 3 digital pins.

Why do you need a 555? This could probably be all done in the CPU.

If you use an external clock source and counter you have to also implement a method of syncing them with the Arduino, otherwise you will never know what channel you are reading.


Rob

Yeah, I think you're right! I could just get a clock from a digital pin for the 'tempo', controlled by a pot on one of the analog inputs of course. And then one for the steps. That will be 1 AIN for the mux'ed pots, one for the clock/timer/tempo, one for the number of steps and then I would like to keep the sample rate knob. That's still only four AIN's, which is pretty good.

Now the problem is the code. I am not good with these code strings for multiplexers, I bought the MUX shield with 48 inputs but the code is martian to me! :sweat_smile:

EDIT:

I thank you for your help so far! I will assemble the mux circuit with the pots and then I'll return and maybe get some help on the coding. Thanks a lot!

If you look at this project:-
http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html
You will see a couple of 4051s feeding analogue sensors into an arduino. Replace the arduio analogue input with your wave shield, see the code for how to simply stepping through the inputs.