I am trying to use a USB relay controller to control the light in my house. I want to be able to on/off with a momentary switch. So If I turn on the light with the switch my DRM software (https://denkovi.com/page/13/drm-software.html) will show light state and Will turn of the light by pressing a button on the program.
for now it's work only if I turn on the light with the program and turn off with the program only
I want to contact with the switch and get it's state how to do that ?
If you bought a relay board that you want to work with momentary switches then why didn't you just buy one directly instead of a USB based one?
You'll need another I/O board that will connect to USB and have to write your own software to read the switches to send the commands to the relay board, the relay board is run by an FTDI chip which means it's just a serial port so you'll have to find the command set from Denkovi's sight, or use a serial port sniffing program to watch what the software is sending to the relay board.
You could write your own software that does the same thing and then just use the keyboard input as momentary switches that would probably be easiest. Depends on your programming experience.
If you bought a relay board that you want to work with momentary switches then why didn't you just buy one directly instead of a USB based one?
You'll need another I/O board that will connect to USB and have to write your own software to read the switches to send the commands to the relay board, the relay board is run by an FTDI chip which means it's just a serial port so you'll have to find the command set from Denkovi's sight, or use a serial port sniffing program to watch what the software is sending to the relay board.
You could write your own software that does the same thing and then just use the keyboard input as momentary switches that would probably be easiest. Depends on your programming experience.
If you just want to use the PC keyboard buttons as your momentary switches you don't need any external I/O board. Could you explain in a little more detail exactly what you're trying to do?
I'm very hazy (and probably wrong ) as to USB operation, but don't attached USB slave devices signal their presence and/or current requirements by putting some signal or resistive load on the data/clock line? If so, could you use a momentary switch to do the same thing and use the Windows API in some way to recognise the switch closure?
If you just want to use the PC keyboard buttons as your momentary switches you don't need any external I/O board. Could you explain in a little more detail exactly what you're trying to do?
I'm very hazy (and probably wrong ) as to USB operation, but don't attached USB slave devices signal their presence and/or current requirements by putting some signal or resistive load on the data/clock line? If so, could you use a momentary switch to do the same thing and use the Windows API in some way to recognise the switch closure?
Some cell phone's have a 'connection detect' that works this way, however this is technically outside of USB specifications, it's just for the phone to know it's connected to a charger that supplies USB voltages, and may actually violate USB specs under some circumstances (particularly high speed communication)
The USB specifications requires actual full protocol enumeration and bi directional transfer to negotiate current to a specific port.
Thanks for the USB explanation, Sceadwian. I knew I was on shaky ground there .
So, the OP wants to use a domestic (wall?) switch to turn the light on and the PC to turn it off, and vice versa. That's going to require a modification to the mains wiring and involve a heavy-current switch (relay/contactor?) with mains isolation from the PC.
Thanks for the USB explanation, Sceadwian. I knew I was on shaky ground there .
So, the OP wants to use a domestic (wall?) switch to turn the light on and the PC to turn it off, and vice versa. That's going to require a modification to the mains wiring and involve a heavy-current switch (relay/contactor?) with mains isolation from the PC.
Something like this? View attachment 65798
Component types/values will depend on the relay used.
If you don't use a latching relay/contactor then for one or the other set position of the mains switch the relay will draw current continuously. A latching relay only needs a brief pulse to change state. A single coil relay is shown, but a dual coil version would simplify the coil drive.
Another option would be to use opto-isolated triacs or solid-state relays instead of the mechanical relay.
As mains voltage is involved here BE CAREFUL and take all due precautions. Circuit parts/wires at mains voltage should be kept at least 3mm from low voltage parts/wires, should be well insulated, and should be installed in compliance with local regulations.
If this is going into a home, or a practical environment, I won't comment further, as much as I know, I know, you know less, and you could hurt someone with what you think you know.
Basically what I'm trying to say is you should not try to do this, if you do you endanger life.