News:

SMF for DIYStompboxes.com!

Main Menu

Bend Matrix 2 project

Started by danngreen, June 12, 2007, 05:24:50 PM

Previous topic - Next topic

danngreen

I'm actively working on a project that involves MIDI and an AVR chip, so I thought I'd document my progress on this forum...
I'm redesigning a former project I did called the Bend Matrix...

It's basically a circuit bending "master brain"/patch-bay, but it could be used as an audio signal switcher (e.g. Crossbar type thing).
The idea is that a 4x4 matrix of buttons make/break connections between jacks. The jacks could be banana for circuit bending, or 1/4" for audio switching. There's also the ability to store/recall 8 patches, and then it can even run as a sequencer by running through your 8 patches in order. there's some misc bend matrix info at http://www.commonsound.com/kits/doku.php?id=commonsound:bend_matrix
When it's done, I'll post the schematics, code, board layouts, gerber files, etc on that page too.

What I have breadboarded so far:
-AVR ATMEGA16 for the brain
-4x4 matrix of buttons with LEDs
-Random button
-Latch mode: connections stay on when you press the button. Random button picks a random patch
-Tap mode: connections are on when the button is down, off when it's up. Holding down Random button flickers through
-Two analog pots feed into the AVR's ADC, each generating an 8-bit value, which total to 16 bits that control the 16 buttons.
-MIDI input: note-on events equate to button press, note-off events equate to button release.
-MIDI output: the analog pots output CC and pitch-wheel commands (not sure what CC number to use here...selectable?)

What I'm working on:
-8 patch/sequence buttons with LEDs.. and Save and Play/Pause buttons. Storing 8 patches and being able to sequence through them at a rate set by a tempo knob. Or would up/down and BPM display be more useful? or a rotary knob?
-MIDI output for buttons: each button on the matrix acts like a keyboard key. What octave to center it around?
-non-volatile memory so it saves your patches on power-off
-better switches

The sequencer is ASMOP (I like this term heh heh)

the main thing is getting better switches.  Right now I'm using CD4066's which have 50dB of bleedthrough in OFF state. yikes! that means a 2V input signal will be about 60mV when it's supposedly OFF. This is way too audible...

There's a few other options:
MAX301 is a dual switch at 72dB, which is better... at $2.60 each from Futurlec
The ADG412 is a quad switch at 90dB, which is better yet...  at $8.20 each from Futurlec
But the Zarlink chip MT8806/8804/8816 are at 90dB and have all the switches need in one chip for under $5!
I'd like to use more commonly available chips like the 4066 or possibly even an array or multiplexors (4052?) but I haven't found any with good enough OFF state feedthrough and crosstalk. Any ideas? I read back some postings about building a crossbar switch with 4052's, did anyone do this successfully without significant bleedthrough?

I welcome any comments on this project, as I'm working on it almost every day...

Processaurus

Wow, sounds great!  For your chip dilemma, how about doubling the # of 4066s you use, and run the audio through two switches in series, connecting the control for the switches together?  That way the bleedthrough has to go through two of the switches in an off state.

danngreen

Aha, you're on to something. I just found that two CD4066 switches in series, with a resistor to ground at the point of connection between the two switches, works great for guitar. I'm inputting a 3.5V p-p signal (fuzz pedal output) and getting nothing my scope can measure or my amp can hear when the switches are off. One problem is that the resistor to ground loads the signal a bit, I get a tiny bit of tone loss using a 100k, but still more than adequate attenuation in the OFF state.

Another problem is that the OFF state attenuation seems to be related to the output impedance of the signal. At least I think that's whats happening. When I run my sine wave generator into the switches, there's very bad bleedthrough (the sine wave gen is rated at 600ohms output impedance). But my guitar or an op-amp output (at the same voltage and frequency) causes almost no bleedthrough. By simply putting a 10k resistor between the sine wave generator and the switches, the feedthrough cuts way down, but then we have a 10k/100k voltage divider which attenuates even in the ON state. hmmm.... I suppose I could use the rest of the switch to put that 10k in there when the signal switch is OFF, but there's gotta be a simplier way...

Anyways I ordered some 74HCT4066's, which seem to have more bleedthrough protection (according to the datasheets). We'll see how those perform.

kvb

#3
I found an article that could be of use
it's in http://www.discovercircuits.com - go to - schematics
then Analog Switches
4th from bottom
here: http://www.edn.com/article/CA300029.html



danngreen

Hey, that's a great idea,thanks for the link. It's just a FET shorting the signal to ground when the switch is OFF, so each switch will need a transistor inverter as well...
I'll test it out later today,and post my results.. i also tested out some other chips (DG202, and 74HC4066) with no good results yet..

I got my MM8816! I have it wired up but so far its not communicating with the uC....

danngreen

OK I tested a few things and have an interesting result...

Using 4.5V p-p square wave (CMOS generated) as an input source, I used a CD4066 running on +5V.

