Page 1 of 2

OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Wed Mar 01, 2017 3:35 pm
by Hackencrash
With the latest v7.40.54 version of piBeacon running on a rPi 2, I can no longer get my OUTPUT-GPIO-max-4-PINs device which I've wired-up to a relay board working.

If I manually run commands on the rPi itself, such as GPIO.output(27, False) - these work OK, so I know that physically there is no problem.

I've tried re-creating the OUTPUT device on Indigo, rebooting, etc. but I cannot get this to work. Other piBeacon plugin devices work, such as Input devices I've got connected to sensors on this rPi.

Please help me where to look

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Wed Mar 01, 2017 3:44 pm
by kw123
I need to be home to check this .... saturday / sunday

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Sat Mar 04, 2017 3:46 am
by Hackencrash
Thank you Karl - I can now confirm that this is working in v7.40.55 8)

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Sat Jul 01, 2017 11:28 am
by Hackencrash
I've got this problem back again.

I've run the following command directly on the pi to confirm things are physically working:
sudo ~/pibeacon/setGPIO.py '{"cmd": "down", "pin": "18", "values": {}}'

This successfully turns on a laser beam.

When I run the Set GPIO Pin on rPI to HIGH-LOW command from the Indigo piBeacon plugin menu, this does not work - no laser light.

When I run the UP/Down continuous command, I can see a setGPIO.py process running, but still no light.

I modified setGPIO.py to print to a log file the sys.argv value so I could see the exact command sent from Indigo and noticed that it was exactly the same as mine except that it specified a startAtDateTime value (which is missing from my command above).

I cannot work out why this doesn't work.

By the way I blocked my rPi IP address from Internet access in my router as a security feature and have since noticed the time has drifted out by a couple of minutes.

I don't suppose this would have anything to do with it perhaps?

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Sat Jul 01, 2017 5:18 pm
by kw123
I am out of town. Will check in Thursday.
Re time. The rpi does ntp to get the time.
If you have some minutes delta and the rpi is slow then it will will wait until it reaches that time the mac had when you send the command.


Sent from my iPhone using Tapatalk

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Sat Jul 01, 2017 5:25 pm
by kw123
You could setup your own ntp server on your mac and make it get its time from there.


Sent from my iPhone using Tapatalk

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Sat Jul 01, 2017 6:58 pm
by kw123
Or set the time forward and test setgpio again


Sent from my iPhone using Tapatalk

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Sun Jul 02, 2017 6:05 am
by kw123
if you like I could add an action to send the time from your MAC to the RPI w/o the need to setup a local NTP server. -- that would be the proper solution, but would require some unix config on your mac and the RPI..

this should be accurate to 0.2 sec. (do it 3 times with 1 sec delta and then do some calculations.. in principle one would need to do a return signal to find out the delay)

I am hesitating to switch from absolute time for actions to relative times. Took me some time to set this up.


Karl

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Sun Jul 02, 2017 3:05 pm
by kw123
i will have a version that can set time on the RPI from within the plugin on Thursday. still doing some some testing .
delta time between RPI and MAC should be better than 0.5 secs

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Mon Jul 03, 2017 2:15 pm
by Hackencrash
Absolutely fantastic Karl


Sent from my iPhone using Tapatalk

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Mon Jul 03, 2017 6:27 pm
by kw123
Also adding support for the RTC clock. It's $1.50 from china no shipping costs
fits directly into the i2c connector.
Will get one on Wednesday.


Sent from my iPhone using Tapatalk

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Tue Jul 04, 2017 12:24 am
by Hackencrash
Interesting... I never grasped the concept that rPi's didn't have a clock with a battery in it like PC's do


Sent from my iPhone using Tapatalk

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Tue Jul 04, 2017 8:32 am
by kw123
I ordered this one: DS3231; US $1.33; no shipping costs on eBay .

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Thu Jul 06, 2017 4:44 pm
by kw123
please check out v 7-62-121. it will sync the time automatically if off. .. and supports hardware clocks

Re: OUTPUT-GPIO-max-4-PINs device no longer working

PostPosted: Mon Jul 10, 2017 1:47 pm
by Hackencrash
Thanks Karl, this new version works great with the time - spot on to the second. I haven't tried the clock module yet.

However, I'm still suffering my original problem. Now, when I run the setGPIO command manually, I get the following:
Code: Select all
pi@PorchPi:~/pibeacon $ ~/pibeacon/setGPIO.py '{"cmd":"down", "pin":"18", "values":{}, "startAtDateTime":1499713972.042107}'
Traceback (most recent call last):
  File "/home/pi/pibeacon/setGPIO.py", line 65, in <module>
    delayStart = max(0,calcStartTime(command,"startAtDateTime")-time.time())
NameError: name 'calcStartTime' is not defined
pi@PorchPi:~/pibeacon $
I don't see any calcStartTime function inside the setGPIO.py script.

Sending the command from Indigo is shown as the following in execcommands.log which I tried to replicate above:
Code: Select all
20170710-20:12:57 next command: {u'restoreAfterBoot': u'0', u'startAtDateTime': 1499713972.042107, u'pin': u'18', u'inverseGPIO': True, u'command': u'up', u'device': u'OUTPUTgpio'}