[plugin] GPIO control: control GPIO with Volumio 3 events (now RPi5 compatible!)

Ah ok! Thanks for the update!

What is my plugin like compared to the amp switcher? :thinking:

Much much more refined, way more options, very flexible!
And unlike amp switcher that crashed Volumio at startup, it won’t toggle any GPIO until configured


Wish I had found it sooner, It would have prevented me to lose a lot of time.

1 Like

Thats great news indeed! I’m glad you found it so helpful. Many thanks! :pray:t4::smiling_face:

Hi Supercrab,

I just wanted to report a problem with GPIO control with Volumio 3.661 (premium subscription) on raspberry 5, 2gb.
Any config I try to implement with regard to events in the plugin, the save action button does not react (though it seems to keep my settings as if I quit then go back in, it has stored them) and the plugin keeps then locked in inactive state, though I set it on »ON » in the plugin main page.
If I undo all settings in the plugin and set them back all to off, then the plugin accept to be activated


Log of the config is here : http://logs.volumio.org/volumio/Anxu3S9.html

Any hints on insight may be helpful - thanks a lot.

Benoit

Not sure off the top of my head, maybe it’s something to do with this line in the log
invalid GPIO 6

Can you try with a different GPIO?

Hi, I have tested several Gpio, low and high, and the result is the same.

@BenoitMarhieu Maybe it’s something to do with Raspberry Pi 5? I don’t have a Raspberry Pi 5 to test this unfortunately. Are you able to test on a non Raspberry Pi 5?

It seems wiringpi is not working on rpi5.
See discussion in thread : https://forums.raspberrypi.com/viewtopic.php?t=359742

They recommand using gpiod, lgpio or gpiozero.

Any chance the plugin is ported to a more compatible and futureproof library?

Benoit

Wiringpi has been deprecated for a couple of years now.

Thanks for your help! You are correct sir!

Looks like GPIO has completely changed on Pi5.

Changing the library shouldn’t be too bad, just have to decide which one is best. Not all of them have been ported to node.js :persevere:

I’ve read that the library I used called onoff shoukd still work, not sure whats going on :face_with_hand_over_mouth:

yeah got the same impression.
I can test if needed, have a rPi5 for it.

It looks like the GPIO numbers have all changed and they now start at 399? That might explain why it’s not working. I think the onoff library does work.

$ cat /sys/kernel/debug/gpio 
gpiochip4: GPIOs 399-452, parent: platform/1f000d0000.gpio, pinctrl-rp1:
 gpio-399 (ID_SD               )
 gpio-400 (ID_SC               )
 gpio-401 (PIN3                )
 gpio-402 (PIN5                )
 gpio-403 (PIN7                )
 gpio-404 (PIN29               )
 gpio-405 (PIN31               )
 gpio-406 (PIN26               )
 gpio-407 (PIN24               )
 gpio-408 (PIN21               )
 gpio-409 (PIN19               )
 gpio-410 (PIN23               )
 gpio-411 (PIN32               )
 gpio-412 (PIN33               )
 gpio-413 (PIN8                )
 gpio-414 (PIN10               )
 gpio-415 (PIN36               )
 gpio-416 (PIN11               )
 gpio-417 (PIN12               )
 gpio-418 (PIN35               )
 gpio-419 (PIN38               )
 gpio-420 (PIN40               )
 gpio-421 (PIN15               )
 gpio-422 (PIN16               )
 gpio-423 (PIN18               )
 gpio-424 (PIN22               )
 gpio-425 (PIN37               )
 gpio-426 (PIN13               )
 gpio-427 (PCIE_RP1_WAKE       )
 gpio-428 (FAN_TACH            )
 gpio-429 (HOST_SDA            )
 gpio-430 (HOST_SCL            )
 gpio-431 (ETH_RST_N           |phy-reset           ) out hi ACTIVE LOW
 gpio-432 (-                   )
 gpio-433 (CD0_IO0_MICCLK      |cam0_reg            ) out lo 
 gpio-434 (CD0_IO0_MICDAT0     )
 gpio-435 (RP1_PCIE_CLKREQ_N   )
 gpio-436 (-                   )
 gpio-437 (CD0_SDA             )
 gpio-438 (CD0_SCL             )
 gpio-439 (CD1_SDA             )
 gpio-440 (CD1_SCL             )
 gpio-441 (USB_VBUS_EN         )
 gpio-442 (USB_OC_N            )
 gpio-443 (RP1_STAT_LED        |PWR                 ) out hi ACTIVE LOW
 gpio-444 (FAN_PWM             )
 gpio-445 (CD1_IO0_MICCLK      |cam1_reg            ) out lo 
 gpio-446 (2712_WAKE           )
 gpio-447 (CD1_IO1_MICDAT1     )
 gpio-448 (EN_MAX_USB_CUR      )
 gpio-449 (-                   )
 gpio-450 (-                   )
 gpio-451 (-                   )
 gpio-452 (-                   )

