Anyone successfully tried the Coda Effects relay switching?

Stompboxes circuits published in magazines, books or on DIY electronics websites.
User avatar
The Rotagilla
Diode Debunker
Information
Posts: 744
Joined: 20 Aug 2007, 18:24
Has thanked: 7 times
Been thanked: 61 times

Post by The Rotagilla »

DISCLAIMER - PROGRAMMING IS NOT MY STRONGEST SKILL

Link to the article - http://www.coda-effects.com/2016/08/relay-bypass-with-anti-pop-system.html

Benoit's article uses the C programming language to program the PIC and even though he step by steps it, I've run in to issues. The first time I tried to program the PIC the circuit and LED would turn on but not off, so I erased the PIC and started over. Now nothing happens and the only way I can get the relay to switch states is by connecting pins one and two of the 12F675.

Here is the layout I used - http://effectslayouts.blogspot.com/2016 ... chive.html

I have tried...

1) Copying and pasting the code into MPLab.

2) Typing the code line by line into MPLab.

3) Erasing and re-coding the 12F675 several times.

I'm not a coder but I'm guessing that brackets ("{}") are used to start and stop commands and it seems that in this part of the code the bracket in red is throwing things off.

if (state == 1) { // effect on
GP0 = 1; // LED on
GP5 = 1; // relay on
GP4 = 0; }
else { // effect off
GP0 = 0; // LED off
GP5 = 0; // relay off
GP4 = 0;
}
}
__delay_ms(10);
}

In MPLab if you click on any bracket, it will highlight the start and stop of that command and the bracket in bold red does not correspond to any command start. In fact if it's left in the code, it causes an error and you can't compile the code but if you remove the extra bracket so the code will compile but the PIC doesn't work. Any ideas?

Also, are photoFET's overly sensitive to heat? Could I have fried the photoFET while soldering it in and should I be socketing them?

Thanks in advance.
The television will not be revolutionized.

User avatar
koch1010
Information
Posts: 3
Joined: 01 Jul 2015, 12:27

Post by koch1010 »

I think it would be helpful if you would upload your complete code/project. The red bracket is actually wrong and should not be there.
I think the circuit should work even if you fried the photomos.

User avatar
The Rotagilla
Diode Debunker
Information
Posts: 744
Joined: 20 Aug 2007, 18:24
Has thanked: 7 times
Been thanked: 61 times

Post by The Rotagilla »

So I modified the code to this and got it working but with a lot of switching noise.

Code: Select all

void main(void) {
   ANSEL = 0; // No analog GPIOs
   CMCON = 0x07; // comparator off
   ADCON0 = 0; // AD ND converter off
   TRISIO0 = 0; // output LED
   TRISIO1 = 1; // input footswtich
   TRISIO2 = 0; // output TGP222A photo FET
   TRISIO5 = 0; // output activated relay
   TRISIO4 = 0; // output ground connection of the relay

   GPIO = 0; // set outputs as low level (0V)

   uint8_t state; // set the on or off state of the pedal
   state=0; // pedal off at the beginning
  
   uint8_t changestate; // changing state
   changestate=0;

   while(1) { // main loop
  
if(GP1 == 0) { // if the switch is pressed
   __delay_ms(15); // debounce
      if(GP1 == 0) {
         __delay_ms(200); // switch is off
         if(GP1 == 1) {
            changestate = 1; // changestate = 1
          }
          else {
             changestate = 0;
          }
       }
    }
    __delay_ms(10);

if(changestate == 1) {
   __delay_ms(20);
   if(state == 0) { // if the pedal is off
      GP2 = 1; // activates the photoFET (step 1)
      __delay_ms(10);
      GP0 = 1; // LED on
      GP5 = 1; // relay on (step 2)
      GP4 = 0;
      __delay_ms(30); // wait for the pop to go to ground (step 3)
      GP2 = 0; // photoFET off (step 4)
      state = 1; } // pedal is on
   else { // if the pedal is on, same steps
      GP2 = 1;
      __delay_ms(10);
      GP0 = 0; // LED off
      GP5 = 0; // relay off
      GP4 = 0;
      __delay_ms(40);
      GP2 = 0;
      state = 0;
      }
   __delay_ms(20);
   changestate=0; // reset changestate to 0 (otherwise it will switch continuously)
}
      
if (state == 1) { // effect on
   GP0 = 1; // LED on
   GP5 = 1; // relay on
   GP4 = 0; }
else { // effect off
   GP0 = 0; // LED off
   GP5 = 0; // relay off
   GP4 = 0;
 }
}
   __delay_ms(10);
}
The television will not be revolutionized.

User avatar
koch1010
Information
Posts: 3
Joined: 01 Jul 2015, 12:27