Measuring the output (p-p voltage)

one switch: 120mV - 200mV
two switches (series): 19mV-25mV
two switches with 100k to ground in between switches: 10mV-15mV

So we're getting about -50dB with one switch, which is very very audible. We get around -75dB with two switches and closer to -90dB if we can afford to ground the signal with a 100k in between the two switches. Hardly audible at all! Pretty good!


I also used my sine wave generator as an input source, at 1kHz with a measured output of 1V p-p.

p-p voltage:
CD4066: 430mV
CD4066 x 2: 20mV
CD4066 x 2 w/100k to ground: 10mV

Yikes, it only cuts the voltage in half with one switch! If I buffer the sine wave, it behaves like the first test (CMOS square wave). What's going on? Here's what I can figure: the sine wave gen's output terminals are rated at 600ohms, and my guess is that the CD4066 acts like a small but non-zero resistor to ground when OFF. Didn't see anything on the datasheet about this, and was surprised at my result. but it's safe enough to just buffer the signal, so this shouldnt be a problem.


Another thing I tried was the FETs...
Using a FET to ground out the signal when the switch is off didn't seem to work. It was attenuating the signal by about half when the FET was supposed to be off. This doesn't make sense to me, I tried a bunch of different FETs (2N5484/85/86, ECG133, 2N3819) with the same results. I've used FETs as audio amps but never as analog switches, so maybe I'm doing something wrong.
I ran the drain to ground, the source to the audio signal, and the gate to a resistor that I manually switched between ground and v+. Using a 10k resistor to ground at the gate, the FET loads the signal down from 4.5V to 1.5V. With the resistor to V+, it loads it down to about 0.5V
Anyone with experience using FETs for switching? Am I just using the wrong FETs?

danngreen

OK, I tried the FET in series, and it works much better. I basically built from the diagram below, except I convertedit to use an N-channel FET 2N5485 (the schematic has a P-channel)


I ran R1 and R2 to +5V instead of ground, and used 100k's for them instead of 10k's. I used 1uF's for C1 and C2. I also omitted C3, C4, R5, R4, and Q2. I took the 1M (R3) to +5V for "ON" and to ground for "OFF"

It blocks a high-gain guitar signal completely. When I use my sine wave generator, it totally blocks the signal up until I input about 4.5V p-p (must be because I'm using a 5V system). I can hear the input signal sometimes, but when I remove the FET from the circuit, the bleedthrough doesn't change, so it must be coming from the fact that I'm using unshielded wire on my breadboard.

I haven't tested how fast switching time is, but it seems to be dependant on the RC constant of C1*R1 and C2*R2.

Anyways I don't know why I couldn't get it to work in parallel yesterday, but this is much better because if this is used before each 4066, the same signal can be used to switch the FET as the CD4066 (0=OFF, 1=ON).

Or better yet, this could possibly be used alone instead of a 4066 (or double up two FETs in series...?)

Well, I still have my MM8816 crosspoint switch sitting here, begging me to finish programming the uC to control it. I'm torn between using it since not many places sell it, and I intend to make a kit for the Bend Matrix... the zarlink chip is so cool, but 4066's will never go out of style ;)

danngreen

Ok, well I got the MM8816 crosspoint chip working with an AVR. very cool chip! I get super crosstalk/feedthrough rejection, I can't even measure it. I'm very pleased (the minor issue of needing a negative powersupply isn't so bad, a 7660D works great).
The biggest hurdle I had was realizing it needed a RESET after being started up. Duh. Also, I read somewhere else on this forum that someone needed to add 1ms (1us?!) after a STROBE pulse. I tried this at first but didn't need it. YMMV. I'm using an 8mHz clock (ATMEGA16). I hope this thread serves to inspire and help anyone else doing something similar...

I wired the MM8816 as 2 separate 2x4 matrices. That way, 8 mono signals could be independantly switched to 2 stereo signals, which you can't do as with simple 4x4 matrix. I only want 16 crosspoint connections on this thing, at least for the first version. I think there's a smaller Zarlink chip that might work for me

Now I'm working on the sequencer, getting the BPM to be accurate. I'm considering a 3-digit LED display....

austin

Another possibility for the switching is the H11F1/2/3 series optocouplers.  I tried for a long time to use them as a variable gain in a tremolo without success, but they do work well as a switch.

danngreen

Quote from: austin on July 15, 2007, 04:18:50 PM
Another possibility for the switching is the H11F1/2/3 series optocouplers.  I tried for a long time to use them as a variable gain in a tremolo without success, but they do work well as a switch.

hmmm.. looking at the datasheet, >300Mohm off-state resistance, sounds good. at $3.60 each, it's not the cheapest option (i'd need 16). One of the applications in the datasheet is for electronic music, so i suppose it can attenuate without distortion? Why did it fail as part of a tremolo?

austin

