Delay in Digital ON/OFF switches

It takes almost 30 to 60 seconds to turn ON and OFF the digital switches.

Once you click the virtual button, it revolves and becomes inactive after 30 to 40 seconds delay and vice versa.

May I know the reason why it is too slow?

This is pretty much the same thing from over here Arduino Yun - Generic Digital Output issues - #2 by adam

Are you using a wireless connection? Using a wired connection can help reduce the frequency. Also refreshing the page right after you click with refresh the button value and allow you to click it again.

But I am not using Arduino. I am using Raspberry Pi 2 with a USB WIFI adaptor.
I want fast response from the digital switches. It should turn ON or OFF on user choice.
Requesting you to please fix this problem within a week if possible.

1 Like

This is likely due to the WiFi connection. I’ve experienced similar, switched to a wired ethernet connection, and it improved to be very fast.

Perhaps we can try to resend commands if there is no response within x amount of seconds (which we already do to some extent), but a solution for what you are experiencing would not be out within a week.

My advice for immediate resolution is to switch to a hard wire connection.

-B

Definitely NOT a WiFi problem-
Hmm- my GPIO switches act the same way, trying to figure it out now. I THINK it’s due to the GPIO input not being tied high. All my Python tests work with my inputs/ tests when I use internal pullups. This SHOULD be a choice in the GPIO PIN setup on the device.

It’s working perfectly using my little Python GPIO test program.

I’m getting unreliable data from all my GPIO inputs without using pullups while using Cayenne at this time.
I’m sure it’s got something to do with Pi internal pullup-

I’m building a comparison with and without a pullup. and let you know :slight_smile:

import time
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)  #RJ48 Orange
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP)  #RJ48 Blue
GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP)  #RJ48 Green
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)  #RJ48 Brown
GPIO.setup(24, GPIO.OUT)  #Relay1
GPIO.setup(25, GPIO.OUT)  #Relay2
GPIO.output(24, 0)    # Preset relay1 OFF
GPIO.output(25, 0)	# Preset relay2 OFF		

while True:
	if GPIO.input(18):
            print ("Switch 1 is 1/HIGH/True - Relay 1 remains OFF")  
            GPIO.output(24, 0)
        else:  
            print ("Switch 1 is 0/LOW/False - Relay 1 winks ON")  
            GPIO.output(24, 1) 
            time.sleep(0.2)
            GPIO.output(24,0)

	if GPIO.input(27):
            print ("Switch 2 is 1/HIGH/True - Relay 2 remains OFF")  
            GPIO.output(25, 0)
        else:  
            print ("Switch 2 is 0/LOW/False - Relay 2 winks ON")  
            GPIO.output(25, 1)
            time.sleep(0.2)
            GPIO.output(25, 0)
            
	if GPIO.input(22):
            print ("Switch 3 is 1/HIGH/True - Relay 1 remains OFF")  
            GPIO.output(24, 0)
        else:  
            print ("switch 3 is 0/LOW/False - Relay 1 winks ON")  
            GPIO.output(24, 1)
            time.sleep(0.2)
            GPIO.output(24, 0)
	
        if GPIO.input(23): 
            print ("Switch 4 is 1/HIGH/True - Relay 2 remains OFF")  
            GPIO.output(25, 0)
        else:  
            print ("Switch 4 is 0/LOW/False - Relay 2 winks ON")  
            GPIO.output(25, 1)
            time.sleep(0.2) 
            GPIO.output(24, 0)

Having the same issue with Raspberry Pi B.