PSU Control - Dropping RPi.GPIO

@XAMCTBO I don't see any issues with your log but there's not much there. I'm going to guess you've got a wiring problem. Follow Troubleshooting · kantlivelong/OctoPrint-PSUControl Wiki · GitHub

@boostoman If 0.1.10 isn't even working for you then you've got a hardware issue whether its bad component or wiring.

What's weird is that both of you are using GPIO14 which is a UART pin. Have you tried another?

1 Like

octoprint (10).log (3.6 MB) Thanks for the feedback. I have tried both GPIO ports 3&4 and the same issue. as soon as i change the GPIO pin in the plugin to the switching GPIO pin which the sense cable is connected the relay's state changes from open (off) to close (on). but i'm unable to control the the relay vial the plug in. when I change the pin to another pin number on the plugin to another pin which the sense wire is not connect the relay state changes from close (on) to open (off). i even tried to turn off the sensing in both app. just so see if that is causing any issues but without any luck.

after doing this testing my conclusion is that its not a hardware issue. if it was i would be then i will not be able to control the relay by changing the GPIO number. it seems there is a bug in the plugin that when ever i select the correct. or it could be a setting in Octopint it self.
does OCTOPRINT have any section in the options to control the GPIO pins.

FYI. i have disabled all apps which are related to the GPIO pins as well just to be sure there is no conflict.

attached is my updated logs

HI.
got you new log
added debug on both plugins
octoprint (4).log (242.1 KB)
attached serial log
serial.log (43.2 KB)
and did get you little messy my setup(it`s not done yet)


power pin 2(5V)
Ground pin 34
signal used pin 40(GPIO 21)
relay: 5V Relay Module SRD-05VDC-SL-C 250V 125V AC 30V 28V DC Arduino Flux Workshop | eBay
PI
Genuine UK Raspberry pi 4 8gb ram | eBay

PI is updated
GPIO pins have no root access:
tested by script py.(from your Wiki)
on pin 18(by owner of this script)
on pin 21(edited by me)

pi@octopi:~ $ sudo python script.py
LED on
LED off
pi@octopi:~ $ python script.py
LED on
LED off
pi@octopi:~ $

pi@octopi:~ $ ls -l /dev/gpiomem
crw-rw---- 1 root gpio 246, 0 May  2 11:27 /dev/gpiomem


dtoverlay=spi0-cs,cs1_pin=14 - comment out - just in case 


I have the same issue like boostoman - powering up PI - it loads up. when system see used pin 21 it powers up printer and after nothing happens. cannot switch off/on.
when changing GPIO pin in settings (PSU control RPI -switching to pin 20) it powers off relay.

GPIO14 - you got it on logs - only because it was just for test - in case GPIO21 was busy/taken by different system... default using GPIO 21

Which script in the Wiki? Link? Ah nvm you're referring to stack overflow. Did that script work?

  • "No access to /dev/mem. Try running as root!"

See Access GPIO pins without root. No access to /dev/mem. Try running as root!

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
print "LED on"
GPIO.output(18,GPIO.HIGH)
time.sleep(1)
print "LED off"
GPIO.output(18,GPIO.LOW)

YEs it did work - result upper :slight_smile:
led on
led off

Yeah just noticed you were referring to stack overflow. does that script work?

yes, tested with sudo without sudo
both PIN`s 18 and 21
both came back with led on/off

But does the relay turn on/off?

on GPIO 21 now tested - relay didn`t act on it :frowning:
have to start looking in PI setup

Right. So check the GPIO pin with a multimeter to see if it's high/low and go from there. Once you get it sorted I'd like to request trying without PSUControl-RPiGPIO as the core plugin should work fine.

@boostoman try that simple LED script as well. Make sure you're using the same GPIO pin.

need to do bit resource to understand how to do it :slight_smile: (not profi in this )
I`ll get back to you when I finish with test :slight_smile:

to do a test I used multimeter - unplugged by green cable from board and pluged test one
(unplugged black from relay - used to connect to multimeter)
commands used

pi@octopi:~ $ echo "21" > /sys/class/gpio/export
pi@octopi:~ $ echo "out" > /sys/class/gpio/gpio21/direction
pi@octopi:~ $ echo "1" > /sys/class/gpio/gpio21/value 
pi@octopi:~ $ echo "0" > /sys/class/gpio/gpio21/value 


Results:
echo "1" - on 3.22V
echo "0" - off 0V 

it passed multimeter test :white_check_mark:
can you direct me where I can look more?

So if what you pasted above plus the led script pass. Then I'd look at the relay next. Disconnect the output connections on the relay and do a continuity test between the output pins. When turning on they should short and off should be open circuit.

well it`s plugged in now.
i done test - connected to GPIO 21
Connected Ground
(all back)
unplugged TX60
connected multimeter - showed 0 (set on 200V)
plugged PSU and turn on it
PI started booting
multimeter 0
Pi fully booted
then green light switch on on Relay
multimeter 23V shoed up.

meaning before PI see GPIO pin 21 there is no signal.
if I unplug Green wire - which is GPIO 21 - "on hot" it cut off relay and power for printer.
if I change GPIO number in setting octoprint to any other - it cut off relay and power for printer

Sorry but I'm not really sure what you are saying here.

if I change GPIO number in setting octoprint to any other - it cut off relay and power for printer

Changing the switching/sensing settings in the plugin will result in a re-init of the pin so yes I'd expect that.

i mean if I change GPIO number for example to 20 - it cut`s off power from my printer

Right, changing the config will result in a re-init. The old pin is cleaned up because it's not being used.

Make sure your relay works with the LED script or sysfs writes you tested earlier. So far there is no reason to believe that there is a bug or problem with the plugin. Evidence leads to an wiring or hardware issue.

1 Like

@XAMCTBO There's one last test I can suggest. Pick 2 GPIO pins and connect them with a jumper cable. Set one pin as sensing and the other as switching. See my example screenshot.

image

You should be able to turn it on/off and the indicator will match up.

relay after tests looks ok.... when im giving relay a signal of 3v it triggers.
I done what you told to pick 2 GPIO
19 GPIO ok
13 GPIO

pi@octopi:~ $ echo "13" > /sys/class/gpio/export
-bash: echo: write error: Device or resource busy

xmm interesting fact
when I input GPIO numbers in PSU control it say`s me device or recourse busy
when I input in GPIO number in PSU RPI.GPIO - it allows me to work with it.
I mean example
echo "13" > /sys/class/gpio/export