DTMF crushes when controlling a relay - Page 1
Forum section: electronics / projects

author: wicket
author_rank: Contributor
timestamp: March 27, 2014, 12:26:16 pm
content: I've been working on a project, where I use DTMF decoder to control high voltage loads via relays. It's simple - when a ceraint tone is detected the interrupt-on-change (StD -> RB0) is triggered and corresponding output sequence is on pins RC0 - RC3 of PIC uC is read. I compare this sequence with a predefined one and if it matches it turns the certain output (RB1) on.Problem - if I'm only controlling an LED, everything works fine. However, when I hook up a relay, it turns it on successfully, but from that point forward DTMF stops responding (it doesn't detect tones anymore) and just stays in it's final state. Does inductance of a relay have anything to do with this? I can't seem to find the reason...If you need more info, please tell.

author: David_AVD
author_rank: Super Contributor
timestamp: March 27, 2014, 12:34:19 pm
content: When you hook up the relay, are you still using the 5V supply for it?

author: richard.cs
author_rank: Super Contributor
timestamp: March 27, 2014, 12:34:29 pm
content: That's an unconventional way to connect the relay but it's unlikely to be the cause of your problem. Could it simply be that your 5V supply drops when loaded by the relay coil? Have you got anything connected to the relay contacts yet?

author: wicket
author_rank: Contributor
timestamp: March 27, 2014, 01:01:03 pm
content: Yes, everything runs from the same 5V regulator. I have nothing connected to the relay. The output from 5V regulator drops from 5.02 V to 4.98 V when the relay is turned on.

author: macboy
author_rank: Super Contributor
timestamp: March 27, 2014, 01:58:10 pm
content: Your relay driver transistor is connected strangely. More commonly, you would connect the emitter directly to ground, the relay coil to the collector, and the other relay coil terminal to +5v. Put a resistor (470 ? or so) in series with the base.Make sure that you bypass the power supply to the relay. A 100 µF or so from +5V to ground near the transistor+relay is needed.

author: wicket
author_rank: Contributor
timestamp: March 27, 2014, 02:23:30 pm
content: I've just replaced the resistor + transistor with ULN2003A (Darlington pair) driver, just to be 100% sure this part is ok. I also added 22uF cap between driver's +5V and GND. Nothing changed, it works till the relay switches on, then DTMF freezes. I can record it if it would help.Oh and by the way... If (for example) I use AND gates chip instead of PIC, it works fine, evendo I'm powering it from the same (PIC) circuit.

author: deephaven
author_rank: Frequent Contributor
timestamp: March 27, 2014, 02:47:58 pm
content: One test you could do is disconnect the relay and see if the fault disappears. That will tell you if the problem is in the software routine or due to the action of the relay operating.

author: Kjelt
author_rank: Super Contributor
timestamp: March 27, 2014, 02:49:28 pm
content: Then I suspect the 5V is dipping or interfering when the relay is powering on. You can check with scope or by seperating the Pic supply (for instance schottly diode and large elco (1000uF) for the PIC.Also it is good practice to filter the supply for any uC for instance resistor of 10 ohms and good capacitors.If the supply is not the culprit it could also be the field of the relay having some influence on the crystal clock maybe check by moving the relay further away from the PIC and also supply elco there for supply decoupling. You have to experiment a lot to find out the real cause.

author: wicket
author_rank: Contributor
timestamp: March 27, 2014, 03:23:45 pm
content: Quote from: deephaven on March 27, 2014, 02:47:58 pmYeah, I already tried that - if I remove the relay and only use an LED, it works fine. Here's the video to make it more clear. Number 2 turns the LED (relay removed) on and off, no problem. When I press number 3, it turns on the relay + LED, but everything becomes unresponsive after that.

author: London Lad
author_rank: Regular Contributor
timestamp: March 27, 2014, 03:39:33 pm
content: Mat I ask what its intended use is?

author: deephaven
author_rank: Frequent Contributor
timestamp: March 27, 2014, 03:40:54 pm
content: Try running the relay off another power supply or battery, just to see if it's power supply noise as has been suggested. You could also run the PIC in debug mode and see what becomes of the program. Also, if you have a scope, as already suggested, have a look for noise on the power supply and on the DTFM signal.

author: wicket
author_rank: Contributor
timestamp: March 27, 2014, 03:54:41 pm
content: Quote from: deephaven on March 27, 2014, 03:40:54 pmJust ran it from 9V battery and it works excellent.Othewise I'm running this from 15 V AC supply. I've just tried using 1000uF cap and it's gotten better. It works 80% of the time, but that's still not acceptable.If I want to continue using this AC supply, what would you suggest?Quote from: London Lad on March 27, 2014, 03:39:33 pmControlling high voltage devices over distance.

author: wicket
author_rank: Contributor
timestamp: March 27, 2014, 03:59:05 pm
content: Should I put a large cap before 7805?I'm actually using 22uF before and after 7805, not as specified in prevoius schematic.

author: London Lad
author_rank: Regular Contributor
timestamp: March 27, 2014, 04:05:14 pm
content: Only asked as I used a load of thesehttp://www.wirelesslanman.co.uk/sms/SOS400.htmlrecently and they only cost £50 ish for the 4 channel version and are password protected. 100% reliable so far.

author: bookaboo
author_rank: Frequent Contributor
timestamp: March 27, 2014, 04:13:08 pm
content: A back emf diode across the diode will help.Also run separate 0v and 5v lines from the regulator to the logic and relay.

author: free_electron
author_rank: Super Contributor
timestamp: March 27, 2014, 04:42:35 pm
content: the current spike cause by the relay energising reset or corrupts the pic.use a seperate regulator for the relay. or simply use a 12 volt relay and feed it power from before the 7805.

author: gxti
author_rank: Frequent Contributor
timestamp: March 27, 2014, 05:12:44 pm
content: Agreed, since the coil is not going to be picky about voltage stability just power it from the bulk supply from before the regulator. Use a low-side switch i.e. a NPN or N-MOS.

author: wicket
author_rank: Contributor
timestamp: March 27, 2014, 05:42:29 pm
content: I'll do that. Thanks.