PIC based silent switching switch matrix

Started by tempus, May 26, 2009, 01:11:25 PM

Previous topic - Next topic

Dave_B

I spent most of the first few months just trying to make the simplest code work.  Once things started coming together, my abilities accelerated quickly.  I still look at old code and cringe, but I probably always will.
Help build our Wiki!

trendyironicname

I like c best but to get your feet wet and led's flashing and things moving, I'd suggest going with something along the lines of a basic stamp or picaxehttp://www.sparkfun.com/commerce/product_info.php?products_id=9195.  You could get the picaxe up and running in an evening with very little to have to think about. They're geared toward education and have really good documentation and free software.   Basic's a good place to start imo.  At any rate, you can do it.  Be it two weeks or two years.
There are 10 types of people in the world, those who understand binary, and those who don't.

tempus

Ok....


I guess I'll have to PIC away (LOL) at the programming side of things. I didn't think that part of it was going to be easy - I've heard plenty of cautious advice since I looked into this. The tutorials I've looked at have been the 'turn an LED on then off again" kind of thing, and they don't seem too tough to grasp. I kind of figured that the programming I need to do (which is 'turn a MOSFET on then off again') would be similar. I've already bought a PIC programmer, so unless there's a good reason to use another manufacturer, I'll be sticking with it for the time being. I've just gotten to the point in this design where I can't go any further until I place an order and start actually working with hardware.

I'm also hoping to avoid spending a ton of $ to get into using uProcessors. I don't really do a lot of electronics work - essentially I build things that I need either because it's way cheaper or (in the case of my pedalboard) I can't find what I need commercially. Is that unrealistic? Is getting into uP an expensive proposition?

Thanks

mdh

Honestly, I think in this case the programming that's necessary truly is of the "hello, world" variety (as I said in the other thread on this topic).  Of course I'm assuming that the OP has a correct understanding of which I/O pins can be used in which ways, but if that's all in order, it really is just a matter of turning LEDs on & off, metaphorically speaking.  I think switching to a "friendlier" controller would probably be false economy, because that would likely result in a uController with fewer I/O pins, and would require learning about serial protocols.  That could hang things up for a long time.

Is there something I'm missing here?

tranceracer

Quote from: tempus on May 26, 2009, 06:26:48 PM
QuoteI too am working on a program to get a PIC to alternately pulse two pins for a latching relay.  Are you programming in Assembly or C?

I haven't gotten my PIC yet, so I don't know what I'll program in. Is one easier than the other? I'm sure I'll be posting here for some programming advice in the next little while...

I've programmed in both languages  and I prefer C.  Assembly is too abstract for me and I don't have the time to relearn it right now.  I'm by no means, even a competent C programmer though I've done it as part of my prereq-engineering back in the 80s.  (I remember more C than I do Assembly)

As great as this forum is and I'm sure you'll get a lot of constructive assistance here, I'd recommend also signing up on the MicroChip PIC forum for assistance. 

Quote from: tempus on May 26, 2009, 06:26:48 PM
I'd also be interested in seeing your code if you didn't mind, just to see if I'm on the right track when I do start.

I'll be happy to share w/ you my code as I progress.  Initially I'm just using loops to get the PIC to pulse latching relays and moving into more complex code from there.

Two books I've found helpful that explain C in the context of the PIC are:
PIC Micro-controller Experiments for the the Evil Genius by Myke Predko
Beginner's Guide to Embeded C Programming by Chuck Hellebuyck

The PICKIT2 is a good starting point because you get the 16F690 processor and a compiler.  Hellebuyck takes you step by step how to setup your compiler and how to use it and the programs are pretty much plug an play so you can get LEDs flashing pretty quick.  You seem to be pretty resourceful so you should be able to take snippets of the different programs, modify them to your specific code i.e. change the RA pin values etc. to fit your needs.

The downside of these to books are, Predko's book references the discontinued PICKIT1 development board but has cool code like debounce and some switching programs. The Hellebuyck's book is full of syntax and typo errors but is a a better basic tutorial to get up and running and references the PICKIT2 developers board.

Keep me posted on the progress!   ;D

MoltenVoltage

In my opinion, learning assembly code first is essential if you want to understand how microcontrollers really process information.  It will make the transition to C, and programming microcontrollers in general, a whole lot easier.  Knowing C without knowing assembly is fine if you just want to do simple switching, but if you want to build a strong foundation, learn assembly first.

It took me three months of pulling my hair out to wrap my head around microcontrollers, but then it finally started clicking and I haven't looked back.

I hope you like reading.
MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!

tempus

After all this discussion, I realized something earlier this morning:

My design won't work anyway.

I forgot about the fact that even when not biased those MOSFETS will still conduct a little, so even in bypass mode there would be some (definitely audible) leakage from each effect. I'm sill going with the uC, but I'm going to have to come up with a better design to control it with. Dammit - I thought I had it this time.

