loading
Picture of Creating a Bluetooth wireless scrollwheel
52f7b11ed535cf849800002c.jpg
I find it difficult to use those builtin mousewheel scrollers, and even the two-finger scroll gesture can be inconvenient at times.  After discovering the Bluefruit EZ-Key and seeing the USB Volume knob project, I knew what I had to do.

After liberating a rotary encoder and weighted knob from an old USB sound board that no longer worked, I started soldering.  

Edit: The code and Fritzing diagrams are available at https://github.com/rmd6502/BluetoothEncoder .  Note that the Fritzing sketch shows a Trinket 5v, this is incorrect - it needs to be a Trinket 3.3v
 
Remove these adsRemove these ads by Signing Up

Step 1: Wire It Up

Picture of Wire It Up

This is pretty straightforward - just wire it up as shown in the attached image.  Since I'd used a nonstandard rotary encoder, I had to solder it to another board to get the pin spacing right.

Step 2: Programming

Picture of Programming
Leave the battery pack off for now - you only want to power the board from one source.

Plug a USB cable into your computer and plug it into the Trinket.  You should see the red LED pulse - if it just comes on then the board wasn't detected by the computer.  Try with a different cable, that seems to matter.  You can also try plugging it in through a hub, people have had better luck with that.

You will need to download and install the special version of Arduino for the Trinket, or perform the steps listed in the tutorial to add Trinket support to you existing installation.  You'll also need the SoftwareSerial and Rotary Encoder libraries.  These should be placed in the appropriate libraries directory for your OS and installation.

Next, uncompress the attached zip file to your Arduino sketch directory, open it, and program the Trinket.  If this succeeds, you are ready for the next step.

Step 3: Pairing to your computer

Picture of Pairing to your computer
This step will vary depending on your OS and installation.  Thus I refer you to the instructions for the EZ-Key, where they are thoroughly covered with walkthroughs.

Once you're paired, you should be able to scroll with the rotary encoder, and click the mouse by pressing the button.
lee.fewtrell6 months ago

Excellent tutorial, any chance of a link to the USB Volume knob project