Giter Club home page Giter Club logo

raspi-mouse-jiggler's Introduction

Raspberry Pi Mouse Jiggler

This repository hosts Raspi code for turning an Pi Pico into a mouse jiggler.

What? Why?

A mouse jiggler is a either a hardware appliance of a software program for mouse cursor movement automation for the purpose of preventing a computer from going to sleep. Sometimes software-based solutions are locked down by IT departments at which point hardware-based solutions save the day.

Inspiration

While researching how to implement this, I've found that someone has already done exactly what I intended: Raspberry Pi Pico - DIY USB Mouse Jiggler.

The person also made his code available on GitHub: novaspirit/PicoMouseJiggler

Code

import time
import usb_hid
from adafruit_hid.mouse import Mouse

mouse = Mouse(usb_hid.devices)

shift = 2
wait = 0.25

while True:
  mouse.move(x=shift, y=shift)
  time.sleep(wait)
  mouse.move(x=shift, y=-shift)
  time.sleep(wait)
  mouse.move(x=-shift, y=-shift)
  time.sleep(wait)
  mouse.move(x=-shift, y=shift)
  time.sleep(wait)

This code will move the mouse in a diagonal shape, staying around the origin and not sliding off.

To make the on-board LED light up when active, see #1.

Raspberry Pi

I'm using a Raspberry Pi Pico:

  1. Press and hold the BOOTSEL button on the Pi Pico
  2. Connect the Pico to the computer using a data+power USB cable
  3. Find the RPI-RP2 mass storage device that should mount and release the button
  4. Download CircuitPython UF2 https://circuitpython.org/board/raspberry_pi_pico
  5. Wait for the RPI-RP2 drive to unmount itself and reconnect it to the computer
  6. Wait for a new device to mount called CIRCUITPY
  7. Go to https://github.com/adafruit/Adafruit_CircuitPython_HID and download it
  8. Move adafruit_hid from the downloaded repository over to CIRCUITPY/lib
  9. Open CIRCUITPY/code.py and edit it to have the above content

There seems to be an issue with macOS currently:

https://github.com/adafruit/Adafruit_CircuitPython_HID/issues/59

Everything works as expected on Windows.

Arduino

I've implemented a Raspberry Pi based mouse jiggler in a complementary repo: https://github.com/TomasHubelbauer/arduino-mouse-jiggler

To-Do

Verify the code now works on macOS out of the box after the issue fix

adafruit/circuitpython#4532

Build adapters from the microUSB port on the Pi Pico to USB A and USB C

Buy these connectors and find somewhere to buy a USB C one, solder the adapters together and use the mouse jiggler by directly connecting it to the computer using the adapter instead of using a short cable which makes it flail around and be overall ugly.

raspi-mouse-jiggler's People

Contributors

tomashubelbauer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

raspi-mouse-jiggler's Issues

Add onboard powerLED to show "ON"

For my use (Thank you , by the way!) I added the following to enable the onboard LED so I'd remember it was actually running:

import board
import digitalio

And in the loop add:

led.value = True

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.