[SLOVED] Octoprint Enclosure don't command GPIO relay

Hi all,

recently i have brought this relay board: https://www.amazon.it/gp/product/B0771HH6J6/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1

I have connected to my RPi, I have setup the Output in Enclosure plugin setup with GPIO pin 24, it show correctly in the plugin but it don't work. If i manually set the GPIO to output with gpio -g mode 19 out the relay work but not with the plugin.

Can anyone help me please?
Thanks a lot

Is the relay able to switch at 3.3V?

Yes if i use the SSH the relay works great.
edit: i have passwordless for sudo

First thing, Wiring pi is deprecated so I wouldn't rely on it for long.

You mention GPIO24 in Enclosure but then 19 w/ gpio. So which is it? What happens when you test with the same pin?

Logs?

Yes GPIO 24 is 19 in BCM so, if you use in Enclosure plugin without BCM mode you have to write 24, but in SSH with gpio command you have to use BCM number.

A part of octoprint.log, here you can see the plugin write on pin 24 by manually trigger the button.

2021-05-13 17:01:19,165 - octoprint.plugins.enclosure - DEBUG - Writing on GPIO: 24 value True
2021-05-13 17:01:19,582 - octoprint.plugins.enclosure - DEBUG - Writing on GPIO: 24 value False
2021-05-13 17:01:20,011 - octoprint.plugins.enclosure - DEBUG - Writing on GPIO: 24 value True
2021-05-13 17:01:20,418 - octoprint.plugins.enclosure - DEBUG - Writing on GPIO: 24 value False
2021-05-13 17:01:23,275 - octoprint.plugins.enclosure - DEBUG - Temperature SI7021 cmd: sudo python /home/pi/oprint/lib/python3.7/site-packages/octoprint_enclosure/SI7021.py 0x40 1
2021-05-13 17:01:24,328 - octoprint.plugins.enclosure - DEBUG - SI7021 result: b'21.4 | 54.8\n'

If i test w/ gpio via SSH it works, with the Enclosure plugin no result

The -g flag indicates you are using BCM mode not physical pin number.

So:
PIN 24 <=> GPIO 8
GPIO 24 <=> PIN 18

PIN 19 <=> GPIO 10
GPIO 19 <=> PIN 35

Make sure you are using the right mode and specify the right number for said mode.

So perhaps an off by 1 mistake :grinning_face_with_smiling_eyes: ?

Sorry, I probably explained myself wrong, I'm using GPIO not BCM mode, but when I try via SSH it works and in Enclousure it doesn't.

This is my settings:



I'm using the Board pin Numbrer not BCM numbers

Did you already this:

And you may try with SUDO off.

Right so you tested with gpio -g 19. That is not the BCM equivalent of PIN24 according to pinout.xyz for the 40 pin header.

The BCM equivlant of PIN24 is GPIO8. You tested with GPIO19.

SLOVED

in my config tab i have unchecked "Use Board Pin #" to use BCM numbers, but the setup window don't save this option and i have to use the Board pin #. Now it works perfectly.

Thanks to all for help.
M

1 Like

Great! So could you please: