Author Topic: CD4018 latching relay bypass.  (Read 1156 times)

digi2t

  • Awesome!
  • ****
  • Posts: 4592
  • Total likes: 1280
  • "Digital? Any idiot can count to 1!" - Bob Widlar
CD4018 latching relay bypass.
« on: June 23, 2018, 10:18:04 AM »
I'm troubleshooting a V1 Silver Rose bypass problem. LED switches on/off, but the 5v relay doesn't flip. From what I can see, it's driven by a CD4018. I found a CD4018 driven relay circuit on the net which works around an IR remote, but I'm still wondering how it would apply to a momentary switch deal, so my troubleshooting is kind of bogged down right now.



I'm assuming that Q1 acts as the latch, which the relay does in this case. I'm tracing down the 5v source right now. Can anyone throw me a bone?
Dead End FX
http://www.deadendfx.com/

Asian Icemen rise again...
http://www.soundclick.com/bands/default.cfm?bandID=903467

"gigantically smaller."  - pinkjimiphoton

R.G.

Re: CD4018 latching relay bypass.
« Reply #1 on: June 23, 2018, 10:53:15 AM »
I'm still on the first cup of  coffee, so be gentle.   :)
The CD4018 is a "divide by N" chip with a Schmitt trigger input on the clock. The clock input can be driven from a sloppy, slow-edged signal and still work OK because the Schmitt trigger action cleans this up into a sharp edge inside the chip. The 4018 can be set to work as a divide by 2  by connecting pin 1 to pin 5, as shown in the receiver diagram.

So it's a flip flop, clocked by whatever is hung on the clock input, which can be sloppy. I'd have to see the actual circuit to guess why the LED works but the relay doesn't. If it's like the receiver circuit, the LED operating would mean current was going through to the transistor base, which eliminates the 4018, LED, resistor, base and emitter as problems. That could leave the transistor with an open collector, the relay as being open, the catch diode being shorted, or the relay as being faulty. Best next step is to measure the voltage on the transistor collector. If it toggles up and down, you have a problem with the relay. If it stays high, or stays low, there are other issues.

The whole circuit is not necessarily driven by 5V. Check the voltage on pin 16 and on the catch diode. Even a 5V relay could be driven from 9V in some cases. Unless you know that 5V is involved, it may be running on some other voltage. The 4018 and transistor would be happy up to about 18V if power dissipation didn't get them.
R.G.

Quick IQ Test: If anyone in a governmental position suspected that YOU had top-secret information on YOUR computer, how many minutes would you remain outside a jail cell?

digi2t

  • Awesome!
  • ****
  • Posts: 4592
  • Total likes: 1280
  • "Digital? Any idiot can count to 1!" - Bob Widlar
Re: CD4018 latching relay bypass.
« Reply #2 on: June 23, 2018, 11:41:51 AM »
OK, this is what I've traced out so far.



Am I safe in assuming that if the LED is working that the 4018 is OK? Bad relay perhaps?

Off to take a resistance reading of the coil.

EDIT: Coil resistance matches datasheet. I should mention that the relay is a 1 coil latching type (Panasonic TQ2-L-5V), which will switch every time coil polarity is switched.
« Last Edit: June 23, 2018, 11:54:23 AM by digi2t »
Dead End FX
http://www.deadendfx.com/

Asian Icemen rise again...
http://www.soundclick.com/bands/default.cfm?bandID=903467

"gigantically smaller."  - pinkjimiphoton

digi2t

  • Awesome!
  • ****
  • Posts: 4592
  • Total likes: 1280
  • "Digital? Any idiot can count to 1!" - Bob Widlar
Re: CD4018 latching relay bypass.
« Reply #3 on: June 23, 2018, 12:42:17 PM »
Tested pin 1 of the 4018. It flips between 0 and +8.98 (adapter power) each time I hit the footswitch.

Updated the schematic...


Dead End FX
http://www.deadendfx.com/

Asian Icemen rise again...
http://www.soundclick.com/bands/default.cfm?bandID=903467

"gigantically smaller."  - pinkjimiphoton

digi2t

  • Awesome!
  • ****
  • Posts: 4592
  • Total likes: 1280
  • "Digital? Any idiot can count to 1!" - Bob Widlar
