How to connect an electrical switch to my vb.net application via USB port?
-
Hi guys, I've read articles about; "Sending and receiving data from RS232 or USB ports" or, "Using vb.net to switch on/off electrical devices", but conversely in my case I want to just using a simple electrical switch to do something in my vb.net application (via RS232 or USB port). For example; if user pushed an electrical switch button which is connected to the RS232 or USB port, then simply a text same as "Pushed" appear in my application's text box. Briefly, could we connect an electrical switch without any circuit or board to USB port to do something simple in our application? Any suggestion or experience? Thanks.
-
Hi guys, I've read articles about; "Sending and receiving data from RS232 or USB ports" or, "Using vb.net to switch on/off electrical devices", but conversely in my case I want to just using a simple electrical switch to do something in my vb.net application (via RS232 or USB port). For example; if user pushed an electrical switch button which is connected to the RS232 or USB port, then simply a text same as "Pushed" appear in my application's text box. Briefly, could we connect an electrical switch without any circuit or board to USB port to do something simple in our application? Any suggestion or experience? Thanks.
Short answer: No. Longer answer: you would need some interface between the switch and the computer's port that converted the elctrical current into the correct signals for the computer. Try searching Google for computer switches to see the sort of devices that are asvailable.
Use the best guess
-
Hi guys, I've read articles about; "Sending and receiving data from RS232 or USB ports" or, "Using vb.net to switch on/off electrical devices", but conversely in my case I want to just using a simple electrical switch to do something in my vb.net application (via RS232 or USB port). For example; if user pushed an electrical switch button which is connected to the RS232 or USB port, then simply a text same as "Pushed" appear in my application's text box. Briefly, could we connect an electrical switch without any circuit or board to USB port to do something simple in our application? Any suggestion or experience? Thanks.
aeskan wrote:
Briefly, could we connect an electrical switch without any circuit or board to USB port to do something simple in our application?
No, as a USB port doesn't know how to interpret a "row" of switches. There's various projects, with prebuild general-purpose controllers and open source to control the hardware, like this one[^]. Alternatively, find a cheap USB-joystick and a large hammer :)
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
Hi guys, I've read articles about; "Sending and receiving data from RS232 or USB ports" or, "Using vb.net to switch on/off electrical devices", but conversely in my case I want to just using a simple electrical switch to do something in my vb.net application (via RS232 or USB port). For example; if user pushed an electrical switch button which is connected to the RS232 or USB port, then simply a text same as "Pushed" appear in my application's text box. Briefly, could we connect an electrical switch without any circuit or board to USB port to do something simple in our application? Any suggestion or experience? Thanks.
Connect a switch to a USB "port", hit the switch just once and you'll short the USB out and possibly kill the USB controller on your motherboard. USB ports are not "ports". USB is a BUS, not unlike the expansion slots (bus) inside your PC. Without an interface chip on the switch to tell USB that a device is there, you cannot listen for the changes in the switch.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
Hi guys, I've read articles about; "Sending and receiving data from RS232 or USB ports" or, "Using vb.net to switch on/off electrical devices", but conversely in my case I want to just using a simple electrical switch to do something in my vb.net application (via RS232 or USB port). For example; if user pushed an electrical switch button which is connected to the RS232 or USB port, then simply a text same as "Pushed" appear in my application's text box. Briefly, could we connect an electrical switch without any circuit or board to USB port to do something simple in our application? Any suggestion or experience? Thanks.
As other have already pointed out. Direct connection to USB is hazardous to the health of the USB ports. However, perhaps if you got hold of a USB-Serial adapter it should be possible to use it on the Carrier Detect/CTS/RTS/DTR/DTS. whichever is available at the serial port. an additional smoothing capacitor & resistor above 1K-ohms in series should help filter out the switching noise/limit current demand.
-
As other have already pointed out. Direct connection to USB is hazardous to the health of the USB ports. However, perhaps if you got hold of a USB-Serial adapter it should be possible to use it on the Carrier Detect/CTS/RTS/DTR/DTS. whichever is available at the serial port. an additional smoothing capacitor & resistor above 1K-ohms in series should help filter out the switching noise/limit current demand.
-
Connect a switch to a USB "port", hit the switch just once and you'll short the USB out and possibly kill the USB controller on your motherboard. USB ports are not "ports". USB is a BUS, not unlike the expansion slots (bus) inside your PC. Without an interface chip on the switch to tell USB that a device is there, you cannot listen for the changes in the switch.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
aeskan wrote:
Briefly, could we connect an electrical switch without any circuit or board to USB port to do something simple in our application?
No, as a USB port doesn't know how to interpret a "row" of switches. There's various projects, with prebuild general-purpose controllers and open source to control the hardware, like this one[^]. Alternatively, find a cheap USB-joystick and a large hammer :)
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
Short answer: No. Longer answer: you would need some interface between the switch and the computer's port that converted the elctrical current into the correct signals for the computer. Try searching Google for computer switches to see the sort of devices that are asvailable.
Use the best guess