gpiochip3: GPIOs 453-458, parent: platform/107d517c00.gpio, gpio-brcmstb@107d517c20:
 gpio-453 (HDMI0_SCL           )
 gpio-454 (HDMI0_SDA           )
 gpio-455 (HDMI1_SCL           )
 gpio-456 (HDMI1_SDA           )
 gpio-457 (PMIC_SCL            )
 gpio-458 (PMIC_SDA            )

gpiochip2: GPIOs 459-475, parent: platform/107d517c00.gpio, gpio-brcmstb@107d517c00:
 gpio-459 (RP1_SDA             )
 gpio-460 (RP1_SCL             )
 gpio-461 (RP1_RUN             |RP1 RUN pin         ) out hi 
 gpio-462 (SD_IOVDD_SEL        |vdd-sd-io           ) out lo 
 gpio-463 (SD_PWR_ON           |sd_vcc_reg          ) out lo 
 gpio-464 (SD_CDET_N           )
 gpio-465 (SD_FLG_N            )
 gpio-466 (-                   )
 gpio-467 (2712_WAKE           )
 gpio-468 (2712_STAT_LED       |ACT                 ) out hi ACTIVE LOW
 gpio-469 (-                   )
 gpio-470 (-                   )
 gpio-471 (PMIC_INT            )
 gpio-472 (UART_TX_FS          )
 gpio-473 (UART_RX_FS          )
 gpio-474 (-                   )
 gpio-475 (-                   )

gpiochip1: GPIOs 476-479, parent: platform/107d508500.gpio, gpio-brcmstb@107d508520:
 gpio-476 (WIFI_SDIO_D0        )
 gpio-477 (WIFI_SDIO_D1        )
 gpio-478 (WIFI_SDIO_D2        )
 gpio-479 (WIFI_SDIO_D3        )

gpiochip0: GPIOs 480-511, parent: platform/107d508500.gpio, gpio-brcmstb@107d508500:
 gpio-480 (-                   )
 gpio-481 (2712_BOOT_CS_N      |spi10 CS0           ) out hi ACTIVE LOW
 gpio-482 (2712_BOOT_MISO      )
 gpio-483 (2712_BOOT_MOSI      )
 gpio-484 (2712_BOOT_SCLK      )
 gpio-485 (-                   )
 gpio-486 (-                   )
 gpio-487 (-                   )
 gpio-488 (-                   )
 gpio-489 (-                   )
 gpio-490 (-                   )
 gpio-491 (-                   )
 gpio-492 (-                   )
 gpio-493 (-                   )
 gpio-494 (PCIE_SDA            )
 gpio-495 (PCIE_SCL            )
 gpio-496 (-                   )
 gpio-497 (-                   )
 gpio-498 (-                   )
 gpio-499 (-                   )
 gpio-500 (PWR_GPIO            |pwr_button          ) in  hi ACTIVE LOW
 gpio-501 (2712_G21_FS         )
 gpio-502 (-                   )
 gpio-503 (-                   )
 gpio-504 (BT_RTS              )
 gpio-505 (BT_CTS              )
 gpio-506 (BT_TXD              )
 gpio-507 (BT_RXD              )
 gpio-508 (WL_ON               |wl_on_reg           ) out hi 
 gpio-509 (BT_ON               |shutdown            ) out hi 
 gpio-510 (WIFI_SDIO_CLK       )
 gpio-511 (WIFI_SDIO_CMD       )

With GPIOD you can still use the pin numbers :slight_smile:

Here’s a snippet from a piece of Python I use:

import gpiod
BUTTON_PINA = 13
chip = gpiod.Chip('gpiochip4')

button_linea = chip.get_line(BUTTON_PINA)
button_linea.request(consumer="Button", type=gpiod.LINE_REQ_DIR_IN)

button_stateA = button_linea.get_value()

It looks good, I just can’t find a decent node port of it :sleepy:

https://forums.raspberrypi.com/viewtopic.php?t=364182

On Pi5 just use “new Chip(4)” instead of zero

1 Like

Thanks a lot Wheaten and Supercrab for the follow up. Seems there is a way forward. Happy to test if a dev version is available.

Do have some concerns if the change is backwards compatible.
Maybe a check on HW is needed to determine the the board, in pseudo:

if rpi5 then  “new Chip(4)”
else “new Chip(0)”
1 Like

I’ve upgraded the plugin to use gpiox give it test when you can. It’s a Beta plugin. Cheers!

@Wheaten @BenoitMarhieu

did a quick test, but it doesn’t seems to work.

The livelog doesn’t show any event.

Placed buttons between
gnd and GPIO23 and GPIO24, switch both ON/OFF in plugin => no results
3.3V and GPIO23 and GPIO24, switch both ON/OFF in plugin => no results

1 Like