Matt Neapolis Posted February 6, 2021 Posted February 6, 2021 Hi! i installed armbian on my tvbox with SOC s905w 2gb and i would like to control a relay via linux .... is it possible? and how? thank you
Werner Posted February 6, 2021 Posted February 6, 2021 Your issue report is invalid for one or multiple reasons (non-exhaustive enumeration): it has been stated at the wrong place it lacks fundamental requested data it could have been easily solved by a quick search and/or reading documentation Since you refused to use the bug reporting form carefully and follow the information there as you have been asked for we have no intention to further investigate. https://www.armbian.com/bugs
SteeMan Posted February 6, 2021 Posted February 6, 2021 @Matt Neapolis You posted your question in a forum for submitting bug reports. I have moved your post to the TV Box club forums. To try to answer your question, you have the wrong tool for the job. You really need a SBC not a TV box. Controlling outside devices is generally done via gpio pins which isn't something TV boxes expose because that isn't what they are designed for. A proper SBC will have pins to your hearts content to interface with other devices. Having said that, while I've never heard of anyone using a TV box to do what you are asking, that doesn't mean it isn't possible. Someone around here may have other knowledge.
jock Posted February 7, 2021 Posted February 7, 2021 Well, usually tv box boards have one or two leds and one IR receiver. Those can be carved out and the relative pins can be used as regular GPIOs, but a proper SBC is indeed a better choice, mostly because you will never know how the GPIO will behave with a different load it has not designed for. A proper SBC will indeed offer the specifications of the GPIO banks, so you know if a pin can do PWM, how much current you can drain from them, the voltage of the pin, etc... etc... all those things are obscure on a tvbox because there is probably a circuit of some sort behind the exposed GPIO pins that restricts the specifications in an unknown way.
Matt Neapolis Posted February 8, 2021 Author Posted February 8, 2021 I had thought about it too ... the tvbox is for a 3d printer for which I succeed in my intent but I also needed only a signal to drive on / off for a 3.3v SSR, in order to turn the whole system on and off from remote .... I used the command "gpioinfo" to search for active pins and convert them for other purposes, but I don't know how to change their status via cli ... in case it fails in my intent I will fall back on usb relay or on the sonoff system with mqtt ... how can I vary their status knowing the actual position on the board? the pin I need resides in / gpiochip1 / gpio19. the pin in question is used by the system to power the 5vs needed by the HDMI but since I don't need it, I can use it to drive the SSR
jock Posted February 8, 2021 Posted February 8, 2021 4 hours ago, Matt Neapolis said: I had thought about it too ... the tvbox is for a 3d printer for which I succeed in my intent but I also needed only a signal to drive on / off for a 3.3v SSR, in order to turn the whole system on and off from remote .... I used the command "gpioinfo" to search for active pins and convert them for other purposes, but I don't know how to change their status via cli ... in case it fails in my intent I will fall back on usb relay or on the sonoff system with mqtt ... how can I vary their status knowing the actual position on the board? the pin I need resides in / gpiochip1 / gpio19. the pin in question is used by the system to power the 5vs needed by the HDMI but since I don't need it, I can use it to drive the SSR You can do cat /sys/kernel/debug/gpio to get a brief map of the gpios registered to the kernel. Usually there you find the leds, buttons and regulators. Other gpios are not present there because they are bounded to devices and not exposed to the kernel. You can then control the pins using the kernel sysfs interface: in the directory /sys/class/gpio there are a couple of files (export and unexport) and a number of directories (gpiochipXXX) that can be used to make the GPIO pin exposed to userspace. Gpiochip directories are the GPIO banks, and the trailing number in directory name is the pin 0 of that bank (called the base). If you run: echo <pin> > export where <pin> is the base gpio bank summed with GPIO pin number, a new directory gpio<pin> appears where you can control the direction of the pin and the state. The main problem is that if you want to control a GPIO it must not be bound to a device, thus you need to remove it from the device tree. Removing leds and buttons from device tree is generally very safe, removing GPIOs from other devices can lead to system malfunctioning of some sort, HDMI included. 1
Recommended Posts