Skip to main content

Micro Wave USB Fan

This library is a pure Python reimplementation of the Jaycar RGB USB LED fan (GH1031) protocol. Communication occurs using USB HID reports as a transport. This library uses hidapi to do this across Linux, macOS, FreeBSD and Windows.

Installation

pip install microwave-usbfan

Example Implementation

Two Text Messages

from usbfan import Device, Program, TextMessage

# A program is made up of a list of Messages
# A "TextMessage" is a subclass of the generic Message class 
p = Program((TextMessage("Hello, World!"),
             TextMessage("How is everyone going?"),))
             
# Open the device and program
d = Device()
d.program(p)

Single Red Dot

from usbfan import Colour, Column, Device, Message, Program

# A generic "Message" is made up of 1 to 144 "Column" object
# A "Column" has 11 boolean pixels and a "Colour"
columns = [Column([True] + [False] * 10, Colour.red)]
for _ in range(7):
    columns.append(Column([False] * 11, Colour.red))
p = Program((Message(columns),))

# Open the device and program
d = Device()
d.program(p)

Rainbow Message

from usbfan import Colour, Column, Device, Message, Program, TextMessage

# We can cycle the rainbow here and fill all 144 columns
rainbow_colours = [Colour.red, Colour.yellow, Colour.green,
                   Colour.cyan, Colour.blue, Colour.magenta]
rainbow = [Column([True] * 11,
                  rainbow_colours[i % len(rainbow_colours)])
           for i in range(Message.MAX_COLUMNS)]
p = Program((
    TextMessage("Here comes the rainbow!"),
    Message(rainbow),
))

# Open the device and program
d = Device()
d.program(p)

Mode Controls

For each message, you can define how it opens, what it does once displayed, and what it does when closing.

from usbfan import Colour, Column, Device, Message, Program, TextMessage, \
    MessageStyle, OpenTransition, CloseTransition

# We can cycle the rainbow here and fill all 144 columns
rainbow_colours = [Colour.red, Colour.yellow, Colour.green,
                   Colour.cyan, Colour.blue, Colour.magenta]
rainbow = [Column([True] * 11,
                  rainbow_colours[i % len(rainbow_colours)])
           for i in range(Message.MAX_COLUMNS)]
p = Program((
    TextMessage("Here comes the rainbow!",
                message_style=MessageStyle.Flash,
                open_transition=OpenTransition.DownUp,
                close_transition=CloseTransition.DownUp),
    Message(rainbow,
            message_style=MessageStyle.Clockwise,
            open_transition=OpenTransition.FromMiddle,
            close_transition=CloseTransition.ToMiddle),
))

# Open the device and program
d = Device()
d.program(p)

Metadata

Release files for microwave-usbfan 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microwave-usbfan 1.1
File Size Uploaded
microwave-usbfan-1.1.tar.gz 155.9 kB Details

Release files / microwave-usbfan-1.1.tar.gz

Download URL microwave-usbfan-1.1.tar.gz
Size 155.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e24e3d8af10b533d5b7ffc791748f6c253236c27e971d8132678de9d1d669236
BLAKE2b-256 checksum
How to use checksums
2a62d79f8844f086a5970ebe58cbb877481608989ad4e3cb5c393bf5063198d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.2

Release history Release notifications | RSS feed

This release

1.1 This release

1 release file

1.0.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page