-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility to have gpio outputs inverted #13
Comments
Tack för idén, Jonas! Inverting the output would of course be quite simple in the program logic. But additional parameters in the channel configuration would always make the user interface a bit more complex - something we try to avoid if easily possible. Olli |
Hi Olli!, Borrowed picture from https://forum.arduino.cc/t/4-channel-relay-board/268035/4 Most of them seem to have this type of setup, the channels have common vcc and to activate the relay the input needs to be pulled low. |
Hi Jonas,
State chart
In case of ESP32 failure:
|
Hello Olli, the main thing is that I want the relay that I am controlling to be energized when the channel in Arska indicates up and is green, most external relayboards seem to use a low signal to energize the coil but some a high signal. I tried "Target State" set to "DOWN" but then it seems like the channel allways indicates "Down" and never turns (high) on regardless of how the rules are set, tried with "P diff to avg 24h". I think the "GPIO user-defined, inverted" is the way to go to solve this, you do however need to consider how you initialize the outputs so that they are set high (if inverted!) before they are set as outputs, in the Arduino enviroment I do something like this in setup: #define Relay_1 38 |
Hi Jonas, About that "Target State set to DOWN" thing you mentioned, A few points about rule conditions - hopefully, these will explain the case - please let me know if not:
I tested with ESP32/LilyGo with integrated optoisolated relay modules following code and
|
Hello Olli, thanks for the advice about "Target State set to DOWN"!, with that workaround the rules works during normal operation but it´s just a little confusing when you look at it as the channel will indicate down when rule 1 is fulfilled and the external relay will activate, and rule 2 will indicate up and the external relay is deactivated when rule 1 is not fulfilled. However, if I the rules are set so that rule 2 is up that puts the gpio high to have the external relay deactivated and then restart the board with the reset button the external relay will go on/off after approx. 22 seconds, when the wifi has been connected, duration maybe 0,5 second. It happens right after the wifi is connected, probably when this line is printed on the serial: and the turns high and deactivates the external relay when this lines is printed 0,5 sec later: You will probably not see this with the internal relayboards that use an active 1 to activate the relays. //Jonas |
Hi Jonas, Olli |
Hello Olli, it should solve the confusing down/up workaround, and if the inverted gpio’s are initialized high the ”click/click” behaviour should go away during startup. //Jonas |
Hello Olli, on my local version I did this: and , this solved the issues for me so the relays don´t go "click-click" during startup and the rules work normaly. You could probably create a new "set_channel_relay_inv" and "set_gpio_pinmode_output_inv" that do this and is called instead if "GPIO inversed" is selected. //Jonas |
Hi Jonas, Anyway, pinMode is needed only once per gpio, but now it is called before every digitalWrite. Maybe removing excessive calls to pinMode helps. I just pushed latest version (not well tested) to devel branch. It makes pinMode call only in init. Olli |
Hello Olli, I poked in your latest 0.92-RC3 from the install page and it seems to work!, you can however see a brief blink ( not enough to energize the relay ) a couple of seconds after powerup. //Jonas Edit: //Jonas |
Hi Jonas! Thanks for the link. There seem to be ...fast versions for AVR environments but I couldn't find them for ESP32. I could not see blinks on my test board with test led and no change in the relay. Maybe the capacitance of the connected relays slows down the change - and normally there is some kind of relay connected. But let's see if this (blink) could cause problems in some future setups - then there is probably a possibility to fix it with software or hardware (capacitor?). Olli |
Hello,
looking thru the schematics of many of the relayboards with optoisolaters available for arduino/esp/rpi etc. most of them need a low pulldown signal to activate the relay.
So maybe there should be an option of some kind that the output could be inverted?
//Jonas
The text was updated successfully, but these errors were encountered: