2

I've just bought a usb fan to cool down my router during the summer as it gets very hot. However, since i don't need to keep it on continuously, i was thinking about a solution to automate its usage via the raspberry pi (B+).

I already have a temperature sensor connected to the pi, which I could use as a measurement to power the fan accordingly. I also have a relay connected which I've already used in the past.

https://www.amazon.it/dp/B00JP93NTC https://www.amazon.it/dp/B00CEQBCSW

(don't mind the language, just look at the pictures)

One solution could be to cut the usb cable and connect the power wire to the relay, I've already done such with a lamp but I don't now how to do with a USB cable and don't want to cut a cable if I'm not sure how to do it actually.

Also, since the fan has a switch I think i could control that but I don't now how to do the wiring. Thanks.

  • Sorry, I wasn't clear enough, I use the fan to cool down the router next to the pi and i was looking for a solution to turn on and off that fan with the pi. – Matteo Jun 29 '16 at 20:43
  • Whoops. You were clear enough I just can't read ;) – goldilocks Jun 29 '16 at 20:50
  • BTW You should find examples of how to dismember a USB cable online. I think the wire colors inside are even standardized, plus you could do a continuity test using a multimeter. – goldilocks Jun 29 '16 at 20:53
0

I assume your USB fan has an attached cable with a USB Type A male connector. Rather than cut this off and permanently alter your fan assembly, I suggest you buy a short adapter cable that has a Type A female connector on one end (see photo for example). These can be purchased very cheaply online. It doesn't matter what type of connector is on the other end of the adapter cable because you're going to cut that off to expose the bare wires.

Just plug your fan into the female end of this adapter cable, then connect the bare wires on the other side of the adapter cable to your relay. Typically, the red wire is your 5V positive and the black wire is ground.

enter image description here

  • It seems reasonable since i could later use for other devices. However could this schematic work? Also, if it does, would it work with the relay i posted in the question? Thanks, I'm pretty much a beginner dropbox.com/s/fwydhoborbr7er3/Senza%20titolo.jpg?dl=1 – Matteo Jul 1 '16 at 9:17
  • Your schematic, as a general design, is fine. However, I looked up the English description of this particular relay and it indicates the relay pins need to be pulled LOW in order to turn the relay switch on and pulled HIGH to shut them off. This behavior is opposite what normal relays do. So depending on your control logic, this may or may not be the relay you want to use. For example, if your control logic from the Pi is sending a full 5V power signal when the fan should be on, then you want to use a more conventional relay that switches on in that scenario. – PhilM Jul 1 '16 at 15:36
  • Is the control logic only about the software part? I usually control the relay via Python or /sys/class/gpio – Matteo Jul 1 '16 at 15:47
  • Let me answer your question directly ... yes, the control logic is the software part using programming logic to control the GPIO pins which send a signal to the relay. I suspect you are sending a signal (logical HIGH) to turn the fan on, and you are not sending any signal (logical LOW) when the fan should be off. In this case, you just need (minimally) a one channel SPST NO relay module. – PhilM Jul 2 '16 at 16:47
0

Why waist the time and potential of messing up a good fan when all you really need is a USB-plug. Also, most routers have USB-plugs built in.
Any-who your method is sound, all you really need is a 5V relay connection between the hot (power) wire connection between the wire and the USB plug-in. The reason not to connect to the ground is because everything is grounded and if the fan hits something else grounded (seeing that its all metal) or with power its easy to make a connection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.