Control USB-powered devices with a Raspberry Pi

Power Point

© Lead Image © Burmakin Andrey, 123RF.com

© Lead Image © Burmakin Andrey, 123RF.com

Article from Issue 250/2021
Author(s):

Command-line tools and Node-RED on a Raspberry Pi let you control projects that use the USB ports.

For home automation projects, a Raspberry Pi offers a simple, low-cost approach to managing and controlling a wide variety of devices. Typically these devices are either digitally wired 0-5V devices such as motion detectors, or wireless Ethernet devices such as smart plugs. It's important to note that a Raspberry Pi can also control USB-powered devices, such as USB fans, lights, and low-end controllers.

In this article, I look at how to monitor, control, and measure USB power in two Raspberry Pi projects. The first project uses Node-RED to create a web dashboard to monitor and control USB lights. The second project turns on USB cooling fans according to the Pi's CPU temperature.

Controlling USB Ports

A number of techniques allow you to control USB ports, and I found that one of easiest approaches is to use the uhubctl [1] utility, which lets you view and control local USB ports and ports on smart USB hubs. To load this utility, enter:

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Node-RED on Android

    We show you how to control devices connected to Rasp Pi GPIO pins with text messages from an Android phone.

  • Workspace – Node-RED

    Learn how to use Node-RED to automate tasks, work with web services, and do other clever things.

  • Node-RED

    Node-RED lets you connect ready-made code building blocks to create event-driven applications with little or no code writing.

  • Python and Node-RED

    Adding Python to your Node-RED arsenal lets you create easy Raspberry Pi robotic and IoT projects.

  • OpenPLC on a Raspberry Pi

    Create automation projects with ladder logic, function blocks, structured text, and Modbus TCP.

comments powered by Disqus