16 channel analog voltage sequencer for analog synthesizers

#1
Skip to end. I had several interations each interesting but the last one was the most useful.....



I am building a sequencer based on the 28x2 for my analog synth. I wanted to share what I found to be the best way to sequence the ports. Rather than set the port each time use a for next loop with a bit shift command. Doing this you have to start the loop on %00000001 outside the loop or you miss the first port. You can make it setp backwards by using a port to determine direction and a set of if then statements. See the code below. Real simple but something people need to do so I thought I'd share the way I did it. I am using the good old 4066 cmos switch but if I did it again I'd look to the never DG403 like switches. I am seeking an addressable 16 or 32 channel multiplexer to do this using one port but that will be version 2.0.

Code:
'16 channel sequencer


		Let dirsA=%00010000
		Let dirsB=%11111111
		Let dirsC=%11111111

main:
		Let pinsC =%00000000
		Let pinsB =%00000001
		
	If Pina.2=0 and Pina.3=0 then goto GoForward
	If Pina.2=1 and Pina.3=0 then goto GoBackwards
	If Pina.2=0 and Pina.3=1 then goto Dual_8ch_Forward
	If Pina.2=1 and Pina.3=1 then goto Dual_8ch_Backward

GoForward:
	
	For b0=0 to 7 step 1 
		Readadc a.0,w3

		If pina.1=0 then let b2=1: Endif	'set speed multiplier
		If pina.1=1 then let b2=10:Endif
		
		Let b1 = %00000001 << b0
		
		Let pinsB=b1
		
		w3=w3*b2
		w3=w3+1
		Pause w3
		
	Next b0

		Let pinsB =%00000000
		Let pinsC =%00000001
			
	For b0=0 to 7 step 1
		Readadc a.0,w3
		
		If pina.1=0 then let b2=1:Endif
		If pina.1=1 then let b2=10:Endif
		
		Let b1 = %00000001 << b0
		
		Let pinsC=b1
		
		w3=w3*b2
		w3=w3+1
		Pause w3
		
	Next b0
	
Goto main
	
GoBackwards:

	For b0=7 to 0 step -1 
		Readadc a.0,w3

		If pina.1=0 then let b2=1: Endif	'set speed multiplier
		If pina.1=1 then let b2=10:Endif
		
		Let b1 = %00000001 << b0
		
		Let pinsB=b1
		
		w3=w3*b2
		w3=w3+1
		Pause w3
		
	Next b0

		Let pinsB =%00000000
		Let pinsC =%00000001
			
	For b0=7 to 0 step -1
		Readadc a.0,w3
		
		If pina.1=0 then let b2=1:Endif
		If pina.1=1 then let b2=10:Endif
		
		Let b1 = %00000001 << b0
		
		Let pinsC=b1
		
		w3=w3*b2
		w3=w3+1
		Pause w3
		
	Next b0
Goto main
	
Dual_8Ch_Forward:

		Let pinsB =%00000000
		Let pinsC =%00000001
	
	For b0=0 to 7 step 1 
		Readadc a.0,w3

		If pina.1=0 then let b2=1: Endif	'set speed multiplier
		If pina.1=1 then let b2=10:Endif
		
		Let b1 = %00000001 << b0
		
		Let pinsB=b1
		Let PinsC=b1
		
		w3=w3*b2
		w3=w3+1
		Pause w3
		
	Next b0
Goto main
	
Dual_8Ch_Backward:

		Let pinsB =%00000000
		Let pinsC =%00000001
			
	For b0=7 to 0 step -1
		Readadc a.0,w3
		
		If pina.1=0 then let b2=1:Endif
		If pina.1=1 then let b2=10:Endif
		
		Let b1 = %00000001 << b0
		
		Let pinsB=b1
		Let pinsC=b1
		
		w3=w3*b2
		w3=w3+1
		Pause w3
		
	Next b0
	
Goto main
 

Attachments

Last edited:

OLDmarty

Senior Member
#4
An alternative to the CD4066 which from looking at your schematic could also be used for your project is the 74HC4051 8-channel analog switch.
I've often used a 4067 (twice the size of a 4051), being a 16channel Analog switch....
Looking at Kecked's schematic, simply feed the outputs of the 16 trimpots into the 4067 and then the 4067 output to his summing amp ouput, which would probably just become a buffer output stage anyway....

The 4067 uses 4 address bits to select 1of16 of the I/O pins to the "main" I/O pin....
I say I/O, because you can feed 16 audio signals into 1 output, OR, 1 input source to 16 outputs, as the analog switching in the 4067 is a bi-directional path and not fixed "in only" or "out only" pins...

