I'm using 8 of the GPIO to trigger relays for a Christmas light controller I am building. Everything works, and the GPIO output correctly, but 1 of the 7 GPIO pins output is delayed. Specifically it is GPIO 6 (pin 31 on my pi zero). Is there something that I should know on why this is happening? I can't seem to find a good answer. I am using node.js by the way and the onoff library, but it was doing something similar in python too.

Side Note: I'm going to try a different pin when I get the chance to try and see if it helps

  • I always feared that people were hanging Christmas tree's off their GPIO PINs.. this just confirms it all.
    – Piotr Kula
    Nov 1 '16 at 19:13
  • 1
    On a serious note... when you say delayed - I can only assume that its a noticeable delay to the human eyeball processor. So that means longer than 600ms (Mohammed Ali that would be >485ms but you are not him) Are you sure its just not your slow relays?? Another problem may just be the OS you are using, ie Raspbian does not guarantee it will do something at a specific time, it only knows that something is queued up and if it gets time it will try and do it. So maybe try RiscOS.
    – Piotr Kula
    Nov 1 '16 at 19:14
  • Timing isn't super critical in this application. I'm talking about seconds here. Not milliseconds. All other relays are triggering at the same time (more or less but for this application the same time). It is actually like a 3 second delay between all 7 other relays and this 1 relay when triggered all at the same time.
    – frdmrckr
    Nov 1 '16 at 20:53
  • 3 second delay. That is not good and very odd. You would have thought it is within the millisecond range. Using Node.JS it should be pretty quick. Is the delay from the node server to GPIO or from the Client to GPIO? I wonder if its somekind of client lag?
    – Piotr Kula
    Nov 1 '16 at 20:55
  • 1
    yeah, try a different pin. If it doesn't work there, write a much simpler, one pin piece of code, and see if the relay is borked. (this past weekend I found a relay that was flakey after a couple of hours focused on my code).
    – stevieb
    Nov 1 '16 at 23:27

Alright, after a few hours of poking around at it, I tried: - Different Pin - Different GPIO Module - Simple Test Code

Results: Appears it very well could be the relay. I was able to see a pattern that the more I used it the longer it took to switch. But the icing on the cake was when after a while it just stopped switching all together on that single pin. Lead's me to believe it's a faulty relay to be replaced.

  • 1
    Just to double check: You are sure those relays are intended to be controlled w/ 3.3 V logic, right? Not just that they work coincidentally? If not you could just have one who's sensitivity wavers on a threshold, sort of like the first canary in a coalmine.
    – goldilocks
    Nov 2 '16 at 13:03

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.