Buttons for Mouse Scroll

by Mr_Glenn in Circuits > Arduino

3387 Views, 1 Favorites, 0 Comments

Buttons for Mouse Scroll

20190712_130347 - Copy.jpg

I have had several computer mice over the years and the scroll wheel
is the one thing that consistantly either doesn't work or works erratically.

I have mostly avoided using the scroll option until recently when I decided to give the graphics package Blender a try, here I found I couldn't get away without using the scroll wheel as it is used to zoom in and out of the viewing area.

Having played around with 32U4 Pro Micro boards as keyboard and mouse input I was interested to see if there was a scroll option as this was not something I had seen used.

Checking the Arduino documentation [1] showed that there was a scroll value in the Mouse.move() function -> Mouse.move(xVal, yVal, wheel).

I wondered if instead of rotating a wheel I could use the push of a button to do each scroll increment and, after testing, found that I could.

Hardware:

1* 32U4 Pro Micro clone

2* 6mm square momentary pushbuttons

1* Stripboard 24*37

2* 12 way 0.1 inch sockets - for the Pro Micro

Construction;

button_scroll_mouse.png
20190712_130347 - Copy.jpg

I designed and build a small board to hold all of the components.

The Pro Micro is plugged into 2* 12 way 0.1 inch sockets and there is a small amount of wiring for the switches and ground connections (6 wires).
There are 13 track breaks 12 of which are between the Pro Micro pins and the other next to one of the switches. Connection to the PC is via the USB connector of the Pro Micro.

I plugged the 2*12 way sockets into the pro micro for stability and then soldered in the corner pins first before soldering the rest. I then soldered in the buttons and did the wiring. Finally I put in the track breaks.

Software:

I wrote the software and programmed the Pro Micro using the Arduino IDE.

For programming purposes the Pro Micro shows up as Arduino Leonardo.

The software uses a timer interrupt to poll and debounce the buttons, when a button is pressed, or more accurately pressed then released the Mouse.Move() function is called to send the scroll value to the attached PC.

I saw no documentation on what scroll value to use so tried 1 which gave a positive increment and then -1 which gave a negative increment; the documentation specifically lists the scroll value as a signed char.

Use:

The unit is just plug and play, it shows up as a HID device to the PC and there are no drivers to install.

References:

[1] Arduino USB Mouse documentation https://www.arduino.cc/reference/en/language/functions/usb/mouse/mousemove/ (Retrieved 6/July/2019)