I have a digital microscope connected to my pi (usb) that you can use in a browser with a java web app that I have written. The microscope is also powered through the usb. There is no on or off switch, whenever you power on the pi, the microscope is turned on as well. I don't like this and I would like a button on my webapp that can turn on/off the microscope. I thought about doing this by cutting off the power to the microscope by using a usb-relay of some sort that I can control with the pi. But I'm not sure how to do this. So normally I just plug in the usb in my pi and whenever you press button x the webapp shows what the microscope 'sees'. But as said the problem is that the microscope is powered on the whole time (which I don't like).
My device looks like this:
The setup would be something like: Pi connected to a 'usb-relay', then that relay connected to my digital microscope...or something. From my pi I would then send a command to the relay to allow the digital microscope to receive power (turn on) or not (turn off). The Pi still needs to receive images from the digital microscope. I found something online that would pretty much do the trick I guess: https://www.yepkit.com/products/ykush
But I'm wondering if this could be done with a relay? And if so what kind of relay would I need?