PUB! Programmable USB Button
PUB! is a Programmable USB Button on which you can program with a sequence of keystrokes. When you press the button those keystrokes are "replayed" over a USB connectionThe button is programmed using an innovative and slightly quirky interface that does not require any custom software to be installed on your computer. All you need is a text editor like Notepad or gedit.
Features
- One-button design (a rotary encoder with a built in switch)
- Programmed by using an ordinary text editor as a display (for example, gedit on Linux, or Notepad on Windows)
- Up to 127 keystrokes can be recorded and played back
- Supports a GOTO function, so you can program loops
- Can send USB System Control codes (Power off, sleep, wake) to your PC
- Can send USB Consumer Device functions (e.g. Mute, Play, Pause, Stop, etc.)
- Requires NO drivers for Windows/Linux etc
- Supports 256 x 8-bit "registers" to record state (in RAM, lost at power off)
- Supports basic arithmetic. Add, subtract, etc
- Supports conditional logic. For example, Compare to value, Jump on zero etc
Futures
The possibilities are fairly broad including:
- Using a Bluetooth module to detect proximity of the button owner's mobile phone so that the USB button is only enabled when its owner is near.
- Addition of an external EEPROM for extra keystroke capacity.
Construction
http://www.instructables.com/id/PUB-Programmable-USB-Button/
How To Use
You want to program your password onto the PUB! button
- Open a text editing program (for example, gedit or Notepad) and make sure it has keyboard focus. This is VERY important. If the keyboard focus is not in the text editor then you will experience much gnashing of teeth and possible loss of hair...
- Plug PUB! into a host USB port
- By default PUB! is in RUN mode at power up, so press and hold the rotary encoder knob for more than 1 second to switch to PROGRAM mode. It will display the following in your text editor:
PUB! Programmable USB Button v0.92 Main: Turn=Select, Press=OK, Press+Turn=Set At, Press+Hold=Exit 0 Set Keystroke at 00 At Code Action
- Press the rotary knob to set a keystroke. It will display:
PUB! Programmable USB Button v0.92 Key: Turn=Select, Press+Turn=Modify, Press=OK, Press+Hold=Return 00 0004 a At Code Action
- Turn the rotary knob to choose the first letter of your password (say c) and then press the knob to add it to the list of actions:
PUB! Programmable USB Button v0.92 Key: Turn=Select, Press+Turn=Modify, Press=OK, Press+Hold=Return 01 0006 c At Code Action 00 0006 c
- Continue choosing and adding the remaining letters (say, a and t):
PUB! Programmable USB Button v0.92 Key: Turn=Select, Press+Turn=Modify, Press=OK, Press+Hold=Return 03 0017 t At Code Action 00 0006 c 01 0004 a 02 0017 t
- Press and hold the rotary knob to Return to the main menu:
PUB! Programmable USB Button v0.92 Main: Turn=Select, Press=OK, Press+Turn=Set At, Press+Hold=Exit 0 Set Keystroke 03 At Code Action 00 0006 c 01 0004 a 02 0017 t
- Turn the rotary knob until Do Local Function is displayed:
PUB! Programmable USB Button v0.92 Main: Turn=Select, Press+Turn=Set At, Press=OK, Press+Hold=Exit D Do Local Function at 03 At Code Action 00 0006 c 01 0004 a 02 0017 t
- Press the rotary knob to enter Do Local Function mode. Next you will choose the local function.
- Press and turn the rotary knob until Save To EEPROM is displayed:
PUB! Programmable USB Button v0.92 Do: Turn=Modify, Press+Turn=Select, Press=OK, Press+Hold=Return Save to EEPROM At Code Action 00 0006 c 01 0004 a 02 0017 t
- Press the rotary knob to perform the Save to EEPROM function:
Saved in EEPROM
- The device is now in RUN mode. Press the knob to "play" the recorded sequence:
cat
Here is an example of a more complicated script that contains conditional logic:
At Code Action 00 E005 Let W = 05 01 0004 a 02 0005 b 03 0006 c 04 E200 Put W in R00 05 E500 Say R00 06 EF01 Wait 1 sec 07 0028 Enter 08 E801 Let W = W - 01 09 F701 Jump if Not Zero to 01
The result, displayed in gedit for example, would be:
abc05 abc04 abc03 abc02 abc01
Menu Functions
The menus, if fully expanded, would look like this:
RUN mode
This is the normal operation mode
Press to begin playback
Press and hold to enter PROGRAM mode
PROGRAM mode
Main menu
0 Set Keystroke (e.g. A, Enter)
0mxx Keystroke xx using modifier m
Rotate to select xx (e.g. A)
Press+Rotate to select m (e.g. CTL+SHIFT)
(too many to list them all here)
1 Set System Control Command (e.g. power off)
1mxx System Control Command xx (m is ignored)
Rotate to select xx
2 Set Consumer Device Command (e.g. play, pause)
2xxx Consumer Device Command xxx
Rotate to select xxx
D Do Local Function
D0xx Delete action at xx
D1xx Redisplay (xx is ignored)
DExx Load from EEPROM (xx is ignored)
DFxx Save to EEPROM (xx is ignored)
E Execute Instruction
E0xx Let W = xx
E1xx Get W from Rxx
E2xx Put W in Rxx
E3xx Compare W to xx
E4xx Compare W to Rxx
E5xx Say Rxx
E6xx Format xx (display format that Say uses)
E7xx Let W = W + xx
E8xx Let W = W - xx
E9xx Set all registers to xx
EAxx Let W = W + Rxx
EBxx Let W = W - Rxx
ECxx Let W = W x Rxx
EDxx Let W = W / Rxx
EExx Wait xx milliseconds
EFxx Wait xx seconds
F Jump On Condition
F0xx Jump Relative by xx
F1xx Jump if Carry to xx
F2xx Jump if High to xx
F3xx Jump if High or Carry to xx
F4xx Jump if Low to xx
F5xx Jump if Low or Carry to xx
F6xx Jump if Not Zero or Carry to xx
F7xx Jump if Not Zero to xx
F8xx Jump if Zero to xx
F9xx Jump if Zero or Carry to xx
FAxx Jump if Not Low or Carry to xx
FBxx Jump if Not Low to xx
FCxx Jump if Zero or Low to xx
FDxx Jump if Not High to xx
FExx Jump if Not Carry to xx
FFxx Jump to xx