Enable Bluetooth and Connect a Wireless Mouse to Your Raspberry Pi 4 in 5 Easy Steps

Learn how to connect a bluetooth mouse to your Raspberry Pi 4 with this step-by-step guide. Follow these simple steps and you’ll have your mouse working in no time! …


Updated October 8, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to connect a bluetooth mouse to your Raspberry Pi 4 with this step-by-step guide. Follow these simple steps and you’ll have your mouse working in no time!

  1. Enable Bluetooth on Your Raspberry Pi To start, make sure that the Bluetooth is enabled on your Raspberry Pi. You can check if it’s already enabled by running the following command in the terminal:
sudo systemctl status bluetooth

If the output shows that Bluetooth is not active or inactive, you need to enable it with this command:

sudo systemctl enable bluetooth

Next, start the service:

sudo systemctl start bluetooth
  1. Pair Your Raspberry Pi and Bluetooth Mouse The first step is to pair your Raspberry Pi 4 with your Bluetooth mouse. To do this, you’ll need to make sure that your mouse is in pairing mode. Consult the user manual for your specific mouse on how to enter pairing mode. Once it’s in pairing mode, run the following command:
bluetoothctl

This will open a new session with Bluetooth settings. Now, use the following commands to scan and pair your mouse:

scan on

This will start scanning for nearby devices, including your mouse. Look for the name or MAC address of your mouse in the list. Once you find it, run:

pair <MAC address or name>

Enter the passkey if prompted and press Enter. Your mouse should now be paired with your Raspberry Pi 4. 3. Trust the Mouse and Connect After pairing, your mouse will appear in a list of devices when you run:

devices

To trust the device and establish a connection, use the following commands:

trust <MAC address or name>
connect <MAC address or name>
  1. Install and Configure GPIO UDev Rules Now that your mouse is connected, you need to install gpio-udev rules so that it works properly with the Pi. Run these commands:
sudo apt update
sudo apt install pi-bluetooth

This will install the necessary packages for Bluetooth connectivity on your Raspberry Pi 4. Next, create a new file in /etc/udev/rules.d called 99-input.rules with the following content:

KERNEL=="event*", SUBSYSTEM=="input", ATTRS{name}=="*Mouse*", ATTRS{phys}=="*usb*", TAG+="uaccess"
KERNEL=="event*", SUBSYSTEM=="input", ATTRS{name}=="*Keyboard*", ATTRS{phys}=="*usb*", TAG+="uaccess"

Save and exit the file. Then, reload udev rules with:

sudo udevadm control --reload-rules
  1. Test Your Bluetooth Mouse Finally, test your mouse by moving it around and clicking to see if it works properly on your Raspberry Pi 4. If everything is set up correctly, you should be able to use the mouse seamlessly. Remember that you may need to run bluetoothctl again and connect to your mouse if you restart your Raspberry Pi or if the connection drops.

That’s it! You have now successfully connected a Bluetooth mouse to your Raspberry Pi 4. Enjoy using your new wireless input device with your Pi.