This project demonstrates how to control the computer mouse cursor using an IR remote control, an Arduino board, and Python. The system works by transmitting IR signals to the Arduino, which then sends commands to the computer via the serial port. A Python script reads these commands and translates them into mouse movements and actions.
- The IR remote sends signals to the IR receiver.
- The Arduino decodes the received IR commands.
- The decoded data is sent to the computer through the serial interface.
- A Python script reads the serial data and controls the mouse using software automation.
- 1× IR Remote Control
- 1× IR Receiver
- 1× Arduino UNO (or Arduino MEGA)
- Jumper wires
Connect the VCC pin to the Arduino 5V and the GND pin to GND.
The data/output pin can be connected to any digital pin on the Arduino — in my case, I used pin X.
You can check the sensor pinout in the image below:
- IRremote — used to decode IR signals from the remote control.
- Python Version: 3.12.7
- PyAutoGUI — used to control mouse movement and clicks.
- PySerial — used to read data from the serial port.
- Upload the
.inofile to your Arduino board; - Connect the IR receiver to the Arduino according to the pin definitions in the code;
- Open the Python script and update the serial port name to match your system:
ser = serial.Serial(port='COM5', baudrate=9600, timeout=1)- Run the Python script;
- Use the IR remote to control the mouse cursor.
- When opening the .ino file in the Arduino IDE, make sure it is placed inside a folder with the same name as the file;
- If you are using an Arduino board with HID support, you may control the mouse directly using the '''Mouse.h''' library, without Python;
- The serial port name may vary depending on your operating system (e.g., COMx on Windows or /dev/ttyUSBx on Linux).
