<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/controlling-usb-camera-lights-on-raspberry-pi-with-usb-hub-power-control-d8s6lu3nm" -->

---
title: Controlling USB Camera Lights on Raspberry Pi with USB...
description: A practical guide to controlling USB camera LED lights on a Raspberry Pi by toggling USB hub port power using the uhubctl command-line tool. The setup targets...
canonical: https://daily.dev/posts/controlling-usb-camera-lights-on-raspberry-pi-with-usb-hub-power-control-d8s6lu3nm
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Controlling USB Camera Lights on Raspberry Pi with USB Hub Power Control | daily.dev
og:description: A practical guide to controlling USB camera LED lights on a Raspberry Pi by toggling USB hub port power using the uhubctl command-line tool. The setup targets...
og:url: https://daily.dev/posts/controlling-usb-camera-lights-on-raspberry-pi-with-usb-hub-power-control-d8s6lu3nm
og:image: https://api.daily.dev/og/posts/d8S6Lu3nM.png
og:image:alt: Controlling USB Camera Lights on Raspberry Pi with USB Hub Power Control
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Controlling USB Camera Lights on Raspberry Pi with USB Hub Power Control

**[apalrd's adventures](https://daily.dev/sources/apalrd)** · 6 min read · 0 upvotes · 0 comments

## Summary

A practical guide to controlling USB camera LED lights on a Raspberry Pi by toggling USB hub port power using the uhubctl command-line tool. The setup targets a 3D printer camera (OctoPi) where all external USB ports share a single power rail. The guide covers installing uhubctl via apt, toggling hub 1-1 port 2 to cut power to all external ports, restarting the webcamd service after power cycling, and automating the whole flow via Node-Red subscribing to an MQTT topic. A key caveat is addressed: some printers (like the Prusa i3 MK3S) rely on USB bus power for their USB-UART chip and digital isolator, so USB power must stay on while the printer is connected. Granting passwordless sudo to the pi user via visudo is required for Node-Red to run uhubctl and systemctl without interaction.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.apalrd.net/posts/2021/3d_printer_uhubctl>

## Questions this post answers

### How do I turn off power to the external USB ports on a Raspberry Pi 3B using uhubctl?

On a Raspberry Pi 3B, all external USB ports share a single power rail controlled through hub 1-1 port 2. Run `sudo uhubctl -l 1-1 -p 2 -a 0` to cut power and `sudo uhubctl -l 1-1 -p 2 -a 1` to restore it. Port 1 on that hub controls WiFi and Ethernet, so targeting port 2 affects only the four user-accessible USB ports without disrupting network connectivity.

_Makers automating Raspberry Pi USB power for 3D printer setups share builds like this on daily.dev._

### Why does my OctoPi webcam stream break after toggling USB hub power and how do I fix it?

Cutting USB hub power also cuts power to the USB camera, which causes the OctoPi webcam daemon (webcamd) to lose the device. After restoring USB power, restart the service with `sudo systemctl restart webcamd` to re-initialize the stream. This is expected behavior because the camera enumerates as a new USB device when power is restored.

_OctoPrint automation tips like this surface regularly for 3D printing hobbyists on daily.dev._

## Similar posts on daily.dev

- [GitHub - mvp/uhubctl: uhubctl - USB hub per-port power control](https://daily.dev/posts/github---mvp-uhubctl-uhubctl---usb-hub-per-port-power-control-skvcwfyni) · Hacker News · 0 upvotes · 0 comments
- [A UPS For Your Pi That’s A Little Different](https://daily.dev/posts/a-ups-for-your-pi-that-s-a-little-different-pwg5o7hrd) · Hackaday · 0 upvotes · 0 comments
- [A Raspberry Pi Zero Broke the Tally Light of my Blackmagic Camera · webtechie.be](https://daily.dev/posts/a-raspberry-pi-zero-broke-the-tally-light-of-my-blackmagic-camera-webtechie-be-yrt87uuqr) · WebTechie · 0 upvotes · 0 comments
- [The unused USB ports on your Home Assistant server can do more than you think](https://daily.dev/posts/the-unused-usb-ports-on-your-home-assistant-server-can-do-more-than-you-think-emjsslxtg) · XDA Developers · 0 upvotes · 0 comments

---

Tags: [#raspberry-pi](https://daily.dev/tags/raspberry-pi)

[View this post on daily.dev](https://daily.dev/posts/controlling-usb-camera-lights-on-raspberry-pi-with-usb-hub-power-control-d8s6lu3nm)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Controlling USB Camera Lights on Raspberry Pi with USB Hub Power Control","url":"https://daily.dev/posts/controlling-usb-camera-lights-on-raspberry-pi-with-usb-hub-power-control-d8s6lu3nm","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/controlling-usb-camera-lights-on-raspberry-pi-with-usb-hub-power-control-d8s6lu3nm"},"datePublished":"2026-08-11T08:53:58.179Z","dateModified":"2026-08-11T09:17:15.693Z","description":"A practical guide to controlling USB camera LED lights on a Raspberry Pi by toggling USB hub port power using the uhubctl command-line tool. The setup targets...","image":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","thumbnailUrl":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","isAccessibleForFree":true,"articleSection":"apalrd's adventures","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"apalrd's adventures","logo":"https://media.daily.dev/image/upload/s--4zkx8dRj--/f_auto,q_auto/v1786438309/logos/apalrd?_a=BAMAMicg0","url":"https://daily.dev/sources/apalrd"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/controlling-usb-camera-lights-on-raspberry-pi-with-usb-hub-power-control-d8s6lu3nm","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"raspberry-pi","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"apalrd's adventures","item":"https://daily.dev/sources/apalrd"},{"@type":"ListItem","position":3,"name":"Controlling USB Camera Lights on Raspberry Pi with USB Hub Power Control"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/controlling-usb-camera-lights-on-raspberry-pi-with-usb-hub-power-control-d8s6lu3nm#faq","mainEntity":[{"@type":"Question","name":"How do I turn off power to the external USB ports on a Raspberry Pi 3B using uhubctl?","acceptedAnswer":{"@type":"Answer","text":"On a Raspberry Pi 3B, all external USB ports share a single power rail controlled through hub 1-1 port 2. Run `sudo uhubctl -l 1-1 -p 2 -a 0` to cut power and `sudo uhubctl -l 1-1 -p 2 -a 1` to restore it. Port 1 on that hub controls WiFi and Ethernet, so targeting port 2 affects only the four user-accessible USB ports without disrupting network connectivity. Makers automating Raspberry Pi USB power for 3D printer setups share builds like this on daily.dev."}},{"@type":"Question","name":"Why does my OctoPi webcam stream break after toggling USB hub power and how do I fix it?","acceptedAnswer":{"@type":"Answer","text":"Cutting USB hub power also cuts power to the USB camera, which causes the OctoPi webcam daemon (webcamd) to lose the device. After restoring USB power, restart the service with `sudo systemctl restart webcamd` to re-initialize the stream. This is expected behavior because the camera enumerates as a new USB device when power is restored. OctoPrint automation tips like this surface regularly for 3D printing hobbyists on daily.dev."}}]}
```

