• Stars
    star
    187
  • Rank 206,464 (Top 5 %)
  • Language
    C
  • License
    Other
  • Created about 9 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

WebUSB LED. Hardware, software, and firmware.

WebLight

WebLight

A USB-controlled LED designed for the WebUSB API.

Try the web app

Have a WebLight device already?
Launch the web app here:
https://sowbug.github.io/weblight/

What does the javascript look like to write color values?
Check out software/src/weblight-card.html

Developing WebLight Devices

Toolchain/environment setup

  • Install avr-gcc. On Windows, download avr-gcc from http://andybrown.me.uk/2015/03/08/avr-gcc-492/. Make sure you've installed a base MinGW and MSYS system or equivalent, and have them in your system path. On Linux, try something like sudo apt-get install gcc-avr binutils-avr gdb-avr avr-libc avrdude. On OS X, CrossPack works.
  • Install libusb. sudo apt-get install libusb-dev works on Linux, and brew install libusb libusb-compat works on OS X.
  • Install pyusb. sudo apt-get install python-usb on Linux, or sudo pip install pyusb on other platforms.
  • Build and install the micronucleus command-line tool to be able to upload to the ATTiny85. Have it somewhere in your PATH. Don't forget the udev rule if needed.
  • Copy the files in udev to /etc/udev/rules.d/ and then sudo udevadm control --reload-rules.

Programming a newly built board

  • Connect a 6-pin AVR programmer. Note that if you've built the production version of the board, you'll need either an SOIC-8 clip manually wired for the ATtiny85, or else a ProtoProg programming adapter. This is the project I ordered from OSH Park, and you'll want 0.68mm diameter, 16mm length pogo pins, probably from eBay.
  • cd firmware
  • Configure the makefile to talk to your type of programmer (default usbtiny).
  • make factory Now you have a bootloader-ready board with no firmware.
  • Disconnect the programmer and plug it into a USB port.
  • make clean upload

Mass-producing boards

This clones the complete firmware from an existing device. For convenience, a relatively stable version of that complete firmware image is already here in the repository (full-[version].hex). If you overwrite it, we'll assume you know what you're doing.

  1. Make one device using the instructions from the previous section.
  2. Unplug from USB and attach to programmer.
  3. cd firmware
  4. make create_full This clones the firmware of the board you just built.
  5. Attach your next board to the programmer.
  6. make factory_mp
  7. Repeat last two steps for all remaining boards.

Development

  1. In the firmware directory, make clean upload.
  2. Plug in the board. After a few moments you should see Micronucleus done. Thank you!
  3. Now the lights on the board should run a startup sequence.
  4. Using lsusb you should see something like Bus 001 Device 006: ID 1209:a800 InterBiometrics.

Usage

  1. Install PyUSB. sudo pip install pyusb==1.0.0.b2
  2. From the base directory of the weblight project, ./commandline/wlctl 800000 will give you a medium-brightness red light (it uses CSS-style RGB color format).
  3. --help for more options.

BOM for production (not developer) circuit

The best results are with an ENIG finish 2.0mm thickness PCB. If you're just prototyping, 1.6mm will work, but you'll want to put some thick solder on the USB leads to bulk them up a bit. Even then, the fit in the USB socket will be loose. ENIG takes longer to wear out than regular HASL.

The board measures 12mm x 41.1734mm x 2.0mm.

  • C1: 1uF 0805 capacitor (DigiKey 311-1365-1-ND)
  • C2: 0.1uF 0805 capacitor (DigiKey 311-1142-1-ND)
  • D1, D2: 3.6V SOD-323 Zener diode. I successfully used BZT52C3V6S-7-F and MM3Z3V6T1G (DigiKey MM3Z3V6T1GOSCT-ND). According to V-USB Hardware Considerations, they should be "those that look like 1N4148 (usually 500 mW or less)"
  • D3, D4: low forward-voltage SOD-323 diode (0.4-volt or less forward voltage so that the supply to the LEDs is higher than 4.5 volts). I have successfully used Toshiba 1SS367 (forward voltage about 0.3V, DigiKey 1SS367H3FCT-ND).
  • LED1, LED2: APA102C LED (Real versions of these are not especially easy to find)
  • R1: 1.5K 0805 resistor (DigiKey 311-1.5KARCT-ND)
  • R2, R3: 68 0805 resistor (DigiKey 311-68ARCT-ND)
  • R4: 10K 0805 resistor (DigiKey 311-10KARCT-ND)
  • U1: ATtiny85 ATTINY85-20SU (DigiKey ATTINY85-20SURCT-ND)

Tips

  • In addition to wlctl in the commandline directory, there is lswusb, which attempts to parse WebUSB descriptors. This utility will help you when you're developing your own WebUSB-compatible device.

