通过USB控制简单的继电器开关 [英] Controlling simple relay switch via USB
问题描述
我希望通过一个简单的通过USB连接到计算机的继电器开关来控制市电灯。
继电器开关甚至不是USB设备。 ,这只是一个简单的开关,需要USB电压才能将其打开。当电压下降到阈值以下时,开关将关闭灯。
我的问题是我无法控制USB端口的电源输出。我很高兴在Windows或Linux上使用任何语言(但最好是Java,因为我已经习惯了)来做到这一点。
不幸的是,在大多数情况下,您无法控制USB端口的电源。电源通常是硬接线的,不能在软件中切换。您可以将重置发送到USB设备,但这无法正常工作在您的情况下。
关于可指导对象的许多项目的工作与您所描述的相似,但是不幸的是,它们似乎很复杂或需要昂贵的零件。 / p>
编辑:实际上,新闻中当前确实有一种您想要的产品,但它似乎尚未发货: http://www.pwrusb.com/
编辑(再次):显然,您可以通过一些USB集线器来实现。 这篇文章表示 Linksys USB2HUB4 是可行的。
编辑(再次):显然有许多类似的问题,但是似乎没有更多有用的答案:
- https://stackoverflow.com/ Questions / 405269 / custom-usb-device-that-disables-power-to-usb-devices-plugged-to-it
- 关闭Windows中软件中的USB设备
- 是否有用于更改USB电源输出的软件或代码
- 我是否可以编写一个可以打开/关闭USB的程序
I'm looking to control a mains powered light from a simple relay switch connected via USB to the computer.
The relay switch isn't even a USB device, it's just a simple switch that requires the USB voltage to turn it on. When the voltage drops below a threshold, the switch will turn the light off.
My problem is that I can't control the power output of a USB port. I'm happy to do it using any language on Windows or Linux (but preferably Java because I'm used to it).
Unfortunately, in most cases you cannot control the power supply to the USB port. The power supply is usually hardwired through, and not switchable in software. You can send a reset to a USB device, but that won't work in your case.
There are a number of projects on instructables that do similar to what you describe, but unfortunately they seem to either be quite complicated or require expensive parts.
EDIT: There is actually a product currently in the news which would do want you want, but it doesn't appear to be shipping yet: http://www.pwrusb.com/
EDIT (again): Apparently you can do this with some usb hubs. This post sugggests the Linksys USB2HUB4 is one that works.
EDIT (and again): Apparently there are a number of similar questions, but there don't seem to be any more useful answers:
- https://stackoverflow.com/questions/405269/custom-usb-device-that-disables-power-to-usb-devices-plugged-into-it
- Power off an USB device in software on Windows
- Is there software or code to alter USB power output
- Can I write a program that swiches USB on/off
这篇关于通过USB控制简单的继电器开关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!