-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optocouplers problem #13
Comments
I didn't understand the problem. You need to have the relay normally open by default to simulate pressing a button. I didn't understand the problem. You need to have the relay normally open by default to simulate pressing a button. Your relay has a normally open channel, why not use it? |
Sorry, my bad. It's actually normally open. When kvmd starts, the relay is closed without inverting the logic. For my case I had to change def set_output(pin: int, initial: bool=True) -> int: # <-- True
assert pin >= 0, pin
GPIO.setup(pin, GPIO.OUT, initial=initial)
return pin
def write(pin: int, flag: bool) -> None:
assert pin >= 0, pin
GPIO.output(pin, not flag) # <-- not |
What is the status of the relay before starting kvmd? Starting kvmd immediately changes the relay state from open to closed? |
Before starting kvmd it's off (open), and yes, it immediately changes to closed once the rpi has booted. |
Ah, I see. Your relay is controlled by zero level. This means that in any uncertain situation, it can close and unexpectedly turn off / turn on your server. I strongly do not recommend using this module. If you are determined to use this particular relay, I will add an option for you. But this is a big source of problems. |
I'm using it only because I didn't have any luck trying with an optocoupler or the 817 module (rpi gpio output is 3.3v and the 817 module requires 5v). The relay has been working well for now, although thinking about it again, if this option does not makes any sense for the project or makes the code harder to reason about, I wouldn't worry (since this is a workaround for my use case). Thanks anyway for your time! :) |
Relay modules for 5V should work well. Give me a link to your module, and I will see what the problem is with my hardware engineer comrade. Also show which optocouplers you use. |
Adding this feature is not very difficult, but I would prefer to help you with your problem rather than treat its symptoms :) |
Okay, here's the thing. Your optocouplers are based on transistors. The module you bought uses the same optocouplers that you tried initially. Polarity is also very important for them. Now you have these options:
In any case, I suggest you go to our discord, where we will help you faster: https://discord.gg/bpmXfz5 |
Sorry for the late response.
Awesome!, because I ordered Can I just replace the optocouplers with the ones in the 817 module and use the same circuit? (at least for the switches) |
No, I told you. They use the same optocouplers that you've tried before. Look at the markings on their body. |
Sorry. Yes, it will work. |
I added information to the documentation that you need to use normal relays. I think this issue can be considered resolved. |
Just wanted to say thank you so much! The optocouplers finally arrived and it's working now, I couldn't make it to work with the existing PCB so I put a 330 Ohm resistor and it worked flawlessly. |
Cool! |
Not sure where else to put this, but in every motherboard I've looked at, there's no need for optocouplers. Barely even a transistor, but transistors are pennies. The Power and Reset signals are floating, and their respective pushbuttons just ground them. Since the Raspberry Pi shares a ground with the PC being controlled, these can be tied directly to GPIO. I demonstrate it here: https://www.youtube.com/watch?v=eXzK3U6huwY The gate charge of those FETs is only a few pF so a gate resistor isn't even needed. Doesn't get much simpler. (Arguably it does, if you had 5v-tolerant GPIO like certain knockoff boards...) |
@myself248 The relays are used for galvanic isolation in case the KVM and server are connected to different power outlets. And if you mix up the poles, you can ruin something on both the motherboard and the Pi. You can use this method if you have checked everything carefully, but remember that this way you lose additional protection from errors. And you can manage something non-standard, not quite ATX. In any case, not using the relay is a great way to see the magic smoke. |
@mdevaev just to double check, i've been using optocouplers (PC817 are really common on aliexpress) for a project a while back and it seemed to work fine and what I do is wire them like the attached picture, just wanted to double check if there's any downsides to using this setup...? the reason I do it this way is so I don't need to check for polarity at all |
@somuchtyler this circuit should work fine, but you need to hang a separate resistor on each anode to limit the current. The value of the resistor must be calculated based on the characteristics of the optocoupler. |
@mdevaev good catch, I did forgot to put in resistors before each of the anodes in my picture. If doing 3.3V logic with a typical forward voltage of 1.2V and a max current of 50mA. If wanting to stay under that at say at 20mA, it would be 105ohms right? |
@somuchtyler yep. 120 ohm is standard value. You can usse it I guess. |
hi ... sorry i didnt read completely, but working with arduino i also had some troubles with these chinese relays, too bad they are poorly documented anyway (at least en english) searching a lot i discovered the correct way to use it .... the mechanical module (the blue little box) is a coil relay with 12v sensitivity, so to get work with 5 or less volt were made with optocopulers in the middle, so you have to feed the optocopulers with a little voltage (5v-2.5v?) and the coil relays with 9v-12v isolated but the relays module comes by default with these 2 circuits shorted with a jumper, thats because 5v inputs are not enough to trigger the relays (or unpredictable)... so you have to remove the jumper and feed with 12v apart to get the module work properly... read the coil relay and the optocopupler specs to know the optimal voltages
|
@mdevaev It appears the G3VM-61A1 has been EOL'ed. Any suggestions on a specific replacement? I'm currently searching through Omron's products but the naming scheme isn't particularly obvious and/or helpful to a novice. |
@mdevaev Finally found it after manually navigating Omron's website and locating the datasheet instead of looking for discontinuation notices. Mouser also wasn't immediately helpful due to the generic label ("Solid State Relays - PCB Mount MOS-FET RELAY"). The recommended part number that appears equivalent for new designs is: G3VM-61AY1 |
Added to the list, thank you |
I've been using 2x PC817 per power switch for years now and never had a problem across dozens servers. |
Hi, the optocoupler I bought isn't working for some reason, so I'm using this relay instead.
The problem I have, is that the logic needs to be inverted for this relay to work, otherwise it will initialized with the "on" state and the PC won't be able to start. Inverting the logic at the relay as "normally open" will work only if the rpi is on.
For the moment I am manually editing the
set_output
andwrite
methods on/usr/lib/python3.8/site-packages/kvmd/gpio.py
for this to work.We could use an ENV variable, like
GPIO_INVERT_WRITE
andGPIO_INVERT_READ
.The text was updated successfully, but these errors were encountered: