Controlling simple relay switch via USB

前端 未结 6 2113
死守一世寂寞
死守一世寂寞 2020-12-24 04:40

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 s

6条回答
  •  感动是毒
    2020-12-24 05:01

    Most of the USB to Serial or USB to RS232 $10 converters support hardware handshaking. Use one of those as a single channel digital io.

    Connect your transistor that will drive the relay to DTR on the converter board and command DTR ON/OFF with the converters driver.

    A 2N7002 is a good transistor to use (FET actually) since it will work from 3V and doesnt need any resistors anywhere.

提交回复
热议问题