># Omni Directional Robot
This is the official repository for the Omni Directional Hand Gesture-Controlled Robot project at IvLabs, VNIT Nagpur.
## Objectives
The objectives of the Summer Intership were to create a Omni Directional Robot which moves in all 8 direction, clockwise and anticlockwise using transmitter receiver with hand gestures.
## Methodology
## Components used :
*MPU6050 , Two EPS32 , Two Motor Driver L298N , Four DC Motor , One stepdown MOSFET , TWO- 9V battery , 24V lithium ion battery , One Switch , Four Mecanum Wheels.*
## System Architecture
The robot system consists of two main parts :
### 1. Gesture Control Unit (Sender) :
- Contains the MPU6050 and one ESP32.
- Detects hand movements and transmits the corresponding control signals via ESP-NOW.
- **MPU6050**: It captures hand movements in terms of acceleration and angular velocity.
- **ESP32 (Sender)**: Processes the MPU6050 data and transmits it wirelessly to the receiving ESP32 module on the robot via ESP-NOW.
### 2. Robot Chassis (Receiver) :
- Contains the ESP32, L298N motor drivers, DC motors, and the power sources.
- Receives the control signals from the gesture control unit and moves the robot accordingly.
- **ESP32 (Receiver)**: Receives the transmitted data from the gesture control unit and converts it into motor control commands.
- **Motor Drivers (L298N)**: The received signals are used to control the speed and direction of the motors.
- **DC Motors and Mecanum Wheels**: The motors drive the Mecanum wheels to achieve omnidirectional movement based on the received control data.
## Software Implementation :
### 1. Connection of MPU6050 with ESP32
Connecting an MPU6050 to an ESP32 is a crucial step in creating an omni-directional hand gesture bot. The MPU6050 is an inertial measurement unit (IMU) that combines a 3-axis gyroscope and a 3-axis accelerometer, which can detect the orientation, movement, and acceleration of the hand. By interfacing this sensor with the ESP32, a powerful microcontroller with built-in Wi-Fi and Bluetooth capabilities, we can capture and process hand movements in real-time. This data can then be used to control the bot's movements, allowing for intuitive and responsive gesture-based control.

### 2. Simulation result of MPU6050
The integration of the MPU6050 with the ESP32 results in precise real-time tracking of hand gestures, enabling smooth and responsive control of the omni-directional bot. This enhances user interaction by translating natural hand movements into accurate bot movements.

### 3. Motion of Omnidirectional robot
| 1] Forward Motion | 2] Backward Motion |
|:----------------------------------------------------------:|:-----------------------------------------------------------:|
|  |  |
| 3] Leftward Motion | 4] Rightward Motion |
|:----------------------------------------------------------:|:-----------------------------------------------------------:|
| |  |
| 5] Clockwise Motion | 6] Anti-Clockwise Motion |
|:----------------------------------------------------------:|:-----------------------------------------------------------:|
|  |  |
| 7] Forward-Left Motion | 8] Forward-Right Motion |
|:----------------------------------------------------------:|:-----------------------------------------------------------:|
|  |  |
| 9] Backward-Left Motion | 10] Backward-Right Motion |
|:----------------------------------------------------------:|:-----------------------------------------------------------:|
|  |  |
### 4. Kinematics
#### 1] Variables :
- **\( Vx \)**: Forward velocity (m/s)
- **\( Vy \)**: Lateral velocity (m/s)
- **\( ω \)**: Angular velocity (rad/s)
#### 2] Wheel Velocity Equations :
For a robot with four omnidirectional wheels, the velocity of each wheel can be expressed as:
- ### **`Vi = Vx.r.cos(θi)+Vy⋅r⋅sin(θi)+L⋅ω/2`**
where \( i = 1, 2, 3, 4 \).
#### 3] Parameters :
- **\( Vi \)**: Velocity of wheel \( i \)
- **\( r \)**: Radius of the wheel
- **\( L \)**: Distance from the center of the robot to the wheel
- **\( θi \)**: Angle of the wheel with respect to the robot

### 5. Error Minimization
During the development, one challenge was minimizing errors in the gesture control. To overcome this challenge we used :
- **`Calibration`** : Calibrated the MPU6050 sensor to reduce drift and improve accuracy in detecting gestures.
### 6. Power Management
The system requires proper power management to ensure smooth operation. We have used :
- **24V Lithium-ion Battery** : Which Powers the motors for the robot’s movement.
- **9V Batteries** :They Power the ESP32 modules and the MPU6050 sensor.
- **Step-Down MOSFET** : Was used to ensure voltage regulation for motor drivers.
### 7. PCB design using KiCad
#### 1] Gesture-Glove (Transmitter) Circuit :
The circuit in the gesture-glove is responsible for capturing hand movements and transmitting the corresponding data wirelessly to the robot.
- The PCB ensures a compact layout to fit inside the glove.
- Integrated connections for MPU6050 via I2C interface.
- Voltage Regulator for stable power supply.
- ESP32 for wireless communication.
#### Circuit of Hand-Gesture IMU :