I've used the 4067 extensively in my old synth/sequencer projects, especially for sound-bending where a number of different capacitors can be switched across filter "X" to achieve a multitude of flexability ;-)

The 4067 will get rid of ALL those 4066's ;-)


Well done, Kecked...


Marty. ;-)
 
#5
Concur with OLDmarty. The '4067 chips is an even better option compared with the '4051 as it doubles the channels for only 50% PCB area increase.

From the datasheets I looked at the 74HC4067 with typical ON-Resistance of around 75 Ohms at 5V (and slightly less at higher supply voltages)
has a lower resistance than the CD4067 / CD4067 where the ON-Resistance at 5V supply is higher at around 470 Ohms (typical)/ 1050 Ohms (max)
 
#6
I've gone to the max335 8 channel spi chip. I can gang as many in a row as I want. I'll post the new schematics and all once I debug it. I can make any 8 channles work fine but I still need to use a dg402 or such to add the channels together. A summer is not the solution as the max chip hangs on the last channels voltage. The switch will fix that. Plus if I add another max335 as the switch I can have 64 channels with one CS. (for now I'm using separate CS) Just have to change the code. The next thing I'm working on is to replace the pots with something that makes exact notes. Also want to be able to stop on any lenght sequence both for the long sequence and as small 8 note blocks and maybe for a 32 channle as 2 16 channel blocks. If I go that far I think I'll end up doing Midi rather than analog signals and use a dac to produce the voltages. Then I need to add a nice lcd and a menu driven system. Hell I never thought I'd get this far so what why not. That would eliminate the skip switches as well. Not sure I put those in the vsm file But they will be in the final. They are just spst switches so you can skip steps. I may add slew on each note as well since its just a pot and cap but now its getting to be a monster in pots and switches which means I should learn to program the solution. After all that is the point of using a micro to replace a ton of analog circuits.

Let's drream here....ok read an adc value, do some code to make the slew, adc it out and set it up so you chose what channels get processed. Works for a single slew value but can't set each channel so need more thinking....
 
Last edited:
#8
vsm spi file

I'll upload the vsm file in another post.
the vsm file

load the counter bas file to the leds. It just reads out a serout command to run the leds. Seems simplest. The other code is the spi code for the max chips. The summer doesn't work and needs a switch but VSM doesn't have the one I'm using. Try using the max335 chip instead. Have to add new spi code and a cs for the new max chip but that is trival spiout pulsout lines. I wonder once I bre4adboard this how fast it will work. The simulation is about right but for spifast this is extremely slow running.

The summer might work if I send %00000000 to the max chips as a last command to turn them off completely when idle. I think I did this but I forget. Just remember 30 days ago I knew none of this stuff!

heres the code blocks

Code:
#picaxe 28x2

' Converted by X2 Conversion Wizard Version 2.0.5 (2010r4.1)

setfreq m16
let adcsetup = 0

'16 channel sequencer


		Let dirsA=%00010000
		Let dirsB=%11111111
		Let dirsC=%11111111

hspisetup spimode00,spifast
main:
		Let pinsC =%00000000
		Let pinsB =%00000001

	If Pina.2=0 and Pina.3=0 then goto GoForward
	If Pina.2=1 and Pina.3=0 then goto GoBackwards
	If Pina.2=0 and Pina.3=1 then goto Dual_8ch_Forward
	If Pina.2=1 and Pina.3=1 then goto Dual_8ch_Backward

GoForward:

	For b0=0 to 7 step 1
		Readadc a.0,w3

		If pina.1=0 then let b2=1: Endif 'set speed multiplier
		If pina.1=1 then let b2=10:Endif

		Let b1 = %00000001 << b0
		hspiout (b1)
		serout b.7, n2400_16, (b1)
		pulsout b.1,5

		
		w3=w3*b2
		w3=w3+1
		
		pause 10
		Pause w3

	Next b0

serout b.7, n2400_16,(0)
		Let pinsB =%00000000
		Let pinsC =%00000001

	For b0=0 to 7 step 1
		Readadc a.0,w3

		If pina.1=0 then let b2=1:Endif
		If pina.1=1 then let b2=10:Endif

		Let b1 = %00000001 << b0

  'Let pinsC=b1
		hspiout (b1)
		serout b.6, n2400_16, (b1)
		pulsout b.2,5
		w3=w3*b2
		w3=w3+1
		
		pause 10
		Pause w3

	Next b0
serout b.6, n2400_16,(0)
Goto main

GoBackwards:

	For b0=7 to 0 step -1
		Readadc a.0,w3

		If pina.1=0 then let b2=1: Endif 'set speed multiplier
		If pina.1=1 then let b2=10:Endif

		Let b1 = %00000001 << b0

  'Let pinsB=b1
		hspiout (b1)
		serout b.7, n2400_16, (b1)
		pulsout b.1,5
		w3=w3*b2
		w3=w3+1
		
		pause 10
		Pause w3

	Next b0
serout b.7, n2400_16,(0)
		Let pinsB =%00000000
		Let pinsC =%00000001

	For b0=7 to 0 step -1
		Readadc a.0,w3

		If pina.1=0 then let b2=1:Endif
		If pina.1=1 then let b2=10:Endif

		Let b1 = %00000001 << b0

  'Let pinsC=b1
		hspiout (b1)
		serout b.6, n2400_16,(b1)
		pulsout b.2,5
		w3=w3*b2
		w3=w3+1
		
		pause 10
		Pause w3

	Next b0
serout b.6, n2400_16,(0)
Goto main

Dual_8Ch_Forward:

		Let pinsB =%00000000
		Let pinsC =%00000001

	For b0=0 to 7 step 1
		Readadc a.0,w3

		If pina.1=0 then let b2=1: Endif 'set speed multiplier
		If pina.1=1 then let b2=10:Endif

		Let b1 = %00000001 << b0

  'Let pinsB=b1
  'Let PinsC=b1
		hspiout (b1)
		serout b.7, n2400_16,(b1)
		pulsout b.1,5
		pause 1
		hspiout (b1)
		serout b.6, n2400_16,(b1)
		pulsout b.2,5

		w3=w3*b2
		w3=w3+1
		
		pause 10
		Pause w3

	Next b0
	serout b.7, n2400_16,(0)
	serout b.6, n2400_16,(0)
Goto main

Dual_8Ch_Backward:

		Let pinsB =%00000000
		Let pinsC =%00000001

	For b0=7 to 0 step -1
		Readadc a.0,w3

		If pina.1=0 then let b2=1:Endif
		If pina.1=1 then let b2=10:Endif

		Let b1 = %00000001 << b0

  'Let pinsB=b1
  'Let pinsC=b1
		hspiout (b1)
		serout b.7, n2400_16,(b1)
		pulsout b.1,5
		pause 1
		hspiout (b1)
		serout b.6, n2400_16,(b1)
		pulsout b.2,5
		
		w3=w3*b2
		w3=w3+1
		
		pause 10
		Pause w3

	Next b0
serout b.7, n2400_16,(0)
serout b.6, n2400_16,(0)

Goto main
Leds

Code:
dirsC=%00000000
dirsb=%11111111
setfreq m16
main:

serin c.0, n2400_16, b1
let pinsB=b1

goto main
 

Attachments

OLDmarty

Senior Member
#9
Interesting step, i've never seen/used the max3335 before.

FYI, the 4067 has an Enable pin which can also be used to cascade several chips together.
Some years ago i used 4x 4067's to create a 64bit sequencer, they all shared the same 4bit addressing pins, and i simply dis/enabled each of the 4 chip-enables in sequence as counting progressed, worked a treat!

On another note, it seems the 4067 chips seem to only be available in the inconveniently wide 600mil Dip package, and the only 300mil wide option is the SOP24 surface-mount package, which is a pity, coz it's always easier to play with Dip plugin chips ;-)

Marty.
 
#10
16 channel analog sequencer with reverse, arpegio, skip, step, and rate control

Ok once again redesigned this. I found the ADG726 chip which simplified the heck out of the design. It's now two chips and has no spi or anything else. Just a binary count. You can add more chips for more channels. They have a 32 channel chip as well but I used 1/2 of it to show the leds. Here you go.

One last point. This chip can only go to VCC. IF you need 10v to drive your synth you need to level shift which is no big deal.

I am going to replace the pots with a prescision voltage source that lets you select the exact note you want. That is coming next. You can also add switches to skip steps and caps to add slide to each note.
 

Attachments

#12
ok I built the adg based sequencer finally and it all works as shown. I am using two in parallel. One is note and one is octave. I found some cheaper ($50.00) ganged pots with an led in the center knob and switch. The output of the sequencer goes to a picaxe that then selects a note and octave. This is then output to midi directly so I can select exact notes. Works like a charm. Had to mess with the values to select the notes and octaves but it worked with a 75 units between values. Since the pot is ganged with an led in the knob and forgot to mention it also has a switch built in so you can turn steps on and off its one line of 16 pots so it fit in a dual motm panel for my modular. 16 pots with led and switch inside and then the speed and direction switches. notes are on the inside and octaves on the outside. has 10 octave range.
 
Top