Re: CD4018 latching relay bypass.
« Reply #4 on: June 23, 2018, 01:22:07 PM »
OK... that cap between the + of the relay and the 4018 is not making sense to me.

Firstly, when ever I plug the pedal in to the adapter, the LED comes on right away, but the effect is in bypass. The LED will turn on/off with the footswitch, but effect is always in bypass.

I just tested the relay with a 9v battery. With the pedal off the adapter, I applied + voltage to the + pole of the coil and I hear it click on. I plug the adapter back in, LED comes on, effect is on. I hit the bypass switch, LED and effect off (bypass). Hit the footswitch again, LED on, effect stays in bypass. 
Dead End FX
http://www.deadendfx.com/

Asian Icemen rise again...
http://www.soundclick.com/bands/default.cfm?bandID=903467

"gigantically smaller."  - pinkjimiphoton

diffeq

Re: CD4018 latching relay bypass.
« Reply #5 on: June 23, 2018, 01:38:12 PM »
OK... that cap between the + of the relay and the 4018 is not making sense to me.

It's  RC differentiator:

0V-->9V going pulse front creates positive voltage ramp-to-ground, 9V-->0V going pulse front creates negative voltage ramp-to-ground. Some relays need inverse polarity to switch. That's what this cap is providing, positive and negative spikes. Apply -9V to the relay "+" and see if it clicks.
« Last Edit: June 23, 2018, 01:40:26 PM by diffeq »

digi2t

  • Awesome!
  • ****
  • Posts: 4592
  • Total likes: 1280
  • "Digital? Any idiot can count to 1!" - Bob Widlar
Re: CD4018 latching relay bypass.
« Reply #6 on: June 23, 2018, 02:05:11 PM »
OK... that cap between the + of the relay and the 4018 is not making sense to me.

It's  RC differentiator:

0V-->9V going pulse front creates positive voltage ramp-to-ground, 9V-->0V going pulse front creates negative voltage ramp-to-ground. Some relays need inverse polarity to switch. That's what this cap is providing, positive and negative spikes. Apply -9V to the relay "+" and see if it clicks.

OK Tony, I see what you mean. I must be getting negative spike, but not positive spike. Since I can set the relay with the battery (+9 to relay +, simulating + spike), it does click on, and then off when I use the footswitch, but not back on with the footswitch.

I just tested the cap, which is supposed to be a 10uF, but my meter gives me a shade over 3uF. Cap not giving enough of a spike perhaps? Should I try another cap in parallel?
Dead End FX
http://www.deadendfx.com/

Asian Icemen rise again...
http://www.soundclick.com/bands/default.cfm?bandID=903467

"gigantically smaller."  - pinkjimiphoton

R.G.

Re: CD4018 latching relay bypass.
« Reply #7 on: June 23, 2018, 02:05:22 PM »
OK, makes more sense.

The 4018 is indeed acting as a simple flipflop. It's an odd use of a fancy chip, and I've have used a CD4049 and gotten the LED driver free, but then I didn't design this and I wouldn't necessarily be trying to obscure the design. Maybe they just had a lot of excess 4018's in the bin.

The LED works because they spent a whole opamp (!!) on an LED driver to just indicate what state the flipflop is in.

The capacitor is the key to how the relay works and I suspect why it's not always working.

The single coil latching relay requires you to push a pulse of current through the coil on one direction to set it, and a pulse of current the other direction to make it set the other way. It's just like a marble in one of those two-section cafeteria plates. It takes a push to get it over the hump between sections, then an opposite push to get it back over the hump the other way. Well, OK, it's done with magnets and coils and things, but the idea is the same.

The coil goes to ground. So the capacitor is charged to the power supply voltage when the Q1 output is high. When the 4018 Q1 output goes low, the cap's + terminal is clamped to ground by the CMOS output, and the cap's (-) side goes below ground. This sucks a bunch of current out of the relay coil's (+) terminal. This flips the relay one way. The capacitor then charges down to 0V across it through the relay coil, the current tailing off as the cap discharges. When the 4018's Q1 goes positive again, the cap's (+) terminal is pulled up to the power supply, and the cap's (-) terminal pulls the relay coil high, pushing current into the relay's (+) teminal, and flipping the relay the opposite direction.