FAQ

  • What is WebUSB? It's a new web standard that makes it easy to write a USB driver once (in JavaScript) and have it work everywhere that WebUSB is supported.

  • Aren't there already a lot of USB-controlled lights out there? Yes, it's more or less a rite of passage in hobbyist electronics to make some kind of blinking light. The purpose of this project was to design a very simple WebUSB device that might actually be useful.

  • You said "useful" in the prior answer. Please define that. A WebUSB-enabled light can alert you of interesting things, like a broken continuous build, a service interruption, or yet another crash in the price of bitcoin.

  • Which board should I build? If you're interested in hacking on the firmware, build weblight_developer.brd. This one has a few more features that make firmware development more convenient. Otherwise if you just want a device to play with, build weblight.brd. That one is more compact, but it requires the ProtoProg ISP adapter, rather than the more common AVRISP 6-pin adapter. Both designs use 0805 SMT components. Either board can be ordered from OSH Park or Seeed. Note that if you manufacture with a standard 1.6mm PCB, you'll have to solder the contacts to give them enough thickness to connect. For end-user boards, 2.0mm or 2.4mm will fit better in USB sockets, and ENIG finish will last longer without tarnishing.

  • I don't want to build a board, but I'd like one. Will you sell me one? I don't have plans to mass-produce boards for sale. But if you're interested in getting one, subscribe to notifications for this issue.

  • I remember reading something about Origin Trials. What does that have to do with WebUSB? Chrome 61 and beyond ship with WebUSB, so if your users are running up-to-date Chrome, you're all set! But in case you're curious, the Chrome team has a system called Origin Trials for gathering real developer feedback on provisional APIs. Go to https://bit.ly/OriginTrials to learn more.

Acknowledgments

More Repositories

1

mkeosimg

Make a Ubiquiti EdgeOS image from a system tarball
Shell
179
star
2

JTAGWhisperer

Yes, your Arduino can replace an expensive JTAG cable!
C
148
star
3

G35Arduino

An Arduino library for GE Color Effects G-35 holiday lights.
C++
64
star
4

WT32-SC01-Demo

A hello world sketch for the WT32-SC01 ESP32 Development board
C
28
star
5

cold-wallet-generator

Given one or more Bitcoin addresses with private keys, generates a TeX file suitable for printing and putting into cold storage.
Python
23
star
6

happynine

A BIP 0032 HD wallet for Bitcoin, implemented as a Chrome App.
JavaScript
18
star
7

smart-usb-switch

An ESP8266-based smart USB type-A switch
XSLT
16
star
8

mkwgconf

Generates Wireguard configuration files
Python
15
star
9

TribeDuino

A proof of concept that uses an Arduino to read a Korg monotribe firmware file in m4a audio format.
Arduino
14
star
10

archer-c9-back-to-stock

A DD-WRT-web-flashable image to take your DD-WRT Archer C9 back to stock firmware.
14
star
11

avr-programmer

A compact AVR programmer that doesn't require ugly cables.
14
star
12

scanqr-app

A Chrome Packaged App that scans QR codes.
JavaScript
13
star
13

groove

A digital audio workstation (DAW) engine.
Rust
13
star
14

b39tools

Tools for working with BIP-39 assets
Python
10
star
15

op-1-tools

Research about the Teenage Engineering OP-1
10
star
16

paSSSphrase

Split a strong passphrase among friends using Shamir's secret sharing, then etch it into metal so it'll last longer than you will.
Ruby
10
star
17

quaid

A single-page webapp that decrypts text using only client-side JavaScript
JavaScript
8
star
18

esp32-ble-button

Allows an ESP32 to read inexpensive "anti-lost" Bluetooth Low Energy buttons (a.k.a. iTAG)
C++
7
star
19

ok-wake

A device that tells pre-literate kids that it's OK to get out of bed.
C
6
star
20

rpio

RPio: A Raspberry Pi Breakout Board
5
star
21

SimpleECDSA

Found at http://jonasfj.dk/blog/2007/12/simpleecdsa-a-simple-implementation-of-ecdsa-in-c/
C
5
star
22

like-a-g35

An alternate driver for GE Christmas lights.
4
star
23

sm16716

An Arduino controller for SM16716-based LED strings.
Arduino
4
star
24

ChromeLeft4kDead

Notch's Left4kDead as a Chrome App.
JavaScript
4
star
25

audrey

A circa-2001 project to open up the 3Com Ergo Audrey internet appliance.
HTML
4
star
26

keycad

Generates various CAD files for custom keyboards
Python
4
star
27

cinemagraph-maker

Erlang
3
star
28

blur-facebook

Helps blot out names in comments when you want to post a funny screenshot to Reddit.
JavaScript
3
star
29

hypnagogo

The Hypna Go Go: Hypnagogic Goggles
C
3
star
30

td-base

A starting point for Tower Defense-style games.
Python
2
star
31

rpi_breakout

The project now known as rpio.
2
star
32

pub

Public documents that are freely available but hard to find or subject to bitrot
2
star
33

nanowrimo-meter

JavaScript
1
star
34

sowbug.github.com

HTML
1
star
35

hsk-mock-exams-pinyin

HSK mock exams with Pinyin versions of listening phrases
1
star
36

psychic-bassoon

A JavaScript passphrase generator
1
star
37

ld14

Entry to Ludum Dare 14
Python
1
star
38

Left4kDeadEdu

A refactored and annotated version of Notch's Left 4k Dead.
Java
1
star
39

sudoku-app

A Chrome Packaged App for playing the puzzle game Sudoku.
JavaScript
1
star
40

8821

Building a Williams arcade machine from scratch
C
1
star
41

trhid

JavaScript
1
star
42

beach

A small PyGame game written in about six hours.
Python
1
star
43

neje_laser_upgrade

How to upgrade your NEJE Master laser engraver to stock GRBL with Laser Mode ($32)
1
star
44

smart-light

Alexa-compatible light controller for ESP8266 and ESP32.
C++
1
star
45

paste-itc-password

A Chrome extension that allows pasting of passwords into the login page of iTunes Connect.
JavaScript
1
star
46

tqw

The Quoting, Whirled: A Burning Man Art Project from August 2002.
C
1
star