Giter VIP home page Giter VIP logo

usb-power-stick's Introduction

USB Power Stick

The USB Power Stick is a USB Stick to control power (up to 1 A) to a USB powered device from a PC or SBC.

Motivation

The Stick is inspired by the common USB relay sticks. But using that stick to switch USB power on and off is messy: it requires cutting a USB extention cord, connecting the relay in between and takes up two USB ports. Leading to contraptions like this:

The USB Power Stick solves that problem neatly by providing the switched power on a USB Type A socket.

The Stick is used to turn an IKEA HÅRTE light on and off using a Python script running on a Raspberry Pi. The light is used to illuminate a 3D printer, controlled by Octoprint, so a webcam can track the printer's progression during the night.

How does it work

Take a look at the PDF of the schematic. The Stick makes use of a USB to serial converter, a flip flop and an output transistor to switch power on and off to the device connected to the Stick's output. The Stick does not provide USB connectivity to the Stick's output.

The RTS line of the serial converter can be controlled from a computer while the port is open. Therefore the RTS line is connected to the flip flop's (FF) data input (D) and the TX line to the FF's clock input (C). By sending a character the FF latches the current RTS state to the FF's output (Q), then the port can be closed again. This allows for a script to periodically turn power to the device on or off when needed.

An RC network is connected to the FF's asynchronous ~R input, to make sure the stick starts up in the off state, a so called Power on Reset (PoR) circuit.

Build your own

You can send the Gerber files (directly downloadable as zip from the releases page) to any PCB manufacturer and have the boards made. The board is designed with manual assembly in mind, all parts are easily soldered using a standard soldering iron, fine solder and a pair of tweezers. For everything but the passives a shop link is provided in the Bill of Materials (BOM). Pay attention to the pin 1 marker (triangle) of D1: the silk screened triangle is correct, the silk screened outline of the part is not!

Use it

  1. Install Python for your OS.
  2. Install the PySerial package.
  3. Plug the Stick into an computer.
  4. Find the Stick's device dev path (Unix) by running ls /dev/ttyUSB* or COM port (Windows) by going to Device Manager.
  5. Clone or download this repository.
  6. Edit the stick_on.py and stick_off.py files to use the correct device dev path or COM port.
  7. In the directory containing the scripts, run python stick_on.py to turn power to the load on, and run python stick_off.py to turn power to the load off.

usb-power-stick's People

Contributors

florisvde avatar

Stargazers

Robin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.