So far, so good. But details always matter. The relay has to be driven with (1) enough current in the pulse (2) for a long enough time to reliably flip states. So the 4018 output has to be able to (1) source and sink enough current to flip the relay and (2) be a big enough capacitance to keep the current above the flipping current long enough to make the relay actually change state. If the cap gets too small, flipping is not ensured. If the cap goes high internal resistance, flipping gets erratic. If the power supply voltage sags too low to put enough charge into the cap, erratic or no flipping. If the 4018 can't ...quite... pull enough current both ways, bum flipping on the relay.

I've used the capacitor flip/single coil relay circuit before, but it's not my first choice. The theoretical efficiency of using one flipflop (the 4018 in this case) and one cap instead of more logic to do an alternate action latching relay is overshadowed in my mind by the disadvantages. But then I didn't design this.

If I were you, I'd test the relay by removing the cap in series with the coil and temporarily soldering a next-bigger cap with its (-) lead in the hole to contact the relay (+) terminal. Then you can manually make the relay flip by alternately touching and holding the cap's + lead to the power supply, then ground. If the relay flips reliably, there were issues with the 4018 current or the cap. If it doesn't, the relay or the power supply voltage have issues.

The CD4018 lists its output current capability at a 10v supply as "typically 2.6ma".  Great. Another useless datasheet "typical". They do give a "typical" chart of output current versus voltage that kind of shows that it can pull 5-10ma to within a few volts of the supplies. So maybe it can do 10ma OK on each capacitor flip. Or it clamps and elongates the pulse or some such.

My choice for this kind of work is the CD4049, which has a typical output of 16 ma. There's that "typical" again. The typical (ugh) graphs show it pulling 32-40ma to within 2 volts of the supply. So it has a much higher current capability.  It's output can, for instance, drive an LED through a resistor directly. You can make three of the six gates do the flip-flop, LED driver, and cap driver in a similar circuit, and have three more inverters to play with. But again, that's just me.

R.G.

Quick IQ Test: If anyone in a governmental position suspected that YOU had top-secret information on YOUR computer, how many minutes would you remain outside a jail cell?

digi2t

  • Awesome!
  • ****
  • Posts: 4592
  • Total likes: 1280
  • "Digital? Any idiot can count to 1!" - Bob Widlar
Re: CD4018 latching relay bypass.
« Reply #8 on: June 23, 2018, 02:48:19 PM »
Did another test, loosely based on what you've suggested. This pedal is all SMD, so I'm avoiding having to do any solder work unless really necessary.

With the pedal disconnected from the power supply, I used a battery as the + trigger. Connected the battery negative to coil negative, and touched battery positive to the + side of the cap. Relay clicked on.

I plugged the pedal into the power supply, and with a jumper, touched cap + to ground. Relay clicked off.

Can I assume then;

- cap is supplying enough of a spike either way for the relay to work.
- 4018 is defective, providing enough current to power the LED, but not enough to flip the relay on. Maybe internal low resistance to ground within the chip allows enough current to ground (turns relay and LED off), but not enough positive current to turn relay on.

Dead End FX
http://www.deadendfx.com/

Asian Icemen rise again...
http://www.soundclick.com/bands/default.cfm?bandID=903467

"gigantically smaller."  - pinkjimiphoton

digi2t

  • Awesome!
  • ****
  • Posts: 4592
  • Total likes: 1280
  • "Digital? Any idiot can count to 1!" - Bob Widlar
Re: CD4018 latching relay bypass.
« Reply #9 on: June 23, 2018, 03:13:22 PM »
AWWWW FOR THE LOVE OF PETE!!!!

My power supply is the problem. All this time I was using my trusty Morley adapter (9vdc - 300mA). Then, thanks to R.G.'s breakdown, the word "current" started washing over my brain.

Pulled out my Boss PSA adapter (9vdc - 500mA).

BINGO!!! All is well in the universe.

This is one current hungry pedal. :icon_rolleyes:

Thanks for the guidance guys.  :icon_biggrin:

Dead End FX
http://www.deadendfx.com/

Asian Icemen rise again...
http://www.soundclick.com/bands/default.cfm?bandID=903467

"gigantically smaller."  - pinkjimiphoton