ESP32-S2 playing with the mouse

Last Updated on 12 June 2023 by Suffocation

Ein Bekannter hat mir neulich sein Leid geklagt. Er sei jetzt im Home-Office und befürchte, dass sein Arbeitgeber seine Computer Daten trackt. Da der Computer nach wenigen Minuten in den Standby-Modus schaltet kam er auf die Idee immer wieder die Mouse zu bewegen, um dies zu verhinden. Seine Funkmouse reiche sogar bis zur Toilette, sagte er mir und richtete seinen Dank an die Hersteller solcher Mäuse.

Now the acquaintance is not only a good one, but also a civil servant, and as is well known, they need their midday nap. Tying the mouse to the cat (does anyone see the irony) or letting it run along on a record player isn't quite perfect.

As I was putting the children to bed in the evening, my thoughts wandered in this direction. It occurred to me ESP32-S2 ins Gedächtnis, der über die Möglichkeit verfügt ein HID (Human Iterface Device) also bzpw. ne Mouse oder Tastatur zu emulieren.

Somit war ein neues Projekt geboren – eine Mouse zu emulieren die dann eingreift wenn man gerade inaktiv ist. Natürlich wäre eine Softwareemulation auf dem Rechner auch denkbar aber die meisten Firmenrechner sind gegen die Installation fremder Software abgesichert.

Facts

  • Simply plug the FAKE mouse into the USB port.
  • Mouse greift ein wenn länger als 3 Minuten keine Aktion erkannt wurde. War nicht möglich keine Rückmeldung vom Computer
  • Mouse hört auf sobald der Benutzer wieder etwas macht. Same reason as above
  • Die Mouse Bewegungen sollten zufällig in Bewegung und Zeitabständen sein.

Gewählte Hardware

LILYGO EP32 S2 V1.1

Alternatives

LILYGO T8 ESP32-S2 Display V1.1

Areas of application

  • Funny mouse movements on the screen
  • Liberation from the yoke of employers.
  • Ausleben des Beamtentums (Eine Entschuldigung an Beamten die für ihr Geld richtig arbeiten müssen)

Views

Photos are available at LILYGO EP32 S2 V1.1.

Programming

Libraries

Die beiden benötigten Bibliotheken USB.h und USBHIDMouse.h sind ab der Version 2.0 in der ESP32 Bibliothek enthalten.

Test programme

ESP32-S2 – Controller auswählen

Demos are available in the example projects below.

ESP32-S2 – Beispielprogramme

Das Beispiel zur MouseButtonControl habe ich als Basis für meine Bestrebungen genutz und mein eigenes erstellt:

‚); document.write(‚

‚); document.write(‚

‚);

Install the firmware and set the DIP switches to HID mode (OTG).

Lilygo ESP32-S2 – Umstellen auf OTG.

Problems

Mouse hält den Computer nicht am Leben.

Possibly the time between movements is too short, so the computer still goes into standby mode.

Einfach den Wert für das Delay verlängern. Ruhig auch mal auf 2000 stellen dann sieht man die Mouse springen.

Miscellaneous

Track Own Mouse Movements

Stefan (siehe Kommentare) schlägt vor die Schaltung in die Mouse zu integrieren, zum einen könnte man die Mousebewegungen dann mit tracken zum anderen bräuchte es bei geschickter Verdrahtung noch nicht einmal OTG Fähigkeit.

Evlt. wäre auch ein durchgeschleifter USB Port etwas, ein Arduino Clone mit Hostshield. Die eigene Mouse an den Hostshield angeschlossen und die Daten der Mouse einfach weiter an den Rechner übertragen. Pausiert die Mouse übernimmt der Ardunio Clone.

Conclusion

Das Programm war schnell geschrieben und funktioniert, in den nächsten Tagen werde ich dem Usertest übergeben.

Verwandte Beiträge

Sources

https://github.com/espressif/arduino-esp32 (Library for looking up USB and Mouse libraries)

https://ericdraken.com/usb-mouse-jiggler/ (Er hat ein ähnliches Projekt mit einen anderen Board gemacht)

https://github.com/seife/marble_fx

https://github.com/seife/marble_fx_digistump

DateChangeAuthor
06.02.2022Post createdSuffocation

6 thoughts on “ESP32-S2 das Spiel mit der Mouse

  1. Indeed, I use a mouse jiggler, though one based on an Arduino micro. While I understand the locking of the screen after a short period in the office to prevent unauthorised access to confidential data when one is away from their desk, it is rather annoying to have to log back in after practically every longer phone call, other conversation, visit to the coffee machine, the toilet, etc.
    This makes sense for data security in the office – but surely not for a single person working from home.
    The idea of only operating the mouse jiggler when needed doesn't sound bad. How about operating the mouse or keyboard with a PS/2 connector on the controller, and converting that to USB or BT HID? There are already projects for that. If there's no input for 2 minutes, then the mouse jiggler could step in, and any real movement would deactivate it again until the next timeout...

  2. I was hoping to find a hint here for using the ESP32-C3 as a HID, unfortunately, it just seemed like clickbait (that would fit someone helping an employee shirk their duties) as the article only mentions the S3, with which HID is no problem.
    It would be nice if the title were corrected

    1. Heading is corrected. However, I was still very annoyed about the clickbait accusation, do you perhaps tend to make snap judgments? Courteous interaction is different!

  3. I do find it more than a little concerning to have such employees, but the HR department also knows all the tricks, don't worry. You can find such devices on every corner since remote working became a thing. They're called mouse jigglers. https://amzn.to/3UiKn70 Simple, effective, affordable.

  4. Hello Stefan,
    Thank you for your comment, indeed a Tiny is sufficient for that. To test the OTG function of the ESP is a nice toy, and for him who only has a hammer, the whole world is a nail ;).
    As a cheap example, I also referred to the Tiny in the sources:
    https://ericdraken.com/usb-mouse-jiggler/
    I have now also included your links in the sources.

    I've also ordered a few of the Tiny boards and wanted to test this again with an Atmel and cheaper.
    https://de.aliexpress.com/item/32409396629.html?gatewayAdapt=glo2deu&spm=a2g0o.order_list.0.0.21ef5c5fL9oQ38

    I like the idea with the mouse, I've added it under miscellaneous.

    Hello
    Stefan

  5. For this, an ESP32-S2 is complete overkill. An Arduino Leonardo clone (e.g. „CJMCU Beetle“ for a very suitable form factor) or even a Digispark (ATTiny85) would suffice.

    The best thing would be to build that into the mouse, so that after you've finished using the mouse, it keeps jiggling for another 30 minutes, and then stops if the official happens to oversleep whilst having their lunch nap… 😉 Example: https://github.com/seife/marble_fx and https://github.com/seife/marble_fx_digistump

    BTW: The title mentions ESP32-C3, but the text ESP32-S2..?

Leave a Reply

Your email address will not be published. Required fields are marked *