### 2] Robot (Receiver) Circuit :
The robot's circuit interprets the transmitted gestures and controls the Mecanum wheels for omnidirectional movement.
- Each motor driver channel is connected to an individual motor, enabling precise control for omnidirectional movement.
- Power Input for motor drivers and ESP32.
- Motor Outputs for Mecanum wheels.
#### Circuit of Omni-Directional Robot:

## Hardware Implementation
### 1. Hardware Simulation of IMU
- **Purpose** : To test the accuracy and responsiveness of the MPU6050 IMU sensor before integrating it into the gesture-glove.
- **Procedure** :
- Connected the MPU6050 to the ESP32 via Breadboard using Jumper wires.
- Simulate various hand gestures and verify the sensor's ability to detect and transmit real-time orientation data.
- Used debugging tools like the Serial Monitor in the Arduino IDE to analyze data consistency.
- **Outcome** : Ensures that the IMU sensor accurately captures gestures and provides reliable input for wireless transmission.

### 2. Fitting Mecanum Wheels
- **Purpose** : To enable omnidirectional movement of the robot.
- **Procedure** :
- Attached four Mecanum wheels to the robot's chassis using secure fittings.
- Ensure correct alignment and orientation of the wheels to achieve the desired movement patterns (forward, backward, sideways, diagonal, and rotational).
- Verified that the wheels rotate smoothly without mechanical obstruction.
### 3. Motor Driver Integration
- **Purpose** : To control the speed and direction of the Mecanum wheels.
- **Procedure** :
- Connected the L298N Motor Driver to the ESP32 for PWM signal input.
- Interfaced each motor driver channel with one of the robot’s motors.
- Provided a 12V power supply to the motor driver for sufficient torque and speed.
- Tested motor responses by sending sample PWM signals through the ESP32.
- **Outcome** : Ensures precise and smooth motor control, enabling the robot to execute all motion commands derived from gestures.

### 4. Speed Control with PWM Pins
- **Purpose** : To control the speed of the motors driving the Mecanum wheels, we employed Pulse Width Modulation (PWM). This technique allows us to simulate varying levels of voltage by rapidly switching a digital signal between high (on) and low (off) states.
- **How PWM Pins Works** :
- ***Duty Cycle*** : The ratio of time the signal is high to the total cycle time determines the effective voltage seen by the motor. A higher duty cycle results in higher average voltage and thus greater speed.
- The PWM signals are sent to the L298N motor driver through its enable pins (ENA and ENB). By adjusting these signals, we can finely control the speed of each motor based on user gestures.
- **Procedure** :
- Used the ESP32 PWM pins to generate Pulse Width Modulation (PWM) signals for the L298N motor driver.
- Maped gesture intensities to speed levels (e.g., tilt angle to PWM duty cycle).
- Ensure smooth acceleration and deceleration by fine-tuning the PWM signals.
- **Outcome** : Enables precise control of motor speeds, ensuring the robot moves efficiently and responsively.
### 5. Wireless Data Transfer using WiFi (ESP-NOW Protocol)
- **Procedure**:
- Used ESP32 modules for both transmitting and receiving data.
- Implemented the ESP-NOW protocol, which allows peer-to-peer communication with low latency.
- Transmited gesture data from the glove as control commands (e.g., direction, speed).
- Validated the transmission by ensuring commands are received accurately and promptly by the robot.
- **Challenges** :
- First we tried using bluetooth , reciever was not able to connect to transmitter.
- Then we tried with only Wifi , there was problem of connection loss.
- At last we used ESP-NOW Protocol for Wireless Data Transfer.

## Final Outcome
### 1] Forward Motion and Gesture
|  |  |
| --- | --- |
### 2] Backward Motion and Gesture
|  | |
| --- | --- |
### 3] Leftward motion and Gesture
|| |
| --- | --- |
### 4] Rightward motion and Gesture
| | |
| --- | --- |
### 5] Backward-Right motion and Gesture
| | |
| --- | --- |
### 6] Forward-Right motion and Gesture
| | |
|--- | --- |
### 7] Backward-Left motion and Gesture
| ||
|--- | --- |
### 8] Forward-Left motion and Gesture
|  |  |
| --- | --- |
### 9] Clockwise motion and Gesture
| | |
| --- | --- |
### 10] Anti-Clockwise motion and Gesture
|  | |
| --- | --- |
---