jesxs
Posts: 14
Joined: Sat May 18, 2019 12:18 pm

How to toggle on/off a usb device on rpi 3b+

Mon Jul 06, 2020 4:17 pm

I want to make an irrigation system (more like a mist-sprayer) for a little terrarium I have, and I'm planning everything I'll need.
So I've found a little usb water pump.
As this would be automated with a humidity sensor, I need to be able to turn on/off the water pump.
I've seen online that usb ports can be powered off/on the rpi 3b+ using https://github.com/mvp/uhubctl

But I want to make sure and ask you guys. Thanks

trejan
Posts: 3064
Joined: Tue Jul 02, 2019 2:28 pm

Re: How to toggle on/off a usb device on rpi 3b+

Mon Jul 06, 2020 4:27 pm

The Pi can only toggle power to all 4 ports together. You can't control individual ports so any other USB device plugged in will also be turned off. If that is okay then you can use uhubctl.

jesxs
Posts: 14
Joined: Sat May 18, 2019 12:18 pm

Re: How to toggle on/off a usb device on rpi 3b+

Mon Jul 06, 2020 4:31 pm

trejan wrote:
Mon Jul 06, 2020 4:27 pm
The Pi can only toggle power to all 4 ports together. You can't control individual ports so any other USB device plugged in will also be turned off. If that is okay then you can use uhubctl.
Well I plan on hooking up some fans to allow for airflow inside the chamber, but I guess I can do that with the GPIO pins so that is not a problem.
Thanks

ejolson
Posts: 6642
Joined: Tue Mar 18, 2014 11:47 am

Re: How to toggle on/off a usb device on rpi 3b+

Mon Jul 06, 2020 4:37 pm

jesxs wrote:
Mon Jul 06, 2020 4:31 pm
trejan wrote:
Mon Jul 06, 2020 4:27 pm
The Pi can only toggle power to all 4 ports together. You can't control individual ports so any other USB device plugged in will also be turned off. If that is okay then you can use uhubctl.
Well I plan on hooking up some fans to allow for airflow inside the chamber, but I guess I can do that with the GPIO pins so that is not a problem.
Thanks
How will you hook a fan to GPIO? Will you use some sort of transistor?

jesxs
Posts: 14
Joined: Sat May 18, 2019 12:18 pm

Re: How to toggle on/off a usb device on rpi 3b+

Mon Jul 06, 2020 4:43 pm

ejolson wrote:
Mon Jul 06, 2020 4:37 pm
jesxs wrote:
Mon Jul 06, 2020 4:31 pm
trejan wrote:
Mon Jul 06, 2020 4:27 pm
The Pi can only toggle power to all 4 ports together. You can't control individual ports so any other USB device plugged in will also be turned off. If that is okay then you can use uhubctl.
Well I plan on hooking up some fans to allow for airflow inside the chamber, but I guess I can do that with the GPIO pins so that is not a problem.
Thanks
How will you hook a fan to GPIO? Will you use some sort of transistor?
That was what I was planning, but maybe I can use 4 of those raspberry small 5V fans and that will be enough.

ejolson
Posts: 6642
Joined: Tue Mar 18, 2014 11:47 am

Re: How to toggle on/off a usb device on rpi 3b+

Mon Jul 06, 2020 4:46 pm

jesxs wrote:
Mon Jul 06, 2020 4:43 pm
ejolson wrote:
Mon Jul 06, 2020 4:37 pm
jesxs wrote:
Mon Jul 06, 2020 4:31 pm


Well I plan on hooking up some fans to allow for airflow inside the chamber, but I guess I can do that with the GPIO pins so that is not a problem.
Thanks
How will you hook a fan to GPIO? Will you use some sort of transistor?
That was what I was planning, but maybe I can use 4 of those raspberry small 5V fans and that will be enough.
If you connect even the smallest fan to a GPIO pin, the Pi will cease to work.

It is possible to connect fans to the 5V power on the GPIO header, but then they can't be turned on or off. If you want them always on, it's better to connect the fans to a separate power supply.

trejan
Posts: 3064
Joined: Tue Jul 02, 2019 2:28 pm

Re: How to toggle on/off a usb device on rpi 3b+

Mon Jul 06, 2020 4:50 pm

Just FYI. Do not try to reduce fan speed/noise by wiring them to the 3.3V pin. You can kill the Pi by doing that.

jesxs
Posts: 14
Joined: Sat May 18, 2019 12:18 pm

Re: How to toggle on/off a usb device on rpi 3b+

Mon Jul 06, 2020 4:52 pm

ejolson wrote:
Mon Jul 06, 2020 4:46 pm
jesxs wrote:
Mon Jul 06, 2020 4:43 pm
ejolson wrote:
Mon Jul 06, 2020 4:37 pm

How will you hook a fan to GPIO? Will you use some sort of transistor?
That was what I was planning, but maybe I can use 4 of those raspberry small 5V fans and that will be enough.
If you connect even the smallest fan to a GPIO pin, the Pi will cease to work.

It is possible to connect fans to the 5V power on the GPIO header, but then they can't be turned on or off. If you want them always on, it's better to connect the fans to a separate power supply.
Hmmm I'd like to be able to turn them on/off.
How could I do it then?

Return to “Beginners”