Arduino as HID (mouse)

Hello folks,

first of all I've got to say that I have never worked with an arduino before, this is my first time ever doing something like this, so please excuse me if this seems like a dumb question to ask. Hopefully there will be somebody to shed some light, thanks in advance. :slight_smile:

I will briefly explain what I'm trying to do before I ask my actual question(s): My goal is to use an arduino to emulate a HID device, more specifically a mouse, to control my desktop computer. I know this has been done a lot, there's a great set of documentation as well, so that shouldn't be a problem theoretically. I've seen people communicating with the arduino over IR, the arduino itself was connected to the desktop computer with USB, etc. My goal is a little different though, I want to make the desktop computer control the arduino which in turn sends mouse movement back to the desktop computer. This may sound silly at first but all I want to do is controlling the cursor without relying on OS (Windows) API.

So while thinking about all of this some questions came to my mind. First of all I'm curious if I can actually send commands to the arduino and receive mouse movement at the same time over a single USB connection. I highly doubt that this works so here's my next question. Is this even possible to do at all using an arduino and if so, is there something I have to take extra care of, e.g. buying a specific model?

I'd really appreciate it if somebody more experienced than me would give me some advice. Thanks in advance.

Greets

An Arduino Leonardo should work. Other boards with the same ATMEGA32U4 chip should also work. Arduino Micro, SparkFun Pro Micro, and Adafruit Itsy Bitsy 32u4 are some examples.

I think it is possible because the Leonard/32u4 will appear to the computer as two USB devices. For example, when running the ButtonMouseControl sketch, the computer sees a USB mouse and a COM port. The COM port is the Arduino serial console. A program running on the computer can open the COM port and send data to the Arduino. The Arduino sketch receives data from the serial console port then writes mouse events.

You can also do this with any one of the Teensy seriese of boards.

gdsports:
...

Grumpy_Mike:
...

Hey,

thanks to both of you for your quick replies. I plan on getting the Arduino Leonardo tomorrow, I can easily get it from a store nearby. Hopyfully things work out properly.

Greets