The datasheet does list gain controll as an application, but I could never make it work right.  I needed it to be able to smoothly ramp the gain from full off to on over around 6 seconds.   What would happen is that with a real small control current, the signal would start to come in, but it was really distorted.  Once the control current increased a bit, the audio would clean up, but it just wasn't acceptable for what I needed.  From what I remember, at low control currents, the audio signal would distort at really low levels, definitely way less than 100mV.

Check out the other variants, I believe the H11F3 is quite a bit less expensive.   

danngreen

just ordered some HR11F3's from digikey at $1.50 each @ qty 10.... For the 16 switches i need, the price still comes out about $20 more than using CD4066's or an MM8816, but theyre smaller and easier to find than the mm8816. i'll see how they perform in my situation... thanks for the tip!

I know what you mean about the distortion that comes in at low control currents with semiconductors: when i was developing the tremulus lune, I tried a bunch of things including FETs and transistors, and found the same thing: clean signal most of the time, but distortion right before they shut "off". I suppose this is due to non-linearities that semiconducters seem to have near the "zero point". not sure what this is technically... anyways I ended up falling in love with photocells (always pure resistance, no weird distortions)

danngreen

Been a while since I updated the forum on my progress, but I've done a lot on this project!

BPM indicator: I used a 4511 and another 'HC595 to control a 3-digit 7-segment LED display for showing the BPM. The AVR draws one digit each time around the main loop, (so in slow motion 240BPM is 2-- then -4- then --0) It goes fast enough that there's no flicker. This technique saves having to have three 4511's or a MUX/latch.
The tempo rotary knob steps the BPM up/down in increments of 5, from 5BPM to 995BPM

EEPROM: Saving each of the eight patches now saves directly into EEPROM. This means that when the power is off, your settings are stored. The drawback is that EEPROM has about 100,000 write-cycles, so it won't last forever. But 100,000 is a lot of "saves"! Anyways thanks to the Tutorial on avrfreaks.net for explaining how to use the built-in EEPROM.


TODO:
* Draw up preliminary schematic (I'll post it here so y'all can know what the heck I've been talking about all this time ;) )
* Draft panel layout. I think I have all my hardware and controls sourced. Everything mounts to the board, even the banana jacks. Only 1/4" jacks, if desired, will have to be wired. I think I'm going with frontpanelexpress. i don't know any alternatives and their prices are decent.
* Receive feedback/double check p's and q's/cross t's and dot i's and then draft the pcb! I'll go wth pcbfabexpress most likely, decent prices for low quantities.

Somewhere in this process I'm taking a trip to south america. So there will be a break, but I'll resume mid-November. I hope to have the schematic and panel layout by then.

danngreen

OK! I've got something... here's a link to the Bend Matrix schematic:
http://4mspedals.com/bendmatrix2/bendmatrix2.pdf

And a sample panel layout:
http://4mspedals.com/bendmatrix2/layout.pdf

And the C code:
http://4mspedals.com/bendmatrix2/bendmatrix2.c
http://4mspedals.com/bendmatrix2/bendmatrix2.h


I don't expect the layout to be 100% self-explanatory... I'll label everything clearly in a future post.
This thing isn't simple to decribe, but I think that's the beauty of its versatility!

Right now I'm packing my bags to go hike around the andes! hasta luego!

swt

Hey dann!! i live 300 miles from the andes...and will be in bariloche from sept 9 to 16...when are you comming?. Where are you plannig to go?? Wish we can met here...

danngreen

Quote from: swt on September 03, 2007, 08:24:11 AM
Hey dann!! i live 300 miles from the andes...and will be in bariloche from sept 9 to 16...when are you comming?. Where are you plannig to go?? Wish we can met here...

im in La Paz, Bolivia right now... just got done hiking around Lake Titicaca... eres en Argentina? haven't been there yet but SA sure is a nice place! I'm dreaming of setting up a little electronics shop here... heh heh... anyways in the mean time between treks i might work on the pcb layout for the bend matrix, as i have the schematic all drawn up and a lot of down time!

danngreen

OK, I got the pcb's in from pcbfabexpress, got the panels from front panel express and we've put 2 together with the other 3 in progress:

photos!!



danngreen


dano12

Hey Dann, that is incredible. A really great idea and great execution.

I'm builing a modular fuzz 'synth' and am looking at using front panel express--are you pleased with their work?


danngreen

I liked front panel express, you get what you pay for and they're not cheap. The aluminum was sturdy and the routing was smooth and nearly exact (there were only slight [20mil??] rounded edges to the square corners we ordered). We paid about $55 per 12x10" panel, which is a good price for 2mm thick aluminum. You pay for convenience, too, as we can find a better price using some local guys who have a router, but quality and delivery date isn't as guaranteed. Also, if we were ever to go to production with a panel like this, Front panel express's small quantity discounts wouldn't keep us with them. In short, it's a great service for prototypes and small batches that you need perfect and quick.