A SAMD21/WS2812 based, low-cost and low-difficulty USB webcam ringlight. Designed for a logitech streamcam (though there is no reason not to create other attachments) and controlled via USB/HID because, why not.
The ringlight firmware runs on a seed xiao board with WS2812 LEDs connected to pin 10, and can be installed via the uf2 bootloader. Both the device firmware and control utility can be downloaded from the releases page, while the control utility can be installed via cargo install rlctl
if preferred.
First you need to connect a set of WS2812 LEDs to the xiao, linking GND->GND, VCC->5V and Pin 10 -> DI (Data In). You can then load the firmware on the device by:
- Download the latest
rlfw.uf2
file from the releases page - Connect the xiao board to your computer via USB
- This should connect as a disk drive
- If this does not occur you may need to short the GND/RST pads on the back of the board twice in quick succession
- Copy the
rlfw.uf2
firmware file onto the drive
rlctl set-brightness BRIGHTNESS
to set brightnessrlctl set-rgb R G B
to set RGB colour outputrlctl help
to show help message / options
Note that values must be between 0-255
(or 0x00-0xff
).
On linux you will need a udev rule to provide your user with permission to access the device. If your account is a member of the plugdev
group this may look like: /etc/udev/40-ringlight.rules
:
SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="fff1", MODE="0660", GROUP="plugdev"
rust
with targetthumbv6m-none-eabi
(viarustup target add thumbv6m-none-eabi
)libusb
viasudo apt install libusb-dev libusb-1.0
,brew install libusb
, orvcpkg install libsusb
(and maybe aLIBUSB_DIR
setting on windows)
Note that memory.x
must be edited to remove the flash offset if your xiao-m0 does not currently have the bootloader loaded.
Other options:
cargo build --release
to build the binarycargo flash --chip ATSAMD21G18A --speed 100 --release
to flash via a connected debuggercargo hf2 --release --vid 0x2886 --pid 0x002f
to load via the bootloader (YMMV)
.uf2
files can be loaded onto the board by dragging and dropping into the correct file system.
Dependencies:
rustup component add llvm-tools-preview
cargo install cargo-binutils u2fconv-rs
for creating.uf2
bootloader files
Steps:
cargo objcopy --bin rlfw --release -- -O binary rlfw.bin
to output a release binary fileuf2conv rlfw.bin --base 0x2000 --output rlfw.uf2
to generate a uf2 file