Post by koch1010 »

I think the last Part should be:

if (state == 1) { // effect on
GP0 = 1; // LED on
GP5 = 1; // relay on
GP4 = 0; }
else { // effect off
GP0 = 0; // LED off
GP5 = 0; // relay off
GP4 = 0;
}
__delay_ms(10);
}
}

But I am not sure if you really need the last if - statement. What kind of switching noise is there?

User avatar
The Rotagilla
Diode Debunker
Information
Posts: 744
Joined: 20 Aug 2007, 18:24
Has thanked: 7 times
Been thanked: 61 times

Post by The Rotagilla »

koch1010 wrote:What kind of switching noise is there?
A loud pop on both the engage and disengage, the photoFET doesn't seem to matter.
The television will not be revolutionized.

User avatar
koch1010
Information
Posts: 3
Joined: 01 Jul 2015, 12:27

Post by koch1010 »

Maybe your photofet relais is broken. Did you try to increase the delay times?

User avatar
The Rotagilla
Diode Debunker
Information
Posts: 744
Joined: 20 Aug 2007, 18:24
Has thanked: 7 times
Been thanked: 61 times

Post by The Rotagilla »

koch1010 wrote:Maybe your photofet relais is broken. Did you try to increase the delay times?
That's why I asked if photoFETs were heat sensitive, I'll order another and try it. Yes, I did try increasing the delay times but it did not make a difference.
The television will not be revolutionized.

User avatar
plush
Cap Cooler
Information
Posts: 641
Joined: 08 Dec 2015, 09:29
Location: Moscow, Evil Russia
Has thanked: 36 times
Been thanked: 172 times

Post by plush »

Guess this needs a bump.

I'm working on the similar project and it seems that Coda's code has some issues in it.
IMO the timings are set wrong so the photofet is almost useless.

User avatar
The Rotagilla
Diode Debunker
Information
Posts: 744
Joined: 20 Aug 2007, 18:24
Has thanked: 7 times
Been thanked: 61 times

Post by The Rotagilla »

plush wrote:Guess this needs a bump.

I'm working on the similar project and it seems that Coda's code has some issues in it.
IMO the timings are set wrong so the photofet is almost useless.
Agreed. I swapped the photoFET out in case I might have damaged it but the popping is still there.
The television will not be revolutionized.

User avatar
Zokk
Resistor Ronker
Information
Posts: 287
Joined: 05 Jul 2010, 20:00
Location: tantalum shortcut area
Has thanked: 211 times
Been thanked: 68 times

Post by Zokk »

Hello

I'm also interested in relay bypass tricks...
I wonder if you used the "latest" code provided by Benoit?
Look at the schematic on this page, you'll see a 1K5 resistor to pin1 of IC2, it doesn't appears on previous schematics, maybe this causes your problem?
http://www.coda-effects.com/2017/02/rel ... -code.html

I'm not a code guy, so I can't say whether the pop is due to a wrong timing in the code, bad relay (?), or wrong schematic, but on the paper those timing setups seem quite reasonable, no?

User avatar
plush
Cap Cooler
Information
Posts: 641
Joined: 08 Dec 2015, 09:29
Location: Moscow, Evil Russia
Has thanked: 36 times
Been thanked: 172 times

Post by plush »

Zokk wrote: I wonder if you used the "latest" code provided by Benoit?
Hi!

Unfortunately, my last experiment took place prior Coda's latest release.
I'm going to try both new schematic and code today. Hope they'll work.

I'm also learning C because of this relay and microcontroller stuff, so i hope to contribute someday, somehow.

User avatar
The Rotagilla
Diode Debunker
Information
Posts: 744
Joined: 20 Aug 2007, 18:24
Has thanked: 7 times
Been thanked: 61 times

Post by The Rotagilla »

plush wrote:Unfortunately, my last experiment took place prior Coda's latest release.
I'm going to try both new schematic and code today.
I'm in the same boat. This new code definitely has some changes to it. I'll see if I can fire it up tonight with the changes and we should both report back.
The television will not be revolutionized.

User avatar
The Rotagilla
Diode Debunker
Information
Posts: 744
Joined: 20 Aug 2007, 18:24
Has thanked: 7 times
Been thanked: 61 times

Post by The Rotagilla »

Loaded up the new code and it's a definite improvement. Here's my list of small issues.

1) By default the PIC is in momentary mode, I need to figure out what part of the code needs to be edited or deleted to remove this option.

2) Switching on is fairly quiet but there's still a "thwip" sound when switching the effect off.

3) Using MPLAB in free mode results in these errors but I do not think they impact this project -
:: warning: (1273) Omniscient Code Generation not available in Free mode
Warning: xclm.conf did not indicate a license directory
Using current working directory to look for and create licenses
Warning: xclm.conf did not indicate a license directory
Using current working directory to look for and create licenses

