AbleMouse Deployment and Usage Guide
1. Prerequisites
Operating Systems: Windows, macOS, iOS, iPadOS, Linux (Ubuntu), Android (specific editions vary by OS support) Python: Version 3.7 or higher Hardware (varies by edition):
- AbleMouse DIY Edition: ESP32 board, basic electronic components (wires, resistors), 3D-printable case (optional).
- AbleMouse AI Edition: A webcam (built-in or external).
- AbleMouse Beyond Switch Edition: No special hardware beyond a standard PC.
Python Libraries (Core dependencies from source files):
opencv-python(cv2) – For computer vision in AI Edition.mediapipe– For facial landmark detection in AI Edition.pyautogui– For system-level mouse and keyboard control.pygame– For audio playback in Beyond Switch Edition.tkinter– For graphical menus (usually comes with Python).numpy– For numerical operations.
Optional/Additional Tools:
- For AI Edition with advanced features: A local LLM server (e.g., Ollama) running on
http://localhost:8080for thetalk2cam.pyscript. - For Windows-specific tools: AutoHotKey (for MouseCommander).
- For DIY Edition: Arduino IDE or similar for ESP32 programming, soldering tools.
2. Installation
-
Clone the Repository:
git clone https://github.com/aradzhabov/AbleMouse.git cd AbleMouse -
Set up a Python Virtual Environment (Recommended):
python -m venv venv # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate -
Install Python Dependencies: The project does not have a central
requirements.txt. Install packages based on the edition you want to use.- For AI Edition:
pip install opencv-python mediapipe pyautogui numpy - For Beyond Switch Edition:
pip install pygame pyautogui - For R&D Tools (e.g.,
talk2cam.py):pip install opencv-python requests pillow
- For AI Edition:
3. Configuration
Configuration is primarily done via editing Python source files. There are no central .env files.
For AbleMouse AI Edition (able_mouse_ai_edition.py):
camera = 0: Change to1or2if you need to use an external webcam.bln_cam_mouse_control = False: Set toTrueto enable cursor control via head movement.USE_MENU_SYSTEM = False: Set toTrueif you want this AI Edition to connect to and control the Beyond Switch Edition menu server.MENU_HOST&MENU_PORT: Configure ifUSE_MENU_SYSTEMisTrue.- Adjust time thresholds (
LEFT_EYE_CLOSE_TIME_THRESHOLD,MOUTH_OPEN_RIGHT_CLICK_TIME_THRESHOLD, etc.) to match the user's physical capabilities.
For AbleMouse Beyond Switch Edition (app_config.py & menu_config.py):
SERVER_CONFIG: Modifyhostandportif needed.UI_CONFIG: Adjusttransparency,highlight_interval, etc.AUDIO_CONFIG: Ensure audio file paths are correct. Place your.mp3files in theaudio/directory.MENU_CONFIG(inmenu_config.py): This is the core navigation structure. Customize the menu entries (likeFOOD,REQUESTS) and their hierarchy to suit the specific user's needs.
For Camera Llama Analyzer (talk2cam.py):
self.server_url = "http://localhost:8080": Point this to your local LLM API endpoint.self.current_instruction: Change the default prompt for the vision model.
4. Build & Run
Choose your edition based on the Product Compatibility Table.
AbleMouse AI Edition (Head/Face Control)
- Ensure your webcam is connected and accessible.
- Run the main script:
cd src/ablemouse_ai_edition python able_mouse_ai_edition.py - A camera feed window will open. Position your face within the frame.
- Cursor Control: Move your head to move the cursor.
- Mode Toggle: Close your left eye for
LEFT_EYE_CLOSE_TIME_THRESHOLDseconds to enable/disable camera mouse control. - Right Click: Open your mouth for
MOUTH_OPEN_RIGHT_CLICK_TIME_THRESHOLDseconds. - Left Click: Close your right eye for
RIGHT_EYE_RIGHT_CLICK_TIME_THRESHOLDseconds. - Menu Selection: Open your mouth briefly (
MOUTH_OPEN_MENU_SELECTION_THRESHOLD) when integrated with the Beyond Switch menu.
AbleMouse Beyond Switch Edition (Single-Switch Menu System)
- This edition provides an on-screen menu navigable with a single switch (like a mouth click).
- Run the server:
cd src/ablemouse_beyond_switch_edition python main.py - A semi-transparent menu window will appear, always on top. It automatically starts a local server on port
12345. - Navigation: The menu highlights items sequentially. Press the Spacebar to select the currently highlighted item. Use the "↩ Back" option to go back.
- This menu can be controlled remotely by other AbleMouse editions (like AI Edition) or any client that sends simple commands (like
"select") tolocalhost:12345.
AbleMouse DIY Edition (Tongue/Touch Pedal)
- This is a hardware project. Follow the detailed build guide in
AbleMouseDIY.md. - It involves flashing an ESP32 board with provided firmware and constructing physical pedals or sensors.
- Once built, it acts as a Bluetooth or USB HID device, controlling the cursor directly.
MouseCommander (Windows Gesture Tool)
- Requires AutoHotKey installed.
- Run the scripts from
src/windows/auto_hot_key/to add mouse gesture shortcuts.
5. Deployment
AbleMouse is designed to run locally on a user's personal computer. "Deployment" here means setting it up to start automatically and run reliably.
- Windows: Add a shortcut to the desired Python script (e.g.,
main.pyfor Beyond Switch) in the Startup folder (shell:startup). Run the script as Administrator if you encounter permissions issues withpyautogui. - macOS/Linux: Create a systemd service (Linux) or a Launch Agent (macOS) to run the Python script at login. Ensure the virtual environment is activated in the startup script.
- Cross-Platform Consideration: The Beyond Switch Edition's menu server (
main.py) is a good candidate to run at startup, as it provides a consistent interface that other assistive tools can connect to.
Not recommended for cloud deployment, as the software requires direct access to local hardware (HID, camera) and low-latency control of the GUI.
6. Troubleshooting
-
"No module named 'cv2' / 'mediapipe' / 'pyautogui'"
- Solution: Ensure your virtual environment is activated and you have installed the required packages for your chosen edition using
pip. See Installation section.
- Solution: Ensure your virtual environment is activated and you have installed the required packages for your chosen edition using
-
Webcam not found (
camera = 0doesn't work)- Solution (AI Edition): Try changing
camera = 0tocamera = 1inable_mouse_ai_edition.py. On macOS, ensure camera permissions are granted to your terminal or IDE. - Solution (General): Test your camera with a simple OpenCV script or a standard app like Zoom first.
- Solution (AI Edition): Try changing
-
pyautoguifails to control mouse/keyboard (especially on macOS)- Solution: You must grant Accessibility or Input Monitoring permissions to your terminal (e.g., Terminal.app, iTerm2) or the app running the script (e.g., VS Code) in System Preferences > Security & Privacy > Privacy.
-
Beyond Switch menu is unresponsive or doesn't highlight
- Solution: Ensure the application window is in focus. Check that no other application is intercepting the Spacebar key. Verify the
highlight_intervalinUI_CONFIGis not set too high.
- Solution: Ensure the application window is in focus. Check that no other application is intercepting the Spacebar key. Verify the
-
Audio feedback not playing in Beyond Switch Edition
- Solution: Check that the
AUDIO_DIRpath inapp_config.pyis correct relative to wheremain.pyis run. Ensure the.mp3files exist in that directory. Check your system's audio output.
- Solution: Check that the
-
AI Edition cursor control is too sensitive/jumpy
- Solution: Enable
bln_do_not_move_cursor_if_xy_move_within_thresholdand adjustSKIP_X_THRESHOLDandSKIP_Y_THRESHOLDvalues upward. Enablebln_nose_centerfor more stable tracking.
- Solution: Enable
-
Connection refused when AI Edition tries to connect to menu server
- Solution: Ensure the Beyond Switch Edition (
main.py) is running first and thatUSE_MENU_SYSTEM = TrueandMENU_HOST/MENU_PORTin the AI Edition script match the server configuration.
- Solution: Ensure the Beyond Switch Edition (