NOOB relay based switching questions.

Started by Nocaster Cat, November 26, 2017, 08:31:06 AM

Previous topic - Next topic

Nocaster Cat

I've been messing with relay based switching and have the code where I want it but have run into two issues that I could use input on.

1) On a couple of my builds (overdrive/distortion pedals) I'm getting what can best be described as a squeak or metallic ping that comes through my amp whenever the relay switches to the ON state. I'm pretty sure it's not the coding so could I have a microphonic part somewhere? The relay? The switch? Anyone else run across this and is there something I can do to quiet it?

2) I'm using the short shaft SPST momentary switches from Mammoth Electronics and sometimes the pedal doesn't switch smoothly/cleanly. For example...

   - The circuit will be on but the LED is off and I have to hit the switch again.
   - I'll go to turn the pedal on or off and will have to double tap it to work

This doesn't happen with every switch and it also doesn't happen every time so I'm thinking it's not a coding issue (but wanted to be sure). Does anyone else have experience with these switches and did you run into the same issue?

Thanks in advance.

GibsonGM

1) is likely a mechanical noise, as the relay contacts move physically to complete the circuit, and then they instantly equalize different DC levels as well.    You could try some sort of R-C network to delay how loud your signal starts out (I'm trying to picture how this would look but am still on my 1st coffee...).   Hard to say more without a sound sample. 

2) you may need a bounce-free circuit after your SPST to make the switching reliable and repeatable.  Something simple, probably - minimum parts.
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

Gus

this has been posted about over the years at this forum.
Look at GEOFEX
search this forum
search for switching using relays on the web.
are you using a flyback diode on the coil?
How are you switching low side, high side, what device are you using as a switch, what voltage is the coil, what resistance is the coil, etc.?


Transmogrifox

Schematic of the circuit, microcontroller and code would be a good start for getting help.

1) Is this a short sound when the relay engages, or an ongoing whine?  Is it a latching relay or standard?
2) Without a schematic we can only guess how it's wired and take a stab in the dark.

#1 & #2 sound like they are rooted in lack of switch debounce routine.  Also not sure what your code is doing with the SPST or how the LED is being driven.   The symptoms sound like buggy code that fails to apply good switch debouncing to me..



trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

Nocaster Cat

Quote from: Transmogrifox on November 26, 2017, 08:33:40 PM
Schematic of the circuit, microcontroller and code would be a good start for getting help.

1) Is this a short sound when the relay engages, or an ongoing whine?  Is it a latching relay or standard?
2) Without a schematic we can only guess how it's wired and take a stab in the dark.

#1 & #2 sound like they are rooted in lack of switch debounce routine.  Also not sure what your code is doing with the SPST or how the LED is being driven.   The symptoms sound like buggy code that fails to apply good switch debouncing to me..

Microcontroller - PIC 12F509

Relay - Panasonic TQ2-L-5V Latching

As far as the sound I'm hearing, it's a metallic ping which I'm assuming is the sound of the relay switching states and it only happens when I hit the switch (it happens in conjunction with the "tick" you normally hear, it's just coming through my amp). I have incorporated the relay into several builds and most of them are very quiet. I spent some time with the pedal that suffered from the noise issue and I reduced the pinging noise by lowering the output of the gain recovery stage but somehow (and I suspect through circuit design error) it seems the normal noise of the latching relay is being picked up and amplified. I posted on another forum and someone suggested making sure the power going to the pedal circuit and the power going to the relay circuit are decoupled.

The switch issue turned out to be a faulty switch. Note to self...always check the obvious.

Juan Wayne

I would definitely have decoupled power supplies. Still would be interesting to see how you are driving the relay, if there's a flyback diode and all. Otherwise, something's gonna fry.


Rixen

to provide flyback protection on a bipolar relay coil like that you need 4 diodes, preferably Schottky, bypassing to the supply rails.. at the moment you are relying on the built in protection the micro has on the pin, and it is unlikely to be rated for repetitive use. Here's one I did with 2 relays and BA870-04 diodes that come as two in a SOT23 package



..and in practice (only one relay fitted):