Oh well, back to the old drawing board...

snap


tempus

Quotehow about the good old diode matrix?

Not sure what that is. Can you elaborate?


iaresee

Why not just use switch relays for every loop?

tempus

That's the design of my current pedalboard, and the pops from switching are life threatening. I wanted to go to a solid state switching design to eliminate this problem, and also to eliminate the acoustic noise of the relays switching.


R.G.

R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

iaresee

Quote from: tempus on May 28, 2009, 12:34:56 PM
That's the design of my current pedalboard, and the pops from switching are life threatening. I wanted to go to a solid state switching design to eliminate this problem, and also to eliminate the acoustic noise of the relays switching.

I have none of these issues with the relay-based looper that I use. Your pedals will be always on which eliminates the pops you usually get as input caps discharge quickly when you switch the effect off/on. The noise of the relays switching is no louder than the noise of my foot on the switch or my pick against the strings -- it's a noise that disappears with even a moderate amount of volume from an amplifier.

tempus

QuoteP channel JFET.

I may be looking more deeply into that RG, but I've got 1 other thing I'd like to try first. More on that later.

QuoteI have none of these issues with the relay-based looper that I use

You're lucky. I built mine a few years ago and have tried everything under the sun to fix the problem, to no avail. I need to build a bigger board anyway, and I want to have phantom power for a buffer built into my cable, so I figured I might as well redesign the whole thing. As I side note, I'm sure the relays aren't the problem, because I did try some CMOS switches in my existing board. When I breadboarded them, they were all but totally silent, but as soon as I put them into my pedalboard, the pops were every bit as loud. I'm just sick of screwing around with that design, and since I actually have a totally (and I mean totally) silent design here I'd like to pursue it and see if I can actually get a working model.


MoltenVoltage

Are you using diodes on your relays to prevent the back EMF?
MoltenVoltage.com for PedalSync audio control chips - make programmable and MIDI-controlled analog pedals!

tempus

QuoteAre you using diodes on your relays to prevent the back EMF?

Yes. Well, not any more. I had them in there for a while, but I'm using a ULN2003 to drive the relays. When I found out that it had the diodes built in, I took the relay diodes out. The only thing I've been able to find as a possibility is a 4v (!?) spike lasting about 60ms at the output of the ULN2003, which I'm not sure how to get rid of. Also, the wires connecting my pedals to the relays are not shielded. I don't know if this could be a source of noise pickup or not.


tempus

RG you mentioned using a P channel JFET. In earlier discussions the JFETs we were talking about were N channel. Would the P channel JFETs be always off until a bias was applied to the gate?

R.G.

Quote from: tempus on May 29, 2009, 01:48:38 PM
RG you mentioned using a P channel JFET. In earlier discussions the JFETs we were talking about were N channel. Would the P channel JFETs be always off until a bias was applied to the gate?
No, they are depletion mode, too. They are on until you turn them off by raising the gate Vgsoff volts *above* the channel voltage. In other words, the simplest way to use them is to hold the drain and source at zero volts (at ground in a negative ground, single supply circuit) and turn them OFF by pulling the up towards the positive power supply with a high value resistor. Turning them on only requires pulling the gate back to ground.

Except for the fact that their gates need driven with negative logic (low voltage = 1 or on, high voltage = 0 or off) and the approximately doubled price over N-channel, I've never been able to understand why they don't get more use. The whole business of holding an N-channel up a few voltage and then pulling its gate to ground seems unnecessarily complex.

But that's just me.   :icon_lol:
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

MetalGuy

QuoteRG you mentioned using a P channel JFET.

It's used most of the time for eliminating realy pops in tube amps. Check out ENGL E530, Mesa DR, Peavey 5150 etc. In those designs you don't even need an MCU.

tempus

QuoteIn other words, the simplest way to use them is to hold the drain and source at zero volts (at ground in a negative ground, single supply circuit) and turn them OFF by pulling the up towards the positive power supply with a high value resistor. Turning them on only requires pulling the gate back to ground.

I'm unsure what you mean here. Let me see if I've got this straight:

D = 0v
S = 0v - so do you ground the drain and source (through a 1 meg or so resistor I'm assuming)?

Quoteand turn them OFF by pulling the up towards the positive power supply with a high value resistor.

Should this read 'pulling the gate up ...' or 'pulling them up....' (as in the drain and source)?

If gate is the answer, you basically use these the same way I was trying to use the MOSFETs, only with reverse logic? IOW:

D = 0v
S = 0v

G = 0v for on
G = 5v for off.

Is that right? If so, could this type of JFET be driven directly from a PIC? And, with the drain and source at 0v (instead of at 1/2 V+) is there any clipping of the incoming signal?

Is it possible to ask so many questions in the same post?

Thanks RG