That's all I have to report at this time, getting rid of the momentary mode and "thwip" would turn this into a very nice switching system.
The television will not be revolutionized.

User avatar
plush
Cap Cooler
Information
Posts: 641
Joined: 08 Dec 2015, 09:29
Location: Moscow, Evil Russia
Has thanked: 36 times
Been thanked: 172 times

Post by plush »

The Rotagilla wrote:Loaded up the new code and it's a definite improvement.
I wonder if you've used it with the old layout or the new one.

User avatar
The Rotagilla
Diode Debunker
Information
Posts: 744
Joined: 20 Aug 2007, 18:24
Has thanked: 7 times
Been thanked: 61 times

Post by The Rotagilla »

plush wrote:
The Rotagilla wrote:Loaded up the new code and it's a definite improvement.
I wonder if you've used it with the old layout or the new one.
Ha! I realized that about 20 minutes after posting!

The new code works with the old layout. I quick-soldered the 1K5 resistor in place and it didn't do anything for the "thwip" sound when turning the pedal off. The new layout removes the diode and 47µF electrolytic but I'm not sure how (if at all) they would impact the performance of the circuit.
The television will not be revolutionized.

User avatar
plush
Cap Cooler
Information
Posts: 641
Joined: 08 Dec 2015, 09:29
Location: Moscow, Evil Russia
Has thanked: 36 times
Been thanked: 172 times

Post by plush »

The Rotagilla wrote:
plush wrote:
The Rotagilla wrote:Loaded up the new code and it's a definite improvement.
I wonder if you've used it with the old layout or the new one.
Ha! I realized that about 20 minutes after posting!

The new code works with the old layout. I quick-soldered the 1K5 resistor in place and it didn't do anything for the "thwip" sound when turning the pedal off. The new layout removes the diode and 47µF electrolytic but I'm not sure how (if at all) they would impact the performance of the circuit.

I've made it w new layout.

Works like a charm, no noise and stuff.

Layout and components placement in the attacment
Place a jumper between "Link" pads or place a dip switch to jump from non-latching switching to latching

I'll post eagle file later

Link to author's article: http://www.coda-effects.com/2017/02/rel ... -code.html
Attachments
components placement
components placement
Coda's relay, layout by plush
Coda's relay, layout by plush

User avatar
The Rotagilla
Diode Debunker
Information
Posts: 744
Joined: 20 Aug 2007, 18:24
Has thanked: 7 times
Been thanked: 61 times

Post by The Rotagilla »

Awesome!

Any noise at all when you switch the circuit off?
The television will not be revolutionized.

User avatar
plush
Cap Cooler
Information
Posts: 641
Joined: 08 Dec 2015, 09:29
Location: Moscow, Evil Russia
Has thanked: 36 times
Been thanked: 172 times

Post by plush »

The Rotagilla wrote:Awesome!

Any noise at all when you switch the circuit off?
No noice at all.

Btw i've made a mistake, you should jumper "link" pads if you want it to work as intended. Or place on-off dip switch.

User avatar
Zokk
Resistor Ronker
Information
Posts: 287
Joined: 05 Jul 2010, 20:00
Location: tantalum shortcut area
Has thanked: 211 times
Been thanked: 68 times

Post by Zokk »

Hello

please could you explain why you've removed the freewheel diode on the relay?
Usually this diode is mandatory to protect the relay against feedback voltage.

Thanks.

User avatar
oooscasianooo
Information
Posts: 7
Joined: 17 Sep 2013, 04:35

Post by oooscasianooo »

My build is having an issue trying to activate the relay. For some reason I'm not getting a consistent 5v from my Pin 2 (GP5). Without the relay in place, I measure 5v. As soon as I put the relay in, I get .02v or my meter just goes haywire and can't read a stable voltage. My LED turns on and off fine without any issue. It's just my pin 2 (GP5) that doesn't seem to be working correctly.

I suspected it might be the PIC IC having been programmed faultily, but I've used the hex directly from github. I've tried everything from powering my Pickit2 from it's own 5v source when programming, buying a pickit3, modifying the code to be a simple GP5 On or GP5 Off, but nothing is working.

I did create my own stripboard layout, but have more than 10 times checked for errors on multiple days (to let my eyes rest haha), but it looks good compared to the schematic and the diy pcb layouts posted here and elsewhere. I even used "Reapers" verified vero layout, but same issue.

All parts (relay, photofet, pic IC) were ordered from Mouser, so they're legitimate.

This is mind boggling and I'm hoping it's something simple.

Anyone have any other suggestions I can try?

Post Reply