Page 1 of 1

Relays are not switching

Posted: Sun May 08, 2022 5:31 pm
by Smokeyghost
I am in the process of setting up BierBot for the first time and I have hit a snag where my relays wont actuate via the BierBot software. They work when I run the test script provided with the software but they wont do anything via either the automatic or manual process of configuring a fermentation controller. In either case, ive gotten the GUI to indicate that the system is in cooling mode, but my relays fail to switch. In fact, as soon as the software starts to run, the lights for the two relay channels i have configured with the software turn off. If i dont run the GUI, the lights for the two relay channels remain lit, indicating they are receiving power. I will add that i configured the relays to be "inverted" and i do not have a load on the relays. Not sure if either of these are causing me to have issue when running my test. Also, here is a snapshot of the logs.... To me, it looks like the software is attempting to active relay 1 (GPIO16) but for some reason, that relay, when checked for continuity has not switched from normally closed over to the normally open position.

INFO:root:set relay 1 to 0
INFO:root:set tempsensor 0 with id 3c51f6491cbd to 17.9375
INFO:root:received new target state 1 for epower_0_state
INFO:root:setting relay 1 (GPIO 16) to 1...
INFO:root:received new target state 0 for epower_1_state
INFO:root:setting relay 2 (GPIO 18) to 0...
INFO:root:sleeping for 15000ms
INFO:root:starting request
INFO:root:set relay 0 to 1
INFO:root:set relay 1 to 0
INFO:root:set tempsensor 0 with id 3c51f6491cbd to 17.9375
INFO:root:received new target state 1 for epower_0_state
INFO:root:setting relay 1 (GPIO 16) to 1...
INFO:root:received new target state 0 for epower_1_state
INFO:root:setting relay 2 (GPIO 18) to 0...
INFO:root:sleeping for 15000ms
INFO:root:starting request
INFO:root:set relay 0 to 1
INFO:root:set relay 1 to 0

Re: Relays are not switching

Posted: Mon May 09, 2022 6:24 pm
by Bernhard
Hey Smokeyghost,

sorry to hear you're having trouble. But to me it sounds like you're almost there.

You say the relays are properly actuated when you use the testscript? If you've used the testscript "as is", not only two but for GPIOS are tested: 31, 33, 35, and 37. Chances are if you only configured two of them, you've used the two wrong ones. Maybe trim down the testscript to the GPIOs you're using for the real thing and give it a shot.

Inverting can make a difference. Easiest way to turn the relays on/off for testing is the following: Create a mashtun, assign one relay to heating, one relay to agitation / pump. Save. Head over to manual mode. Now: Setting target temperature ABOVE current temperature should turn the heating relay on. Setting the target temperature BELOW the current temperature, should turn it off. Turning on and off the stirring will help to debug the other relay.

I fear that you just have to play a little bit around. The fact, that the testscript runs fine indicates that most likely some GPIO numbers were not set correctly as the "real" programm (main.py) uses the exact same method.

Let me know if that helped,
Bernhard.

Re: Relays are not switching

Posted: Wed May 11, 2022 11:50 pm
by Smokeyghost
Thanks for the quick response and for the recommendations. Sounds like i am close so i will keep plugging at it. Thanks!

Re: Relays are not switching

Posted: Wed May 25, 2022 3:53 pm
by Homebrewer46
Hello. I had the same issue as the above. The test script worked with the relay and the bricks.log showed that it was recieving commands and everything.
I followed these commands when installing
"git clone https://github.com/BernhardSchlegel/Bie ... erryPi.git
cd BierBot-Bricks-RaspberryPi
sudo pip3 install -r requirements.txt
sudo python3 setup.py"

I want to point out I'm not very familiar with python scripts or permissions.
But I tested running (in the application folder)
"sudo python3 main.py "
And now it's running in my terminal BUT it works. Manual mode works and I can switch the relay on and off using the web-gui.

My question is, what have I done wrong when installing this? It must have to do with rights? Maybe someone else ran into the same thing I've done.
I did the same misstake in that case on my Raspberry pi 4 as I installed it on that one aswell for troubleshooting, same issue. I'm currently running on a Raspberry pi B+.


Update:
For some reason now it works as it should. I've rebooted it a couple of times and I can still controll the relays.

Re: Relays are not switching

Posted: Wed May 25, 2022 6:06 pm
by Bernhard
Hey Homebrewer46,

thanks for sharing!

You need the "sudo" in front of the "python3 main.py" for the Python process to run on an escalated level. This is necessary for controlling GPIO.

The BierBot service (setup for automatically when running the "sudo python3 setup.py") sets up the main.py to be executed automatically at startup with escalated rights. This is why it works after a reboot.

Cheers,
Bernhard.