How To Perform Different Operations On PC Using Hand Gestures?
Now as we know the abstract of the project, let us move forward and gather different information to start working. We will first make a list of the components, then study them briefly, then assemble all the components to make a working system.
Step 1: Collecting the Components
The best approach to start any project is to make a list of components and going through a brief study of these components because no one will want to stick in the middle of a project just because of a missing component. A list of components that we are going to use in this project is given below:
Step 2: Studying the Components
As we have a complete list of all the components. Let’s move ahead and go through a brief study of the working of all the components. Arduino Nano is a microcontroller board that carries out various operations in different circuits. It requires a C Code that tells the board what tasks to perform and how. It has 13 digital I/O pins which mean that we can operate 13 different devices. Arduino Nano has exactly the same functionality as Arduino Uno but in quite a small size. The microcontroller on the Arduino Nano board is ATmega328p.If you want to control more than 13 devices, use Arduino Mega. HC-SR04 board is an ultrasonic sensor which is used to determine the distance between two objects. It consists of a transmitter and a receiver. The transmitter converts the electrical signal into an ultrasonic signal and the receiver converts the ultrasonic signal back to the electrical signal. When the transmitter sends an ultrasonic wave, it reflects after colliding with a certain object. The distance is calculated by using the time, that ultrasonic signal takes to go from the transmitter and come back to the receiver.
Step 3: Assembling the Components
Now as we know the main working of the components that we are going to use. Let us start assembling the components to make a final working product.
Step 4: Getting Started with Arduino
If you are not already familiar with the Arduino IDE, don’t worry because a step by step procedure to set-up and use Arduino IDE with a microcontroller board is explained below. To download the code, click here.
Step 5: Setting the Gestures
We want to write a code that will detect and convert the distance into an appropriate command to perform a task. let us first make a list of all the tasks that we want to carry out using gestures. Following is the list of all those tasks. We will now set gestures to perform all these operations. We have written the code and made all the conditions based on the above gestures. And it should be noted that we are using Google Chrome as our Web Browser and VLC Media Player as our media application.
Step 6: Understanding the Arduino Code
We have written a code that converts 5 gestures into a digital command. this command is sent to the serial port. We will write a python program to interpret these commands and perform some keyboard functions to accomplish various tasks.
- At the start, all the pins are initialized that we want to connect with the sensors. Different variables are also initialized to store data for the calculation of time and distance.
- We have written a function, void find_distance(void) to calculate the distance of both the ultrasonic sensors. It is better not to trigger both of the ultrasonic sensors at the same time because it can cause some interference. This function will return the distance in cm.
- void setup() is a function that that initializes all the pins to be used as INPUT or OUTPUT. Baud Rate is also set in this function. Baud Rate is the speed by which the microcontroller board communicates with the sensors attached.
- void loop() is a function that runs repeatedly ina loop. In this loop, we are calculating the distance in many instances and applying conditions to detect the gesture.
Step 7: Python Programming
We will install PyAutoGUI and invoke various keyboard commands by simply reading incoming serial data. With this program, we can mimic many mouse operations and keyboard operations like left or right-click on the mouse or any keyboard key press. First, we will install PIP on our windows. It is a simple procedure. Click here to open the video guide to install pip on your computer. After installing PIP on our computer, we will move ahead and install pyAutoGUI. To do so, type the following command in the command prompt This command will install puAutoGUI on your computer. If everything goes well till now, let us go ahead and write a python program to invoke different keyboard commands. As we are receiving 5 different commands in the serial input by the Arduino code, Python code can convert these commands into certain keyboard commands as follows.
Data: “next” —–> Action: “Ctrl + PgDn”Data: “previous” —–> Action: “Ctrl + PgUp”Data: “down” —–> Action: “Down Arrow”Data: “up” —–> Action: “Up Arrow”Data: “change” —–> Action: “Alt + Tab”
Python can be used to program an Arduino, simply by importing pyfirmata, which can interface the Arduino with Python. Following is the Python code which will be required to run the project: That was the simplest way to control your PC by using hand gestures. Follow all of the steps mentioned above and enjoy controlling your PC by your hand instead of a keyboard and mouse.
How To Make Arduino Based Traffic Light Controller?How To Make Arduino Based Calculator?How To Make A Smoke Alarm For Your Kitchen Using Arduino?Leaks Suggest the Apple AI Glasses To Start at $499 US: Would Feature a LiDAR…