DIYstompboxes.com

DIY Stompboxes => Digital & DSP => Topic started by: potul on January 03, 2007, 06:45:38 PM

Title: PIC question
Post by: potul on January 03, 2007, 06:45:38 PM
Hi All,

First of all forgive me if this question is really not suitable for this forum, as it's not directly related to audio but to PICs.
The point is that I'm trying to develop my own programable switcher/looper using some concepts of the ASMOP remote switching and other stuff. I want to keep it as simple as possible and I'm using a PIC 16f84. It will have 4 presets (x 10 banks) activated by 4 momentary stompswitches, and 6 loops + 2 switches.
In order to have a status LED for each preset I "multiplexed" the input pins , so they act as an input for the preset change and as an output for the LED. The pins are usually set as an output and only configured as input for a moment when checking the switch status, as this is done quickly enough, the LED doesn't flick at all.

I've connected the LED and switch as follows:

(http://usuarios.lycos.es/mapesicc/sw_led.jpg)

(I had to add the 68k to make the switch low state detection reliable)

I've breadboarded it an it works fine, but I want to double-check with the experts if it could be damaging something in the PIC. My knowledge of electronics is quite basic and I determined the R values by trial-error, so I don't know if this could be dangerous for the PIC or have any undesired effect.

Another question I have:
I was planning to use CMOS switches instead of relays to make it simpler and cheaper, but I realized that if I do so I will need to add DC blocking caps and bias all the signals before the CMOS switches. Taking into consideration this and the fact that I will need to supply power and ground to the ICs..... will it be more complicated than the normal Relay +  driver setup?

Regards,

Potul
Title: Re: PIC question
Post by: David on January 04, 2007, 08:29:35 AM
I can tell you two things and they are going to conflict, so you will have to make up your own mind.

The first thing is that the CD4053 switcher on GEO will give you the tools to implement DPDT switches electronically and reliably.  For what it's worth, I also had good results with a breadboarded "Wicked Switch" from "the Tone God"s site.  A more telling piece of information, and one you probably won't like, is what's contained in the switching subsystem of the ASMOP project - also on GEO.  Relays.  If they're there, R.G. had good reason to put them there.  Start with the electronic switching.  If you run iinto difficulties, resort to the relays.
Title: Re: PIC question
Post by: potul on January 04, 2007, 01:51:10 PM
Hi David,

thanks for the advice.... I will try the CMOS in a similar configuration as the "wicked swithc" first, with minimum extra parts and see if it works for me or I switch to relays. I suppose I will need relays anyway for the amp channel change...

Anyone has a hint on the other topic? (multiplexing in / out in one pin)

Potul
Title: Re: PIC question
Post by: David on January 04, 2007, 03:27:25 PM
Quote from: potul on January 04, 2007, 01:51:10 PM
Hi David,

thanks for the advice.... I will try the CMOS in a similar configuration as the "wicked swithc" first, with minimum extra parts and see if it works for me or I switch to relays. I suppose I will need relays anyway for the amp channel change...

Anyone has a hint on the other topic? (multiplexing in / out in one pin)

Potul

This is where R.G. found out how to do it:  www.piclist.com
Title: Re: PIC question
Post by: potul on January 05, 2007, 05:58:51 AM
Thanks for the link. This is where I firtt looked and grabbed most of the ideas, but couldn't find an answer to my concrete question.
I will go on with the configuration I tested and see what happens.

Potul
Title: Re: PIC question
Post by: Rex Karz on January 09, 2007, 02:24:43 AM
One thing I have found with PIC's and Stamps is that they do not like to see long wires attached to the input pins. If you are confident that the pulldown resistor is low enough, cool, but better would be to optoisolate them.
Title: Re: PIC question
Post by: potul on January 09, 2007, 08:48:31 AM
Thanks for the advice. But I don't fully understand what you mean. What should I optoisolate? All inputs/outputs if I need long cables?
Title: Re: PIC question
Post by: David on January 09, 2007, 09:21:32 AM
Quote from: Rex Karz on January 09, 2007, 02:24:43 AM
One thing I have found with PIC's and Stamps is that they do not like to see long wires attached to the input pins. If you are confident that the pulldown resistor is low enough, cool, but better would be to optoisolate them.

Rex:

Please explain the optoisolation comment.  I've usually seen this applied only to MIDI circuits.  However, there are many MIDI devices on the Internet that do NOT require optoisolation.  In fact, I've built several and they worked without any problems.

Also, FWIW, I had input wires about 18 inches long on one circuit I was working on.  I saw no problems with it.  I'm not contradicting or challenging you, I'm trying to understand what you mean.
Title: Re: PIC question
Post by: Rex Karz on January 10, 2007, 07:47:00 PM
Hi guys,
In my instance, I used a multi-cable from my pic to the pedal board (The pedal board is 4 feet long and has 8 switches). The cable was about 12-15 feet long. What happens is stray RF and EMF gets coupled to the cable and ends up at the pins with enough voltage to affect the controller.

As to optoisolating, I would just use ic opto's and design it with a low enough impedance that stray currents would be not enough to turn the circuit on.

Title: Re: PIC question
Post by: Rex Karz on January 10, 2007, 07:52:54 PM
If you would like me to expand or even throw up a circuit or 2, let me know.

I would isolate all inputs and outputs. Outputs would be isolated if they are relays. Which I use and recommend. I don't like the CMOS stuff in my audio path, but that's more my stubborness.... besides, relay lots are so cheap, and they never fail. (Almost never)
Title: Re: PIC question
Post by: potul on January 14, 2007, 03:42:49 PM
Ok, thanks for the clarification. I will try anyway first without isolating, as I will not be using a separate floorboard.

Potul
Title: Re: PIC question
Post by: RaceDriver205 on January 27, 2007, 09:24:44 PM
Before you touch a soldering iron, I am just about to post something you might like the look of.
Check DSP forum for RF Switcher.
Title: Re: PIC question
Post by: FredCDobbs on July 10, 2007, 01:58:12 PM
It is better to have the LED & its resistor connect to +5. 

Then run your switch to ground.

Saves two resistors and matches the input levels of the PIC correctly.