mirror of
https://github.com/pikvm/pikvm.git
synced 2026-03-02 18:16:56 -05:00
GPIO Pulse Does Not Return to Initial State for Active-Low Relay in PiKVM #1019
Labels
No labels
component:documentation
help wanted
resolution:delayed
resolution:duplicate
resolution:fixed
resolution:invalid
resolution:rejected
resolution:wontfix
success story
type:bug
type:bug
type:feature
type:question
type:question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/pikvm-pikvm#1019
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @radu-boboc on GitHub (Apr 3, 2025).
Originally assigned to: @mdevaev on GitHub.
Describe the bug
When using the GPIO configuration in PiKVM to control an active-low relay, the relay does not return to its initial state (HIGH, relay off) after a pulse is triggered. Instead, after the first click on the "Button" or "Pulse" element in the web interface, the relay remains activated (pin stays LOW, relay on). Subsequent clicks trigger a pulse that temporarily deactivates the relay (pin goes HIGH), but then the relay reactivates (pin returns to LOW). The expected behavior is for the relay to activate temporarily (pin goes LOW) and then return to its initial state (pin HIGH, relay off) after each click.
To Reproduce
Configure the GPIO in /etc/kvmd/override.yaml as follows:
Restart the PiKVM service:
systemctl restart kvmd
Open the PiKVM web interface and go to the "Control ATX" menu.
Click on the "Reset Relay1" button.
Observe that the relay activates (pin goes LOW) but does not return to HIGH (relay remains on).
Click the button again, and observe that the relay deactivates temporarily (pin goes HIGH for 0.2 seconds), then reactivates (pin returns to LOW).
Expected behavior
At startup, the relay should be off (pin HIGH, since the relay is active-low, with initial: true and invert: true).
When clicking the "Reset Relay1" button, the relay should activate temporarily (pin goes LOW for 0.2 seconds, as defined by pulse: {delay: 0.2, active: false}), then return to its initial state (pin HIGH, relay off).
Each subsequent click should repeat this behavior: activate the relay for 0.2 seconds, then deactivate it.
Screenshots
Desktop (please complete the following information):
PiKVM info:
Raspberry Pi board version: Raspberry Pi 4
Video capture type: CSI bridge
kvmd 4.52-1
kvmd-fan 0.32-1
kvmd-platform-v2-hdmi-rpi4 4.52-1
kvmd-webterm 0.50-1
uname -a
Linux pikvm 6.6.45-10-rpi #1 SMP Fri Jan 24 03:51:01 UTC 2025 armv7l GNU/Linux
Additional context
The relay is active-low, meaning it activates when the GPIO pin is LOW (0) and deactivates when the pin is HIGH (1). This is why invert: true is used in the configuration.
The issue persists even when using different interface types in the view section (e.g., "Pulse", "Button", or "Click").
Please help me fix the logic, because I don't wanna keep the relay always on. I want it always off, except when it's doing a pulse.
@mdevaev commented on GitHub (Apr 5, 2025):
Hello. You have a configuration error:
invert: trueis wrong, it should beinverted: true. Theinitialparam should be removed too.@radu-boboc commented on GitHub (Apr 6, 2025):
you are correct, now everything works ok.
Thank you!!
@mdevaev commented on GitHub (Apr 6, 2025):
👌
@anshtiwari314 commented on GitHub (Nov 2, 2025):
i have the similar issue with GPIO pins if i set mode: output & try to switch the button from web ui it doesn't toggle GPIO mode from HIGH to LOW.
current problem ( GPIO pin output is always HIGH & not changing )
similar when u do mode: input ( GPIO pin output is always LOW & not changing by clicking the button )
here is my override.yaml
i m also sharing output of my http://pikvm_ip/api/gpio
@mdevaev @radu-boboc can u pls guide me what i m doing wrong . Thankyou
@radu-boboc commented on GitHub (Nov 2, 2025):
@anshtiwari314,
I see you're facing a similar issue with GPIO pins not toggling properly in PiKVM—outputs stuck on HIGH and inputs on LOW, despite your override.yaml configuration. Based on the original bug report in this issue and my own testing, this often stems from configuration mismatches, especially around initial and inverted settings, or hardware/pull configurations.
Troubleshooting suggestions:
Verify hardware:
Are pins 5/6/12/13 free? No shorts to GND/3.3V?
Use gpio readall (install wiringpi if needed: sudo apt install wiringpi) to check physical states outside PiKVM.
Logs: journalctl -u kvmd -f while clicking—look for GPIO errors.
Minimal test: Comment out all but one pin, restart, test.
API watch: Curl http://pikvm_ip/api/gpio before/after clicks to confirm software toggle.
@anshtiwari314 commented on GitHub (Nov 2, 2025):
@radu-boboc Thanks for replying , but the issue has now been resolved
the problem i using
mode: input ( web ui cannot toggle this bcz its a readable mode for signals in pi )
fixed
mode: ouput ( 0v & 3.3 v ) ( u can only control the ouput mode from web ui which can be 0v or 3.3 v )
why i m using input mode , bcz i was tring to control a relay module
bought from https://robu.in/product/5v-4-channel-relay-module/ ( building a smart IP powerstrip for cheap ATX which will also work in devices which doesn't have atx pins in motherboard )
there are 6 pins in relay module , ( vcc , v1 , v2 , v3 , v4 , gnd )
i was powering the relay module 5v directly from pi 5v pin
v1 connected to gpio5
v2 connected to gpio6
v3 connected to gpio12
v4 connected to gpio13
& gnd connected to pi gnd
when u modified override.yaml with mode:output relay gets turned on ( & get turned off when using mode:input )
its a output based relay module its get activated when u connect signal pins to gnd ( don't know exactly how i was getting expected output from relay module while directly connected to raspberry pi )
but this behaviour u can't have with web ui ,
web ui only work with mode: ouput ( either 0v or 3.3v , later i verified this with a direct connection of Led with pi )
i will use octocupler module for further setup this ...