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.
(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.