Mouse Cursor Tracker Motion Robot
The Mouse Cursor Tracker Motion Robot is a project designed to control a robot’s movement by tracking the position of a mouse cursor in real-time. It utilizes Python with PyQt5 for the graphical interface and serial communication to send movement commands to the robot. The system allows the robot to move forward, backward, left, and right based on cursor position while also visualizing its movement path. A reverse mode enables inverted motion control for more flexibility. The project integrates an SMD Red Module for motor control, ensuring smooth and precise movement. By combining real-time tracking with serial communication, this project can be applied to robotics simulations, interactive motion control, and remote navigation systems.
About Tools and Materials:
2x SMD Red (Purchase Here)
SMD USB Gateway (Purchase Here)
Arduino Gateway Module (Purchase Here)
2x BDC Motor (Purchase Here)
Step 1: Hardware & Software Overview
Project Key Components
The SMD acts as a bridge between the script and the modules. It is responsible for interpreting the commands sent by the script and translating them into actions that read input from the Ultrasonic Distance Sensor Module and meanwhile, actuate the motor for the continuous reading of the script.
The 100 RPM BDC Motor with Encoder is used to rotate the radar mechanism in a full circle. The user can precisely control the motor and get the position through the built-in encoder.
Key Features
Robot Control: The robot's movement is controlled through a graphical interface using mouse clicks. The robot's position and orientation are updated based on user input.
Motor Control: Two motors (left and right) drive the robot's forward, backward, and rotational movements.
Path Tracking: The path followed by the robot during movement is displayed on the screen. Users can clear the path if needed.
Target Movement: The robot moves towards a target point specified by the user with the mouse.
Step 2: Assemble
Getting Started
Hardware Setup
USB Connection: The
USB_Port()
function detects a suitable USB device connected to the platform and establishes a connection.Qt Interface: A graphical user interface (GUI) built with PyQt5 enables users to visually control the robot.
Dynamic Motor Speed Adjustment: Motor speeds are dynamically adjusted based on the distance to the target and angular differences.
Reverse Mode: Users can enable reverse mode to make the robot move in the opposite direction.
Project Wiring Diagram
Step 3: Run & Test
When the application runs, it searches for a device connected to the USB port.
In the graphical interface, the robot is represented as a red rectangle (or green in reverse mode).
Users can set the robot's target by clicking on the desired position in the interface, and the robot will move towards it.
Control buttons like "Start," "Stop," "Clear," and "Reverse" allow users to manage the robot's movement.
Control Buttons
Start
Function: Initializes the robot's motors and begins the movement logic.
Use Case: Click this button to start the robot. The robot will move towards the target point set by clicking on the interface.
Stop
Function: Stops the robot's motors and halts movement.
Use Case: Use this button to pause the robot's movement at any time. The robot will remain stationary until "Start" is pressed again.
Clear
Function: Resets the robot's path and position.
Use Case: Click this button to clear the path drawn by the robot on the interface and reset its position to the center of the canvas. Useful for starting a new simulation.
Reverse
Function: Toggles the robot's movement direction between forward and reverse.
Use Case: Press this button to enable or disable reverse mode. When enabled, the robot will move backward relative to its target. The button text changes dynamically to indicate the current mode:
"Reverse": Forward movement mode is active.
"Forward": Reverse movement mode is active.
Codes
Last updated