OPTO RELAY - setting GPIO - HELP

Hello,

it is possible to set in OCTORELAY the option that the relay switches on and immediately switches off during the ON action, and remains switched off. It will do the same with the OFF action (turns on and immediately turns off, and stays off). Do you have any suggestions. could it be set in OS command ON and OS Command OFF???

Thanks

The problem is that OctoRelay wasn't made for this. Yes you could put it in the OS command field but then plugin would still indicate an on state.

You could do it with PSU Control and put the on/off gcodes into you start gcode.
You probably also need this subplugin PSU Control - RPi.GPIO

May I ask what you're doing?

That's what I'm after. I have a device that starts and turns off with a short pulse, when I turn it on, I need the icon to indicate on, but the relay goes on and off - then the relay is still off. The same when switching off - the icon indicated switching off and the relay was switched on - switched off - then the relay was still switched off. Do you have any idea?

Is there any way you could use a seperate IO point to monitor the actual state. It's hard(imposible) to really know the state of what you have described. Showing something is in one state that is really not in that state is a recipe for disaster. It would be better if you had the trigger IO Point do as you described but have another IO point capable of knowing the real state of the thing the trigger just turned on or off. Using the PSUControl PlugIn with GPIO sub(as mentioned by @PrintedWeezl ) would allow you to set up the 2 IO points one for trigger and one for sense.

Well I got a way to do it with the OctoRelay plugin, but the indicator doesn't work. It reads the pin state so unless you change the code it shows the real state.

It still does what you want. I also looked for a way to do everything in the plugin, because I don't know if you feel comfortable with ssh.

First the technical side - those are the bash commands we use:

pi@octopi:~ $ echo "17" > /sys/class/gpio/export  
pi@octopi:~ $ echo "out" > /sys/class/gpio/gpio17/direction
pi@octopi:~ $ echo "1" > /sys/class/gpio/gpio17/value

I use GPIO 17 for the relay in this example.
First we export the pin we want to use, then we set it to output and the last one turns it off (the logic is inverted).

So what we do now is to enter

echo "1" > /sys/class/gpio/gpio17/value

into the OS Command ON box.

Then we enable another relay (which we're only use to execute the other two lines once) and enter

echo "17" > /sys/class/gpio/export && echo "out" > /sys/class/gpio/gpio17/direction

into that OS Command ON box.

Set the other relay to an unused pin like 4.

Now just click on save and we're ready to go.

You now just have to enable the second relay just once every time you restart the pi and relay one should just send a short pulse.

I also tried the active on start option for the second relay, but for some reason the OS Command isn't executed that way.

If you feel comfortable with ssh we can also look for another way that doesn't need the second relay workaround.