3

I have an Arduino controlling a relay. I was taking a look at the timings using a logic analyzer and at the onset of the relay switching, it quickly switches again.

This seems to be occurring randomly and I thought it could be highlighting a problem with my code but I wondered if it might just be a 'relay bounce' due to the speed of the switch. I've attached an image below. Any feedback is greatly appreciated. Thanks.

enter image description here

  • 3
    It's probably just bounce. – Majenko Nov 18 '15 at 23:27
  • Increase the sample rate and you may get a clearer idea. – Chris Stratton Nov 19 '15 at 6:13
  • 1
    you would probably get a better answer in electronics.stackexchange.com although usually as soon as they see the word "arduino" they usually bump things over here lol. Do you have the relay connected directly to the arduino pin or are you switching through a transistor and if so, on which side are you measuring it. That will give you a much better idea. For all intents and purposes, it does just look like bounce. – Madivad Nov 19 '15 at 11:54
  • Thanks for the replies guys. Madivad: it is connected directly, however it's one of the module boards (tinyurl.com/ph5pozj) so there may be a transistor it's going through there. I just thought of using a solid state relay so that may shed some more light on whats going on. Thanks again for your help – oduffy Nov 28 '15 at 10:03
  • If you can, attach the LA to both sides of the relay so that you can watch the signal controlling the relay as well as the relay output. That should make it much easier to tell what is happening. – dlu Dec 18 '15 at 22:09
3

According to your plot, the pulse length is 50 microseconds. Typical mechanical relay switching time is 10 milliseconds, which is 200 times longer. It's next to impossible that the pulse is due to your software powering the relay back on for a moment, since the relay simply could not react to such a short input pulse.

So yeah, it's just a bounce. You can safely ignore it in most cases, unless you're counting events or doing something similar. In the latter case, there are both hardware and software debouncing techniques, which share the basic idea of a low-pass filter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.