Replacing a membrane switch with a relay for automated testing

Hello,

I have a battery operated device that we are testing for component durability and suitibility (battery and motor). Instead of cycling the device with a membrane switch, as we are doing now, I built a simple relay circuit to replace the switch and control with my UNO. I wanted to do it this way, because in theory it would not add additional power to the device, just cycle it as the switch would and we can get some basic data to see if we are on the right track.

The code is a modified blink program with a counter that I borrowed from the forums. pin 12 set to high, delay for 2000ms, set pin 12 low, delay for 5000ms, add one to count, repeat if less than 200.

The relay circuit is simple as well and uses a 5VDC reed relay powered by the UNO it self. (see attached pictures)

When I test the relay setup with a motor and power it with a seperate battery, it performs as it should and is very responsive regardless of the delay settings.

When I connect it to the switch circuit (see attached picture), it will cycle once and start skipping cycles after that. the longer the delay with the pin set to low, the more often it will respond as it should.

My questions are:

Is this a reasonable approach?

What is causing the skipping?

And how can this be corrected to operate as an automatic switch, without adding or subtracting power from the device it self?

Any thoughts are appreciated.

So one relay contact is connected to TP1 and the other goes to TP2?

That is correct. I don't know if the resistor and capacitor shown in the schematic will interfere with the switching via the relay or it is an issue with using a relay in this fashion.

I'm looking at your circuit photo. Which transistor is that? Is it E-C-B? Is the transistor's emitter connected? I see the black wire coming over from Ground connected to the row shared with an LED's lead. You don't really need a transistor, you can run the reed relay from the pin directly, but you [u]still[/u] need the diode.

I'm not really following your setup. I can see the approach of using a relay to isolate your system under test from the Arduino, and that makes perfect sense. But the bottom diagram you posted doesn't show using a relay, as far as I can work out. Are you actually connecting it directly via that circuit, now? Why have you stopped using the relay?

The transistor is a 2n3704 and it is connected properly. I forgot about the led being in there, please ignore it, it has been removed. The relay works with or without the transistor, can hear it clicking away. Nice to know that I don’t need it. I was just following the schematic I found online.

I am trying to replace the membrane switch in the schematic (pic 3 in my original post), which is a totally separate device with its own pic processor, with the relay controlled by the arduino. Please see the hacky MS paint attachment. Unfortunately, I cannot show the entire schematic.

The basic test is to switch the device on and off until it is no longer functioning and test the battery voltage at every 200 cycles. Currently, the batteries are lasting 3,000-7,000 cycles. This will make your finger pretty tired after a few thousand cycles.

It basically works as setup in the attachment below, the issue is it will skip cycles randomly. When I connect just the motor and battery from the device to the relay, it works like a champ. We measured the resistance of the original membrane switch and it is ~65 ohms and the relay ~5.

I don’t know what the issue is, nor do I really know how to find it. I included the schematic for the original switch, because there is a resistor and a capacitor and my thought is maybe they are interfering with the relay.

I am pretty new to all of this so thank you for putting up with me.

burakzilla: It basically works as setup in the attachment below, the issue is it will skip cycles randomly. When I connect just the motor and battery from the device to the relay, it works like a champ. We measured the resistance of the original membrane switch and it is ~65 ohms and the relay ~5.

By 'motor and battery do you mean you just connected a completely different circuit through the relay to prove it was closing properly?

When you say 'skip cycles' do you mean the circuit under test doesn't behave as if the 'membrane switch' had been operated, or do you mean the relay isn't closing? You can test for closure by measuring the voltage difference across the switch.

If the relay is significantly lower resistance than the membrane switch it is simulating, it may affect the circuit under test. To avoid the risk, you could put a suitable resistance in series with the relay.

Have you confirmed that the coil circuit and the switched circuit inside the relay are electrically isolated from each other? They should be, but it never hurts to double check.

Is there any other electrical connection at all between the circuit under test, and the Arduino? Any shared power supply you forgot to mention, or anything like that?

By 'motor and battery do you mean you just connected a completely different circuit through the relay to prove it was closing properly?

Yes, that is exactly what I mean. I wanted to verify that the relay circuit itself is functioning properly, which it would appear that it does.

When you say ‘skip cycles’ do you mean the circuit under test doesn’t behave as if the ‘membrane switch’ had been operated, or do you mean the relay isn’t closing? You can test for closure by measuring the voltage difference across the switch.

The relay does close and you can hear the audible click, but sometimes it will not trigger the device like the membrane switch does. It happens randomly. If you run 20 cycles, it may skip on 2 and 18 and the next run of 20 cycles, skip or not actuate on 3 and 10, for example. I will test for voltage difference across the switch as you have mentioned.

I have tried to put additional resistance into the relay circuit, but I will try several other configurations.

I will also check to see if the circuits are actually isolated. they do not share any power or ground, as far as i can tell they are totally seperate, but will test to confirm.

I will follow up with what i find. Thanks!

Do you have a diode back-biased across the relay terminals? Definitely necessary to dissipate the surge at turn off.

Also the relay may have more contact bounce than the membrane switch and its debounce circuitry. The circuit under test may be quickly cycling on off on off... half of the time ending up off!

Could you leave the tested equipment intact and just use a servo to rig up an artificial 'finger' to press the membrane switch for you?

Dragiosis.. Maybe the relay contacts have more bounce than the membrane switch and the circuit's own debounce isn't enough - as others suspect - and warrant "remediation":

http://www.zen22142.zen.co.uk/Design/debounce.htm

Key question. You say "skipping cycles". Just the device or the relay, too? In other words, if you put a scope (or voltmeter) on the relay contacts and then on the relay coil do you see a skipped cycle on the relay contacts, the relay coil, or both?

Also 2000 ms seems long to simulate a finger press. Use 500.