USB Relay Power Switch

By Coofer Cat

51
0
Free
It's free to download
Main Image

Technical

I made this using things I already had, so YMMV. You will need: 1 x 5V relay (eg. https://smile.amazon.co.uk/gp/product/B013ER8OMQ/) 1 x USB type A connector (eg. https://smile.amazon.co.uk/gp/product/B07MM5X2J6/) 1 x USB type B connector (eg. https://smile.amazon.co.uk/gp/product/B07R9SQW3Y) 1 x 2.1mm barrel jack socket 1 x diode (eg. 1N4001) Some wire, solder, soldering iron etc. Some M2.3 x 5 screws Make the plastic box, and check all the pieces fit inside it. Then: - Wire the two connectors D+ lines together, and then the D- lines (ie. D+ to D+ and D- to D-). - Solder on some wires for V+ and GND on both connectors. - Fit the two connectors into the box, and screw them down - Solder some wires onto the barrel socket and then fit the socket (there was just enough room to turn the retaining nut on mine - YMMV) You need to know which pins on the relay are the coil, common, Normally Closed (NC) and Normally Open (NO). Now connect everything up as follows: - put the diode between the pins of the coil on the relay. It can go on either way around, but the pin nearest the stripe on the diode becomes the "positive" pin. The diode is used as a "flyback diode" here - it's very important! - Connect all the ground wires from both USBs and the power socket together and solder them to the negative coil pin on the relay. - Connect the V+ from the Type B connector to the positive side of the coil on the relay - Connect the V+ from the Type A connector to the "Normally open" (NO) pin on the relay. - Connect the V+ from the power connector to the common pin on the relay Now you can test. I'd try this in a USB power supply rather than your shiny new computer. Plug the cable into USB hub/power supply and the other end into the Type B connector. You should hear the relay click as you push the connector in, and click again as you take it out. Next, try a device in the Type A connector (eg. a lamp). Obviously, with nothing connected it should be off. Plug in the USB power supply - the lamp should still be off. Unplug the USB power supply and put a 5V supply into the barrel jack connector. The lamp should stay off - but turn on as soon as you plug in the USB power supply again.

License

Tags

15 objects 4 Followers
Joined about 11 years ago ralph@coofercat.com

YouMagine

a MyMiniFactory company
© 2024 YouMagine. All rights reserved.  2 Berners Road, Islington, London, N1 0PW, United Kingdom