OpenWrt devices & 5V relays

Hi all. i am running Openwrt in Alix 2d13 as my main router and i would like to ask if there is a way to hook up 5V relays to control(on/off) external devices

That's not really an openwrt question, but a question for the manufacturer,
unless you use an interface like USB, or the serial port.

The question you should ask is which controllers openwrt (or linux) support....

Assuming there's support, I can't see why.

1 Like

Why not?

# cat /sys/kernel/debug/gpio 
gpiochip0: GPIOs 0-31, cs5535-gpio:
 gpio-0   (GPIO0               )
 gpio-1   (GPIO1               )
 gpio-2   (GPIO2               )
 gpio-3   (GPIO3               )
 gpio-4   (GPIO4               )
 gpio-5   (GPIO5               )
 gpio-6   (GPIO6               |alix:1              ) out lo    
 gpio-7   (GPIO7               )
 gpio-8   (GPIO8               )
 gpio-9   (GPIO9               )
 gpio-10  (GPIO10              )
 gpio-11  (GPIO11              )
 gpio-12  (GPIO12              )
 gpio-13  (GPIO13              )
 gpio-14  (GPIO14              )
 gpio-15  (GPIO15              )
 gpio-16  (GPIO16              )
 gpio-17  (GPIO17              )
 gpio-18  (GPIO18              )
 gpio-19  (GPIO19              )
 gpio-20  (GPIO20              )
 gpio-21  (GPIO21              )
 gpio-22  (GPIO22              )
 gpio-24  (GPIO24              )
 gpio-25  (GPIO25              |alix:2              ) out hi    
 gpio-26  (GPIO26              )
 gpio-27  (GPIO27              |alix:3              ) out hi    
 gpio-28  (GPIO28              )

I'm not sure how they're exposed on the board.

As an alternative you could utilize the existing (?) I²C port and add something like MCP23017 16-Bit I2C I/O Expander

If that was meant for me, I assumed OP had done his homework,
and already checked what was possible with the board he had.

Could have been wrong though :wink:

Yes you can use USB relays with the package crelay
See more info in the wiki https://openwrt.org/docs/guide-user/services/automation/crelay

It's simpler and safer than trying to find out where the GPIO pins are in your board.

It's recommended to use auxiliary power supply if you are controlling a board with more than 2 relays as USB power will not be enough.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.