# 9. Wireless Glove Control Course
## 9.1 Wireless Glove Introduction and Wearing The wireless glove consists of five potentiometers and uses a Bluetooth module to communicate with devices. ### 9.1.1 Structure Introduction
**Potentiometers**: There are five potentiometers on the back of the wireless glove, which are key components that control the opening and closing of the uHand UNO.
**Gyroscope Acceleration Sensor (MPU6050)**: It can obtain the acceleration and tile angle of the wireless glove in the x,y, and z axes. You can control the uHand UNO by rotating the wireless glove for more operations.
**Bluetooth Module**: It is mainly used for communication between the wireless glove and the uHand UNO.
**Function Keys**: The functions of these two keys are as follows:
**(1) DEL:** Clear the history of Bluetooth connections.
**(2) K3:** Switch the control mode of the wireless glove.
**(3) Reset Key:** Restart the wireless glove.
**(4) LED Indicators:** Display the control mode of the wireless glove.
**(5) USB Port:** Used to connect to a PC for debugging and downloading programs.
**(6) Power Port:** Connect to a lithium battery to power the wireless glove, with a standard voltage of 7.4V.
### 9.1.2 Wearing Method
Open all straps. First, tie the finger straps at the last knuckles of each finger, and then tie the hand strap and wrist strap at the hand and wrist respectively. The final wearing effect is as follows (please refer to the video in the same path as this document for details):
### 9.1.4 Control Modes Switching
You can press the **'K3'** key on the wireless glove to switch control modes. The LEDs (D1 to D5) will provide feedback on the currently selected mode.
The corresponding relationship between the LED status and the mode is shown in the following table:
| LED status(D1-D5) | Mode |
| :-----------------------: | :-----------------------------------------: |
| All off | Biorobot Control Mode |
| 1 on (D1) | Robotic Hand Control Mode (Right Hand) |
| 2 on (D1, D2) | Tank Control Mode |
| 3 on (D1, D2, D3) | Robotic Arm Control Mode (PWM Servo Drive) |
| 4 on (D1, D2, D3, D4) | Robotic Hand Control Mode (Left Hand) |
| 5 on (D1, D2, D3, D4, D5) | Robotic Arm Control Mode (Bus Servo Drive) |
### 9.1.5 Control Mode Instruction
The wireless glove has four control modes, which are used for controlling products in the biorobot series, robotic hand series, tank robot series, and robotic arm series with a built-in Bluetooth module. The specific control methods for each type of product are shown in the table below:
| Product Type | Examples |
| :-----------------------------------------: | :----------------------------------------------------------: |
| Biorobot Series | Narrow-footed robot, Cross-footed robot, Spiderbot |
| Tank Robot Series | Tankbot |
| Robotic Hand Series | uHand, uHand UNO |
| Robotic Arm Series | LeArm, xArm 1S, MiniArm |
* **Biorobot**
The control of biorobot is mainly achieved through gesture control to make the robot perform a set of action groups:
| Gesture Description | Gesture Image | Biorobot Feedback Action(from the robot's view) |
|---|---|---|
| Extend your middle finger, crook your ring finger, and tilt the palm to the right. | ![]() |
Turn right |
| Extend your middle finger, crook your ring finger, and tilt the palm to the left. | ![]() |
Turn left |
| Make a fist with the palm facing down. | ![]() |
Stop |
| Stretch your hand (straighten your middle finger) with the palm facing down. | ![]() |
Move forward |
| Crook your middle finger, and straighten your little finger with the palm facing up (Spider-Man gesture). | ![]() |
Move backward |
| Stretch your hand with the palm facing up. | ![]() |
Stop |
| Initial Gesture | Gesture Description (from your perspective) | Gesture Image | Feedback Action from the Tank Robot (from the tank robot's perspective) |
|---|---|---|---|
| Straighten your index and middle fingers, with the palm facing down (other fingers crooked in). | Raise your wrist, that is, your straightened fingers point forward and upward. | ![]() |
Move forward |
| Bend your wrist downward, that is, your straightened fingers point forward and downward. | ![]() |
Move backward | |
| Bend your wrist clockwise, that is, the palm faces to the left. | ![]() |
Rotate clockwise in place. | |
| Bend your wrist counterclockwise, that is, the palm faces to the right. | ![]() |
Rotate counterclockwise in place. | |
| Other Gestures | Stop | ||
| Potentiometer Position | Gesture Image | Servo Controlled |
|---|---|---|
| Thumb | Servo 1 | |
| Index Finger | Servo 2 | |
| Middle Finger | Servo 3 | |
| Ring Finger | Servo 4 | |
| Little Finger | Servo 5 | |
| Stretch your hand with the palm facing down, and your wrist rotates clockwise. | ![]() |
The Pan-tilt rotates counterclockwise (from the perspective of the robotic hand). |
| Stretch your hand with the palm facing down, and the wrist rotates counterclockwise. | ![]() |
The Pan-tilt rotates clockwise (from the perspective of the robotic hand). |
| Initial Gesture | Gesture Description | Gesture Image | Servo Controlled |
|---|---|---|---|
| The palm faces down. | Extend your index finger and tilt to the left or right. | ![]() |
Servo 1 |
| Extend your index and middle fingers, and tilt to the left or right. | ![]() |
Servo 2 | |
| Extend your middle, ring, and little fingers, and tilt to the left or right. | ![]() |
Servo 3 | |
| Extend your four fingers, and tilt to the left or right. | ![]() |
Servo 4 | |
| Stretch your hand with the palm facing down, and tilt to the left or right. | ![]() |
Servo 5 | |
| The palm faces down. | Make a fist with the palm facing down, and tilt to the left or right. | ![]() |
Servo 6 |
(2) Put the wireless glove on according to the "[**9.1 Wireless Glove Introduction and Wearing**](#anchor_9_1)".
(2) Connect the Arduino to the computer through a UNO cable (Type-B).
(3) Click the **"Select Board"**, the software will automatically detect the current Arduino serial interface, then click to connect.
(4) Click
to download the program to Arduino, and then wait for the download to complete.
* **Wireless Glove Program Download**
The program is preloaded onto the wireless glove at the factory, so this section is for information purposes only.
(1) Locate and open the [lehand.ino](../_static/source_code/lehand.zip) program file in the same directory as this section.
(2) Connect the wireless glove to the computer through micro USB cable.
(3) Click the **"Select Board"**, the software will automatically detect the current Arduino port. Then click to connect.
(4) Click
to download the program to Arduino, and then wait for the download to complete.
### 9.2.3 Program Outcome
After connecting the wireless glove to the robot hand, the rotation of the robot hand servo can be controlled through the potentiometer of glove, and the pan-tilt servo rotation can be controlled through robot wrist. Specific information can be found in the following table.
| Potentiometer Position | Servo Control |
| :----------------------------------------------------------: | :----------------------------------------------------------: |
| Thumb | Servo No.1 |
| Index finger | Servo No.2 |
| Middle finger | Servo No.3 |
| Ring finger | Servo No.4 |
| Pinkie | Servo No.5 |
| Rotate your wrists clockwise with the palm facing down | Pan-tilt servo rotates anticlockwise. Take hand as the first view. |
| Rotate your wrists counterclockwise with the palm facing down | Pan-tilt servo rotates clockwise. Take hand as the first view. |
### 9.2.4 Brief Program Analysis
[uHand UNO Program](../_static/source_code/lehand.zip)
Below is the analysis of the program of the robotic hand [blue_uhand.ino](../_static/source_code/blue_uhand.zip), and wireless glove [lehand.ino](../_static/source_code/lehand.zip).
* **Robot Hand Program Analysis**
(1) Import Library File
Import the RGB control library, servo control library, Bluetooth reception and other library files required for this program.
{lineno-start=1}
```
#include