-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Hi fourstix!
Hope this is the correct place to post this question/issue...
First, thanks for sharing this library! I have been using it to build a simple connected garden - lights, water and monitoring.
I have experienced a problem, whereby after some time the Relay 'locks' to the 'on', and requires a full power-down of the Raspberry Pi I'm using. Thank you for reviewing this comment, and for the time and effort you have shared freely.
I first posted this issue over at the Spark Fun forum,
https://forum.sparkfun.com/viewtopic.php?f=105&t=53752
Posting here under the guidance of Sparkfun technical support, Brandon Williams, who suspects this may be a software issue.
In a nutshell, everything works as expected, to start, I can read the Firmware number, connection status, and I can turn on/off repeating every few minutes. After a while (most recently, after a hour) all i2c busses look filled, the blue status light persists, and the device (Rasp Pi) will not function until a complete power down (not 'just' a reboot). Attached is a i2cdetect showing normal operation, and then, 'stuck'.
My code (all dependencies are installed, and tested working):
#!/usr/bin/python3.7
import time
import board
import busio
import sparkfun_qwiicrelay
import atexit
loop = 100
delay = 240
i2c = busio.I2C(board.SCL, board.SDA)
relay = sparkfun_qwiicrelay.Sparkfun_QwiicRelay(i2c)
def exitclean():
relay.relay_off()
def main():
atexit.register(exitclean)
if relay.connected:
print('Relay connected')
else:
print('Relay does not appear to be connected')
exit()
print('Firmware version ' + relay.version)
for _ in range(loop - 1):
print('{} of {}'.format(_ + 1, loop))
relay.relay_on()
if relay.status != 0:
relaystate = 'On'
else:
relaystate = 'Off'
print('The relay status is {}, holding {} seconds'.format(
relaystate, delay))
time.sleep(delay)
relay.relay_off()
if relay.status != 0:
relaystate = 'On'
else:
relaystate = 'Off'
print('The relay status is {}, holding {} seconds'.format(
relaystate, delay))
time.sleep(delay)
print('Finished')
if __name__ == '__main__':
main()
I hope this may help others, or, may be a simple fix which I can share with others on the SparkFun forum.
Christian