Arduino Autoclicker

"The Clickotron-5000"

Overview

The Clickotron board is a shield for the Arduino Leonardo that I designed to extend the capabilities of a normal mouse. The full Clickotron-5000 autoclicking device uses a Leonardo, a USB Host Shield board, and the Clickotron board on top, with my code loaded on the Arduino.

The Arduino can simulate mouse clicks on the computer, so other input devices can be used to create mouse clicks. For example, I use the Clickotron with two foot pedals as left and right click. The device can also continuously click the mouse buttons when the respective pedal is held down. I made the device because bad posture was causing numbness in my hands and I had trouble using a regular mouse (proper posture and exercises have fixed this!). I still use the autoclicker to play League of Legends with my friends, since over the Covid-19 pandemic it's the best way to stay in touch.

Link to the code: https://github.com/rmboyce/arduino-autoclicker

Link to the schematic: Autoclicker schematic

Autoclicker device

About the Device

A normal USB mouse plugs into the USB Host board and the mouse signals are passed through the device. This means that the mouse can be used normally as if it was plugged into the computer without the device (see footnote 1 for details). Then other input devices can be soldered to the Clickotron to generate mouse clicks.

In my current setup with two foot pedals, the Clickotron has two modes, regular and autoclick. To switch between the modes, hold down both pedals until the autoclick LED turns on or off.

In regular mode the device will simulate a click for as long as a foot pedal is held down. The left and right click indicator LEDs will also turn on while the Clickotron holds the mouse button down. This allows me to select text by holding the left foot pedal down to hold left click and dragging the mouse across the text.

In autoclick mode, while a foot pedal is held down the device will constantly click at a speed that is set using a potentiometer soldered to the device. The number of clicks per second is shown by the two seven segment displays on the Clickotron. The click durations are generated based on a normal distribution so that the Clickotron will be indistinguishable from human clicking.

Autoclicker pcb

Usage

Put together the circuit either using the Clickotron board or a breadboard. If you do not use input devices that normally act as closed switches, you will have to modify the program to click when a "HIGH" voltage is read (basically just change all the "LOW"s into "HIGH"s). Then load the program onto your arduino-make sure that you have the "USB Host Shield Library 2.0" installed in the menu (Tools > Manage Libraries). You will also need an Arduino Leonardo and a USB Host Shield board. If your USB Host Shield board is not set up, you will have to bridge the 5V pad and the SPI (a communciation protocol) lines so that power and data go to the circuits.

Note that applies if your scroll wheel does not seem to be working correctly: If it only works while the mouse is moved, making an edit to the USB Host Shield library will fix it. On Windows you will have to go to Documents > Arduino > libraries > USB_Host_Shield_Library_2.0 > hiduniversal.h and add "virtual" on line 60 before the BuffersIdentical function so that it reads "virtual bool BuffersIdentical". For other operating systems you will have to figure out where the USB Host Shield Library is stored and make the same change to the code.

One place to buy the USB Host board: https://shop.tkjelectronics.dk/product_info.php?products_id=43

USB Host hardware manual: https://chome.nerpa.tech/usb-host-shield-hardware-manual/

USB Host library documentation: https://github.com/felis/USB_Host_Shield_2.0

Autoclicker pcb camera

Technical Details

Link to the schematic: Autoclicker schematic

When the switches are closed, current runs from the 5V pin through the 10 kiloohm resistor to ground and the input pins detect a voltage. When the switches open, the resistor pulls down the voltage of the input pins to ground. The foot pedals that I used have the switch normally closed, and pressing the pedal down opens the switch inside. Therefore, I made the program click when pins 12 or 13 read a "LOW" voltage.

In the LED circuit, the pins of the arduino are set to high when the LED should turn on. There is also a resistor to limit the current and stop the LED from burning out.

The potentiometer is soldered onto the Clickotron using wires. The device reads the value through pin A5 of the arduino and uses it to set the click speed in autoclick mode.

The MAX7221 chip is used to drive the two seven segment displays. The arduino sends SPI signals to the chip through the 2x3 ICSP header to control it. The two capacitors C1 and C2 keep the power stable for the chip. I decided to add the capacitors because many websites say that the MAX7221 is extremely sensitive to power fluctuation, although the capacitors are not strictly necessary.

Notes

Note 1: The current code should work with normal USB mice, but some functions may or may not work depending on the exact mouse you use. If you use a more complicated mouse that reports input differently, you will have to change the code so that the HID report the Clickotron device sends to your computer is correct.