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.